Spectator mode v1.7 (AKA "actionfinder")
Moderator: Moderators
Spectator mode v1.7 (AKA "actionfinder")
Hello, this is my first attempt of learning Lua.
The script was inspired from the MinimapEvents widget written by trepan. It adds a "/luaui specmode" command during gameplay to activate it. You can also use CTRL+ALT+S to enable/disable it and CTRL+ALT+C to switch between normal mode and attract mode.
The script will move the camera around "hot" places on the map. If there is no fighting then the widget will show different buildings, units that are created.
For the moment there is no algorithm to prioritize the importance of an event just that an battle event is more important than a building completion one.
The script was inspired from the MinimapEvents widget written by trepan. It adds a "/luaui specmode" command during gameplay to activate it. You can also use CTRL+ALT+S to enable/disable it and CTRL+ALT+C to switch between normal mode and attract mode.
The script will move the camera around "hot" places on the map. If there is no fighting then the widget will show different buildings, units that are created.
For the moment there is no algorithm to prioritize the importance of an event just that an battle event is more important than a building completion one.
- Attachments
-
- cmd_actionfinder.lua
- 1.7
- (17.52 KiB) Downloaded 42 times
Last edited by xyz on 11 May 2013, 19:55, edited 16 times in total.
Re: Spectator mode
i have tried it, it works very well!
its perfect to spec spring games on the second computer, and use it like a TV (doing nothing) or for publicly streaming tournament games or so..
good idea for a first try, well done!
thanks!
its perfect to spec spring games on the second computer, and use it like a TV (doing nothing) or for publicly streaming tournament games or so..
good idea for a first try, well done!
thanks!
Re: Spectator mode
Thanks for trying it out!hoijui wrote:i have tried it, it works very well!
its perfect to spec spring games on the second computer, and use it like a TV (doing nothing) or for publicly streaming tournament games or so..
good idea for a first try, well done!
thanks!
I've updated the first post with version 1.1 of the script.
change-log 1.0 - > 1.1:
- Fixed bug: the script was not paused if the user was moving the mouse, or scrolling using the keyboard.
- Did some cleanup.
P.S. Is it just me, or the smilies here look a bit, EVIL?
Re: Spectator mode v1.1
yeah... if you want to look at it like this.. you can see them as evil :D
will try the new version too.
will try the new version too.
Re: Spectator mode v1.1
The smileys here look evil because our community is EVIL!
Re: Spectator mode v1.1
Thanks. I renamed it because "Spec Mod" isn't very descriptive. I made it also change the height, and made it choose between three camera mode, TA, Total War, and the elusive tracking FPS. Plus some other changes.
Now that I can have an attract mode, all I need is some huge monitor in view of passerbys to advertise.
Now that I can have an attract mode, all I need is some huge monitor in view of passerbys to advertise.
- Attachments
-
- cmd_actionfinder.lua
- (14.36 KiB) Downloaded 35 times
Re: Spectator mode v1.1
works really nice, gj. you could try to not fps-track 3do models, they look fugly when not looked at from above ;p
Re: Spectator mode v1.1
Why not just deselect the tracked unit instead of disabling user widgets?
- Attachments
-
- cmd_actionfinder.lua
- (14.24 KiB) Downloaded 38 times
Re: Spectator mode v1.2 (AKA "actionfinder")
Thanks to everyone for helping.
I did some modifications:
- removed math.sqrt by comparing with the square of 150 = 22500 for performance reasons (sqrt is CPU intensive).
- also included MelTraX changes.
There is a bug in DrawWorldPreUnit and IsTerrainViewable, in some rear circumstances the camera will continually be adjusted jumping around the unit, and ignoring all the other events. It is because lastMove is reseted every time the camera is changed, but I don't have any idea how to fix it.
I've updated the first post to use the latest script.zwzsg wrote:Thanks. I renamed it because "Spec Mod" isn't very descriptive. I made it also change the height, and made it choose between three camera mode, TA, Total War, and the elusive tracking FPS. Plus some other changes.
Now that I can have an attract mode, all I need is some huge monitor in view of passerbys to advertise.
I did some modifications:
- removed math.sqrt by comparing with the square of 150 = 22500 for performance reasons (sqrt is CPU intensive).
- also included MelTraX changes.
There is a bug in DrawWorldPreUnit and IsTerrainViewable, in some rear circumstances the camera will continually be adjusted jumping around the unit, and ignoring all the other events. It is because lastMove is reseted every time the camera is changed, but I don't have any idea how to fix it.
Re: Spectator mode v1.2 (AKA "actionfinder")
My IsTerrainViewable isn't perfect, I had to give it a huge tolerance and I'm pretty sure it sometimes find un-viewable terrain that is, but I have no idea what's wrong, and it seemed to works right most of the times anyway.
I hadn't noticed the bug about how it can keep adjusting view while forgetting to change view, but to fix it, I guess just add another variable counting how many time the same view has been adjusted.
Also, my logic was that most of camera change are done with UpdateCamera, which does travelling but doesn't change the view angle, and that PickCameraMode was only used like every 3 or so Update, or when we have to (view blocked, FPS unit dead, etc...). Because a simple travelling is easier on the eye than a sudden turning all over. With your change, lastMove = gameSecs is not done when UpdateCamera goes into the "else" "SetCameraTarget" part. Oh, and you forgot to comment out the Spring.Echo of the distance calculated by IsTerrainViewable.
I hadn't noticed the bug about how it can keep adjusting view while forgetting to change view, but to fix it, I guess just add another variable counting how many time the same view has been adjusted.
Because I thought a SendCommands wasn't immediate but took a cycle or two to take effect. Appears I was wrong.MelTraX wrote:Why not just deselect the tracked unit instead of disabling user widgets?
Stop playing 98's mods.imbaczek wrote:works really nice, gj. you could try to not fps-track 3do models, they look fugly when not looked at from above ;p
Also, my logic was that most of camera change are done with UpdateCamera, which does travelling but doesn't change the view angle, and that PickCameraMode was only used like every 3 or so Update, or when we have to (view blocked, FPS unit dead, etc...). Because a simple travelling is easier on the eye than a sudden turning all over. With your change, lastMove = gameSecs is not done when UpdateCamera goes into the "else" "SetCameraTarget" part. Oh, and you forgot to comment out the Spring.Echo of the distance calculated by IsTerrainViewable.
Re: Spectator mode v1.2 (AKA "actionfinder")
I've uploaded the wrong file, changed it back to the good one, thanks.zwzsg wrote:With your change, lastMove = gameSecs is not done when UpdateCamera goes into the "else" "SetCameraTarget" part. Oh, and you forgot to comment out the Spring.Echo of the distance calculated by IsTerrainViewable.
I was wandering, isn't it better to keep the normal BA camera type for fighting events and only do the fancy camera mode switch when the script is showing buildings? As if you change the camera while showing a battle is hard to keep track who is attacking who.
Re: Spectator mode v1.2 (AKA "actionfinder")
I don't use it to follow what's going on, I use it to have some fanciful videos on my screen (F5 to disable the GUI). In fact, I find that the heavily tilted and tracking FPS viewed are not used often.
Bawwww!xyz wrote:the normal BA camera type
Re: Spectator mode v1.3 (AKA "actionfinder")
Updated the first post to version 1.3
I've separated specmode option from zwzsg's attracctmode option.
Specmode option:
-Enable it by typing /luaui specmode
-This option will not change the camera type during gameplay
Attractmode option:
-Enable it by typing /luaui attractmode
-This option will also change the camera mode while switching from one event to another.
To switch between the two modes you can also use CTRL+ALT+C (you need to be in specmode or attractmode before using this).
Bugfixing:
-tried to fix the camera jumping around bug in attractmode.
-optimisation: in attractmode do not check every frame if the the unit is in view.
I've separated specmode option from zwzsg's attracctmode option.
Specmode option:
-Enable it by typing /luaui specmode
-This option will not change the camera type during gameplay
Attractmode option:
-Enable it by typing /luaui attractmode
-This option will also change the camera mode while switching from one event to another.
To switch between the two modes you can also use CTRL+ALT+C (you need to be in specmode or attractmode before using this).
Bugfixing:
-tried to fix the camera jumping around bug in attractmode.
-optimisation: in attractmode do not check every frame if the the unit is in view.
Re: Spectator mode v1.3 (AKA "actionfinder")
The fix has failed,but i found a way to reproduce the bug:xyz wrote: Bugfixing:
-tried to fix the camera jumping around bug in attractmode.
Start a AIvsAI game as a spectator,
Turn the script off
Select a unit (Commander) and press T to track it
While tracking enable the attractmode and wait.
Re: Spectator mode v1.3 (AKA "actionfinder")
Sorry, I though deselecting was enough to disable tracking, but it's not, you need some "trackoff" commands. I fixed that and the bug about the camera that keeps picking new angles and forget to change point, but then I started to turn it into a gadget and things went awry.
Re: Spectator mode v1.3 (AKA "actionfinder")
What things went away?
Converting it into a gadget means that it will need to be installed on all the clients.
Converting it into a gadget means that it will need to be installed on all the clients.
Re: Spectator mode v1.3 (AKA "actionfinder")
Call-ins such as UnitDamaged, UnitDestroyed, etc... in the unsynced part of a gadget.xyz wrote:What things went away?
Uh. How to explain. See, we have different goals. You're still thinking "So I log into the lobby, find a nice DSD BA 16v16 battleroom, enter it, tick spec, then actively watch how other people are playing.", while I'm thinking "Use the spring engine in a way it was not intented, as a mean of having my monitor shows a never ending stream of pretty moving images of battles, disregarding notions such as "playing", "game", "user input"".xyz wrote:Converting it into a gadget means that it will need to be installed on all the clients.
Re: Spectator mode v1.3 (AKA "actionfinder")
I've updated the firs post with version 1.4
changes since 1.3:
- ESC no longer exits the script, to turn specmode on or off use CTRL+ALT+S
- After 10 fighting events the script will force an economy event to be displayed next so that in games with a lot of fighting the user will also get a glance of how the players economy is doing.
changes since 1.3:
- ESC no longer exits the script, to turn specmode on or off use CTRL+ALT+S
- After 10 fighting events the script will force an economy event to be displayed next so that in games with a lot of fighting the user will also get a glance of how the players economy is doing.
Re: Spectator mode v1.3 (AKA "actionfinder")
maybe you could split the map in areas, and every time something interesting happens in an area you increase its score (a map could be splitted in like 20x20 areas), then you show the part of the map with the best areas, to choose what part of the map to show you fix a maximum zoom, then you iterate through all possible pos of the cam on the map, and get the best one, then reduce the maximum zoom, itarate through all possible pos of the cam on the map again take the best one by average score of its areas etc (ofc the zoom step should be big to make it fast) until you reach a min zoom
you would get a list of cam pos + score for each zoom level, then you could pick the best score and show its cam pos + zoom level
every .... N seconds, you would decrease the areas visible on the screen, and search for a new cam pos, so displayed areas would loose interest over time unless things keep happening there, you could limit the score to add in displayed areas so it won't show the same thing for too long
the hard part would be to assign the right score to events
edit: comparing cam pos by average score is really good but i can't think of something better right now
you would get a list of cam pos + score for each zoom level, then you could pick the best score and show its cam pos + zoom level
every .... N seconds, you would decrease the areas visible on the screen, and search for a new cam pos, so displayed areas would loose interest over time unless things keep happening there, you could limit the score to add in displayed areas so it won't show the same thing for too long
the hard part would be to assign the right score to events
edit: comparing cam pos by average score is really good but i can't think of something better right now
Re: Spectator mode v1.4 (AKA "actionfinder")
hey, Satirik
Thanks for the suggestions.
The thing is that when I first set off in writing this script I planned to divide the map in sectors, but then I realized that if an area of the map has a lot of activity it is more likely that the script will select an event in that part of the map, that's why I had to put that 10 fighting events limit, so that the script will show some economy every once in a while.
As for scoring I was thinking of something like the more HP a unit that generates the event has (unit finished, unit destroyed, unit attacked) the higher the score, and then put this into an event priority queue, and select the first most important event.
Your idea to adjust the zoom so that more action is included sounds really good, I'll have to look into that.
Thanks again.
Thanks for the suggestions.
The thing is that when I first set off in writing this script I planned to divide the map in sectors, but then I realized that if an area of the map has a lot of activity it is more likely that the script will select an event in that part of the map, that's why I had to put that 10 fighting events limit, so that the script will show some economy every once in a while.
As for scoring I was thinking of something like the more HP a unit that generates the event has (unit finished, unit destroyed, unit attacked) the higher the score, and then put this into an event priority queue, and select the first most important event.
Your idea to adjust the zoom so that more action is included sounds really good, I'll have to look into that.
Thanks again.