js api: how to get detailed structure / droid info?
Posted: 08 Feb 2012, 07:11
Could some new properties be added to droids / structures?
For droids:
* .propulsionType
* .body
* .turret1
* .turret2 (only applicable for Dragon currently)
Use case:
I want to know what the enemy is producing and can't rely on .name. Seeing what enemy creates in more detail will allow AI to better adapt to gameplay situation.
For structures:
* .structID (eg. P0-AASite-SAM2)
And ideally (I don't know if the game has this level of detail internally):
* .base (tower, emplacement, pit, bunker, hardpoint, etc?)
* .turret (howitzer, hellstorm, sensor, wide angle sensor, etc?)
Use case:
Currently there is a vast array of structures that get a .stattype == DEFENCE. I need to know more specifically, what sort of defence? Is it a sensor (and if so, what sort), is it artillery (and what sort), etc.
I can deduce this information from the .name property, however it's going to be a somewhat crufty set of code to do that.
Knowing this is useful not just when assessing enemy defences, but also when dealing with my own defences. As NoQ found on his nullbot AI, he needs a way to determine how many sensors he's built, for example.
Economic factors:
I'd also like to experiment with an AI that makes decisions based on economic factors - eg. how much something cost to build.
Could a new property be added to droids/structures:
* .cost (total cost of the droid/structure)
Or have a getCost(obj) function that returns the cost of the passed in object?
If the other new properties were added (listed earlier in this post) then again I could deduce the cost of something by using lookup tables, etc. The issue there is that those tables will quickly become out of date, and they won't know about any custom units added by mods, etc.
For droids:
* .propulsionType
* .body
* .turret1
* .turret2 (only applicable for Dragon currently)
Use case:
I want to know what the enemy is producing and can't rely on .name. Seeing what enemy creates in more detail will allow AI to better adapt to gameplay situation.
For structures:
* .structID (eg. P0-AASite-SAM2)
And ideally (I don't know if the game has this level of detail internally):
* .base (tower, emplacement, pit, bunker, hardpoint, etc?)
* .turret (howitzer, hellstorm, sensor, wide angle sensor, etc?)
Use case:
Currently there is a vast array of structures that get a .stattype == DEFENCE. I need to know more specifically, what sort of defence? Is it a sensor (and if so, what sort), is it artillery (and what sort), etc.
I can deduce this information from the .name property, however it's going to be a somewhat crufty set of code to do that.
Knowing this is useful not just when assessing enemy defences, but also when dealing with my own defences. As NoQ found on his nullbot AI, he needs a way to determine how many sensors he's built, for example.
Economic factors:
I'd also like to experiment with an AI that makes decisions based on economic factors - eg. how much something cost to build.
Could a new property be added to droids/structures:
* .cost (total cost of the droid/structure)
Or have a getCost(obj) function that returns the cost of the passed in object?
If the other new properties were added (listed earlier in this post) then again I could deduce the cost of something by using lookup tables, etc. The issue there is that those tables will quickly become out of date, and they won't know about any custom units added by mods, etc.