View topic - Speeding-up game execution



All times are UTC + 1 hour


Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 21 Apr 2012, 09:50 

Joined: 20 Aug 2011, 19:21
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!


Top
 Offline Profile  
 
PostPosted: 21 Apr 2012, 10:59 
Moderator

Joined: 05 Aug 2009, 19:42
(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


Top
 Offline Profile  
 
PostPosted: 21 Apr 2012, 13:42 
Spring Developer

Joined: 08 Oct 2006, 15:58
For completeness:

Code:
// 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);


Top
 Offline Profile  
 
PostPosted: 28 Apr 2012, 11:25 

Joined: 20 Aug 2011, 19:21
Several more questions:

I see I can set in [modoptions]
Code:
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!


Top
 Offline Profile  
 
PostPosted: 28 Apr 2012, 11:55 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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.

Quote:
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.


Top
 Offline Profile  
 
PostPosted: 02 May 2012, 16:57 
Spring Developer

Joined: 31 May 2009, 23:08
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...


Top
 Offline Profile  
 
PostPosted: 02 May 2012, 19:53 
Moderator

Joined: 05 Aug 2009, 19:42
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


Top
 Offline Profile  
 
PostPosted: 02 May 2012, 22:10 
Spring Developer

Joined: 31 May 2009, 23:08
no, no direct support is needed, see these console commands:
Code:
aikill
aicontrol
ailist


Top
 Offline Profile  
 
PostPosted: 03 May 2012, 09:24 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.