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 are all just a single hexadecimal value, but there are more which are of combinations of these flags using a bitwise or operation (Basically just adding the numbers together)
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.
//typedaily.com/" rel="noopener nofollow" target="_blank">https://typedaily.com/ I am using this for a long time that's why I am telling you"}" data-sheets-userformat="{"2":4498,"4":{"1":2,"2":65280},"7":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"10":2,"11":0,"15":"Arial"}">Hi, here the writer is talking about very beneficial information. This will fulfill the needs of many users. So we thank you for sharing this. Now I want to suggest a great service that has all solutions for your writing difficulties. I hope this will do its best for your work so go on https://typedaily.com/ I am using this for a long time that's why I am telling you
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
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.
c_makeDefault = -1
c_makeNoFlags = 0x00000000 = 0
c_avoidClosePowerOrCreep = 0x00000001 = 1
c_avoidCloseFactory = 0x00000002 = 2
c_avoidCloseDefense = 0x00000004 = 4
c_avoidCloseDropoff = 0x00000008 = 8
c_avoidFarPowerOrCreep = 0x00000010 = 16
c_avoidFarFactory = 0x00000020 = 32
c_avoidFarDefense = 0x00000040 = 64
c_avoidFarDropoff = 0x00000080 = 128
c_nearClosePowerOrCreep = 0x00000100 = 256
c_nearCloseFactory = 0x00000200 = 512
c_nearCloseDefense = 0x00000400 = 1024
c_nearCloseDropoff = 0x00000800 = 2048
c_nearFarPowerOrCreep = 0x00001000 = 4096
c_nearFarFactory = 0x00002000 = 8192
c_nearFarDefense = 0x00004000 = 16384
c_nearFarDropoff = 0x00008000 = 32768
c_avoidResource = 0x00010000 = 65536
c_avoidChokePoint = 0x00020000 = 131072
c_nearResource = 0x00040000 = 262144
c_nearChokePoint = 0x00080000 = 524288
c_valueSpaceMinor = 0x00100000 = 1048576
c_valueSpaceMajor = 0x00200000 = 2097152
c_valueTouchingEdges = 0x00400000 = 4194304
c_canBlock = 0x0c000000 = 201326592
c_canLower = 0x08000000 = 134217728
c_onVespeneGas = 0x10000000 = 268435456
c_onlyHere = 0x20000000 = 536870912
c_ignoreDanger = 0x40000000 = 1073741824
These flags are all just a single hexadecimal value, but there are more which are of combinations of these flags using a bitwise or operation (Basically just adding the numbers together)
c_avoidPowerOrCreep = c_avoidClosePowerOrCreep | c_avoidFarPowerOrCreep = 17
c_avoidFactory = c_avoidCloseFactory | c_avoidFarFactory = 34
c_avoidDefense = c_avoidCloseDefense | c_avoidFarDefense = 68
c_avoidDropoff = c_avoidCloseDropoff | c_avoidFarDropoff = 136
c_nearPowerOrCreep = c_nearClosePowerOrCreep | nearFarPowerOrCreep = 4352
c_nearFactory = c_nearCloseFactory | c_nearFarFactory = 8704
c_nearDefense = c_nearCloseDefense | c_nearFarDefense = 17408
c_nearDropoff = c_nearCloseDropoff | c_nearFarDropoff = 34816
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.
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.
//typedaily.com/" rel="noopener nofollow" target="_blank">https://typedaily.com/ I am using this for a long time that's why I am telling you"}" data-sheets-userformat="{"2":4498,"4":{"1":2,"2":65280},"7":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"10":2,"11":0,"15":"Arial"}">Hi, here the writer is talking about very beneficial information. This will fulfill the needs of many users. So we thank you for sharing this. Now I want to suggest a great service that has all solutions for your writing difficulties. I hope this will do its best for your work so go on https://typedaily.com/ I am using this for a long time that's why I am telling you