Speeding-up game execution

Speeding-up game execution

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
ljd
Posts: 7
Joined: 20 Aug 2011, 20:21

Speeding-up game execution

Post by ljd »

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!
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Speeding-up game execution

Post by gajop »

(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
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Speeding-up game execution

Post by Kloot »

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);
ljd
Posts: 7
Joined: 20 Aug 2011, 20:21

Re: Speeding-up game execution

Post by ljd »

Several more questions:

I see I can set in [modoptions]

Code: Select all

maxspeed=100;
minspeed=100;
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!
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Speeding-up game execution

Post by knorke »

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.
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?
never had problems..at some points it simply does not go faster.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Speeding-up game execution

Post by abma »

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...
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Speeding-up game execution

Post by gajop »

abma 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...
it may well be worth it, since the game usually doesn't last long if you have speed set high, f.e 100 or so
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
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Speeding-up game execution

Post by abma »

no, no direct support is needed, see these console commands:

Code: Select all

aikill
aicontrol
ailist
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Speeding-up game execution

Post by knorke »

gajop wrote:
abma 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...
it may well be worth it, since the game usually doesn't last long if you have speed set high, f.e 100 or so
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
Would probally require quite some changes to games as some parts will depend on GameFrame or passed game seconds and all that.
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.
Post Reply

Return to “AI”