Knowing from the outset what sort of factories are available will obviously have an impact on research paths, build orders, and so on.
Tank Factory
This is what I have planned so far:
Code: Select all
var tanksDisabled = (!isStructureAvailable("A0LightFactory", me)) && (!enumStruct(me, FACTORY).length);
But, if the game us using baseType of CAMP_BASE or CAMP_WALLS, there might be pre-placed factories on the map meaning my AI will assume it can make tanks for the rest of the game -- when the factories are destroyed, they can't be rebuilt by the AI due to structure limits.
Cyborg Factory
Because I have to research Cyborg Factory before I can build one, it's not available at the very start of the game. So I can't see any way to determine from the outset if my AI will be able to build cyborgs.
VTOL Factory
Same issue as cyborg factory. I have no way of knowing at the start of the game if VTOLs are disabled. In addition, I'd also need to know if VTOL rearm pads are disabled (effectively making VTOLs pointless because I'd have to recycle then build new ones in order to "rearm" = too much pain).
Solution?
A getStructureLimits() function that returns an object with named keys (structure ids) and corresponding numeric values (limit set for that structure for this game) would completely solve the problem.
I could then do this during eventGameInit() or eventStartLevel():
Code: Select all
var structLimits = getStructureLimits();
var tanksEnabled = structLimits["A0LightFactory"];
var cyborgsEnabled = structLimits["A0CyborgFactory"];
var vtolsEnabled = structLimits["A0VTolFactory1"] && structLimits["A0VtolPad"];