Hey everyone, I was hoping that people would post here and share some of their knowledge / experience with custom campaign AI opponents.
I'm literally talking about the enemy player, in missions where the player will start with a base with a normal economy. The tech tree of the player should resemble normal SC2 melee gameplay. Note that this does NOT include special missions like Left2Die, base-less missions like the first level of Wings of Liberty, or anything where you have a drastically altered techtree.
So, let me share my experience. Please share yours too!
Basic Triggers
I've always given the computer enemy the following things via the initialization trigger:
Start the campaign AI for player X
Give player X 100000000 Vespene and Minerals
Modify player X supply limit to 400
(I also create "Food of a Thousand Feasts" in a hidden corner of the map)
This is cool because then you don't have to go crazy adding supply depots for the computer. An amateur mistake in my opinion would be not having a "Food of a Thousand Feasts" - I see this a lot and it is ugly, and annoys the player unnecessarily because it often takes such a long time to kill all the depots. Supply of the computer is invisible to the player anyway.
Of course, I always want my AI to have infinite money.
Upgrades
I always have a trigger that does this:
Adds player 2, 3, and 4 to Player Group "Enemies"
Pick every player in "Enemies"
For each picked player, add upgrades specified
I always give the AI everything, except the weapons/armor upgrades. Always give the AI combat shields if they're Terran, otherwise the mission will be too easy. Set weapon/armor according to difficulty. Don't give 3/3 carelessly. A nice way to approach this is to have a timer, and give the AI free weapons/armor upgrades as the game progresses. Giving the AI 0/0 for the whole game in my opinion is not good.
AI Triggers
I always add AI Triggers to Banshees, Ghosts, Battlecruisers, Infestors, Ravens, High Templar, Sentry, Corruptors, etc. For instance:
Events
Unit - Any Unit is attacked
Conditions
(Unit type of (Triggering unit)) == Infestor (Spellcaster)
(Owner of (Triggering unit)) > 1
Actions
AI - Suggests order (Infestor - Infestor - Fungal Growth targeting (Position of (Attacking Unit))) to (Triggering unit) using tactical AI logic
This is pretty cool. For Ghosts (which has 2 abilities you want to use), I get them to Cloak upon being attacked, if they do not have the Cloak buff. If they have the Cloak buff, and the player is a Protoss, I force the Ghost to EMP. Oh, and don't forget to tell the unit to suicide when they Cloak (otherwise they just stand there). My trigger looks like this:
Events
Unit - Any Unit is attacked
Conditions
(Unit type of (Triggering unit)) == Banshee
(Owner of (Triggering unit)) > 1
Actions
AI - Suggests order (Banshee - Cloak (Banshee)) to (Triggering unit) using tactical AI logic
AI - Enable suicide for (Triggering unit)
For Battlecruiser, do a check - if the attacking unit has over 150 HP + Shields, I use Yamato as a response. If not, then do nothing.
Stalkers have a special treatment, to blink back! How to do this? Here is a sample trigger:
AI - Suggests order (Stalker - Blink targeting ((Position of (Triggering unit)) offset by 6.5 towards (Angle from (Position of (Attacking Unit)) to (Position of (Triggering unit))) degrees)) to (Triggering unit) using tactical AI logic
AI - Enable suicide for (Triggering unit)
If you put these triggers in your maps, the AI will be so much more interesting.
(Widow Mines, I have not figured out yet how to use WMs offensively. Please let me know if you find a good way to use them in attack waves! Right now I only use them as stationary defences.)
Resilience
As we all know, the AI rebuilds stuff. But you have to control how much they rebuild. If they have infinite resources, and they always rebuild everything, then the player will be bored. This encourages the so-called "deathball" which makes the campaign repetitive and boring.
If they AI has everything at rebuild = 0, then it could also be boring. Even the weakest attack could deal crippling damage.
So it all depends on the specifics of the map. Generally, I like to give the AI more rebuilds when it's easy for the player to macro up. The harder to macro and get economy, the less rebuild for the AI. Zerg units especially build very quickly, so giving them more rebuilds feels good for the player. Feels like getting swarmed when you play (especially TvZ campaigns).
I try not to give Terran too many rebuilds, especially for Battlecruisers, Missile Turrets, Planetary Fortress, and Widow Mines in outer bases. Widow Mines are really bad because they are invisible. So I always set rebuild = 0 for WMs.
What do you think?
Base layout and difficulty
Is it better to have "gaps" in the enemy static defence, so that a player can capitalize upon it? In Brood War, the map designs often had this feature. For example, ledges without anti-air, spore colonies in front of sunken colonies which could be picked off, or bases where Zerg Guardians weren't supported by Spores.
Overall, what's the ideal difficulty? I think a Gold-ranked player on NA should have some trouble, but should be able to win. That's where I would set the standard for a custom single-player campaign.
Wow this is really helpful. I'm working on my own campaign and this is a good starting point to jump off from. I don't have ideas or suggestions at the moment, but perhaps when I delve more into my campaign I will have some.
Is there something like this for other aspects of campaign making? Perhaps a tutorial or dedicated forum!!!??
Example: I really want to tell a story in my campaign, but I feel like my first mission is getting really wordy. Is there any rubric/guidelines veteran campaign makers follow.
Also Red, I saw you made a lot of changes to that first mission in your campaign. That Korhal mission is an AI stomp fest. I'm glad you gave the Zerg some more strength. I just massed those bad ass vikings and just mowed everything down. Beautiful Map!!
Nice tips. I use some of these, but not all. I consider enemy AI to be one of my weak points, to be honest. I've just learned to use bullies, though, thanks to DeltaCadimus.
@ Hockleberry: I've been thinking of doing a story tutorial, actually, particularly on the use of Chekhov's Gun. As for it being too wordy or not: Some players might find there to be too much dialogue, others won't. I suppose it's also a matter of quality in addition to quantity. If it's bad, the feeling that there is too much is instant, and vica versa. I deliberately toned down dialogue in the beginning of my campaign, for two reasons. First, because I didn't want to lose the player too early, and secondly because the less you reveal in the beginning, the more story you'll get to churn out. In Crimson Moon you slowly learn information about the characters, and that's better than to churn it all out at once, in my opinion, because it becomes overwhelming and leave you with less for future missions. Also ask yourself if you can't show something instead of telling it. SC2 is an action game, and you'd rather show someone being a bad-ass than say they are. :)
I'll pretty soon be making a very topic concerning this matter, detailing so much bullies as random integer, a particular trigger named 'Set Difficulty Parameter', my private views of ethics of designing an AI, expansions, transports and other stuff.
@ Hockleberry: Btw, the best tip I can give you is to do what you want! Let loose your inner artist! Take inspiration not only from SC, but from books and TV and films and life and whatnot!
Thanks for the interest guys, I will add a few more things in the guide as I think of them. Hopefully, I can end up with a catch-all checklist for map makers to follow.
Wow this is really helpful. I'm working on my own campaign and this is a good starting point to jump off from. I don't have ideas or suggestions at the moment, but perhaps when I delve more into my campaign I will have some.
Is there something like this for other aspects of campaign making? Perhaps a tutorial or dedicated forum!!!??
If you ever have AI-related questions, feel free to ask me and we can discuss. I find that it is always good to bounce ideas off other people and get inputs from other like-minded (or not so like-minded!) mapmakers. That's why I started this topic, as a dedicated forum for custom campaign creators who want to discuss how to make a perfect AI, who will dance and fight with you in such a way that you'll thoroughly enjoy the experience and come back for more.
Example: I really want to tell a story in my campaign, but I feel like my first mission is getting really wordy. Is there any rubric/guidelines veteran campaign makers follow.
Also Red, I saw you made a lot of changes to that first mission in your campaign. That Korhal mission is an AI stomp fest. I'm glad you gave the Zerg some more strength. I just massed those bad ass vikings and just mowed everything down. Beautiful Map!!
In terms of telling a story, EivindL is the person to go to. He is probably the guy who knows the best about storytelling. I've discussed this topic with him in great detail already, and he knows the topic really well, and has really good creative instincts to boot. He is also a great terrain designer, and I strongly suggest anyone making missions to take some inspiration from his designs.
I can give you guidelines on gameplay, AI and terraining if you ever want to discuss, but I don't focus too much on the story, mainly because I'm too lazy.
And I'm glad you enjoyed the Korhal mission! Yes, it is an AI stompfest, because the first mission is always supposed to be easy! The difficulty ramps up later though... so beware :D
Hey njordys! I remember playing through your Bio-Tech campaign. They were a blast... please play through and let me know what you think of mine. Cheers!
I'll pretty soon be making a very topic concerning this matter, detailing so much bullies as random integer, a particular trigger named 'Set Difficulty Parameter', my private views of ethics of designing an AI, expansions, transports and other stuff.
Hi there! I think this is a pretty good place to give your opinions on AI, expos, and stuff like this. I hope to get all the feedback and opinions on this stuff onto the first post. This is a discussion thread after all and I'd love to hear your inputs on this.
Are AI upgrades appropriate? Marauders have two upgrades for concussive shells (one from campaign dependency, the other from melee), but only one of them works properly. I always give both just to be safe.
Do AI have triggers in place that ask them to use abilities? Otherwise, giving them upgrades is useless. Snipe, Siege Mode, Infested Terran, and Guardian Shield are automatically used by the AI. Other abilities need manual prodding.
Does the AI have "Food of a thousand feasts" instead of mass supply depots?
If "Food of a thousand feasts" is used, is the victory condition "destroy all enemy units"? If so, the player can never win. Change the victory condition to "destroy all enemy structures".
Are any No-Fly Zones used in the centre of the map? These things cause pathing issues for air units if there is more than 1 together. Use them on the edges of the map only, if you're planning on using more than 1. If you're using them singularly, for instance for large rocks or Korhal buildings, they work as intended.
Always put a trigger that sets the speed of the game to "Faster" at the start of your mission. This is because sometimes when people "test" your missions, default SC2 settings somehow make the mission play on "Normal" speed which is just kinda dumb.
The no-fly zone tip is pretty helpful. I have a big crane in AS07 that mutalisks would just fly right through, but with the zones, they get stuck, because I added too many. I suppose using only one and adding a waypoint would fix it.
Didn't know about Food of a Thousand Feasts either. Having been stuck on AWs becuase the enemy has too little supply, I can see how that is useful. I suppose the best way to use it in a victory trigger is to just use units that are labelled "Prevent defeat" in the trigger, though.
I have a tip of my own: If the enemy base is large and/or separate, use several players and color them the same way (color them in the triggers so you can keep an overview of them in the editor). This helps with AWs (if I'm correct, the AI considers only AW at a time, which can get odd if you have separate ones happening at the same time) and can increase enemy size (otherwise their maximum army potential would equal the player's).
Yep, I forgot this one. It may seem pretty obvious, but generally when you want to have more than 1 enemy base, give them to separate players with the same colour. This helps with supply limits, AI attack waves, and resilience (one base won't rebuild another).
Though you can always use a trigger to set the AI's supply limit at whatever value you want.
This is certainly helpful! I'll be working on some campaign-like AIs rather soon, and I probably would've missed few things pointed out here.
I was wondering, though, what exactly are Bullies and Flags/Flag Indexes? If I understood them correctly, Bullies are units the AI will always recreate (until told not to), and Flags are basically booleans? (Sorry if this is derailing the thread, just thought I'd ask since the topic was regarding (campaign) AIs.)
One thing that I also do, besides using No-Fly Zones, is also using regions with triggers to raise unit heights within certain regions. However, they need two triggers, one to raise and another to lower back down. Been playing with it recently, and it tends to work, and I intend to apply it in my city map, in my campaign.
Tactical AI is your friend. It is what permits High Templar to auto cast Storm and land it perfectly. Same goes for burrowing units, siege tanks, Ghost EMP, among other things. See Data -> Advanced -> Tactical AI, and Target Find.
This is certainly helpful! I'll be working on some campaign-like AIs rather soon, and I probably would've missed few things pointed out here.
I was wondering, though, what exactly are Bullies and Flags/Flag Indexes? If I understood them correctly, Bullies are units the AI will always recreate (until told not to), and Flags are basically booleans? (Sorry if this is derailing the thread, just thought I'd ask since the topic was regarding (campaign) AIs.)
Bullies are units that the AI will automatically rebuild. I used to use bullies but I find that, these days, I'd rather just use normal AI attack wave triggers. They are easy to use and give a lot of control. You can also always manually set any unit to "always" rebuild anyway.
Tactical AI is your friend. It is what permits High Templar to auto cast Storm and land it perfectly. Same goes for burrowing units, siege tanks, Ghost EMP, among other things. See Data -> Advanced -> Tactical AI, and Target Find.
I didn't know about that one! I still don't know how to use it.
My solution also works pretty well though, and it works for Stalkers' blink micro as well, which I don't think tactical AI can do.
The AI section in the wiki tutorial is pretty weak. Any chance we could clean up some of this and post it in there? I'd be happy to try and cut and paste and you guys can review.
@RedRevolution: Go Tactical AI can be planned to use anything basically. I used it to make Oracles and Vipers cast their abilities back when I made HotS maps (before and during HotS beta).
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Introduction
Hey everyone, I was hoping that people would post here and share some of their knowledge / experience with custom campaign AI opponents.
I'm literally talking about the enemy player, in missions where the player will start with a base with a normal economy. The tech tree of the player should resemble normal SC2 melee gameplay. Note that this does NOT include special missions like Left2Die, base-less missions like the first level of Wings of Liberty, or anything where you have a drastically altered techtree.
So, let me share my experience. Please share yours too!
Basic Triggers
I've always given the computer enemy the following things via the initialization trigger:
This is cool because then you don't have to go crazy adding supply depots for the computer. An amateur mistake in my opinion would be not having a "Food of a Thousand Feasts" - I see this a lot and it is ugly, and annoys the player unnecessarily because it often takes such a long time to kill all the depots. Supply of the computer is invisible to the player anyway.
Of course, I always want my AI to have infinite money.
Upgrades
I always have a trigger that does this:
I always give the AI everything, except the weapons/armor upgrades. Always give the AI combat shields if they're Terran, otherwise the mission will be too easy. Set weapon/armor according to difficulty. Don't give 3/3 carelessly. A nice way to approach this is to have a timer, and give the AI free weapons/armor upgrades as the game progresses. Giving the AI 0/0 for the whole game in my opinion is not good.
AI Triggers
I always add AI Triggers to Banshees, Ghosts, Battlecruisers, Infestors, Ravens, High Templar, Sentry, Corruptors, etc. For instance:
Events
Conditions
Actions
This is pretty cool. For Ghosts (which has 2 abilities you want to use), I get them to Cloak upon being attacked, if they do not have the Cloak buff. If they have the Cloak buff, and the player is a Protoss, I force the Ghost to EMP. Oh, and don't forget to tell the unit to suicide when they Cloak (otherwise they just stand there). My trigger looks like this:
Events
Conditions
Actions
For Battlecruiser, do a check - if the attacking unit has over 150 HP + Shields, I use Yamato as a response. If not, then do nothing.
Stalkers have a special treatment, to blink back! How to do this? Here is a sample trigger:
Events
Conditions
Actions
If you put these triggers in your maps, the AI will be so much more interesting.
(Widow Mines, I have not figured out yet how to use WMs offensively. Please let me know if you find a good way to use them in attack waves! Right now I only use them as stationary defences.)
Resilience
As we all know, the AI rebuilds stuff. But you have to control how much they rebuild. If they have infinite resources, and they always rebuild everything, then the player will be bored. This encourages the so-called "deathball" which makes the campaign repetitive and boring.
If they AI has everything at rebuild = 0, then it could also be boring. Even the weakest attack could deal crippling damage.
So it all depends on the specifics of the map. Generally, I like to give the AI more rebuilds when it's easy for the player to macro up. The harder to macro and get economy, the less rebuild for the AI. Zerg units especially build very quickly, so giving them more rebuilds feels good for the player. Feels like getting swarmed when you play (especially TvZ campaigns).
I try not to give Terran too many rebuilds, especially for Battlecruisers, Missile Turrets, Planetary Fortress, and Widow Mines in outer bases. Widow Mines are really bad because they are invisible. So I always set rebuild = 0 for WMs.
What do you think?
Base layout and difficulty
Is it better to have "gaps" in the enemy static defence, so that a player can capitalize upon it? In Brood War, the map designs often had this feature. For example, ledges without anti-air, spore colonies in front of sunken colonies which could be picked off, or bases where Zerg Guardians weren't supported by Spores.
Overall, what's the ideal difficulty? I think a Gold-ranked player on NA should have some trouble, but should be able to win. That's where I would set the standard for a custom single-player campaign.
Interesting stuff. Thank you for putting this up.
I'll look into your campaign later.
@RedRevolution: Go
Wow this is really helpful. I'm working on my own campaign and this is a good starting point to jump off from. I don't have ideas or suggestions at the moment, but perhaps when I delve more into my campaign I will have some.
Is there something like this for other aspects of campaign making? Perhaps a tutorial or dedicated forum!!!??
Example: I really want to tell a story in my campaign, but I feel like my first mission is getting really wordy. Is there any rubric/guidelines veteran campaign makers follow.
Also Red, I saw you made a lot of changes to that first mission in your campaign. That Korhal mission is an AI stomp fest. I'm glad you gave the Zerg some more strength. I just massed those bad ass vikings and just mowed everything down. Beautiful Map!!
Nice tips. I use some of these, but not all. I consider enemy AI to be one of my weak points, to be honest. I've just learned to use bullies, though, thanks to DeltaCadimus.
@ Hockleberry: I've been thinking of doing a story tutorial, actually, particularly on the use of Chekhov's Gun. As for it being too wordy or not: Some players might find there to be too much dialogue, others won't. I suppose it's also a matter of quality in addition to quantity. If it's bad, the feeling that there is too much is instant, and vica versa. I deliberately toned down dialogue in the beginning of my campaign, for two reasons. First, because I didn't want to lose the player too early, and secondly because the less you reveal in the beginning, the more story you'll get to churn out. In Crimson Moon you slowly learn information about the characters, and that's better than to churn it all out at once, in my opinion, because it becomes overwhelming and leave you with less for future missions. Also ask yourself if you can't show something instead of telling it. SC2 is an action game, and you'd rather show someone being a bad-ass than say they are. :)
@EivindL: Go
I'll pretty soon be making a very topic concerning this matter, detailing so much bullies as random integer, a particular trigger named 'Set Difficulty Parameter', my private views of ethics of designing an AI, expansions, transports and other stuff.
I certainly won't mind that!
@ Hockleberry: Btw, the best tip I can give you is to do what you want! Let loose your inner artist! Take inspiration not only from SC, but from books and TV and films and life and whatnot!
Thanks for the interest guys, I will add a few more things in the guide as I think of them. Hopefully, I can end up with a catch-all checklist for map makers to follow.
If you ever have AI-related questions, feel free to ask me and we can discuss. I find that it is always good to bounce ideas off other people and get inputs from other like-minded (or not so like-minded!) mapmakers. That's why I started this topic, as a dedicated forum for custom campaign creators who want to discuss how to make a perfect AI, who will dance and fight with you in such a way that you'll thoroughly enjoy the experience and come back for more.
In terms of telling a story, EivindL is the person to go to. He is probably the guy who knows the best about storytelling. I've discussed this topic with him in great detail already, and he knows the topic really well, and has really good creative instincts to boot. He is also a great terrain designer, and I strongly suggest anyone making missions to take some inspiration from his designs.
I can give you guidelines on gameplay, AI and terraining if you ever want to discuss, but I don't focus too much on the story, mainly because I'm too lazy.
And I'm glad you enjoyed the Korhal mission! Yes, it is an AI stompfest, because the first mission is always supposed to be easy! The difficulty ramps up later though... so beware :D
Hey njordys! I remember playing through your Bio-Tech campaign. They were a blast... please play through and let me know what you think of mine. Cheers!
Hi there! I think this is a pretty good place to give your opinions on AI, expos, and stuff like this. I hope to get all the feedback and opinions on this stuff onto the first post. This is a discussion thread after all and I'd love to hear your inputs on this.
Checklist
Will add more as I think of them.
The no-fly zone tip is pretty helpful. I have a big crane in AS07 that mutalisks would just fly right through, but with the zones, they get stuck, because I added too many. I suppose using only one and adding a waypoint would fix it.
Didn't know about Food of a Thousand Feasts either. Having been stuck on AWs becuase the enemy has too little supply, I can see how that is useful. I suppose the best way to use it in a victory trigger is to just use units that are labelled "Prevent defeat" in the trigger, though.
I have a tip of my own: If the enemy base is large and/or separate, use several players and color them the same way (color them in the triggers so you can keep an overview of them in the editor). This helps with AWs (if I'm correct, the AI considers only AW at a time, which can get odd if you have separate ones happening at the same time) and can increase enemy size (otherwise their maximum army potential would equal the player's).
@EivindL: Go
Yep, I forgot this one. It may seem pretty obvious, but generally when you want to have more than 1 enemy base, give them to separate players with the same colour. This helps with supply limits, AI attack waves, and resilience (one base won't rebuild another).
Though you can always use a trigger to set the AI's supply limit at whatever value you want.
This is certainly helpful! I'll be working on some campaign-like AIs rather soon, and I probably would've missed few things pointed out here.
I was wondering, though, what exactly are Bullies and Flags/Flag Indexes? If I understood them correctly, Bullies are units the AI will always recreate (until told not to), and Flags are basically booleans? (Sorry if this is derailing the thread, just thought I'd ask since the topic was regarding (campaign) AIs.)
Things like this should be posted to tutorials, or triggers.
Other than that it looks good.
@EivindL: Go
One thing that I also do, besides using No-Fly Zones, is also using regions with triggers to raise unit heights within certain regions. However, they need two triggers, one to raise and another to lower back down. Been playing with it recently, and it tends to work, and I intend to apply it in my city map, in my campaign.
Tactical AI is your friend. It is what permits High Templar to auto cast Storm and land it perfectly. Same goes for burrowing units, siege tanks, Ghost EMP, among other things. See Data -> Advanced -> Tactical AI, and Target Find.
You should do a write-up on escorts. I find them very helpful, both for allies and enemies.
Bullies are units that the AI will automatically rebuild. I used to use bullies but I find that, these days, I'd rather just use normal AI attack wave triggers. They are easy to use and give a lot of control. You can also always manually set any unit to "always" rebuild anyway.
I didn't know about that one! I still don't know how to use it.
My solution also works pretty well though, and it works for Stalkers' blink micro as well, which I don't think tactical AI can do.
By the way, does the AI scan automatically, or do I need to use triggers?
@EivindL: Go
Scans are automatic.
Oh and here is a (not yet) exhaustive list of all the spells that are automatically cast by default Blizzard AI:
Confirmed AI does not use, but can be utilized with triggers:
Confirmed AI does not use, and I have yet to make use of them via triggers:
The AI section in the wiki tutorial is pretty weak. Any chance we could clean up some of this and post it in there? I'd be happy to try and cut and paste and you guys can review.
@RedRevolution: Go Tactical AI can be planned to use anything basically. I used it to make Oracles and Vipers cast their abilities back when I made HotS maps (before and during HotS beta).