Developing StarCraft 2 Build Orders With Genetic Algorithms
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)."
Especially of the ones who frigging *know* what genetic algorithms are all about, as I expect a better half of /.?
Paul B.
P.S. Or was it auto-generated by a genetic algorithm? :)
I'd bet on human ingenuity vs generic build orders though. We learn build orders from each other and adapt far faster to disruptive tactics than any AI can at this point. Of course we can't watch 15 flash points at once...
For in politics, as in religion, it is equally absurd to aim at making proselytes by fire and sword. - Publius
Makes sense to me... do you know Starcraft or RTS's in general?
Make sure everyone's vote counts: Verified Voting
"insane" difficulty bots, i would imagine.
WÌÌfÍ--ÍSÌÒÍ...Í...ÌHÌÍfÍÍÍ--ÍÍÍ
I'd like to see a game that isn't a click-fest, but still would offer some action and nice visuals. Something with the gameplay involving giving orders to partially autonomous troops. After giving orders, you could watch and see how they fare and perhaps give some further orders, maybe with some possible penalty incurred for breaking radio silence. Or in the setting of a Total War type of game, there could be a limited number messengers who would take time to reach the troops and even have a chance to fail in delivering your orders.
;)
Still, it's nice to see geeks ruining games that can be dominated by simply knowing the best build order.
The entire summary is devoted to explaining what a genetic algorithm is, though I'm not convinced this is a particularly "genetic" genetic algorithm.
I've known this technique to be used frequently in game development. It sounds like someone is using it to find good opening gambits in Starcraft. I say "good", because generational algorithms can frequently find "local" optimal solutions, whereas there may be better solutions further away from your breeding start point. You're just never sure you've found the best solution.
The actual interesting points come in the details of the strategies the program found, but those are only really of interest to Starcraft nerds.
The ______ Agenda
All work and no play makes Jack a dull boy.
Lighten up.
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.)
Friend: "The NIC is misconfigured..." Me: "No prob, I'll just telnet in and fix it." *Silence*
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.
I would love to have a tool like this to solidify the "Theorycraft" behind build orders in SC2 :) I mean, I've got my build orders down pretty good now, but that doesn't mean a genetic algorithm isn't ready to punch my face :)
Nah, mutations, multiple iterations and choosing good stop conditions will avoid getting caught in local minmums. This isn't hill climbing.
No one just plays the dang game anymore. Its all about winning via pre-built key sequences.
"Have you ever thought about just turning off the TV, sitting down with your kids, and hitting them?"
Yes, I find the summary comprehensible and know what a genetic algorithm is. I don't know what an explanation of genetic algorithms is doing in the summary, though. Linking the Wikipedia page would be much more effective, since so many readers get nothing out of this explanation (either they already know what a GA is and, like me, are annoyed at the minor waste of time, or they don't and a brief explanation isn't enough).
Made sense to me. Granted lines from it are fail:
In other words, have the most successful reproduce.
Need help treating your acne? Come here!
This isn't very surprising, given that similar things existed for StarCraft 1. Namely, "Evolution Forge". It is the first successful implementation for SC2 that I've heard of, though.
However, through exploring SC1 build orders with Evolution Forge, I found that the mass of players manage to replicate the best build orders. I think this will likely be the case for SC2 as well - many man-years (or perhaps even man-centuries) have already gone into tweaking SC2 build orders, and human-tweaked schemes can be optimized for both speed and adaptability.
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.
How would you evaluate for fitness?
If you create X units of type Y - and the opponent has created units specifically to counter them, then its going to be 'unfit' - even though that it might have worked under other circumstances.
I think that the fitness function changes too rapidly during the game in order to be properly used. Also since GA take lots of time to properly function (which may include a lot of garbage) - I don't see this reacting fast enough to changes in tactics either.
So its an awesome idea - but I don't think a GA is the best tool for the job.
What do you mean "genetic-genetic"? The only thing that I can see that might be missing is a reference to "sexual reproduction" or "mating" in TFA, but I don't think that's strictly necessary for a GA. I especially liked the potential for "junk DNA" to build up. In my own simulations, chromosomes did either something or nothing consistently; perhaps it's just the domain that he's working in, but it certainly lends itself to "situational" expression of a chromosome.
It's certainly no Evolvable Hardware, but it's still a pretty neat idea.
Comment removed based on user account deletion
It's completely different. The whole point of evolutionary algorithms is that you start from a population of initial builds (the "previously entered"), and, at each iteration, it creates new builds by altering the existing ones at random.
Given enough builds, a lot of those alterations perform a bit worse than their original, and eventually gets removed, while others perform a bit better, and thus gets used as a base for other variations.
If your performance space is relatively smooth, that kind of approach is extremely powerful at finding minimas in the performance space. If it's very crinkled, it leads to chaos, but I don't think it's the case in this problem.
Yes, but it's painfully obvious. Even if I hadn't heard of it before, how can it not be obvious what a genetic algorithm is?
Also, they did not mention the problem of local maxima.
Choose my build order. Rock, paper, or scissor?
Nothing, because the only way to win is not to play.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Nothing, because the only way to win is not to play.
Unlike Blizzard's other popular game, where the only way to play is not to work...
Rampant carbon sequestration destroyed the Dinosaurs' tropical paradise. I'm here to help repair the damage.
I've often watched my brother who is a multitasking jedi play WoW, SC2, etc and I've often asked him why he does not go into day trading. The skill sets of managing a quickly changing massive amount of information and evaluating probabilistic results for gain is EXACTLY what real time traders do.
Computer games, role playing games (with emphasis on the statistical portion), war games, RTS...
When it comes down to it, it's nothing more than statistical simulations.
If some game company can overlay something like WoW or SC over a real time stock trading system,...well...we will see what happens when a bunch of people who spend hours every day optimizing probabilistic statistical systems to their advantage has on world financial markets.
Probably would make a good Sci-Fi Novel if nothing else
that this can be more efficiently calculated using simple linear programming. Solutions are then even sure to be optimal, in contrast to when using GAs.
It's not a matter of intimidation or fear of losing. Memorizing sequences requires memorization skills and the desire to use them, nothing more. If I choose not to memorize, for whatever reason, playing against one who does becomes unsatisfying. If I out-think their canned routine, what satisfaction do I get? If I slip and their canned routine runs over me, what have I learned? The other player wasn't really responding to my moves. I would learn as much from studying a book. Why am I playing this person if they are going to act like a machine? They are not personally engaged in what we are doing. It's like going for a walk on a fine sunny day and meeting people who are plugged into their music systems. We are in two different worlds; they don't hear the birds I hear nor can they adequately respond to a greeting.
What the algorithm can't take into effect is micro and positioning in battles. Just because you have a more powerful army doesn't mean you will win the battle.
In a "crinkled" search area you are more likely to find local min/max and have to plan for that but that isn't the same as chaos. I could be misunderstanding your meaning though.
Sounds all very sensible to me! Don't understand a fucking word of it but it sounds all very sensible.
A closed mouth gathers no foot.
This is not necessarily original. Douglas Lenat used EURISKO (http://en.wikipedia.org/wiki/Eurisko) to win the Traveler RPG (http://en.wikipedia.org/wiki/Traveller_(role-playing_game) "Trillion Credit Squadron" championship in the early 1980's. Lenat got the attention of DARPA and later formed the company CyCorp (http://www.cyc.com/).
If we were to encounter an alien race...
Think American Indians, you are 99.9% right
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 http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/daily/mr11 and http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/daily/mr220a
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 http://www.lurkerlounge.com/forums/thread-10277.html)
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.)
I haven't lost in almost a month, it's also pretty easy to do.
I just don't play the game anymore...
I don't have an intelligent phone, so I need to be.
Publius (or Gaius) Cornelius Tacitus brought us "tactics", and Strategos, plural strategoi Attic-Ionic (Greek: , pl. ; Doric Greek: , stratagos; literally meaning "army leader") brought us "strategy".
Strategic planning is _all_ about logistics. Your comment seems to infer a distinction that doesn't exist there.
Strategy is getting you units to the right places with the correct intelligence and provisioned and equipped for their task.
Tactics is executing your task in the best possible manner, with contingencies considered and ready for the fact that no plan survives contact with the enemy.
For instance, while people often (mis)describe Chess as strategic, it is mostly tactical. The only vaguely strategic element of chess is that there is a hierarchy of threat used as "support" for a piece. e.g. if you take my knight with your queen, the rook that covers it will get her. This is pure tactics.
Most "real time strategy" games actually fail utterly to be strategic in any form. They have economy and they have tactics, but they lack all forms of proper strategy. You don't ever have to "supply" your units, so you never have to have "supply lines". That means that you don't really have to control an area of the map in a proper sense.
Were I to make StarCraft actually strategic:
Zerg would only take orders if there were a sufficient number of overlords "close enough" to the units in question to pass those orders. There would also have to be a chain of overlords to bridge the distance between a hive and the directing overlord in question. Units not directly under control would drift, do random things, and possibly squabble. Unit groups under "insufficient control" would get sloppy. If an overlord becomes isolated from all hives it and its units will become defensive and put out a "distress call", and some hive will extend an overlord chain towards that position. Said chain would unreel from the base (closest overlord would advance to a controlling position, the ones behind it would move as well, and back near the base a new overlord would be dispatched to fill the trailing gap etc.) A set of units can be tied to a particular overlord and then given "standing orders" to guard or patrol, such a unit will persist in this action without further control (e.g. it can be isolated deliberately or accidentally) but its orders cannot be changed at all until a control conduit is restored.
The Terran forces would have (automagic) runner units that would resupply field units. There would be no build cost for these guys, and there would be a good number of them as they would appear on demand. But they would be destroyable. The player could assign particular supply depots to particular units if he would like, and drop routing flags that the runners would "want" to run between. Each supply depot would be able to generate a particular amount of supplies per minute, but they could charge like batteries and there would be an default "expected peak demand" based on proximity and or tuneables. It would therefore be useful to have supply depots near combat locations. As units run out of supplies their fire rates slow and eventually stop. A unit can be flagged "do not resupply" and will receive no runners (needed for ghosts etc so that the runners don't reveal the ghost) but when the unit goes hungry it will be useless until the flag is removed and a runner reaches it. "Priority supply target" can be set for the reverse condition so that a main defensive position can be maintained "at all costs" etc.
For the Protoss, any unit that leaves the field of a Pylon would gain a chain of lights (destroyable micro pylons) to power it. Isolated pylons would generate their fixed power. The first time a unit moves to an isolated pylon its chain of lights would span to that pylon, connecting it to the grid. Any unit that isn't "locked" to a pylon would automatically re-anchor its chain to the last pylon it was powered by. Units within one-light of the nearest pylon don't need the light (to reduce graphics loa
Innocent people shouldn't be forced to pay for inferior software development.
--"Code Complete" Microsoft Press
If we were to encounter an alien race, I wonder if we would really be the top on the food chain....
Depends how we encounter it.
They visit us? They could introduce themselves by dropping bombs from orbit.
We become space-faring and encounter them? Well our first alien encounter then could be anywhere from the aforementioned super-aliens to a few monkeys still making rock-tools.
I believe it is the one with the least negative impact on its environment that has more right to live, and unfortunately , this would make us first in line to die as a species.
Except your "right" to live is a dreamed-up human notion. Objectively, you have no more or less right to life than a dog because the universe doesn't even consider your rights. As for the dog, it isn't considering its "rights" when it defends itself from a predator or otherwise, the dog just knows that it wants to live. In most cases, we're about the same. Our "rights" really have no impact on a situation involving someone who really wants to kill us.
So does that mean that even if you want to live, you have no right to live per se on this planet, you would have to simply live because you are able to do so by overcoming your predators...
With that in mind, if we were to be overrun by aliens, and became their cows for their consumption,
such as the wraith in stargate atlantis...you would have no real reason to be upset that you are enslaved as to them you have no more intelligence then what cows seem to have to us.
This is a subject I find most peculiar, as you get to see what people consider their rights as humans vs. their rights as species living on a planet with more then 1 species to consider.
Yep, and yet we seem to feel so bad about what we have done as "white men" we are giving them land and casinos and money to compensate, where as if this really was the order of things, we should feel no remorse what so ever.
Insane's build queues are all 50% time. And time is sort of the biggest resource in the game ;)
You better watch out, there may be dogs about . .
The main weakness is when you score prematurely as "fit" or "unfit". A line derived from adequate but lower-scoring stock in a certain generation may actually prove to be very high scoring after a few more generations.
Always choosing just the "most fit" or "highest scoring" from a particular generation isn't really optimal and isn't really how genetics work, either. Taking all of the top half of each generation and intermingling their offspring later would be more realistic genetically. It may also produce better final offspring after some number of generations.
The major drawback to using many more inputs per generation is you end up with vastly more runtime and memory involved to compare them at every generation. You may or may not see better final candidates for it.
Yes, I remember X-COM 3 attempted something like this. Very, very nearly a great game.
And such a scheme won't work with 3+ players, and only with 2 if you can synchronise slow down eg units automatically see each other at the same time.
I wonder if there's a way to apply this research to make it easier to win web-based RTS games like the awesome Lacuna Expanse? Check it out, it's totally awesome. Like a cross between Tradewars and Star Control.
- In Soviet Korea, only old people loose all their bases to Natalie Portman's petrified hot grits overlords.