About the Author
Mass Effect
Final Fantasy X
Batman:Arkham City
Borderlands Series
Weekly Column
Champions Online
World of Warcraft
DM of the Rings
Good Robot
Project Frontier

Starcraft: Bot Fight

By Shamus
on Wednesday Apr 9, 2008
Filed under:
Game Reviews


I’m not sure who will find this interesting. This is an AI analysis of a ten year old videogame. This entire endeavor will sound absurd to people familiar with the game in question, and hopelessly esoteric to those that aren’t. Still, I’m putting this up in case there is someone else out there who is just as peculiar as I am, in that I find this sort of thing intensely compelling.

About a month ago I wrote a Starcraft scenario which allowed you to observe a game between AI players. I’ve been curious about the quirks in the Starcraft AI and I’ve wanted a chance to see them do their thing in a deterministic environment. I learned some surprising things about this ten-year-old gem. While the races themselves are very nearly balanced in the hands of humans, it turns out the AI is a lot better at using some races compared to others.

This is a very pixelated map of The Hunters.  The map has eight starting locations, marked by the colored squares.  Players are randomly placed on the map, with one random spot left empty.
This is a very pixelated map of The Hunters. The map has eight starting locations, marked by the colored squares. Players are randomly placed on the map, with one random spot left empty.
The setup is this: Seven AI players. Randomized start locations. Using the Broodwar expansion. The last “player” is the human observer, who controls no units but who can see the entire map. The script in question runs on the map “The Hunters”, although it could easily be exported to other maps. There are two Protoss players, two Zerg players, and three Terran Players. The computer players are all set to “insane” level difficulty, informed that all other players are their enemy, and told to go at it. Mayhem ensues.

I’d usually let the game run overnight and check on the results in the morning. (Yes! This was my solution for being too busy to play computer games, I programmed a game to play itself for me!) A game normally takes a couple of hours, although rarely one will end in an hour, and several became endless stalemates.

At first I just set the difficulty to “normal”, but I found that the computer players were far too likely to consume all the resources on the map, go broke, and then just sit there. I’d start a game before going to bed, and when I came back in the morning I’d find the battle was down to three sides who couldn’t make any fighting units. I changed the difficulty to “Insane”, which auto-cheats by giving itself 2,000 minerals and gas anytime it goes broke, meaning the thing is always rolling in resources. This made sure that most battles came to a proper conclusion. Although this made battles larger, more spectacular, and a little more chaotic, it didn’t seem to affect who won. I ran many overnight battles with both AI setups, and while higher difficulty made for inflated scores, over many games the results painted a clear picture.

A note about the AI difficulty settings. Skip to the end if you just want to read about how it turned out.

I dislike this auto-cheat for a number of reasons, mostly because it negates a lot of the strategy in the game. None of the players can go broke, but the AI still plays as though resources were important. The only true way to knock a player out of the game is to annihilate their core base with all the critical buildings in it. Expansion bases are (mostly) worthless in a game like this. Yet the computer still builds and defends expansions (because that’s what it’s programmed to do) and still wastes time attacking enemy expansion bases. This introduces a bit of luck into the game: Who wins depends a lot on positioning. The AI tends to attack the nearest base, not the most important one. Sometimes the nearest base is the core base. Sometimes the nearest is an expansion which is pointlessly destroyed and rebuilt over and over again.

Like I said, in the long run it didn’t really change the fact that one race continually came out on top.

Anatomy of an AI battle

Without the unpredictable actions of a human involved in the match, the AI fights like clockwork. Games have a perceptible rhythm to them. They all build their first couple of buildings within a few seconds of each other. Even these variations are probably the result of minor changes in the layout of each base. If the bases were somehow shaped the same, the players would probably all build in perfect unison.

They build an initial attack force. On insane difficulty this attack force is huge – probably sixteen or so zealots or the given race equivalent. On normal difficulty the force is smaller, but the behavior is the same. They all leave the base at about the same time, and (as far as I can tell) attack a foe totally at random. Sometimes this foe will be a neighbor, and sometimes it will be someone all the way across the map.

This is the most chaotic and unpredictable part of the game, and it’s basically a crapshoot. Usually one or two players get taken out. Nobody has any defenses at this point, so when an enemy comes knocking, their survival is a matter of luck: The defender has an attack force elsewhere on the map. Is that force still intact, and can it be recalled before the place is destroyed? Are there enough of them left to save the place? A player can also do really well if they are attacked by two people at exactly the same time – the attackers end up wiping each other out and leaving the buildings alone.

The AI seems to wait until this initial attack force is nearly all dead before entering the next phase: It builds defenses and another attack force. Again, this force is sent out. Once gone, the AI begins trying to build its first expansion base.

The rest of the game is a series of escalating attack waves. As they add more buildings onto their main base they work their way up to air units, and this is where you start seeing some differences in how well the computer handles the different races.

The Different Races

If you’ve never played Starcraft, you’re probably not even bothering to read this, but just in case:

