Hey guys, I've been making a foray into making an AI for a project of mine recently, and I've made a useful discovery along the way. I didn't see anything about it when I searched it here so I figure I should put this information out here.
So, the build flag parameter of the AI Build action, what does it do? It determines where the AI will seek to build the structure within the chosen town. This includes this such as where gas harvesting structures are built (ie on top of geysers), if they should be spaced out for things such as efficient protoss psi distribution, defensive structures being placed near mineral lines/chokes, etc. Several structures have a triggered default flag, but if you make custom structures with similar functionalities to any of these and you may run into some problems. Using the correct flags can fix this.
Now, the numbers each of these different flags are associated with is the difficult and confusing part. You might expect them to be neatly indexed from 0 to however many there are. However, this is not the case.
There are numerous flags which are declared that are found in TriggerLib/BuildAI.galaxy. Instead of normal numbers, they are associated with hexadecimal values. I have converted all of these hexadecimals to typical numbers, and here you see all of their values.
These flags themselves I haven't seen used as the actual build flags, but only as components. I'm not sure if these flags in of themselves work, or if you can make your own combinations. My guess is that only the declared flags will work, but I haven't tested this. Now, onto the flags primarily used.
c_makeStandard = c_makeNoFlags = 0
c_makeCenter = c_nearResource = 262144 (This is for HQ structures such as Command Centers)
c_makeCreep = c_valueSpaceMajor | c_avoidPowerOrCreep = 1052928 (This is used for Creep Tumors to help maximize creep coverage)
c_makePower = c_valueSpaceMajor | c_avoidPowerOrCreep | c_nearFarDropoff = 1085696 (This is used for Pylons to help maximize Psi coverage)
c_makeExpanPower = c_nearResource | c_nearDropoff | c_avoidClosePowerOrCreep = 296961 (No found usage, but maybe its used for Pylons in select situations?)
c_makeDarkPower = c_nearResource | c_nearDropoff = 296960 (Same as the normal power flag, except it doesn't care at all if it is placed within Psi, only found use case is a Protoss structure which was cut during development)
c_makeCollector = c_onVespeneGas | c_nearDropoff = 268470272 (This is for gas harvesting structures such as Refineries)
c_makeDefense = c_avoidCloseDefense | c_nearResource | c_nearFarDropoff | c_nearFarFactory | c_nearFarPowerOrCreep | c_nearChokePoint = 831492 (This is used for defensive buildings, primarily any which can target ground units)
c_makeResourceDefense = c_avoidCloseDefense| c_nearResource = 262148 (This is used primarily for defensive structures which may only target air units)
c_makeLowerable = c_makeStandard | c_canLower = 134217728 (This is for Supply Depots)
c_makeWall = c_nearChokePoint | c_canBlock = 201850880 (No found usage, not exactly sure how this works out)
I haven't tested what each and every one of these flags do, but I think looking at the names and the components they are made of are self explanatory enough that with some messing around you could figure it all out. Anyways, I hope this helps some people out, and please do share any discoveries relevant to the uses of the flags or let me know if I've made any mistakes in the math.
Rollback Post to RevisionRollBack
Looking for feedback on my custom races extension mod called "Scion Custom Races (Mod)"
fascinating. very interesting. I my self have not dabbled in the ai editor yet, so this was nice to read, thank you.
Im not of much help, lol, but the creep flags interest me the most, since creep is jerry-rigged into water in my project. and im seeing some strange issues.
I wonder how those work in greater detail, like if thats just for ai structure production/placement or if its also commanded ai movements spells or perhaps even the way attack waves move or how they choose to move, like when zerg ai army retreats.