I wrote a BA playing AI for my thesis. I need to run a few hundred games to collect data. What can I do to speed up game execution? Can running spring-headless speed things up? In game I can press +/- to speed-up/slow-down the game. Is there a way to do this from my agent? I didn't see anything in the AI Interface (I'm using the plain C interface).
Thanks!
Speeding-up game execution
Moderators: hoijui, Moderators
Re: Speeding-up game execution
(you may need a linux box, can't recall if it works 100% on windows)
download: https://github.com/gajop/springgrid and https://github.com/gajop/botrunner and set it up
you can then schedule as many games as you want, at the speed you want, etc.
if that's too complex for you, you can check how i'm using scripts for my own AI: https://github.com/gajop/MyAI/tree/master/scripts, check run.sh and go.sh, and any of the other concrete scripts (they will need to be modified for your AI)
you can start a game from springlobby for your map/mod and modify the important parts such as map/mod name & hash in one of the existing scripts
those shell scripts can easily be converted to a batch script
download: https://github.com/gajop/springgrid and https://github.com/gajop/botrunner and set it up
you can then schedule as many games as you want, at the speed you want, etc.
if that's too complex for you, you can check how i'm using scripts for my own AI: https://github.com/gajop/MyAI/tree/master/scripts, check run.sh and go.sh, and any of the other concrete scripts (they will need to be modified for your AI)
you can start a game from springlobby for your map/mod and modify the important parts such as map/mod name & hash in one of the existing scripts
those shell scripts can easily be converted to a batch script
Re: Speeding-up game execution
For completeness:
Code: Select all
// same as pressing + once
SSendTextMessageCommand msg = {"/speedup", 0};
// or whatever the Actual_F_uglyName of this callback is
cb->HandleCommand(COMMAND_SEND_TEXT_MESSAGE, &msg);
Re: Speeding-up game execution
Several more questions:
I see I can set in [modoptions]
Will setting the minspeed too high cause any errors in the game simulation? Will the game slow down to complete all the calculations needed per frame if I set minspeed too high?
Is there a limit to how high I can set the minspeed?
While I wish to test the game at max speed, I also want to be able to watch replays at normal speed. I can set minspeed=1, maxspeed=100. Then set the in game speed to 100 during the test. When I want to review the demo, I can just reduce the speed to 1x. What's the best way to set the game speed? Is there a mod option for this as well? Or is the only option SSendTextMessageCommand from the AI as kloot explained above?
Thanks!
I see I can set in [modoptions]
Code: Select all
maxspeed=100;
minspeed=100;
Is there a limit to how high I can set the minspeed?
While I wish to test the game at max speed, I also want to be able to watch replays at normal speed. I can set minspeed=1, maxspeed=100. Then set the in game speed to 100 during the test. When I want to review the demo, I can just reduce the speed to 1x. What's the best way to set the game speed? Is there a mod option for this as well? Or is the only option SSendTextMessageCommand from the AI as kloot explained above?
Thanks!
Re: Speeding-up game execution
you can type commands into console to change gamespeed:
/setmaxspeed 10
/setminspeed 10
/setspeed 10 (not sure about this..if it does not work just use setminspeed)
with a widget (lua script) you can automate that:
Spring.SendCommands ("setminspeed 10") etc
use
http://springrts.com/wiki/Lua_UnsyncedR ... Spectating
to only speed up during game and not in replay.
/setmaxspeed 10
/setminspeed 10
/setspeed 10 (not sure about this..if it does not work just use setminspeed)
with a widget (lua script) you can automate that:
Spring.SendCommands ("setminspeed 10") etc
use
http://springrts.com/wiki/Lua_UnsyncedR ... Spectating
to only speed up during game and not in replay.
never had problems..at some points it simply does not go faster.Will setting the minspeed too high cause any errors in the game simulation? Will the game slow down to complete all the calculations needed per frame if I set minspeed too high?
Re: Speeding-up game execution
spring-headless is perfect for that. there is an example widget, that sets speed to 100 if its run with spring-headless:
https://github.com/spring/spring/blob/d ... _setup.lua
just "install" as a normal widget. (copy to ~/.spring/LuaUI/Widgets)
just an idea: (not sure if its worth to do that)
you could speed up re-runs of the ai by slightly modifiyingthe game and "reset" the game after each run (add a gadget that removes all features/units, kills ai / reinitializes the ais) . but i'm not sure if its worth the trouble/time because you only save the start-up time of spring (usally ~10 seconds or so, thats not much if the game itself runs for 10 minutes...). also you need to create your own .sdd...
https://github.com/spring/spring/blob/d ... _setup.lua
just "install" as a normal widget. (copy to ~/.spring/LuaUI/Widgets)
just an idea: (not sure if its worth to do that)
you could speed up re-runs of the ai by slightly modifiyingthe game and "reset" the game after each run (add a gadget that removes all features/units, kills ai / reinitializes the ais) . but i'm not sure if its worth the trouble/time because you only save the start-up time of spring (usally ~10 seconds or so, thats not much if the game itself runs for 10 minutes...). also you need to create your own .sdd...
Re: Speeding-up game execution
it may well be worth it, since the game usually doesn't last long if you have speed set high, f.e 100 or soabma wrote:but i'm not sure if its worth the trouble/time because you only save the start-up time of spring (usally ~10 seconds or so, thats not much if the game itself runs for 10 minutes...). also you need to create your own .sdd...
but your AI (and the opposing one, which you may not have knowledge of) may need to be changed, to support reinitialization without "Game Start" event being triggered
Re: Speeding-up game execution
no, no direct support is needed, see these console commands:
Code: Select all
aikill
aicontrol
ailist
Re: Speeding-up game execution
Would probally require quite some changes to games as some parts will depend on GameFrame or passed game seconds and all that.gajop wrote:it may well be worth it, since the game usually doesn't last long if you have speed set high, f.e 100 or soabma wrote:but i'm not sure if its worth the trouble/time because you only save the start-up time of spring (usally ~10 seconds or so, thats not much if the game itself runs for 10 minutes...). also you need to create your own .sdd...
but your AI (and the opposing one, which you may not have knowledge of) may need to be changed, to support reinitialization without "Game Start" event being triggered
Also you would end up with a replay that is multiple hours long which will make it hard to watch a specific match: imo not a good idea.