The Zerg are a bug-like race. Think H. R. Giger Aliens or Starship Trooper aliens. Their units are usually cheap, plentiful, and weak. They are made to be mass-produced and sent to their deaths. The Protoss are highly advanced aliens with lots of fancy technology. Their units are very expensive but very durable. Their units are usually less numerous. Their shield technology encourages you to try and make sure they survive a battle so you can recharge their shields and send them off to fight again. They are not intended to be disposable units. The Terrans are the humans and fall somewhere between these two extremes in terms of cost vs. unit lifespan. It’s actually far more complex than this, but that’s the general, high-level, broad, big-picture overview. Volumes have been written on these three races and we can’t begin to cover it all here. Just remember: Zerg = cheap and weak, Protoss = expensive and tough, Terrans = Somewhere in-between.

I expected the AI to excel at using the Zerg, since their intended usage fits nicely with how the computer behaves: Churn out masses of units and fling them at the enemy without regard to casualties. I expected Protoss to be the worst, since the send-them-to-die policy of the AI would end up squandering a lot of very expensive units.

The Results

Without a doubt, the AI is far better as using the Protoss. It’s not even a contest. The only time a Protoss would get wiped out would be if they had a stroke of bad luck in the initial first-wave attack, which is always a game of Russian Roulette. Assuming they survive that, a Protoss AI is probably going to go the distance. The only foe they have to really worry about is the other Protoss. In the dozens of games I ran, only once did I see a game where the top spot wasn’t occupied by a Protoss. Most of the time two protoss players occupy the top two slots in terms of scoring.

This is the outcome of a very typical battle.  Protoss kicking butt. Zerg coming in second.  Terrans going extinct in some kinda hurry.
This is the outcome of a very typical battle. Protoss kicking butt. Zerg coming in second. Terrans going extinct in some kinda hurry.

The Terrans were unquestionably the worst in the hands of the AI. Despite the fact that there were (usually) three Terran players, thus slanting the odds in favor of a Terran-dominated game, they never got above third place, and often the Terran players would occupy three of the bottom four slots. They were more likely than the other races to get wiped out in the first rush, and if they survived they had a terrible time doing real damage to their foes. Despite the fearsome power of the Terran Battlecruiser, the AI was very shy about building them. Even with limitless resources, it never built more than a few and it never used them very well. Even late in the game it was building Wraiths, and it would not quit making them no matter how absurdly poorly they performed. The Terrans seemed to maintain a smaller force. It used Siege Tanks poorly, sent Marines to fight without Medics, and generally fought like a complete tool.

The computer did alright with the Zerg, although it was moronic with its mix of air units. Guardians were often sent in with too little support, making them easy fodder for enemy defenders. If it used Defilers, it was likely as not going to hit its own units when using plague.

Other Notes

A familiar battle: Siege Tank vs. Mutalisk.  Also popular is the Valkyrie vs. Dragoon fight.  The Terran AI always seems to have the wrong unit, at the wrong time, in the wrong place, doing the wrong thing, and not nearly enough of them.
A familiar battle: Siege Tank vs. Mutalisk. Also popular is the Valkyrie vs. Dragoon fight. The Terran AI always seems to have the wrong unit, at the wrong time, in the wrong place, doing the wrong thing, and not nearly enough of them.
When I fight the AI Protoss, it uses the Templar Psi Storm with murderous efficiency. I’ll have a tight group of units moving into its base when a Templar will appear in juuuust the right spot, drop a Psi Storm on my guys, and dart away before I can punish him for it. With a couple of Templar available he’ll play hit-and-run with me all day, and do tremendous, infuriating damage to my forces.

Against other AI, the Templar are bumbling comic goofs. They will drop Psi Storm on single enemy units and hit a bunch of their own guys in the process. They will blunder through fortified territory attempting to reach a unit deep inside, and get cut down before they even get close.

I’ve come to suspect that the AI cheats a bit and detects clusters of units which have been grouped by hotkey by human players. This is very naughty if it’s true. What’s worse is that peeking at how my hotkeys are set up seems to be central to its decision making. Deprived of that bit of cheating info, the Templar is helplessly stupid. Boo.

I’m note sure why the thing is so bad at utilizing Terrans. Aside from the issues I mention above, it just seems less aggressive overall. It also has a penchant for building base defenses (bunkers, towers) in places where a base should go, effectively rendering a viable expansion useless. It will attempt to lunch nukes without bothering to cloak the Ghost first. It will risk the painfully expensive Science Vessel in order to irradiate something of very low strategic value. It makes small numbers of all units instead of focusing on a few and using them well.

Still, this was an amusing experiment. If you have the Broodwar expansion for Starcraft you can try it out yourself. You can get the map here:


You DO remember where your Starcraft disks are, don’t you?

Comments (139)

