Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
Programming Real Time Strategy (Games) Games

Developing StarCraft 2 Build Orders With Genetic Algorithms 200

Jamie recommends a blog post from software engineer Louis Brandy explaining how using genetic algorithms to evaluate build orders in StarCraft 2 has led to some surprisingly powerful results. Quoting: "One of the reasons build-order optimization is so important is that you can discover openings that 'hard-counter' other openings. If I can get an army of N size into your base when you do opening X, you will always lose. ... a genetic algorithm is a type of optimization algorithm that tries to find optimal solutions using a method analogous to biologic evolution (to be specific: descent with modification & natural selection). Put simply, you take a 'population' of initial build orders, evaluate them for fitness, and modify the population according to each element’s fitness. In other words, have the most successful reproduce. The program’s input is simply the desired game state. In practice, this means 'make N units' to determine some rush build order (but it also allows for other types of builds, like make N workers with some defensive structures and a small army)."
This discussion has been archived. No new comments can be posted.

Developing StarCraft 2 Build Orders With Genetic Algorithms

Comments Filter:
  • by John Pfeiffer ( 454131 ) on Tuesday November 02, 2010 @02:45AM (#34098498) Homepage

    Who knows, with the help of this kind of technology, maybe I can play against Koreans without BEING HORRIBLY MURDERED! (Until they start doing it, at which point we're all proper-fucked.)

  • by Anonymous Coward on Tuesday November 02, 2010 @02:46AM (#34098504)

    Traditional RTSes are all about memorizing the optimal build order (which apparently can now be calculated via an algorithm, removing the player almost entirely) and then being able to click really fast, and this is why I think it's a terrible genre. Hand-eye coordination should not even come into play in a game that calls itself a "strategy" game.

    There are exceptions--those that aren't traditional RTSes, but are more real-time tactical games that focus on maneuver, flanking, suppression, and other actual military tactics instead of gathering resources and base-building.

    The problem is that strategy is not inherently real-time and that too many people confuse tactics with strategy. The only games I've played that effectively combine the two are those that keep them completely separate, like the Total War series.

  • by Kenja ( 541830 ) on Tuesday November 02, 2010 @02:56AM (#34098534)
    No one just plays the dang game anymore. Its all about winning via pre-built key sequences.
  • by cigawoot ( 1242378 ) on Tuesday November 02, 2010 @03:07AM (#34098584)

    Exactly. An AI could win by exhibiting super-human micromanagement by engaging enemeies in several locations at once, diverting the attention of the human player. Unlike Chess, which is a turn-based game, Starcraft 2 is a real-time game. This gives people who can manage multiple conflicts at once while still pumping out units and maintaining their economy will prevail. An advanced AI would roflstomp a human. Blizzard's "Insane" AI for multiplayer still follows the rules of human skill. An AI bot designed to crush a human opponent would not limit itself like that.

  • by FrootLoops ( 1817694 ) on Tuesday November 02, 2010 @03:21AM (#34098612)
    TFA's method is designed to optimize rush builds, where the goal (ex. 7 roaches ASAP) is specified by the human. It wouldn't work at all for longer games where you have to respond to your opponent, since then your goals depend on what they do. At best, I'd say this method (1) provides strong but inconclusive support for the quality of various opening builds; (2) might find better opening builds that are not commonly known to humans. (2) seems much less likely than (1). I wonder if a brute-force all-branches approach is actually possible or even better than a genetic algorithm. For the first few minutes of SC(2) you don't have many options, so the branches wouldn't become horrifically numerous until several minutes in.

    In any case, this method depends on humans to specify its goals and doesn't work in larger situations. I don't think there should be any concern about this type of AI beating "human ingenuity".
  • by Nursie ( 632944 ) on Tuesday November 02, 2010 @03:29AM (#34098628)

    If I get SC2 I'll play the single player campaign only.

    I'm really not interested in being pwned by someone who has a bunch of rush tactics memorised, let alone someone who's used genetic algorithms to optimise their deployment/build strategy.

  • by Warma ( 1220342 ) on Tuesday November 02, 2010 @04:02AM (#34098732)

    A lot of people seem to complain about this and especially about the realtime requirement in strategy, but the truth is that in addition to the kind of economically suboptimal rush build orders you seem to hate, there are strategies designed to securely carry you into the midgame, where the opponent no longer benefits from memorized build orders.

    Moreover, the whole gripe seems misplaced, as I doubt that the same players are against people memorizing openings in chess, board states in go or probabilities in poker. It's simply being intimidated by people better in the game than you - being afraid of losing. You must realize that a video gaming company the size of Blizzard is very aware of this, and the whole mentality is precisely why Starcraft has a very friendly ladder system, which tries to match you against people of your own skill level.

  • by Lloyd_Bryant ( 73136 ) on Tuesday November 02, 2010 @04:04AM (#34098742)

    I remember reading a review of one of the early RTS games that pointed out that they weren't so much strategy games as logistics games; the reviewer predicted the failure of the genre on the basis that everyone wants to play the general, they don't want to play the quartermaster. Obviously, he was wrong, and a lot of people do want to be the quartermaster; but he captured what I've always found so boring about RTSes.

    What we call "strategy" in in fact mostly a matter of logistics - having a perfect tactical plan is worthless if you can't keep your troops supplied during the course of it. RTS games are generally just a simplified/idealized version of how things work in the real world.

    Amateurs study tactics, professionals study logistics

    (attributed to Gen. Omar Bradley)

    It sounds like what *you* want is a large-scale RTT (Real-time tactical) game, where all you have to worry about is deciding on which units to move and where to move them. Personally, I would consider *that* boring, as it removes a lot of the complexity that makes a good RTS challenging.

  • by khchung ( 462899 ) on Tuesday November 02, 2010 @04:12AM (#34098768) Journal

    No one just plays the dang game anymore. Its all about winning via pre-built key sequences.

    Yes, and nowadays football games are all about winning using pre-planned passes, and chess is all about memorizing opening moves. /sacarsm

    At your level when ppl are just learning how the game works, then, yes, a pre-planned built sequence can often win you the game. Much like a football team with well practiced passes can win low level games with little more than executing their practiced passes. Or beginning chess players can win games by playing from memorized opening moves.

    However, once you reached a higher level, then if you cannot adapt your strategies to the situation at hand, you WILL lose against opponents who can.

    This is the same with ANY competitive sports.

    Yes, that involves a lot of practice and hard work. Seems like you just never reached that level. (Neither did I, BTW). But you can see it in the pro-level SC games in Korea. How the players respond to the unexpected is what differentiates good and not so good players.

  • by spottedkangaroo ( 451692 ) * on Tuesday November 02, 2010 @05:29AM (#34098960) Homepage

    I think the point of your post is clear and correct. I'm not arguing that at all, but...

    Or beginning chess players can win games by playing from memorized opening moves.

    I don't actually play chess, but I know a few people who do. I think you actually have this backwards. You can get by playing the game at the low levels, but if you want to get advanced you need a really big library (of actual books) so you can memorize things. You have to get to the very very top to get back to playing.

    I'm not saying there isn't a lot of thinking and analysis going on, but it appears to me (from the outside and from comments from "expert" level players) that memorization is key to winning chess at the higher levels.

    Then again, I'm told (by an expert level player who hates this) that it can be hilarious to memorize archaic openings that nobody bothers with and using those as your opening, so you can hopefully get to a middle game that isn't memorized.

  • by murdocj ( 543661 ) on Tuesday November 02, 2010 @08:20AM (#34099502)

    it's been that way since war2 and before. I remember learning build orders from cases ladder players on war2+kali. Oh how fun that was, smashing face with bloodlusted ogres then dragons. Such a simple strategy, it normally lost to good micro of someone doing almost exactly the same thing (or worse, quick upgrade grunt rushing.)

    Star Craft build order discussion became a bit of a national past time in South Korea before the release of SC2, now that's the primary focus.

    I loved it in war2 when someone came at me with dragons. Dragons took forever to build. cost of a ton of gold, and were easy to kill. Took a little bit of micro but I was awful at micro and I managed to do it... a mage to slow them, a blizzard, and a couple of archers and they were dead.

  • by jonaskoelker ( 922170 ) <jonaskoelker&yahoo,com> on Tuesday November 02, 2010 @11:59AM (#34101636)

    Video games are designed to be fun

    For whom? What do people consider fun? Do all people consider the same kinds of things fun?

    I think the answer is no. In the case of Magic: The Gathering (the card game), Mark Rosewater (lead designer) thinks the answer is no---his three psychographic profiles Timmy, Johnny and Spike want different things. See [] and []

    I think these apply reasonably well to Starcraft (and RTSes in general). Let me describe them briefly, in terms of Starcraft 1:

    Timmy wants to make a splash; he wants to build big units and cause a splash; he likes tanks, nukes and carriers.

    Johnny likes quirky and underused combos; he plays the oddball strategy to see if it might just work---"I have to try statis-fielding my own units to trap the opponent on one side of the ramp", or "Can I reliably win using only melee attacks?"
    (Johnny also likes to make quirky RPG builds, in the style of MongoJerry's pacifist Diablo II necromancer, see [])

    Spike plays to win, and will play whatever is effective. Do you 9-pool or overpool on a 128x128 map? Does the answer change on 128x192 maps? How do you react when the opponent goes for +1 attack _before_ +1 defense vs. after? How good are our relative zergling micro---do I win mirror battles?

    These aren't hard-line categorizations; they're attributes you can have more or less of. (I'm a multiclass Johnny/Spike, FWIW.)

    They will sacrifice [anything] if it will the game more fun. If that means the AI can be beaten, so be it.

    For Spike, if you nerf the AI, you make the game less fun. If godlike micro lets Spike defeat human opponents, he wants an AI to help him hone his godlike micro skills (yes, they _will_ be godlike).

    He will want an AI with human-like micro skills, so that he can simulate the real deal closely; he'll also want a different AI that will let him train specific skills---say, a macrobot AI vs. him self-imposing a macrobot playing style; or a custom scenario where you have to multi-task between microing a unit being chased and building your base to defend against the "5 minutes no rush" rush.

    Thats what Spike wants. That's what's fun to him. Especially if he's Korean :-)

    I don't think you get to tell him he's wrong (it's a chocolate vs. vanilla thing). I think you, if you're the right person in the right job, gets to decide that you want to make a game that appeals more to Timmy and Johnny. I don't think you get to decide that there are more Timmys and Johnnys in the world; that's an empirical question. You do get to comission a survey, though, and base your product development decisions on that survey.

    (Based on recent developments in popular games, as I see them mostly from the outside, Timmy is the hot new market segment.)

Truth is free, but information costs.