Page 1 of 1

AI option values?

Posted: 30 Sep 2009, 10:20
by allanmc
I am developing an AI for Spring, and would now like to allow it to read some settings from a configuration files. I would believe that AIOptions.lua is meant to be used for this?

I am using the new C++ interface, and can very well read from the AIInfo.lua file using the following command:

Code: Select all

Info::GetInstance(ai->callback)->...;
My best guess for reading from AIOptions.lua, which is what i would like to do, is using the following command:

Code: Select all

OptionValues::GetInstance(ai->callback)->...;
But this doesn't seem to know anything about the options i have entered in AIOptions.lua - GetSize() returns 0.

So my question is: Is the AI supposed to be allowed to access AIOptions.lua, and if, how should this be done using the new C++ interface?

Re: AI option values?

Posted: 30 Sep 2009, 11:10
by hoijui
no, the AI should not ever have to access this file.
AIOptions.lua is meant to declare the options the AI supports to the outside world. eg, The lobby would read this file, and then show some graphical menues nad boxes and stuff, so you can set the options through a GUI. On game start, the lobby would then write the values selected by the user into the start script (script.txt). The values in there are what you can read out through the callback. As the lobbies do not yet support AI options, you have to write them manually into your test start script, as you can see it in the spring source under:
Documentation/SpringStartScript.txt