Intentional image. Humor intentional, but the matter related is the same.
Introduction
There are challenges in single-player as there are challenges in multi-player. FPS, RTS, TBS, ARPG, hack-and slash, it doesn't matter the type of the game. What matters is the opponent, if the player wants to be satisfied in a single-player experience as much as in multi, this opponent must be in itself challenging, yet lenient, a capable, yet rewarding experience. This applies so much to human as in computer opponents.
The level of opposition itself, unfortunately, in latest games, has tethered in two extremes: Either they're so easy and absolutely, brutally frail that it's past the laughable point, or they're too hard in a masochistic level, but unfortunately not rewarding at all. Either way, this kills, by itself, the interest in a long-run campaign, as people will just want to 'move to next level'. In my opinion, the experience for single-player must last in a similar, if not equal, of a level compared to that of multiplayer. People want to savor the same experience from beating, humiliating, trolling, and ultimately defeating the AI as much as he or she does with the human opponent. But they also want to learn, to grow, to mature themselves to a point where they can aspire professionalism in major league matches, and the AI must a tough, but fair teacher.
And, when concerning AI, unlike major companies believe, everything is key, especially unpredictable. Unlike major companies and developers, whom think of making as everything as casual as possible, thus developing a preset of events in a determined, single order, the unpredictable makes the difference between a game that's something-to-everyone and a game that's everything-to-someone (Thanks, Taffer.). People want to be caught with their pants down, at a certain point, they want to be surprised, they want to know their opponent is learning and making the fight a personal one, they want to know their skills made up a deadly enemy unintentionally, pretty much in the classic case the Batman made the Joker.
Such concept, however, doesn't need to be applied exclusively to RTS alone, like StarCraft II, as this article will cover about. The concept can be applied to RTS, with backdoor strikes, mineral drops, defense crawling and mine bullying, to FPS, with camping, sniping, rifle-rushing, to hack-and-slash, with parring, quick combos or heavy combos and dodging, or even RTT, with hit-and-run, flanking, sneaking or mopping up after requesting a carpet bombing. Or even TBS, with selecting spells, holding, charging to archers or staving off that super-stack. What we're talking about here is how we can make the AI flexible, mutable, grow-able and unpredictable in a way the player will get surprised at every turn, instead of just knowing it all the moment he presses the Reset Mission button.
The perfect AI, in my opinion, is the one that learns it's mistakes gradually from how the player performs, from the usual Marine/Marauder grinder or cowering newb to a professional player or Gosu. The perfect AI is the one that improves itself at every play, although with certain, slim limits, to allow gameplay chances, as it increases and stores difficulty against the most capable of players, adapting and even thinking for itself. Unfortunately, such a thing is nigh impossible in today's current industry and methodology standards, especially with the paternalistic tendency the industry is putting on casuals, 76% of current general gaming populace, but we, as modders and mapmakers, can, at very best, make an alpha simulacrum of what the real concept would be.
This is what this article covers about. Making an AI that expands, chooses for itself, reacts, defends and has a chance of actually prevailing against the player, and detailing step by step the procedure.
I'm DeltaCadimus, I've only had so far a few months of permanence here and about one campaign in progress, as well as an Arcade-meant map. But I've been into games, particularly the RTS and TBS genre, with it's comedies and dramas concerning AI, for more than ten years. I've seen it all, the hilarious pathing of Warcraft III, the unbalanced and awfully designed AI from EA games and the infuriating predictability of WoL/HotS campaigns. I've played campaigns like Legacy of the Confederation, Aeon of the Hawk, Flame Knives, The Antioch Chronicles, had passed from all sorts of AIs, from the ones made by Blizzard to the radically rewritten ones by dear IskatuMesk for his attempted mods, that include ITAS and Armageddon Onslaught. From all my experiences, I've garnered a degree of experience concerning how a satisfactory AI should be. But only now, having tested it and progressed myself in AI development through triggers in the Starcraft II's Trigger Editor, in the Map Editor, that I'm compiling it and effectively translating it so as to bring the understanding of Artificial Intelligence in a different level. Your level.
Making your own SkyNet - The concept of making of a near-ideal AI.
Everyone knows how the AI is currently done in StarCraft II, yet the knowledge, until now, has been a limited one, particularly in a B&D mission, explaining the several factors that lacked in the official missions: Predictable attack waves and attack routes, lack of expansions that'd bring a 200/200 max out level, non-existent use of cloaked/disguised units, few transports used, upgrades and teching not done in a physical in-game level, many core factors whose corners were cut in the official version, masked with the use of gimmicks like lava surges, flash freezes, Supply Trains, Rip Field Generators and Zerg egg collection. This is no criticism, but rather a fact that the AI in Starcraft II's missions is below the standards expected out of the game, particularly late game, where progress was considerably made, and with so many tools and options available.
People rather think that making an AI is complicated, because it's either taking a hard work, through the Trigger Editor, which this tutorial will encompass, or go through the Galaxy Editor. But the truth is that it's actually all about the effort itself, and the will to employ it. How much do you want a challenging AI so badly? That was the question, when I was making my campaign, that led me to go beyond my limiting and my fears. I garnered knowledge from the official missions, learned of their mistakes, as well as ideas and necessary materials for developing the AIs I needed, especially for the macro field. All the materials I know will be put here, but the first I'll talk about below is establishing the foundations, the concept, the matter of difficulty and leniency and a small view on my designing ethics for AIs and how do I apply them.
First of all, when you make an AI, the first thing you must have in mind is how it'll act, for starters. Will it be a major power player? Will it be a grinder with 90% low-tech units, or maybe tech up to the big bad boys? Will it be a meat shield? Or maybe it'll be a crawler, slowly encroaching you, or perhaps even rush forward ahead, harassing and containing you with Bunker, Photon or Crawler rushes. Maybe it'll use mostly support or artillery. Maybe it'll focus more on transport. The possibilities are limitless, particularly with the Trigger Editor and it's tenfold increased flexibility, but it doesn't stop there. You can make it transition, or often must make it, in late game, but how? Make the Bio player go Bio-Mech or Bio-Sky, maybe? Make him take a different route, using Warp Prisms or Nydus Worms? The question does brew on the maker's mind, but when you know what do you want, all you require is the how.
Then, there's the race issue, and how it's done. How the race itself plays out. But this, so much as the idea of the AI, is up to the mapmaker. For me, I follow a series of designing ethics I established for myself, and that are below. Note that this is only my personal opinion of how I make my AIs per race, I don't expect anyone to copy them because it's actually that way, I'm not here to say 'Don't do that, do this, don't do this, do that.'. That's the maker's call, I'm just exposing my views for my particular AIs per race.
Terran - Terran AIs tend to play out in the most standard way possible, nothing new about them. Apart from a few, unique exceptions like Engineers (Bunker/Mine/Sieged crawling), Fast Terran (Reapers, Hellions and Vultures) and Support (Ravens and Science Vessels), they'll go either pure Bio (Marines, Marauders, Medics, Firebats and Ghosts), pure Mech (Hellions/Hellbats, Diamondbacks, Goliaths, Siege Tanks and Thors), pure Sky (Vikings, Wraiths, Banshees and Battlecruisers), or composite mixes between each, each with numbers not as few as the Protoss, nor as much as the Zerg. They have their own traits, however. The first is that, when they expand, they'll first build their CCs in the main base, just like in a match, and then move it to the expo before doing the rest of the expo, and the first ones will generally be away. The second is that they don't use that much of spellcasters, unlike the other races. The third is that their transitioning will mostly be a radical one, except for cases like Bio-Mech, Sky-Mech or Bio-Sky.
Zerg - Zerg tend to be the most active, expanding while it does it's first attack waves, if there are any expansions available. Zerg will put a top priority on spreading as much Creep as it can, as to have a highway for faster attacks, but it won't remain on that. It'll mostly go ground, but won't deny air or transports or Nydus Worms. When attacking, it'll ensure either Ultralisks or masses of Zerglings for meat shield. Zerg transition mildly. One thing that they'll do certainly is crawl slowly with Spine and Spore Crawlers, and any defenses added in any mod, if the maker desires so. They'll use spellcasters moderately. When using Nydus Worms, I ensure they have one separate AI player dedicated to that function alone. When expanding, they immediately make two new Hatcheries per expansion, along with two new Queens. Spreading creep is done through waves of separate Creep Tumor bullies (Doing it all in one bully makes the Queens confused, as the unit AI is wretched, so you must go one-at-a-time), but Zerg will also use expendable Overlords to puke creep everywhere, even inside the player's base. Depending on Random Integer or the mapmaker's decision, it'll either start one way or another, or use both at once. This latter, Overlord Puking, is useful as a harassment tool as well as distraction for AA defenses that, unless the Overlords are quickly destroyed, won't attack aggressing Mutalisks/Brood Lords for two seconds.
Protoss - Protoss are the most reserved, using small waves of rather advanced, powerful units, always accompanied with spellcasters in middle/late games, if they have any. They like to attack from afar, if they can, but won't deny melee, either. They expand slowly, roughly after two attack waves, even more later than Terran, but they immediately upgrade and will only send their first wave when the first upgrades are done. Protoss use Chrono Boost frequently, always research Warp Gate ASAP, if they have the Cybernetics Core early, and will tech faster than other races. Their transitioning will be the most reserved, to the level of roughly one Colossi or Carrier first, and then crawling forward. When using Phase Prisms, once deployed, the AI will warp in frequently different troops, depending on the Random Integer value. Transports don't go without escorts, unlike Terrans and Zerg. If a decision is made to Photon Cannon rush, it'll be done roughly three minutes after the player starts, or immediately, but afar, as to give the player a fighting chance, while effectively restraining him on his base. When expanding, they don't expand their production line until five minutes after the expo is done.
Many of these actions are done in a nigh-masochistic level, all through the Trigger Editor. This sounds rather like just a work not meant for you, you rather preferring to have the AI just go Melee mode and let it do it's bizarre work. It'd be understandable, were not for the fact that even the Melee AIs done by Blizzard are messed up, too, particularly depending on expansion position, especially if it's an island map. That explains the virtual lack of island maps in matches and such, as the attack waves for ground, so much as transport AI, are pretty troublesome in themselves. And the only way the AI could be refined or modified would be through Galaxy Editor. We're dealing with making AIs through triggers, here, and these allow so much as control, possibility, expansion of possibilities and, most importantly, controlling the way expansions, Nydus Worms, Prisms and transports should be used.
And, above anything else, we can make the supposed 'AI' play like an actual AI, making it circle, choose different units, paths and methods, upgrade, expand and tech physically, in the game, instead of just giving upgrades, expansions and such. This can be done through several ways, through Bullies, Random Integers, Difficulty Parameters, many of which will be explained here, and how to control and use them.
Bullies
Screenshot taken from the Editor view of WoL's third Mar Sara mission 'Ground Zero'. Notice that, above the Creep patches, you can see transparent, red-tinted Spine Crawlers where they should be when the mission began, but they don't until later.
The concept of bullies was introduced to me by IskatuMesk in a development video for his cancelled SC2 project named 'Apex', where he intended to practically remake Starcraft in a different manner, to the point of replacing Zerg for a different, mechanical race known as Necropolis. He was also intended on making a Build and Destroy AI that was practically non-existent in WoL's official campaign. This involved so much utilizing the Galaxy Editor as well as triggers and bullies. But it was only when I snooped, without any intention to research at the time, into the third Mar Sara mission map and I discovered what Bullies actually were, and that led me to start learning on AI making.
Bullies are units whom actually are rather demands for the AI to build on a determined time, when the said 'permission' is granted through triggers, activating the bullies. Once activated, the unit will be built in-game, through it's production structure or worker. If it's a unit, it'll be built first and head there, like a unit moving to a Rally Point. If it's a structure, the worker will travel there, if it's possible to reach, and will build on the spot. If Zerg, the Creep must be there, except if it's a Hatchery or Extractor. If the AI is Protoss, the Pylon will be built first, except if the structure is a Nexus or Assimilator. Setting bullies for Extractor, Assimilators or Refineries on top of Vespene Geysers will make the builders build them, without any trouble.
When making an AI, bullies tend to play a very vital and active role, because they represent the very fact that the AI is actually acting, reacting and doing something other than standing still while the player destroys them or stands still. Depending on how it's done and when, bullies will make the AI actually expand and start mining, will make the AI build more factories, will reinforce the base when attacked, make more units who'll so much defend as being also available for an attack wave, will make the AI crawl Bunkers, Photon Cannons, Crawlers, Siege Tanks, mines and other stuff towards a player, making a literal war for map control... In summary, it's what makes the AI actually build the units and structures instead of generating them through drop pods and spawn points, or through excruciatingly painful manual triggering, like I had this grim prediction in the early development stages for my campaign, still to be disclosed.
Bullies are so easy to utilize as relatively easy to make, and the more you put effort will be equally rewarded the same. To 'bully' a unit (No pun intended, of course), you can make a unit or structure, a Barracks for an instance, anywhere you can build. Make a Region around the unit, preferably small (NOT SMALLER THAN THE UNIT, JUST TO FIT INTO IT) if you wish to make that unit alone and none other, if there are other bullies around. Name the region and, for easy identification, pick a color by pressing ENTER with the region selected.
Select the unit you wish to bully and press ENTER, opening the Object Properties dialog. Select the AI tab.
Simple representation of a bullied unit. Too simple, actually.
If you wish to make a bully, simply uncheck the 'Initially Created' box. However, there's also a limit, as you can see, to the number of times the bully can be built and rebuilt, if it's destroyed. Either set the number you desire or select 'Always' on the menu, depending on the difficulty. Unless you're working with multiple difficulties, you'd better only use the 'Normal' or 'Medium' menus and set the difficulty on the Trigger Editor. If you want to make multiple structures/units of the same type, on the same trigger, simply pick the regions along, using SHIFT, and when you're done, press NumPad 0 to merge them.
Merged Regions, who'll use the same trigger and build all those bullies in a row.
Bullies can be applied to any unit or structure, and they'll so be made.
Note, however, that bullies will only be built in-game if the AI CAN make them, if they have the structure, the required tech, the resources, enough supply and the ability to make them. By ability, I mean setting the unit's button on the Command Card and adding the unit to the 'Build' ability list of the unit/structure, both of which done on the Data Editor.
Also, unless the bullies are de-activated when the map starts and they have a trigger to activate them at the determined time, the AI will build them all at once, once the AI is turned on. Of course, you can do that if you want the AI to do everything at once, but if you're seeking a controlled timing of what it's built and when, you'll need two types of triggers: One to deactivate all bullies and one (multiples, actually) to activate a specific bully at a time. The action for these bullies, in the Trigger Editor, is the Activate/Deactivate Bullies in Region, also explaining the need for Regions covering your bullies.
Bullies are your doggies. Leash'em or leave'em, and let'em trash all your house.
Random Integer
For unpredictability, dial these numbers.
The first time I actually discovered Random Integers, when I was searching for a way to make things random, was right here, at SC2Mapster, working with my beta colleague EivindL on Amber Sun. In one of the missions, during a fight, random dialog gloats from the enemy were spurt out. Looking into the triggers to know how he did it, I discovered the Random Integers. But the flexibility with accepting attack waves, attack paths, timers and other things were what made me welcome this tool with open arms, knowing that not only could I make the things I wanted, but so much more. I could make, through triggers, an AI that actually could play like an AI, unlike any any company, EA, Ubisoft or even Blizzard had conceived, even at the times of when StarCraft was first launched and it enticed tens of millions of people, to the point of becoming an official South Korean e-sport.
Random Integers somehow, looking from a certain angle, work pretty much like the Switches did on the Brood War editor. For those whom remembered it, when switches were activated or deactivated, actions occurred or cutscenes were safer, to prevent heroes from dying unnecessarily and the player accidentally losing. But, when they were randomized, particularly for boss fights and unit spawns, the actions were unpredictable. And incredible.
Some old people whom played Brood War campaigns will remember the Life of a Marine campaign, a Brood War campaign made by Gemini (Campaign Creations). In the second mission, which you'd have to circle a tug-of-war frontline battle to get to the enemy encampment, you could take an opportunity and look at the constant generation of units and their different types, though these were pre-triggered. A look at the map's triggers in the editor reveals a series of triggers that would random three switches between on and off and then, depending on the probabilities, creating the desired, different units that'd be sent to die on the battlefield. Yes, it was all just a matter of math, but the concept of random, meaning unpredictable, was what could entice me. I wanted more of that. So much more...
This somehow is about the same basics for Random Integer, though the difference between what you could do back in the Brood War editor and here is far different tenfold. In the Brood War editor, you could either determine dialog, wave spawns or boss powers, but here you can be very different. You can determine dialog, wave spawns, wave trajectories, methods, boss powers, builds, upgrades, AI course, unit types, practically many things.
Random Integer plays a role not as so vital, but equally as important as the bullies if players aim to design an AI that can deliver the supposed impression of independence, like if it can make choices for itself and either go different or persist. That's a core concept in my Build and Destroy missions that go beyond the simple all defending and useless attacking we've seen so far in WoL and HotS. Here, the AI gets to 'choose' how to do it and what to apply, all because of Random Integer, it allows the AI to play with the player, as the player plays with the AI equally.
Depending on the integer choices, you'll either face one of these. No more predicting what will come and when. With this, it's about rolling the dice and taking the chances.
Random Integer is a tool, in B&D missions, that can be used for:
- Attack waves: A doubt fills your mind: What will your opponent use? Will he go the fast way, with Hellions and Reapers, Zerglings and Banelings? Will he use artillery with some infantry cover? Will he go mech? Will he go aerial? Strafing or transport? Will he use Nydus Worms or Phase Prisms?
- Attack routes: Before, there were only frontal assaults and scripted flank assaults, drops and Nydus Worms. Now, another doubt comes in: Where will he attack, if not on the front. Which entrance is less defended? Which flank is exposed? What if he uses Reapers, or Raptors or Colossi? Is your supply threatened? What if he goes air? Where he'll land? Back of your base? Mineral line, perhaps? Or, better yet, what if it's not on your base, but rather on an expansion? Doubt, doubt, doubt...
- What to spawn in Nydus Worm or warp in Phase Prism: A Nydus Worm bursts from the ground, within or outside your base. A Phase Prism manages to sneak in and unfolds. What will it come out? What will warp-in? Will it be Zealots? Stalkers with some High Templar? Dark Templar? Waves of Zerglings, some Roaches who'll mass or not, an Ultralisk, maybe? Who'll know what that diabolical AI is up to?
- Where to tech to: In some missions, you'll want the AI to have it all, but the decision is up to the Random Integer. Aerial or mech, pure, advanced Bio? Nukes, maybe? Pure Carriers or Immortals with Colossi. Or go bolder and get Archons with Storms. Roach and Hydra, or Ling and Muta?
Apart from abilities, this randomization can also be used for timers, particularly Nydus Worms and Phase Prisms, as well as drop pods and warp-ins without Prisms, and when they'll show up. The timers can also be used for other things, as well, to give an impression that the player should always be ready, be it during a boss fight or anything else.
However, I ensure there must also be a careful moderation in early missions, in a campaign, and early in a boss fight. In early missions, I start with some few, predictable waves as to get the player prepared, mostly around the 5 minute mark. But only in earlier missions, in later the player should be tested and, eventually, made prepared against unpredictability. Tug-of-war missions that I make use the Random Integer liberally.
Boss fights, in my designs, use Random Integers for timers and powers, but I've also got locks whom are only opened as the boss fight progresses, especially according to hit points left (75%/50%/25%/10%), very much like it were with boss fights in Dawn of War II, only more refined. The only unlocked Random Integers are for dialog gloats.
Difficulty Parameters
Your spice list. Salt, Oregano, Pepper, Tony...
I actually saw this one while snooping a bit of the final HotS mission, it's something relatively new made by Blizzard for the campaign, but, in itself, it becomes a useful tool in the right hands and the perfect one to make a solid AI even more solid.
I usually like to refer to making an AI as 'cooking'. I pick the ingredients, the raw material, the salt, the right sauce. Difficulty Parameters are something of a 'special spice' that I put up, to make the flavor unique.
Difficulty Parameters are coded automated processes made for a computer to play along with while it's working it's attack waves and building units. These Parameters immediately inject demands and suggestions for the AI (Campaign, preferably, as Melee AI can get rather screwy) related to peculiar things that could and should have been implemented already in the original campaign AIs. With these, you'll have little problem in crawling with Bunkers, getting some supposed micro that's inexistent and especially making the AI actually use it's expansion's Vespene Geysers.
The list below belong to the functions that I know how they work and what. All the others left off are so because I honestly don't know how they work.
- Autoloading Bunkers: That's self-explanatory, except that this one often requires the closest units, most likely the ones who'll join the Bunker while under construction.
- Defending with Peons: Folks who've been through a 6-pool or a Reaper should understand it well.
- Enable Repairing in General: Works only with Terrans.
- Fleeing from Attackers when Low Health: This is an attempt at micro, but it's rather screwed up, not doing it right, particularly because the units, even damaged, get back to the fight.
- Not seeing Enemies without Scouting: It'll first send a worker scout or Overlord to explore the map, but that's troubling as well, especially when the scout gets hampered somewhere he shouldn't be.
- Optimizing Gas Harvesters: Mandatory for expos and bases whom still haven't built their Refinery. It'll try and use the ideal number of workers or the minimum to get Gas everytime there's a refinery built.
- Repair Very Early in the Game: Same as Enable Repairing, but early and with more urgency.
- Throttling APM: The computer gets overactive, even more when you've already set a high APM. Think sugar for children.
The next post will cover Defense Parameters and APM and methodology on attack waves, attack routes and defense. Probably a thing or two on difficulty and defense crawling, and probably expansions too.
This post is essential for learners of AI, in my opinion. Thanks for the shout-out! I've actually been meaning to use more random integers, actually (they show up for Phantom Locust in AS06 too, designating his move path). Might even go back and put in some in the older AS maps. Although I am more forgiving of Blizzard AI than you are, I totally agree that diversifying in the manner you propose is absolutely an improvement.
Bullies is, as you know (because you were the one taught me how to use 'em), something I've just discovered. I was actually looking for something like that for AS02 (when the Zerg moves in after you finish the first rock), and might go back and add it.
By the way, I'd like to mention that using attack waves is often smarter than ordering the computer units to attack specifically. This was something I discovered for AS01 (specifically, when the enemy chase down the Hercules transports, and the ending transport defense), where I thought using a standard "issue order" trigger would be sufficient. However, I soon learned that attack waves worked better, the reason being that the computer acts in a more intellectual manner. For instance, by using AWs to attack a specific unit (like the artifact in All In), you still leave room for the AI to defend itself against defenders of that unit, whilst still making it keep an eye on its true target. AWs also forces faster units to wait for slower ones, and is generally very beneficient for a lot of situations, and shouldn't be considered exclusive for "enemy base attacks player base" situations.
Although I am more forgiving of Blizzard AI than you are, I totally agree that diversifying in the manner you propose is absolutely an improvement.
I didn't say I was less forgiving of what Blizzard did with the AI, but there are just too many flaws in it, particularly B&D, that just can't be ignored. Also the fact they also casualized it, even more now in HotS, makes matters even more worrying and disgusting.
Remember the good old golden days of playing with BW AIs and how solid they were? I'm just aiming to fix some stuff to reach that level.
Cool. Thanks for the tip. You should post this in the wiki tutorials for AI. That section is very weak and outdated. I had to search the stacks for advice on how to do an AI. A lot of the entries are from 2010 and are not useful at all.
Thanks for the tutorial, I knew practically nothing about how to use the trigger AI before reading this. Now I have a great idea on how to make the AI computer opponent to setup the defense locations at their base. Tho, I cant seem to figure out how to get the barracks to build the add-on's after their built with the activate bullies in region trigger. Ok, the Factory finally built the Tech lab, It took the factory some time to build the tech lab add-on but the factory manage to do it. :) Sometimes the SCVs go out and build on command but other times they just don't stop gathering minerals. I gave them plenty to start off with but this is beyond me.
Random integers have no place in high quality AI. A correct AI should use knowledge and precepts to always judge the best course of action. Random integers are often used to introduce variance for replayability (make stuff less predictable) or short cut function complexity rather than actually be smart. Truly intelligent beings are not a random number source, as such if the lack of predictability is what they desire they often resort to pseudo random techniques to simulate it. Most real cases have no use of truly random numbers as instead intelligence is used to try and guess the opponents response and make a more suitable action.
Although probabilities are often used with regard to AI development they are more like desirability factors than statistical probability.
From a game play perspective "dumb AI" is often a desirable thing. If your AI was truly intelligent then chances are it will out perform most humans (as it passes the Turning Test). People will complain and quit eventually as they will get very annoyed that the computer is better than they are. This is why games like Diablo III and Final Fantasy use practically no AI and instead heavily use random numbers in their decisions. In the end you want a product that is fun and to achieve that it might require you to purposely under-develop AI.
A good example would the capture the artefact campaign mission in WoL where you have to race the Zerg to it. Proper Protoss AI in it would simply grab all units on your lane and attack move them to your base right at the start where you have as good as no ability to defend yourself. The result is the AI will always win and as such it could be deemed smart. Instead they choose the stupid route by simply placing bullies along the way. From an AI perspective this is retarded as those units should attack and not stand at arbitrary places however from a gameplay perspective it made the mission challenging as you have limited time and resources and tech to push through some tough stuff.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Intentional image. Humor intentional, but the matter related is the same.
Introduction
There are challenges in single-player as there are challenges in multi-player. FPS, RTS, TBS, ARPG, hack-and slash, it doesn't matter the type of the game. What matters is the opponent, if the player wants to be satisfied in a single-player experience as much as in multi, this opponent must be in itself challenging, yet lenient, a capable, yet rewarding experience. This applies so much to human as in computer opponents.
The level of opposition itself, unfortunately, in latest games, has tethered in two extremes: Either they're so easy and absolutely, brutally frail that it's past the laughable point, or they're too hard in a masochistic level, but unfortunately not rewarding at all. Either way, this kills, by itself, the interest in a long-run campaign, as people will just want to 'move to next level'. In my opinion, the experience for single-player must last in a similar, if not equal, of a level compared to that of multiplayer. People want to savor the same experience from beating, humiliating, trolling, and ultimately defeating the AI as much as he or she does with the human opponent. But they also want to learn, to grow, to mature themselves to a point where they can aspire professionalism in major league matches, and the AI must a tough, but fair teacher.
And, when concerning AI, unlike major companies believe, everything is key, especially unpredictable. Unlike major companies and developers, whom think of making as everything as casual as possible, thus developing a preset of events in a determined, single order, the unpredictable makes the difference between a game that's something-to-everyone and a game that's everything-to-someone (Thanks, Taffer.). People want to be caught with their pants down, at a certain point, they want to be surprised, they want to know their opponent is learning and making the fight a personal one, they want to know their skills made up a deadly enemy unintentionally, pretty much in the classic case the Batman made the Joker.
Such concept, however, doesn't need to be applied exclusively to RTS alone, like StarCraft II, as this article will cover about. The concept can be applied to RTS, with backdoor strikes, mineral drops, defense crawling and mine bullying, to FPS, with camping, sniping, rifle-rushing, to hack-and-slash, with parring, quick combos or heavy combos and dodging, or even RTT, with hit-and-run, flanking, sneaking or mopping up after requesting a carpet bombing. Or even TBS, with selecting spells, holding, charging to archers or staving off that super-stack. What we're talking about here is how we can make the AI flexible, mutable, grow-able and unpredictable in a way the player will get surprised at every turn, instead of just knowing it all the moment he presses the Reset Mission button.
The perfect AI, in my opinion, is the one that learns it's mistakes gradually from how the player performs, from the usual Marine/Marauder grinder or cowering newb to a professional player or Gosu. The perfect AI is the one that improves itself at every play, although with certain, slim limits, to allow gameplay chances, as it increases and stores difficulty against the most capable of players, adapting and even thinking for itself. Unfortunately, such a thing is nigh impossible in today's current industry and methodology standards, especially with the paternalistic tendency the industry is putting on casuals, 76% of current general gaming populace, but we, as modders and mapmakers, can, at very best, make an alpha simulacrum of what the real concept would be.
This is what this article covers about. Making an AI that expands, chooses for itself, reacts, defends and has a chance of actually prevailing against the player, and detailing step by step the procedure.
I'm DeltaCadimus, I've only had so far a few months of permanence here and about one campaign in progress, as well as an Arcade-meant map. But I've been into games, particularly the RTS and TBS genre, with it's comedies and dramas concerning AI, for more than ten years. I've seen it all, the hilarious pathing of Warcraft III, the unbalanced and awfully designed AI from EA games and the infuriating predictability of WoL/HotS campaigns. I've played campaigns like Legacy of the Confederation, Aeon of the Hawk, Flame Knives, The Antioch Chronicles, had passed from all sorts of AIs, from the ones made by Blizzard to the radically rewritten ones by dear IskatuMesk for his attempted mods, that include ITAS and Armageddon Onslaught. From all my experiences, I've garnered a degree of experience concerning how a satisfactory AI should be. But only now, having tested it and progressed myself in AI development through triggers in the Starcraft II's Trigger Editor, in the Map Editor, that I'm compiling it and effectively translating it so as to bring the understanding of Artificial Intelligence in a different level. Your level.
Making your own SkyNet - The concept of making of a near-ideal AI.
Everyone knows how the AI is currently done in StarCraft II, yet the knowledge, until now, has been a limited one, particularly in a B&D mission, explaining the several factors that lacked in the official missions: Predictable attack waves and attack routes, lack of expansions that'd bring a 200/200 max out level, non-existent use of cloaked/disguised units, few transports used, upgrades and teching not done in a physical in-game level, many core factors whose corners were cut in the official version, masked with the use of gimmicks like lava surges, flash freezes, Supply Trains, Rip Field Generators and Zerg egg collection. This is no criticism, but rather a fact that the AI in Starcraft II's missions is below the standards expected out of the game, particularly late game, where progress was considerably made, and with so many tools and options available.
People rather think that making an AI is complicated, because it's either taking a hard work, through the Trigger Editor, which this tutorial will encompass, or go through the Galaxy Editor. But the truth is that it's actually all about the effort itself, and the will to employ it. How much do you want a challenging AI so badly? That was the question, when I was making my campaign, that led me to go beyond my limiting and my fears. I garnered knowledge from the official missions, learned of their mistakes, as well as ideas and necessary materials for developing the AIs I needed, especially for the macro field. All the materials I know will be put here, but the first I'll talk about below is establishing the foundations, the concept, the matter of difficulty and leniency and a small view on my designing ethics for AIs and how do I apply them.
First of all, when you make an AI, the first thing you must have in mind is how it'll act, for starters. Will it be a major power player? Will it be a grinder with 90% low-tech units, or maybe tech up to the big bad boys? Will it be a meat shield? Or maybe it'll be a crawler, slowly encroaching you, or perhaps even rush forward ahead, harassing and containing you with Bunker, Photon or Crawler rushes. Maybe it'll use mostly support or artillery. Maybe it'll focus more on transport. The possibilities are limitless, particularly with the Trigger Editor and it's tenfold increased flexibility, but it doesn't stop there. You can make it transition, or often must make it, in late game, but how? Make the Bio player go Bio-Mech or Bio-Sky, maybe? Make him take a different route, using Warp Prisms or Nydus Worms? The question does brew on the maker's mind, but when you know what do you want, all you require is the how.
Then, there's the race issue, and how it's done. How the race itself plays out. But this, so much as the idea of the AI, is up to the mapmaker. For me, I follow a series of designing ethics I established for myself, and that are below. Note that this is only my personal opinion of how I make my AIs per race, I don't expect anyone to copy them because it's actually that way, I'm not here to say 'Don't do that, do this, don't do this, do that.'. That's the maker's call, I'm just exposing my views for my particular AIs per race.
Terran - Terran AIs tend to play out in the most standard way possible, nothing new about them. Apart from a few, unique exceptions like Engineers (Bunker/Mine/Sieged crawling), Fast Terran (Reapers, Hellions and Vultures) and Support (Ravens and Science Vessels), they'll go either pure Bio (Marines, Marauders, Medics, Firebats and Ghosts), pure Mech (Hellions/Hellbats, Diamondbacks, Goliaths, Siege Tanks and Thors), pure Sky (Vikings, Wraiths, Banshees and Battlecruisers), or composite mixes between each, each with numbers not as few as the Protoss, nor as much as the Zerg. They have their own traits, however. The first is that, when they expand, they'll first build their CCs in the main base, just like in a match, and then move it to the expo before doing the rest of the expo, and the first ones will generally be away. The second is that they don't use that much of spellcasters, unlike the other races. The third is that their transitioning will mostly be a radical one, except for cases like Bio-Mech, Sky-Mech or Bio-Sky.
Zerg - Zerg tend to be the most active, expanding while it does it's first attack waves, if there are any expansions available. Zerg will put a top priority on spreading as much Creep as it can, as to have a highway for faster attacks, but it won't remain on that. It'll mostly go ground, but won't deny air or transports or Nydus Worms. When attacking, it'll ensure either Ultralisks or masses of Zerglings for meat shield. Zerg transition mildly. One thing that they'll do certainly is crawl slowly with Spine and Spore Crawlers, and any defenses added in any mod, if the maker desires so. They'll use spellcasters moderately. When using Nydus Worms, I ensure they have one separate AI player dedicated to that function alone. When expanding, they immediately make two new Hatcheries per expansion, along with two new Queens. Spreading creep is done through waves of separate Creep Tumor bullies (Doing it all in one bully makes the Queens confused, as the unit AI is wretched, so you must go one-at-a-time), but Zerg will also use expendable Overlords to puke creep everywhere, even inside the player's base. Depending on Random Integer or the mapmaker's decision, it'll either start one way or another, or use both at once. This latter, Overlord Puking, is useful as a harassment tool as well as distraction for AA defenses that, unless the Overlords are quickly destroyed, won't attack aggressing Mutalisks/Brood Lords for two seconds.
Protoss - Protoss are the most reserved, using small waves of rather advanced, powerful units, always accompanied with spellcasters in middle/late games, if they have any. They like to attack from afar, if they can, but won't deny melee, either. They expand slowly, roughly after two attack waves, even more later than Terran, but they immediately upgrade and will only send their first wave when the first upgrades are done. Protoss use Chrono Boost frequently, always research Warp Gate ASAP, if they have the Cybernetics Core early, and will tech faster than other races. Their transitioning will be the most reserved, to the level of roughly one Colossi or Carrier first, and then crawling forward. When using Phase Prisms, once deployed, the AI will warp in frequently different troops, depending on the Random Integer value. Transports don't go without escorts, unlike Terrans and Zerg. If a decision is made to Photon Cannon rush, it'll be done roughly three minutes after the player starts, or immediately, but afar, as to give the player a fighting chance, while effectively restraining him on his base. When expanding, they don't expand their production line until five minutes after the expo is done.
Many of these actions are done in a nigh-masochistic level, all through the Trigger Editor. This sounds rather like just a work not meant for you, you rather preferring to have the AI just go Melee mode and let it do it's bizarre work. It'd be understandable, were not for the fact that even the Melee AIs done by Blizzard are messed up, too, particularly depending on expansion position, especially if it's an island map. That explains the virtual lack of island maps in matches and such, as the attack waves for ground, so much as transport AI, are pretty troublesome in themselves. And the only way the AI could be refined or modified would be through Galaxy Editor. We're dealing with making AIs through triggers, here, and these allow so much as control, possibility, expansion of possibilities and, most importantly, controlling the way expansions, Nydus Worms, Prisms and transports should be used.
And, above anything else, we can make the supposed 'AI' play like an actual AI, making it circle, choose different units, paths and methods, upgrade, expand and tech physically, in the game, instead of just giving upgrades, expansions and such. This can be done through several ways, through Bullies, Random Integers, Difficulty Parameters, many of which will be explained here, and how to control and use them.
Bullies
Screenshot taken from the Editor view of WoL's third Mar Sara mission 'Ground Zero'. Notice that, above the Creep patches, you can see transparent, red-tinted Spine Crawlers where they should be when the mission began, but they don't until later.
The concept of bullies was introduced to me by IskatuMesk in a development video for his cancelled SC2 project named 'Apex', where he intended to practically remake Starcraft in a different manner, to the point of replacing Zerg for a different, mechanical race known as Necropolis. He was also intended on making a Build and Destroy AI that was practically non-existent in WoL's official campaign. This involved so much utilizing the Galaxy Editor as well as triggers and bullies. But it was only when I snooped, without any intention to research at the time, into the third Mar Sara mission map and I discovered what Bullies actually were, and that led me to start learning on AI making.
Bullies are units whom actually are rather demands for the AI to build on a determined time, when the said 'permission' is granted through triggers, activating the bullies. Once activated, the unit will be built in-game, through it's production structure or worker. If it's a unit, it'll be built first and head there, like a unit moving to a Rally Point. If it's a structure, the worker will travel there, if it's possible to reach, and will build on the spot. If Zerg, the Creep must be there, except if it's a Hatchery or Extractor. If the AI is Protoss, the Pylon will be built first, except if the structure is a Nexus or Assimilator. Setting bullies for Extractor, Assimilators or Refineries on top of Vespene Geysers will make the builders build them, without any trouble.
When making an AI, bullies tend to play a very vital and active role, because they represent the very fact that the AI is actually acting, reacting and doing something other than standing still while the player destroys them or stands still. Depending on how it's done and when, bullies will make the AI actually expand and start mining, will make the AI build more factories, will reinforce the base when attacked, make more units who'll so much defend as being also available for an attack wave, will make the AI crawl Bunkers, Photon Cannons, Crawlers, Siege Tanks, mines and other stuff towards a player, making a literal war for map control... In summary, it's what makes the AI actually build the units and structures instead of generating them through drop pods and spawn points, or through excruciatingly painful manual triggering, like I had this grim prediction in the early development stages for my campaign, still to be disclosed.
Bullies are so easy to utilize as relatively easy to make, and the more you put effort will be equally rewarded the same. To 'bully' a unit (No pun intended, of course), you can make a unit or structure, a Barracks for an instance, anywhere you can build. Make a Region around the unit, preferably small (NOT SMALLER THAN THE UNIT, JUST TO FIT INTO IT) if you wish to make that unit alone and none other, if there are other bullies around. Name the region and, for easy identification, pick a color by pressing ENTER with the region selected.
Select the unit you wish to bully and press ENTER, opening the Object Properties dialog. Select the AI tab.
Simple representation of a bullied unit. Too simple, actually.
If you wish to make a bully, simply uncheck the 'Initially Created' box. However, there's also a limit, as you can see, to the number of times the bully can be built and rebuilt, if it's destroyed. Either set the number you desire or select 'Always' on the menu, depending on the difficulty. Unless you're working with multiple difficulties, you'd better only use the 'Normal' or 'Medium' menus and set the difficulty on the Trigger Editor. If you want to make multiple structures/units of the same type, on the same trigger, simply pick the regions along, using SHIFT, and when you're done, press NumPad 0 to merge them.
Merged Regions, who'll use the same trigger and build all those bullies in a row.
Bullies can be applied to any unit or structure, and they'll so be made.
Note, however, that bullies will only be built in-game if the AI CAN make them, if they have the structure, the required tech, the resources, enough supply and the ability to make them. By ability, I mean setting the unit's button on the Command Card and adding the unit to the 'Build' ability list of the unit/structure, both of which done on the Data Editor.
Also, unless the bullies are de-activated when the map starts and they have a trigger to activate them at the determined time, the AI will build them all at once, once the AI is turned on. Of course, you can do that if you want the AI to do everything at once, but if you're seeking a controlled timing of what it's built and when, you'll need two types of triggers: One to deactivate all bullies and one (multiples, actually) to activate a specific bully at a time. The action for these bullies, in the Trigger Editor, is the Activate/Deactivate Bullies in Region, also explaining the need for Regions covering your bullies.
Bullies are your doggies. Leash'em or leave'em, and let'em trash all your house.
Random Integer
For unpredictability, dial these numbers.
The first time I actually discovered Random Integers, when I was searching for a way to make things random, was right here, at SC2Mapster, working with my beta colleague EivindL on Amber Sun. In one of the missions, during a fight, random dialog gloats from the enemy were spurt out. Looking into the triggers to know how he did it, I discovered the Random Integers. But the flexibility with accepting attack waves, attack paths, timers and other things were what made me welcome this tool with open arms, knowing that not only could I make the things I wanted, but so much more. I could make, through triggers, an AI that actually could play like an AI, unlike any any company, EA, Ubisoft or even Blizzard had conceived, even at the times of when StarCraft was first launched and it enticed tens of millions of people, to the point of becoming an official South Korean e-sport.
Random Integers somehow, looking from a certain angle, work pretty much like the Switches did on the Brood War editor. For those whom remembered it, when switches were activated or deactivated, actions occurred or cutscenes were safer, to prevent heroes from dying unnecessarily and the player accidentally losing. But, when they were randomized, particularly for boss fights and unit spawns, the actions were unpredictable. And incredible.
Some old people whom played Brood War campaigns will remember the Life of a Marine campaign, a Brood War campaign made by Gemini (Campaign Creations). In the second mission, which you'd have to circle a tug-of-war frontline battle to get to the enemy encampment, you could take an opportunity and look at the constant generation of units and their different types, though these were pre-triggered. A look at the map's triggers in the editor reveals a series of triggers that would random three switches between on and off and then, depending on the probabilities, creating the desired, different units that'd be sent to die on the battlefield. Yes, it was all just a matter of math, but the concept of random, meaning unpredictable, was what could entice me. I wanted more of that. So much more...
This somehow is about the same basics for Random Integer, though the difference between what you could do back in the Brood War editor and here is far different tenfold. In the Brood War editor, you could either determine dialog, wave spawns or boss powers, but here you can be very different. You can determine dialog, wave spawns, wave trajectories, methods, boss powers, builds, upgrades, AI course, unit types, practically many things.
Random Integer plays a role not as so vital, but equally as important as the bullies if players aim to design an AI that can deliver the supposed impression of independence, like if it can make choices for itself and either go different or persist. That's a core concept in my Build and Destroy missions that go beyond the simple all defending and useless attacking we've seen so far in WoL and HotS. Here, the AI gets to 'choose' how to do it and what to apply, all because of Random Integer, it allows the AI to play with the player, as the player plays with the AI equally.
Depending on the integer choices, you'll either face one of these. No more predicting what will come and when. With this, it's about rolling the dice and taking the chances.
Random Integer is a tool, in B&D missions, that can be used for:
- Attack waves: A doubt fills your mind: What will your opponent use? Will he go the fast way, with Hellions and Reapers, Zerglings and Banelings? Will he use artillery with some infantry cover? Will he go mech? Will he go aerial? Strafing or transport? Will he use Nydus Worms or Phase Prisms?
- Attack routes: Before, there were only frontal assaults and scripted flank assaults, drops and Nydus Worms. Now, another doubt comes in: Where will he attack, if not on the front. Which entrance is less defended? Which flank is exposed? What if he uses Reapers, or Raptors or Colossi? Is your supply threatened? What if he goes air? Where he'll land? Back of your base? Mineral line, perhaps? Or, better yet, what if it's not on your base, but rather on an expansion? Doubt, doubt, doubt...
- What to spawn in Nydus Worm or warp in Phase Prism: A Nydus Worm bursts from the ground, within or outside your base. A Phase Prism manages to sneak in and unfolds. What will it come out? What will warp-in? Will it be Zealots? Stalkers with some High Templar? Dark Templar? Waves of Zerglings, some Roaches who'll mass or not, an Ultralisk, maybe? Who'll know what that diabolical AI is up to?
- Where to tech to: In some missions, you'll want the AI to have it all, but the decision is up to the Random Integer. Aerial or mech, pure, advanced Bio? Nukes, maybe? Pure Carriers or Immortals with Colossi. Or go bolder and get Archons with Storms. Roach and Hydra, or Ling and Muta?
Apart from abilities, this randomization can also be used for timers, particularly Nydus Worms and Phase Prisms, as well as drop pods and warp-ins without Prisms, and when they'll show up. The timers can also be used for other things, as well, to give an impression that the player should always be ready, be it during a boss fight or anything else.
However, I ensure there must also be a careful moderation in early missions, in a campaign, and early in a boss fight. In early missions, I start with some few, predictable waves as to get the player prepared, mostly around the 5 minute mark. But only in earlier missions, in later the player should be tested and, eventually, made prepared against unpredictability. Tug-of-war missions that I make use the Random Integer liberally.
Boss fights, in my designs, use Random Integers for timers and powers, but I've also got locks whom are only opened as the boss fight progresses, especially according to hit points left (75%/50%/25%/10%), very much like it were with boss fights in Dawn of War II, only more refined. The only unlocked Random Integers are for dialog gloats.
Difficulty Parameters
Your spice list. Salt, Oregano, Pepper, Tony...
I actually saw this one while snooping a bit of the final HotS mission, it's something relatively new made by Blizzard for the campaign, but, in itself, it becomes a useful tool in the right hands and the perfect one to make a solid AI even more solid.
I usually like to refer to making an AI as 'cooking'. I pick the ingredients, the raw material, the salt, the right sauce. Difficulty Parameters are something of a 'special spice' that I put up, to make the flavor unique.
Difficulty Parameters are coded automated processes made for a computer to play along with while it's working it's attack waves and building units. These Parameters immediately inject demands and suggestions for the AI (Campaign, preferably, as Melee AI can get rather screwy) related to peculiar things that could and should have been implemented already in the original campaign AIs. With these, you'll have little problem in crawling with Bunkers, getting some supposed micro that's inexistent and especially making the AI actually use it's expansion's Vespene Geysers.
The list below belong to the functions that I know how they work and what. All the others left off are so because I honestly don't know how they work.
- Autoloading Bunkers: That's self-explanatory, except that this one often requires the closest units, most likely the ones who'll join the Bunker while under construction.
- Defending with Peons: Folks who've been through a 6-pool or a Reaper should understand it well. - Enable Repairing in General: Works only with Terrans.
- Fleeing from Attackers when Low Health: This is an attempt at micro, but it's rather screwed up, not doing it right, particularly because the units, even damaged, get back to the fight.
- Not seeing Enemies without Scouting: It'll first send a worker scout or Overlord to explore the map, but that's troubling as well, especially when the scout gets hampered somewhere he shouldn't be.
- Optimizing Gas Harvesters: Mandatory for expos and bases whom still haven't built their Refinery. It'll try and use the ideal number of workers or the minimum to get Gas everytime there's a refinery built.
- Repair Very Early in the Game: Same as Enable Repairing, but early and with more urgency.
- Throttling APM: The computer gets overactive, even more when you've already set a high APM. Think sugar for children.
The next post will cover Defense Parameters and APM and methodology on attack waves, attack routes and defense. Probably a thing or two on difficulty and defense crawling, and probably expansions too.
@DeltaCadimus: Go
This is a really good and in-depth tutorial, I await the next parts.
This post is essential for learners of AI, in my opinion. Thanks for the shout-out! I've actually been meaning to use more random integers, actually (they show up for Phantom Locust in AS06 too, designating his move path). Might even go back and put in some in the older AS maps. Although I am more forgiving of Blizzard AI than you are, I totally agree that diversifying in the manner you propose is absolutely an improvement.
Bullies is, as you know (because you were the one taught me how to use 'em), something I've just discovered. I was actually looking for something like that for AS02 (when the Zerg moves in after you finish the first rock), and might go back and add it.
By the way, I'd like to mention that using attack waves is often smarter than ordering the computer units to attack specifically. This was something I discovered for AS01 (specifically, when the enemy chase down the Hercules transports, and the ending transport defense), where I thought using a standard "issue order" trigger would be sufficient. However, I soon learned that attack waves worked better, the reason being that the computer acts in a more intellectual manner. For instance, by using AWs to attack a specific unit (like the artifact in All In), you still leave room for the AI to defend itself against defenders of that unit, whilst still making it keep an eye on its true target. AWs also forces faster units to wait for slower ones, and is generally very beneficient for a lot of situations, and shouldn't be considered exclusive for "enemy base attacks player base" situations.
I didn't say I was less forgiving of what Blizzard did with the AI, but there are just too many flaws in it, particularly B&D, that just can't be ignored. Also the fact they also casualized it, even more now in HotS, makes matters even more worrying and disgusting.
Remember the good old golden days of playing with BW AIs and how solid they were? I'm just aiming to fix some stuff to reach that level.
The screen shots are very tough to read. I zoomed in and still have trouble.
@Hockleberry: Go
Right click and have it open the image. It's in it's original size, it's the post that dumbed it down to fit the size.
Cool. Thanks for the tip. You should post this in the wiki tutorials for AI. That section is very weak and outdated. I had to search the stacks for advice on how to do an AI. A lot of the entries are from 2010 and are not useful at all.
Thanks for the tutorial, I knew practically nothing about how to use the trigger AI before reading this. Now I have a great idea on how to make the AI computer opponent to setup the defense locations at their base.
Tho, I cant seem to figure out how to get the barracks to build the add-on's after their built with the activate bullies in region trigger. Ok, the Factory finally built the Tech lab, It took the factory some time to build the tech lab add-on but the factory manage to do it. :) Sometimes the SCVs go out and build on command but other times they just don't stop gathering minerals. I gave them plenty to start off with but this is beyond me.I put this up on the Wiki under the AI section.
i really have to add something. it's not needed at all to put any regions. just create a new region around the target point (circle) within triggers.
Random integers have no place in high quality AI. A correct AI should use knowledge and precepts to always judge the best course of action. Random integers are often used to introduce variance for replayability (make stuff less predictable) or short cut function complexity rather than actually be smart. Truly intelligent beings are not a random number source, as such if the lack of predictability is what they desire they often resort to pseudo random techniques to simulate it. Most real cases have no use of truly random numbers as instead intelligence is used to try and guess the opponents response and make a more suitable action.
Although probabilities are often used with regard to AI development they are more like desirability factors than statistical probability.
From a game play perspective "dumb AI" is often a desirable thing. If your AI was truly intelligent then chances are it will out perform most humans (as it passes the Turning Test). People will complain and quit eventually as they will get very annoyed that the computer is better than they are. This is why games like Diablo III and Final Fantasy use practically no AI and instead heavily use random numbers in their decisions. In the end you want a product that is fun and to achieve that it might require you to purposely under-develop AI.
A good example would the capture the artefact campaign mission in WoL where you have to race the Zerg to it. Proper Protoss AI in it would simply grab all units on your lane and attack move them to your base right at the start where you have as good as no ability to defend yourself. The result is the AI will always win and as such it could be deemed smart. Instead they choose the stupid route by simply placing bullies along the way. From an AI perspective this is retarded as those units should attack and not stand at arbitrary places however from a gameplay perspective it made the mission challenging as you have limited time and resources and tech to push through some tough stuff.