1 2 3

  1. What gives the Protoss the edge here? Is it just that their control of the Humans and Zerg are hopelessly stupid, or it is that the AI’s favourite tactics (ie. Zealot rushes) are more effective with Protoss units? I’m assuming the Protoss AI is still a bit stupid, but its stupidity doesn’t hurt it as much?

  2. Shamus says:

    Darcy: Well, it is terrible at playing the Terrans. But when it comes to Protoss vs. Zerg, I think you’re right: It’s stupidity isn’t as harmful (to itself) when using Protoss units. Blindly flinging Guardians at an enemy base is just a waste, but you can fling carriers at an enemey base and do quite well because they are a little more able to defend themselves.

    And yes, the Zealot rush is just horrifying.

  3. krellen says:

    Given unlimited resources, the Protoss are sure to dominate. The usual way the Protoss go down is losing all their resources. Otherwise, being able to continue to pump out troops will inevitably make them win.

  4. Shamus says:

    I should add that Protoss dominate even without infinite resources. It’s just that The last two protoss are usually too broke to finish each other off. :)

  5. Doesn’t surprise me that much. The Terrans always struck me as having capabilities that need to be fiddled with to work. Basically, where Protoss technologies for the most part are elegant and Just Work, which makes them fairly easy to get decent use out of, Terrans have more what I’d describe as a “bag of tricks”. They can be effective, but you have to be clever enough to use the tricks. This is true from the unit types (which have to be carefully deployed to support each other to really shine, as opposed to say Dragoons which pound for pound can take on most foes, ground or air, fairly well) to the special abilities (which tend to require thought as to setting up their use, when to turn them on and off so as to maximize their usefulness and not get caught empty and so on). Even the brutal Terran tanks are deeply vulnerable to air power, cloaked things and so forth, and don’t steamroll the enemy unless you are effective at switching to and from siege mode. So they need support and moderately careful handling.

    So I’m not surprised. Terrans can work effectively, but they require a bit more care and feeding to reach half decent effectiveness levels, and not via the brute-force maximizations that AIs are decent at.

    Not to say Protoss and Zerg don’t have tricks. But they don’t depend on them as much. A not-too-bright AI can operate them effectively without using the tricks well.

  6. Maniakes says:

    Hmmm, before reading the last section I was assuming that Protoss were better because the AI made better use of their special ability units than Humans can — I hardly ever used Templars despite their theoretical value because I can’t click fast enough to take full advantage. Human pros are much better at fast clicking than I am, but the computer theoretically should be better still. But you’ve already looked at this and found it not to be the case.

    The major limitation I’ve seen to the Protoss in human vs. human games I’ve played is that the Protoss hit the supply limit much earlier than other races (unless, of course, you mind control other races’ worker units to build whole slave bases with independant supply pools, but that only works on high-resource maps against players who give you plenty of time to develop). If the attack waves are timed close enough, then the Terran and Zerg advantage of being stronger when supply is maxed out is eliminated.

  7. Galaxian says:

    Shamus, you are not alone in your AI curiosity. I recall doing something similar when Age of Empires came out, and, even further back, falling asleep while my Sinclair ZX Spectrum (48k!) went multi-wizard on itself with the mid-80s turn-based strategy game ‘Chaos’… just so I could see how it was ‘thinking’. Man, I miss that game.

  8. As to supply limit, to me it depends how you play the Protoss. Personally, I never build carriers, for instance. I put together a little test scenario and found that two dragoons (2! Count them!) can take out a carrier which costs way more and has to pay for all those little blighters on top of it, and replace them when they die. Equal weight in scouts takes them out, too. They’re inefficient.

    Thing about Protoss is, if you play them fairly conservatively, even defensively, you can be effective on relatively low resources. The goal in an engagement with Protoss is low casualties. You shouldn’t have to go around replacing Protoss units very often.
    Dark Templar are amazing for this. Put a couple of Dark Templar on the *defensive*, right by your base and your laser batteries (not all by themselves, obviously). Shoot anything that comes near that can spot cloaked things, and watch the Dark Templars kill everything else that moves with no hope of retaliation. So sweet.
    As base defenses go, Protoss laser batteries are very efficient. Other races have stuff that can hit air and stuff that can hit ground, so you have to build some of each. Laser batteries hit both, so on any given attacker you can concentrate double the firepower. And they aren’t actually that expensive.

    Sure, Zerglings and Marines are cheap–but after you get a dozen of them shredded while the Protoss lost nothing, which was cheaper?

  9. Alenuska says:

    Interesting. However star craft is rather old I admit id be rather impressed if you had tried this experiment with somthing a bit more current like Dawn of war or the newest command and conquer or possibly compared the results from three different games.

  10. riodoro says:

    geiger = false
    giger = true

  11. I remember playing the campaign missions when you’re playing the Terrans and fighting other Terrans. It got hilarious when they got nukes, because I was always careful to keep my base surrounded by detecting towers. So the ghost would carefully sneak up to the very first tower and nuke *just that tower*. By the time they had another nuke ready, I’d built the tower again.

    I played some scenarios where the enemy Terrans nuked the same tower six times and never got any further into my base.

  12. Shandrunn says:

    You’re wondering who would find this interesting? Are you kidding me? I LOVE this sort of thing!

  13. GamerCow says:

    I’ve never played Starcraft. But I’m geek enough to recognize the terms and whatnot used in this post, and I found it fascinating. Of course, I also used to watch the Borg Bot on angband for long stretches of time.

  14. bkw says:

    One of the things about the StarCraft AI is that it doesn’t handle carriers very well at all — the targets you are attacking with a carrier views the *interceptors* as dangerous, and will attack them, and not necessairly the carrier itself.

    For example: when a carrier attacks a missile tower, the tower fires at the interceptors, not the carrier (unless the carrier moves into range before launching interceptors). Marines and hydralisks *also* will attack interceptors. If interceptors are deployed, the interceptors will be taking damage — not the carriers themselves.

    The balancing limiter of the Protoss was always that their units were terribly expensive: on a large map with unlimited resources, the protoss should always win, unless they are killed in the opening gambits.

    I think if you were to run this simulation on, say, Bloodbath (mod for 5 players, with the 5th being an impartial observer on its own island), your results would probably be very different. I would suspect the Zerg would have an advantage, but … hmm. I think I’ll run some tests myself tonight! ^_^

    A protoss rush isn’t that difficult to defeat; it just requires a very specific build order, and that build order will gimp the rest of your game unless it is successful, and the destruction of the early zealot rush is capitalized upon.

    I’m not sure I’ve ever seen the necessary opening gambit used by the AI, however, so AI vs AI games will always fail vs the early zealot rush.

    Anyway: my contention is that the protoss will always win in the scenario you’ve set up because:

    1) you’ve removed the economic limitation
    2) the StarCraft AI is inherently poor at countering carriers
    3) none of the opening AI gambits work well against the early zealot rush

    I think point 3 is the most important reason, as you’ve noted the Protoss win even with limited economics, and not every game proceeds to the carrier stage.

    It might be interesting to run scenarios where the map was configured to disallow aggressive flying units, but I imagine that would break the AI script. It’s a shame the SC AI isn’t more robust … but given that it still gets store shelf space twelve years later … it hasn’t needed to be.

    And yeah, I know what I’m going to be doing tonight. :)

  15. Phlux says:

    Shamus: Have you tried going into a fight with the Protoss AI and NOT grouping your units via hotkey to test your hypothesis?

    Peeking at player info is a major cop-out in AI programming. The only time it’s really deemed acceptable is when you’re moving beyond the “hard” difficulty and into “insane” or “nightmare” or whatever equivalent your game has. AI can only be so good, so in order to challenge a good player, it’s an understood compact with the player that the AI is allowed to cheat to amp up the difficulty.

    EDIT: Does anyone know if there is a particular race that has an advantage in human vs human play? I know for a while all my friends used Zerg because supposedly they were the best.

    • Zachary "Zesty" Ramirez says:

      Personally, I am a zerg player…
      However, there is no best race in StarCraft. If you want evidence of this, watch games between Flash(T) and Jaedong(Z). There was never a clear victor. The great thing about StarCraft is that there is no (as we say in the Army) approved solution. Certain races will enjoy a superior build every now and then, but it is only a matter of time until someone innovates a counter build. Then it comes down to a matter of scouting the opponents build and responding with the appropiate counter. This is an oversimplification, but you get the idea.
      Also, my thoughts on why the terran are the AI’s worst race…players have long known that the terran bio (when not massed) is by far the weakest. In order to be effective the terrans must wall in (I am actaully astonished that no one has mentioned this yet). The wall in innovation that has become a staple of terran play was an explotation of the fact that many terran buildings(indcluding the barracks) can lift off. Basically, you wall in a narrow chokepoint in front of you’re base with a barracks and two supply depots, and build your forces behind the wall. Since the Marine is the only 1st unit that is ranged, a few weak marines can easily snipe the early attacks from the more powerful zealots and the more numerous zerglings. Since this innovation was not an intentional feature, the AI is not programmed to make use of it, hence their almost certain demise in the eraly game. But I have been rambling on a blog that no one is likey to read (as it is so old)…if anyone is interested in playing either SC1 or SC2 with send me an e-mail.

  16. Mad Tinkerer says:

    “This entire endeavor will sound absurd to people familiar with the game in question, and hopelessly esoteric to those that aren't.”

    Actually, the first thought that popped into my mind was “awesome!” rather than “absurd!” ;)

    Also “Yes! This was my solution for being too busy to play computer games, I programmed a game to play itself for me!” made me laugh.

  17. Nentuaby says:

    “EDIT: Does anyone know if there is a particular race that has an advantage in human vs human play? I know for a while all my friends used Zerg because supposedly they were the best.”

    The fact that there is not to any significant degree has basically been the reason Starcraft has succeeded so admirably as an “e-sport” game.

  18. Dillon says:

    I have noticed in other games vs. a computer that the protoss seem to build more resources worth of zealots than the zerg seems to build of zerglings.

    On terrans, I agree with the person above with the terrans needed more fiddling to work than the protoss and zerg do.

  19. Burning says:

    I concur that this is a really cool exercise, and I’ve never played Starcraft.

    I test software for a living (although not games) and I would actually think that this is one of the things a game developer should do to shakedown their AI before release.

  20. Ed Borden says:

    I will take my Starcraft disks to the grave with me. What kind of question is that? :)

    The fact that the computer rushes any of its opponents’ position on the map I think shows that it cheats the fog of war. I’d like to see you run this with a few empty player slots and see if it ever goes to an empty position. I doubt it would, and it never sends units to scout. You can never “hide” expansions against it.

  21. MaxOverdrive says:

    I have a feeling that the AI may have been tweaked for the INITIAL release of the game, and may not be balanced for any nerfing or tweaking that was done in patches after the fact (patches being mostly for hvh play) But who knows how this would affect the outcome

  22. guy says:

    i’ve seen plenty of games with AIs duking it out with eachother, and never noticed any of that. i have, however, noticed that the AI doesn’t use top-teir units often. battlecruisers, carriers, guardians, and defilers are among them. aslo, how do you change star craft AI difficulty? i thought they didn’t have changeable difficulty, unlike warcraft3. maybe you should mod your script to work on another map and see how that works. the protoss advantage may be a local phenomon.

  23. JFargo says:

    I only recently started playing Starcraft (yes, yes, I’m behind the times; I’ve also never beaten Half-Life), and I found this absolutely fascinating!

  24. Dan says:

    Still on X-Com. Starcraft is next. I swear.

  25. guy says:

    you know, the scoring might be weighted towards the protoss, since they use alot of resources, build alot of buildings, and have high kill ratios. the zerg spend less and more units die per kill, plus they have less in the way of defenses and need fewer buildings to sustain their armies. a straight victory time of death counter would tell you more accurately how well everyone did.

  26. SolkaTruesilver says:

    It would be nice if Blizzard gave us a AI-script designer. I am sure some peoples who are cracks at programmation but lousy at quick-clicking could create incredibly strong AI.

    AI tournaments would be cool too! Let’s see how you programmed your beast! :)

  27. Felblood says:

    Actually, talking about Starcraft isn’t really “behind the times.”

    Plenty of people drag games like that out every couple of years, to see if they can make it further this time. I do anyway; I rarely have the fortitude to beat the second half of any given game before something else catches my eye, but the test of a truly great game is that you come back to give it a second go round.

    Spring break this year, I finally got to the final level of Broodwar (Omega). Someday, I will beat that level, conditions allowing.

    Maybe this style of play grew out of a childhood spent playing Super Mario World. It took my little kid self years to beat that game, and there are still levels I haven’t gotten around to unlocking, but someday I want to. Every level in that game was a brilliantly designed treat, that you’d never find in today’s Build-a-game-engine-throw-on-some-crap-levels-and-ship-the-thing mindset.

    Solka: So, like Final Fantasy XII, but for slow handed starcraft players instead of ATB haters (–who are totally encouraged to try Crisis Core. The new battle engine blends the best of old and new much better than it’s retarded PS3 cousin)?

  28. Ed says:

    I think you grossly underestimate the geekdom of your readership if you thought we wouldnt find this totally facinating. I believe your header says, you just rolled a 1 on your saving throw versus dork.

  29. khorboth says:

    I’m totally downloading this and using it to strategarize better. Thanks, it’s made of win (and also pixels).

  30. Cadamar says:

    Nice work, Shamus. However, if you are willing to learn Korean I’m sure you’ll find that this has been done.
    When I was in Seoul last year there were two, count them TWO channels in my hotel room dedicated to Starcraft tourniments. It was nuts. Color commentators talking excitedly about the strategies, girls, GIRLS!, going crazy over the players, large in-studio audiences gasping and cheering. Seriously! Two channels of 24 hour Starcraft. They have people who make livings as pro-Starcraft players. I’m not making this up. http://en.wikipedia.org/wiki/StarCraft_professional_competition
    They are crazy-insane for their Starcraft e-sport thing.

  31. Lanthanide says:

    “I have a feeling that the AI may have been tweaked for the INITIAL release of the game, and may not be balanced for any nerfing or tweaking that was done in patches after the fact (patches being mostly for hvh play) But who knows how this would affect the outcome”

    This is definitly true for Starcraft vanilla, and probably true for Broodwar as well.

    If you try and play the original Starcraft campaigns using the latest patches, level 3 of the protoss is very difficult compared to what it should be at that point in the game, because when the game originally came out sunken colonies were about 1/2 as fast and did 1/2 as much damage. Now however, unless you’re very careful with your units, you can easily get slaughtered before you get 1/2 way through the opening sequence. I know comparing single player campaigns to AI is a little iffy, but I doubt Blizzard made any significant changes to the AI until Broodwar, despite the numerous balance changes prior to that (obviously the AI would account for things like cost changes, but not neccesarily for things like damage type or unit size changes).

    • aldowyn says:

      I thought balance changes usually didn’t affect the singleplayer for pretty much exactly that reason? Maybe that’s a more recent thing :/

      Now that I think about it, I can think of at least one change for Battle for Middle Earth that breaks a certain sequence in the campaign… (You’re supposed to enrage a Mumakil by shooting fire arrows at it so it tramples this line of enemies, but they don’t enrage anymore)

  32. Adamantyr says:

    I like Starcraft, but I can’t say I’m a huge fan of RTS games… SC is a fine game, but the micromanagement required to win just isn’t what I find fun at all… I guess that’s part of why it’s popular for tournament play in South Korea; a lot of work is placed on the human player, the units are pretty much dumb. I wonder how SC2 will deal with it.. will your units be dumb as rocks again, having to be told to do everything, or will that be a “tournament mode” option so single-player games can have units that actually do a bit of thinking for themselves?

    As far as AI goes, a big problem for me in RTS games is the path finding. A friend recommended I try Total War, and almost immediately I was aggravated by the STUPID AI that, when my army tried to move through the gates of London and got bottlenecked started sending guys AROUND the city! What annoyed me the most was this is no different from RTS games from ten years ago. Why haven’t they written a smarter pathfinder? It’s not like they lack the memory and processing speed to do so.

    As far as AI cheating, it would not surprise me in the least if the SC AI is “peeking” under the fog of war, or checking hot key assignments. It really has to in order to provide any semblance of a challenge.

    A lot of AI is dependent upon recognizing patterns. Human beings are incredibly good (compared to a computer) at pattern recognition. I did some work with map conflation and it becomes readily apparent how STUPID computers are at such things. We can look at a mess of lines and find a match instantly; a computer has to store points, match angle, length, etc., try line combos of every order and proximity…

    So in an average SC game, the computer AI sees a single enemy unit easily, but how does it know if a group of units are, in fact, a congested group ripe for a Psi attack? It could store all units in a given distance, check distances in between, and make a balanced judgment call if those units are a group “now”. But will they still be in the time that it takes a templar to get out there and frag them? Should it measure over time to see if they remain in a group? All this ends up being a lot of extraneous data that would probably (On a 1998 PC) end up crashing the game since this is just one of hundreds of tactical decisions it may be doing. Or it can just peek at the hot keys and say “Yep, that’s a group, just go to unit X’s location and attack.”

  33. Joshua says:

    I was all set to make a post until I noticed Ed Borden beat me to it. I’ve often wondered how much the AI “cheats” when it comes to the Fog of War. I’ve often suspected that the exploration units like the Observer and Science Vessel were mostly for show and for detecting cloaked units rather than actual exploration. It never seems as if the computer has to blunder around to find your base…..

    As far as the play-styles, you would think that the computer would do better with the Terrans than actual players due to the higher amount of micro-management involved(repair buildings and units, etc.), but it seems like the delicate touches the Terrans often require to maximize their advantages offensively are beyond the computer. You will seldom also finding the computer taking a whole force of power units like 12 cruisers or siege tanks against your defenses.

    One way to “cheat back” against the computer’s zealots rushes at the beginning are to have a small force attack the invaders and then run away somewhere else. The zealots will usually chase after their attackers, even though the targets are much less important than destroying your base. How long this strategy works in the long-term, however, I don’t know.

  34. Namfoodle says:

    I agree, this was a cool exercise. I was always fairly certain that the AI cheated and ignored the fog of war. It also makes sense that it would cheat and use hotkey groups for targeting psi storms.

    I was always curious about how the AI was set up. It’s frustrating when the AI can exhibit perfect control of multiple units. I would love to be able to edit the AI for my side so that I can decrease the stupidity of the individual units.

    I need to find my Starcraft discs! I don’t think I ever istalled the game on my XP machine – I played it on my windows 95 machine. All this talk of Starcraft has me wanting to play again.

  35. Freykin says:

    Me and a friend do a similar thing for the map DotA for Warcraft 3. We’ll each pick 4 heroes for our side, and then observe the match and see how it goes. It’s kind of like being a manager and drafting players for your team :) It’s a fun way to test out combinations, and when I was still living with him, we would sometimes use it as a way to determine who’s turn it was to make dinner :P

  36. Hawkehunt says:

    Dammit Shamus, that’s 2 games now I need to install and play again despite my overload of Uni and work ;) I just hope my SC discs still work – I seem to remember that one – BW I think – died on me, and I don’t have enough cash to replace it.

  37. GAZZA says:

    Well, Starcraft is the best RTS ever made, so it’s not really unusual to be discussing that instead of whatever the latest one is.

    This is very interesting work Shamus. I’m a bit curious as to what happens if you set up a “2” player game (I guess you’d actually need 3, to include the human observer), since that would seem to take out the crap shoot of getting ganged up on at the start.

  38. IskatuMesk says:

    The AI doesn’t detect hotkey groups; psi storm is entirely based on proximity of enemy units and once triggered the templar will cast it in that location even if the enemy units aren’t there anymore.

    (To be exact, the AI casts psi storm on a single unit with very high hit points, such as an Overlord. This is also how yamato works. The proximity of the unit in relation to the templar has a small bearing on its cast time, but the AI cannot detect hotkey groups. I don’t even use hotkey groups.)

    This is a pretty general summary. If you are really interested in learning how this AI works, or how to build scripts, you should probably check out my bible. I have posted only a small fraction of what I know about the AI, but if you are really interested in learning how it ticks, this is a good start.

    I’ve been modding Starcraft AI for 8 years. If you’re getting tired of the old stuff, you may want to have a look.


    Also, DotA’s AI is programmed by players completely.

    Also, if you think the standard zealot rush is at all a challenge, perhaps you should try out my TGA AI I released recently for tournament purposes. I plan to release this modification at campaigncreations.org very soon. If you guys are interested in spicing up Starcraft skirmish, stay tuned.

    edit – http://www.campaigncreations.org/forum/index.php?topic=755.0

  39. Kris says:

    I do know where the discs are, the problem is I tossed the Jewel Cases ages ago when all my games got plopped together into a binder. Now I have no CD-Key for them. I was really annoyed when I first discovered this blunder, but now it’s kind of funny. Le Sigh… I even bought the damn game, too, I just can’t play it.

  40. Namfoodle says:

    Hey, wow, a whole site full of downloadable campaigns. I was always better at campaigns than PvP or skirmish. Now I really need to find my Starcraft discs!

  41. Mephane says:

    I am wondering how something similar would turn out with Dawn of War. I am playing that game at the moment and I am seeing similarities, the AI is very poor at teching up the orcs, and sending far too little numbers to be effective most of the time. Even as a Tau player, I just have to manage to successfully fight the initial wave of melee fighters they send at me, which are easy prey if you combine Kroot Carnivores with Fire Warriors. After that, their waves usually get eating by my ranged units before they can doing any serious harm.
    On the other hand, space marines for example, make way better attack forces (although the AI doesn’t get it when I defend with stealthed units, adding Scouts to its troops totally randomly, even if they always get eaten by my Ghosts; however, later in the game the Ghosts are too weak so this tactic just works in the earlier stages of the game). Especially later into the game with higher-teched units, they can make quite formidable damage to your base if you don’t look after your defenses yourself. While at the same time, Orcs are just running into certain doom again and again, and can often be defeated just by bombing his base with a couple of Barracudas. It feels as if the programmers forgot that some races have some rather different mechanics than others and just have the same AI for any of the races (Orcs need to build masses of WAAAGH!-Banners to tech up instead of researching technology in a handful of specialized buildings, but even late in the game they have like two or three only in their base).

    I’d love to see what would happen if AI was fighting each other in DoW the way you could observe it in Starcraft. I suppose either Necrons or Space Marines would win, but I might be wrong.

  42. Vander says:

    Just ran it and the terran kicked butt, winning in 1 hr 35 mins. But watching them, they made heaps of stupid mistakes.

  43. mister k says:

    Thing is, if the AI spammed battlecruisers (well.. kinda) rather than wraiths, on stupid AI front battlecruisers can look after themselves pretty well… meh

    I tried something similar to this in Civ 2 on a WWii scenario that came free with the game to see which country had the best set up for victory. Sadly when left to their own devices wwii became a harmonic peacelike land where all the countries lived in peace and harmony…

  44. Greg says:

    Aww, it’s a shame the hotkey theory has been rebuffed. I was going to start hotkeying loads of expensive units to a cheap one and send it first into every battle. (with the rest at home)

    I wonder how much effect the map had. Lots of people have pointed out the effecitveness of carriers against the AI and since there’s a lot of water on that map I wonder if air units are of dissproportionate strength.

    I wonder if they did the “play different AIs against each other and see what happens” thing to work out which AI to release with the game. An AI that spammed the top tier aircraft would probably be better against a human player, but it would lose to an AI that spammed the lower tier aircraft (which are typically very powerfull air to air)

    Also do the AIs work out how to build their waves based on “I need X units” or “I need X minerals worth of units” because if it’s the former that’d give a clear reason for a Protoss win.

    An’ I’m annoyed about that cheat. No wonder me and Laura never beat the AI on insane. We typically invoked a “take more than half the rescources on the map then turtle till our opponent is helpless” strategy.

  45. Saint_007 says:

    You know, with all these huge Protoss advantages in terms of both human and AI abilities, one has to wonder how the hell the Protoss got their asses kicked in-game not once, not twice, but about four times by the others (Zerg under Overmind, UED, Zerg under Kerrigan twice).

  46. BlackBloc says:

    I tried something similar to this in Civ 2 on a WWii scenario that came free with the game to see which country had the best set up for victory. Sadly when left to their own devices wwii became a harmonic peacelike land where all the countries lived in peace and harmony…

    I guess the Cylons had a point then, maybe it’s just us humans bungling stuff up. :)

  47. GAZZA says:

    You know, with all these huge Protoss advantages in terms of both human and AI abilities, one has to wonder how the hell the Protoss got their asses kicked in-game not once, not twice, but about four times by the others (Zerg under Overmind, UED, Zerg under Kerrigan twice).

    This seems to cover that.

  48. JohnW says:

    Shamus, have you ever read “Artificial Life” by Steve Levy? Excellent book, the most fascinating part deals with using evolutionary programming. I don’t know if this is at all possible with Starcraft, but you basically set up a system to randomly combine sets of AI code to create a new generation of code. You run many simulations, like you do here, and the most successful examples are “bred” together to produce the next generation. Lather, rinse, repeat, and it is eventually supposed to churn out an optimized set of code much more efficiently than using human programmers to figure out every possible variation.

    I explained it better many moons ago on the Total War forums, but can’t find it anymore. But you may want to check that book out.

  49. Fakey McFakerson says:

    I do know where the discs are, the problem is I tossed the Jewel Cases ages ago when all my games got plopped together into a binder. Now I have no CD-Key for them. I was really annoyed when I first discovered this blunder, but now it's kind of funny. Le Sigh… I even bought the damn game, too, I just can't play it.

    You can’t play online with this key.


  50. Deoxy says:


    The theory there is nifty, but in practice, it’s really very hard to do this in a useful way – you end up producing code that is VERY VERY good at… beating other code. Unless your code can grow big enough to have its own problem-solving skills, it will still have weaknesses that any semi-competent human can exploit.

    The only exception to this might be that AI can control all the units essentially at the same time, so it might be able to use THAT ability to defeat humans, but that’s hardly creating a good AI, it’s just using the input limitations humans face against them (and that’s really not a useful or fun way to play – wow, you can beat me with one person, even a relatively dumb one, for every single unit or controllable object you ever spawn, while I’m stuck with just me for everything – yeah, that’s fun).

  51. […] Games: Starcraft: Bot FightIn yesterday’s post on Startcraft AI, SolkaTruesilver mentioned here that it would be nice to have a way to make custom AIs for the game and pit them against each […]

  52. Downtym says:

    I would guess, but would need to watch a number of games to confirm, that the reason that the AI Protoss do better than the AI zerg or AI terrans is for the following reasons:

    1. The Protoss have regenerating health in the form of shields. This means that a unit in the protoss force is engaged at (effectively) full health. If a Protoss unit has 1 hp, but full shields then it’s pretty much exactly like fighting that same Protoss at full hp and full shields. This is because – on the whole – Protoss units are very squishy without their shields.

    2. The Protoss are an extremely “Form Follows Function” force. Zealots are excellent ground pounders that don’t need much in the way of support. You can build Zealots and upgrade them and have a very effective destructive force. As for Air combat, Scouts are extremely effective as well. Their missiles fire quickly, do incredible amounts of damage to other air units, and have anti-ground capability that allows them to pick off units which are not anti-air centric.

    3. On the whole, Protoss units seem to have more total hp out the gate then other units. The shields + natural hit points seem to error in the Protoss favor – compare for example the Paper thin Terran Wraith or the meaty Zerg Mutalisk with a Protoss Scout.

    4. The Protoss get one of the most valuable units in the game in the form of the Probe. An extremely cheap (once researched) unit which is permanently cloaked and provides field of vision for the Protoss. If information of your enemy is the greatest weapon then the Probe is an atom bomb of information warfare. To put it bluntly, there’s no way in this world that a cloaked unit should ever kill a Protoss unit.

    For the other races to succeed it requires a lot more combined arms effort. For example, to achieve the sheer Ginsu knife efficiency of the Protoss Zealot you need to mix Terran Firebats, Marines, and Medics. Of course, Firebats are a liability since – unlike Zealots – they can damage not other Terran units. Letting your Firebats get in a circle around a Protoss Zealot is guaranteed to be a Pyrrhic victory. However, the utility of the Firebat is that his splash damage is great *if* you can get the fiddly bastards in a chokepoint.

    For the Zerg, you need to pile on the Hydralisks and Zerglings. Hydras are perhaps *the* best common ranged unit in the game and Zerglings, once fully upgraded to Cracklings, can rip through enemy units and provide excellent blocking for Hydralisks.

    As to air units, neither the Terran or the Zerg have a very effective air force. Wraiths are made of paper and are clearly assumed to be cloaked while fighting. Mutalisks while cheap and great against massed air or ground due to their multiple hit ability do nothing to counter the Protoss who if they concentrate on massed units, do so through the Zealots and Carriers. Mutas versus Scouts is a slaughter in favor of the Scouts.

  53. Cineris says:

    Some quick notes – With the latest Starcraft patch, I believe, you no longer need your CD in the drive to play.

    Also, it doesn’t surprise me that much that Protoss are generally victorious in AI games. The AI is dumb about targeting interceptors instead of Carriers, and it doesn’t build enough BattleCruisers to auto-win as Terran. And Zerg air just can’t compete with either of those.

  54. Cutahlion says:

    Maybe someone already said this (no way I’m reading all those comments), but I bet it has to do with the campaigns.

    Which races are usually player races in the campaigns? Computer races? Include both the original and the expansion, especially the original, since that’s going to have the original AI any changes were likely built upon.

    I never really played the campaign, but I know the first game uses Terran a lot. So, if the hard levels of the campaigns don’t use Terran opponents as much as Zerg, and don’t use Zerg as much as Protoss, it makes sense for the developers to spend more time on the Protoss AI. That’s just my guess. Maybe the campaigns actually use Terran for the opponents in the ending levels. I really don’t remember much about the campaigns. But the more important a race is as an enemy in a campaign, the more time they probably put into it.

  55. Gary says:

    Just adding a note to the High templar thing. When I watched one scenario of this, I saw a couple templars all psionic storm a single area a couple times in a row… In a place where there were no units.

  56. Yahzi says:

    Best. Post. Ever.


  57. Ryan says:

    Thanks for sharing this. I love Starcraft and pull it out every once in a while. Knowing how the AI reacts is a great asset. I just wish there were a way to change how it runs so that maybe it would use different tactics.

  58. Kevin says:

    This doesn’t seem like an ideal scenario because there are too many random variables.

    What happens if you run different combinations of races on Blood Bath, or a six player map that is perfectly symmetrical?

  59. Else says:

    That was a really interesting analysis. Thanks for sharing it with the world.

  60. Renatus says:

    This is not true. Shields always take full damage, while their “health” damage is affected by armor and size.

    I’ve been playing Starcraft Broodwar for 10 years now. Many skirmishes vs AI and many against friends. This stuff is very interesting. I always like to take on 7 AI on a high resource map and watch the AI get ripped apart on my defenses. The best Protoss defense is 4-5 cloaked reavers in front of a bunch of photon cannons. Nothing gets through (only cloaked Siegetanks are better). Then I slowly destroy them with carriers, covered by corsais against those pesty scourges.

  61. Renatus says:

    Hmmm, something went wrong there. I replied on this line:

    If a Protoss unit has 1 hp, but full shields then it's pretty much exactly like fighting that same Protoss at full hp and full shields. This is because – on the whole – Protoss units are very squishy without their shields.

1 2 3

One Trackback

  1. By Twenty Sided » Blog Archive » User-made AI on Thursday Apr 10, 2008 at 11:56 am

    […] Games: Starcraft: Bot FightIn yesterday’s post on Startcraft AI, SolkaTruesilver mentioned here that it would be nice to have a way to make custom AIs for the game and pit them against each […]

Leave a Reply

Comments are moderated and may not be posted immediately. Required fields are marked *


Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun.

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>