More AI Interface Questions (maybe not java specific)
Moderators: hoijui, Moderators
-
- Posts: 51
- Joined: 14 Aug 2008, 21:54
More AI Interface Questions (maybe not java specific)
In the ecconomy object...what is the difference between the values returned by:
getCurrent(Resource c_resourceId)
getIncome(Resource c_resourceId)
getStorage(Resource c_resourceId)
getUsage(Resource c_resourceId)
for a particular resource? I can guess on a couple....but...some clarification would be awesome.
Another stupid question...how many resource types ARE there in (for example) BA? Just metal and energy?
What is a 'feature'? (com.springrts.ai.oo.Feature)? Where can I get a list of feature IDs?
Is there any way my AI can determine how many different players there are? I can get a count of teams, but not the same thing.
Thanks in advance
getCurrent(Resource c_resourceId)
getIncome(Resource c_resourceId)
getStorage(Resource c_resourceId)
getUsage(Resource c_resourceId)
for a particular resource? I can guess on a couple....but...some clarification would be awesome.
Another stupid question...how many resource types ARE there in (for example) BA? Just metal and energy?
What is a 'feature'? (com.springrts.ai.oo.Feature)? Where can I get a list of feature IDs?
Is there any way my AI can determine how many different players there are? I can get a count of teams, but not the same thing.
Thanks in advance
Re: More AI Interface Questions (maybe not java specific)
"Current" tells you how much of resource R the AI has in storage.
"Income" tells you how much of resource R the AI is producing.
"Storage" tells you how much storage capacity for resource R the AI has.
"Usage" tells you how much of resource R the AI is spending.
There are two concrete engine resource types (metal, energy) that AI's know about; however, many non-*A games define their own types with Lua code outside of the engine's view.
A feature is any static game object (trees, rocks, wrecks).
The player count is inaccessible.
"Income" tells you how much of resource R the AI is producing.
"Storage" tells you how much storage capacity for resource R the AI has.
"Usage" tells you how much of resource R the AI is spending.
There are two concrete engine resource types (metal, energy) that AI's know about; however, many non-*A games define their own types with Lua code outside of the engine's view.
A feature is any static game object (trees, rocks, wrecks).
The player count is inaccessible.
-
- Posts: 51
- Joined: 14 Aug 2008, 21:54
Re: More AI Interface Questions (maybe not java specific)
thanks!!
""Income" tells you how much of resource R the team is producing." per frame? per second? per what?
"The player count is inaccessible."

""Income" tells you how much of resource R the team is producing." per frame? per second? per what?
"The player count is inaccessible."

Re: More AI Interface Questions (maybe not java specific)
why you need to know about hte players?
You can fetch a list of resources of a mod. even doh this currently only works for the engine ones, you should rely on this.. so you do not have to know about what reosurces there are.. as you can dynamicaly fetch the list ...
You can fetch a list of resources of a mod. even doh this currently only works for the engine ones, you should rely on this.. so you do not have to know about what reosurces there are.. as you can dynamicaly fetch the list ...
Re: More AI Interface Questions (maybe not java specific)
Sorry, forgot to mention that. Both production and usage are measured per 32 frames.per frame? per second? per what?
-
- Posts: 51
- Joined: 14 Aug 2008, 21:54
Re: More AI Interface Questions (maybe not java specific)
"why you need to know about the players?"
I don't strictly NEED to know (some of my algorithms are based on how cramped the map will be...based on how many players)....
But does number of teams (which I CAN count) equal the number of starting commanders? If so, then I am good to go.
I don't strictly NEED to know (some of my algorithms are based on how cramped the map will be...based on how many players)....
But does number of teams (which I CAN count) equal the number of starting commanders? If so, then I am good to go.
Re: More AI Interface Questions (maybe not java specific)
Yes.casperjeff wrote:But does number of teams (which I CAN count) equal the number of starting commanders? If so, then I am good to go.
Although maybe some mods change this using Lua.
Re: More AI Interface Questions (maybe not java specific)
are you kidding? for real? will have to doccuemnt that.Kloot wrote:Sorry, forgot to mention that. Both production and usage are measured per 32 frames.per frame? per second? per what?
Re: More AI Interface Questions (maybe not java specific)
does the AI not run in 30 FPS? why is it in 32 frames?
Re: More AI Interface Questions (maybe not java specific)
No, Spring (and any loaded AI lib) does run at a base-rate of 30 simulation frames per second. However, the economic state of a team is backed up every 32 frames (during a "SlowUpdate" in engine parlance), and the state values for income and usage that AI's have read access to represent summations over the last team slow-update cycle. So, at any frame f that is not an integer multiple of 32, an AI is only able to obtain its cumulative income and usage from frame (int(f / 32) - 32) up until frame int(f / 32).
Re: More AI Interface Questions (maybe not java specific)
Hmm, would it be possible to make a value(s) like that available via the ai interface ? :)
In case someone decides to change it at some point and mess with ai's written based on the knowledge ? :)
In case someone decides to change it at some point and mess with ai's written based on the knowledge ? :)
Re: More AI Interface Questions (maybe not java specific)
what about dividing the returned values by 32?
that would be a problem for current AIs, but as i have access to most of them, i could fix this in the same commit.
that would be a problem for current AIs, but as i have access to most of them, i could fix this in the same commit.
Re: More AI Interface Questions (maybe not java specific)
You mean the interface would return the current resources generated per frame rather than per slow update?
hmmm, that would need a few algorithms to be slightly re-engineered but would result in minor simplification.
Nonetheless the 32 frames fact is signicant and should not be ignored. Dividing by 32 and assuming that its per frame will only introduce a greater margin of error in certain algorithms, and we already have a large margin of error as it is due to non deterministic resource consumption.
Instead i would like an extra callout to find out how often resources are updated. For example a mod may define a new resource which comes in every 2 seconds in lua, I would find that data useful, and the 2 seconds value could be worked into algorithms.
hmmm, that would need a few algorithms to be slightly re-engineered but would result in minor simplification.
Nonetheless the 32 frames fact is signicant and should not be ignored. Dividing by 32 and assuming that its per frame will only introduce a greater margin of error in certain algorithms, and we already have a large margin of error as it is due to non deterministic resource consumption.
Instead i would like an extra callout to find out how often resources are updated. For example a mod may define a new resource which comes in every 2 seconds in lua, I would find that data useful, and the 2 seconds value could be worked into algorithms.
Re: More AI Interface Questions (maybe not java specific)
What AF said :D
Sorta :)
It's not just the size of the value, it's the fact that the value is updated each 32'th frame (right ??).
So I want to get the value jsut after it's updated, or my info is old :)
So I want to know the 'keyframes' when this value is updated :)
Hmm, or mayby make the value update an event ? :D
There is something to be said for normalized values also tho :)
Sorta :)
It's not just the size of the value, it's the fact that the value is updated each 32'th frame (right ??).
So I want to get the value jsut after it's updated, or my info is old :)
So I want to know the 'keyframes' when this value is updated :)
Hmm, or mayby make the value update an event ? :D
There is something to be said for normalized values also tho :)