Does anyone know in-depth the means and ways to use these triggers?
I've been able to use set stock and running the AI, but came to a deadlock when having Enable Stock then adding new Set Stocks after 5 minutes. The AI builds partially the second set of Set Stocks, but not all of them.
If however I do the Set Stocks at once and do Enable Stock only once for all Set Stocks, the AI will build everything specified by Set Stocks.
Any ideas?
Rollback Post to RevisionRollBack
Whatever you do, wholeheartedly, moment by heartfelt moment, becomes a tool for the expression of your very soul.
I assume AI Advanced is the trigger rendition of the Galaxy code. Here is my understanding of them.
SetStock -
Since the melee Galaxy code fires continually, the AI Stock commands get fired continuously. If fired on their lonesome, they quickly seem to "forget" what to do and don't get processed. The same is much the case with Bullies. The AI goes through the entire Stock List regardless of its contents, because they don't have a "wait" behavior (unlike Brood War, where they "remember" things), while Enable Stock is what actually tells them to do something with it. Very unlike Brood War, where commands are independent and more logical. Also, the melee code usually runs Clear Stock before its stock string, even though it's just repeating the same thing over and over again. While highly inefficient as a code structure, it is likely something they have to do because of the unreliably of individual commands. Thus, you may wish to structure your triggers in a similar fashion to something like this.
It is also worth noting that the AI builds a "blueprint" of its base (presumably similar to non-built Bullies) when you run SetStock without any kind of waits or conditions. Thus, when I have the AI build 12 barracks, 12 factory, 12 starport, many of the buildings tend to get ignored, because there isn't enough room in the blueprint. Thus, I use numeral conditions to segregate the construction and promote more active construction. That is why I have the Supply Depots segregated as such in Buttes' build order, though it would help to take this a few steps further. That said, SetStock is extremely unreliable, especially regarding expansions. I have code that runs SetStock for defenses and production at expansions and they tend to take anywhere from 10-30 minutes to build them.
I don't know the differences between the various SetStock commands. They have some relevance, but because the documentation was scribbled together by interns the only real way to know would be to experiment in a controlled environment. I am far too lazy for that.
The AI builds some of the units and structures in Set Stock at trigger 2, but not all. If I combined the two triggers and have only one Enable Stock the AI builds them all.
If I cleared stock at trigger 2, prior to adding the set stocks and enable stock after like this:
Trigger 2: at 5 mins of game
Clear Stock
Set Stock D
Set Stock E
Set Stock Etc
Enable Stock
The AI wouldn't build anything.
The command Make Always though makes the AI build structures but gets cancelled out or something if I do enable stock or clear stock.
If I understand it correctly, controlling the AI this way would not be a good thing. Any advice which way would be the best?
Mesk, do you loop your trigger there to get the AI doing them?
My Ai is just a modified melee galaxy. I couldn't get the AI to work reliably enough through triggers. Since the galaxy code just loops the entire thing ad infinitum, I presume the same must be done for triggers to work. But I don't know enough about the melee code to know if the looping mechanism is just as simple as having a trigger run itself forever. My gut reflex is that just crashes the game.
For you, it might be better to try the Bully approach, unless you really need dynamic base construction.
@IskatuMesk: Go I've tried to meddle with melee galaxy back during the early days of WoL but didn't know how to. Can you share how its done so I can try once more to get my AI working? I'm mainly a data guy and these triggers gave me nothing.
What we have is only an early prototype at best, due to the performance impact it has. But, in essence, these are the steps we ran through to make AI for my campaign.
First, we extracted the most recent variants of the AI from the patch files for the game. There are some files that won't be in those patch files, which you then would fall back towards the WoL core to eventually find (if the HoTS ones don't have them).
These are now treated as the project's Master Files. Which is to say, these are imported into the appropriate dependency when changed.
For the purpose of the campaign, I modify the Insane Difficulty files and ignore all others. All AI's are treated as one difficulty and the only difficulty the campaign imposes is through some switches that will be tied to time-gated functions and certain unit abilities. Else, shit gets messy.
This is where things get kind of complicated for me, so I had a friend working on it for the most part at this point. The gist of what we wanted to accomplish, at least for testing purposes, was a way to get the AI to know A.) which map and B.) which player it is. The build order system is stripped out and the AI only uses the one build. That looks a bit like this.
no idea whats required to keep ai functioning yet
AISetMainState(player, e_mainState_Open, e_mainSubState_Init);
buildIndex = PickHDTerranOpening(player);
AISetUserInt(player, c_currentBuildIndex, buildIndex);
AISetMainState(player, e_mainState_Open, e_mainSubState_Build);
buildIndex = AIGetUserInt(player, c_currentBuildIndex); check MapID variable from map and player ID to determine build
0x01
if (MapID == 1 && player == 2) { done = Terran0x01FrenchAuxiliaries (player); }
else if (MapID == 1 && player == 3) { done = Terran0x01GracianLoyalists (player); }
...<</quote>>
I believe the AI initializes an integer somewhere else (so it doesn't get looped in here), but I can't remember where that is since I haven't looked at this for months.
So, each map has an ID. Cross referencing the ID and player # gets us the build we want. The map itself can be void of any gameplay-related elements except the most mandatory of triggers, like aforementioned timegates. The idea was that the AI handled itself in the galaxy files, and data handled everything else.
Some important files there for general note.
BaseAI.Galaxy - This sets up the headers, a lot like the ones in Brood War, but more numerous and more specific. I turn off certain things in here in a vain effort to get more than 9fps in my maps, like Use Extra Scouts, which causes insane stuttering with zerg since it treats overlords as scouts. Beacons is something you'd want to disable for a campaign (that's the 1.5 ai command menu/voice notices). I may look into modding those in the future if the project gets anywhere, since voice acting characters for that would be incredibly trivial.
RequirementsAI.Galaxy - Define new units in here so you don't need to use quotations everywhere.
MeleeHigh, Low, etc. - Tiertary code that compounds itself. If you know galaxy you can probably trim a lot of this without a lot of drawbacks (for example we don't currently use Counters due to our crazy unit counts).
BuildAI - Very important, as it sort of gives the AI a hint at how to place structures. Doesn't always seem to follow this. A big problem with supply depots is I want to get rid of their burrowing behavior since it's silly, but I can't get the AI to consistently not wall off their CC with depots.
MeleeAI - Derivative of the racial AI's, you'll want to make particular note of the various AINewUnit* commands as they are hardcoded to fire when the AI gets a unit, and you can sort some stuff this way (like observers and units you don't want in attack waves). Incidentally, this will be why the melee AI ignores those property flags in the editor. Again, if you know galaxy, you can probably do a lot here. I don't, so I just get chicken grease everywhere instead.
I've since handed off work to Jademus since the AI performs horrendeously badly and the melee attack waves are kind of terrible. If he fixes it, maybe I can further my documentation and experiments.
I have some extensive observational related documentation on a private forum but I doubt much of it would be useful. From what I understand, people just prefer to make their own AI as opposed to change the existing melee AI, since the existing melee AI is pretty terrible.
@IskatuMesk: Go Thank you. Could you tell me the exact folder paths these files are supposed to go when imported? I remember my tests resulted in the AI ignoring my files (probably wrong folders) or giving an error then not working at all (probably correct folders).
My plan is to modify the melee AI to include a few units. I don't have the time nor abilities to plan a new AI. And back then there was no information about that so I decided to move on to other things.
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.
Does anyone know in-depth the means and ways to use these triggers?
I've been able to use set stock and running the AI, but came to a deadlock when having Enable Stock then adding new Set Stocks after 5 minutes. The AI builds partially the second set of Set Stocks, but not all of them.
If however I do the Set Stocks at once and do Enable Stock only once for all Set Stocks, the AI will build everything specified by Set Stocks.
Any ideas?
Whatever you do, wholeheartedly, moment by heartfelt moment, becomes a tool for the expression of your very soul.
I assume AI Advanced is the trigger rendition of the Galaxy code. Here is my understanding of them.
SetStock -
Since the melee Galaxy code fires continually, the AI Stock commands get fired continuously. If fired on their lonesome, they quickly seem to "forget" what to do and don't get processed. The same is much the case with Bullies. The AI goes through the entire Stock List regardless of its contents, because they don't have a "wait" behavior (unlike Brood War, where they "remember" things), while Enable Stock is what actually tells them to do something with it. Very unlike Brood War, where commands are independent and more logical. Also, the melee code usually runs Clear Stock before its stock string, even though it's just repeating the same thing over and over again. While highly inefficient as a code structure, it is likely something they have to do because of the unreliably of individual commands. Thus, you may wish to structure your triggers in a similar fashion to something like this.
<<quote>>
--------------------
Terran0x01LordViktorVonButtes--------------------bool Terran0x01LordViktorVonButtes (int player) {
buttes
AIClearStock(player);
AISetStock( player, 1, c_TB_CommandCenter_Alias );
AISetStock( player, 10, c_TU_SCV );
AISetStock( player, 1, c_TB_SupplyDepot );
AISetStock( player, 12, c_TU_SCV );
AISetStock( player, 1, c_TB_Barracks );
AISetStock( player, 14, c_TU_SCV );
AISetStock( player, 3, c_TB_Barracks );
AISetStock( player, 15, c_TU_SCV );
AISetStock( player, 2, c_TB_SupplyDepot );
AISetStock( player, 9, c_TU_Marine );
AISetStock( player, 3, c_TB_SupplyDepot );
AISetStock( player, 15, c_TU_Marine );
AISetStock( player, 20, c_TU_SCV );
AISetStock( player, 1, c_TU_Marine );
AISetStock( player, 1, c_TB_EngineeringBay );
AISetStock( player, 2, c_TB_Barracks );
AISetStock( player, 1, c_TB_Academy );
AISetStock( player, 2, c_TB_SupplyDepot );
AISetStock( player, 3, c_TB_MissileTurret );
AISetStock( player, 6, c_TB_Factory );
if (AITechCount(player, c_TB_Factory, c_techCountCompleteOnly) >= 4) {
AISetStock( player, 30, c_TB_SupplyDepot );
}
AISetStock( player, 1, c_TB_Armory );
AISetStock( player, 4, c_TB_Barracks );
AISetStock( player, 2, c_TB_Starport );
AISetStock( player, 6, c_TB_Starport );
AISetStock( player, 1, c_TB_ScienceFacility );
AISetStock( player, 1, c_TB_FusionCore );
AISetStock( player, 2, c_TB_Drydocks );
AISetStock( player, 6, c_TB_Barracks );
AISetStock( player, 5, c_TU_Hercules );
AISetStock( player, 8, c_TB_Bulwark );
AISetStockUnitNext( player, 18, c_TU_Goliath, c_stockAlways );
AISetStockUnitNext( player, 8, c_TU_Medic, c_stockAlways );
AISetStockUnitNext( player, 24, c_TU_Marine, c_stockAlways );
AISetStockUnitNext( player, 14, c_TU_Wraith, c_stockAlways );
AISetStockUnitNext( player, 8, c_TU_Vulture, c_stockAlways );
AISetStockUnitNext( player, 8, c_TU_Commando, c_stockAlways );
AISetStockUnitNext( player, 8, c_TU_Gunship, c_stockAlways );
AISetStockUnitNext( player, 10, c_TU_SiegeTank, c_stockAlways );
TerranHDEmergencyDetectionAntiAir(player);
AIPeriodicExpansion240(player, c_TB_CommandCenter);
FrenchAuxiliariesDefenseLight(player);
AIEnableStock(player);<</quote>>
It is also worth noting that the AI builds a "blueprint" of its base (presumably similar to non-built Bullies) when you run SetStock without any kind of waits or conditions. Thus, when I have the AI build 12 barracks, 12 factory, 12 starport, many of the buildings tend to get ignored, because there isn't enough room in the blueprint. Thus, I use numeral conditions to segregate the construction and promote more active construction. That is why I have the Supply Depots segregated as such in Buttes' build order, though it would help to take this a few steps further. That said, SetStock is extremely unreliable, especially regarding expansions. I have code that runs SetStock for defenses and production at expansions and they tend to take anywhere from 10-30 minutes to build them.
I don't know the differences between the various SetStock commands. They have some relevance, but because the documentation was scribbled together by interns the only real way to know would be to experiment in a controlled environment. I am far too lazy for that.
@IskatuMesk: Go
My trigger runs somewhat the same.
Mine was like:
Trigger 1: at 1 second of game
Set Stock A
Set Stock B
Set Stock Etc
Enable Stock
Trigger 2: at 5 mins of game
Set Stock D
Set Stock E
Set Stock Etc
Enable Stock
The AI builds some of the units and structures in Set Stock at trigger 2, but not all. If I combined the two triggers and have only one Enable Stock the AI builds them all.
If I cleared stock at trigger 2, prior to adding the set stocks and enable stock after like this:
Trigger 2: at 5 mins of game Clear Stock Set Stock D Set Stock E Set Stock Etc Enable Stock
The AI wouldn't build anything.
The command Make Always though makes the AI build structures but gets cancelled out or something if I do enable stock or clear stock.
If I understand it correctly, controlling the AI this way would not be a good thing. Any advice which way would be the best?
Mesk, do you loop your trigger there to get the AI doing them?
Whatever you do, wholeheartedly, moment by heartfelt moment, becomes a tool for the expression of your very soul.
My Ai is just a modified melee galaxy. I couldn't get the AI to work reliably enough through triggers. Since the galaxy code just loops the entire thing ad infinitum, I presume the same must be done for triggers to work. But I don't know enough about the melee code to know if the looping mechanism is just as simple as having a trigger run itself forever. My gut reflex is that just crashes the game.
For you, it might be better to try the Bully approach, unless you really need dynamic base construction.
@IskatuMesk: Go
Thanks Mesk.
Whatever you do, wholeheartedly, moment by heartfelt moment, becomes a tool for the expression of your very soul.
@IskatuMesk: Go I've tried to meddle with melee galaxy back during the early days of WoL but didn't know how to. Can you share how its done so I can try once more to get my AI working? I'm mainly a data guy and these triggers gave me nothing.
@SoulFilcher: Go
What we have is only an early prototype at best, due to the performance impact it has. But, in essence, these are the steps we ran through to make AI for my campaign.
First, we extracted the most recent variants of the AI from the patch files for the game. There are some files that won't be in those patch files, which you then would fall back towards the WoL core to eventually find (if the HoTS ones don't have them).
These are now treated as the project's Master Files. Which is to say, these are imported into the appropriate dependency when changed.
For the purpose of the campaign, I modify the Insane Difficulty files and ignore all others. All AI's are treated as one difficulty and the only difficulty the campaign imposes is through some switches that will be tied to time-gated functions and certain unit abilities. Else, shit gets messy.
This is where things get kind of complicated for me, so I had a friend working on it for the most part at this point. The gist of what we wanted to accomplish, at least for testing purposes, was a way to get the AI to know A.) which map and B.) which player it is. The build order system is stripped out and the AI only uses the one build. That looks a bit like this.
<<quote>>
void TerranOpenChIn (int player) {bool done = false;
int buildIndex;
AIEarlyDefenseScouting(player);
no idea whats required to keep ai functioning yet
AISetMainState(player, e_mainState_Open, e_mainSubState_Init);
buildIndex = PickHDTerranOpening(player);
AISetUserInt(player, c_currentBuildIndex, buildIndex);
AISetMainState(player, e_mainState_Open, e_mainSubState_Build);
buildIndex = AIGetUserInt(player, c_currentBuildIndex);
check MapID variable from map and player ID to determine build
0x01
if (MapID == 1 && player == 2) { done = Terran0x01FrenchAuxiliaries (player); }
else if (MapID == 1 && player == 3) { done = Terran0x01GracianLoyalists (player); }
...<</quote>>
I believe the AI initializes an integer somewhere else (so it doesn't get looped in here), but I can't remember where that is since I haven't looked at this for months.
So, each map has an ID. Cross referencing the ID and player # gets us the build we want. The map itself can be void of any gameplay-related elements except the most mandatory of triggers, like aforementioned timegates. The idea was that the AI handled itself in the galaxy files, and data handled everything else.
Some important files there for general note.
BaseAI.Galaxy - This sets up the headers, a lot like the ones in Brood War, but more numerous and more specific. I turn off certain things in here in a vain effort to get more than 9fps in my maps, like Use Extra Scouts, which causes insane stuttering with zerg since it treats overlords as scouts. Beacons is something you'd want to disable for a campaign (that's the 1.5 ai command menu/voice notices). I may look into modding those in the future if the project gets anywhere, since voice acting characters for that would be incredibly trivial.
RequirementsAI.Galaxy - Define new units in here so you don't need to use quotations everywhere.
MeleeHigh, Low, etc. - Tiertary code that compounds itself. If you know galaxy you can probably trim a lot of this without a lot of drawbacks (for example we don't currently use Counters due to our crazy unit counts).
BuildAI - Very important, as it sort of gives the AI a hint at how to place structures. Doesn't always seem to follow this. A big problem with supply depots is I want to get rid of their burrowing behavior since it's silly, but I can't get the AI to consistently not wall off their CC with depots.
MeleeAI - Derivative of the racial AI's, you'll want to make particular note of the various AINewUnit* commands as they are hardcoded to fire when the AI gets a unit, and you can sort some stuff this way (like observers and units you don't want in attack waves). Incidentally, this will be why the melee AI ignores those property flags in the editor. Again, if you know galaxy, you can probably do a lot here. I don't, so I just get chicken grease everywhere instead.
I've since handed off work to Jademus since the AI performs horrendeously badly and the melee attack waves are kind of terrible. If he fixes it, maybe I can further my documentation and experiments.
I have some extensive observational related documentation on a private forum but I doubt much of it would be useful. From what I understand, people just prefer to make their own AI as opposed to change the existing melee AI, since the existing melee AI is pretty terrible.
@IskatuMesk: Go Thank you. Could you tell me the exact folder paths these files are supposed to go when imported? I remember my tests resulted in the AI ignoring my files (probably wrong folders) or giving an error then not working at all (probably correct folders).
My plan is to modify the melee AI to include a few units. I don't have the time nor abilities to plan a new AI. And back then there was no information about that so I decided to move on to other things.
@SoulFilcher: Go
Pretty much the same thing, I could never get it to work with suggest order triggers
http://www.sc2mapster.com/assets/nolanstars-textures/
Be sure to check out the extension mod: Hots Custom Map support on NA and EU, Despite the name it greatly expands the roster of options for the default 3 races and is updated all the way to NCO.
@SoulFilcher: Go
This is what I'm looking at in my mod file.