# Game Theory Applied To Game Design

January 24th, 2009

Every modern real-time game has some form of rock, paper, scissor mechanics. As gamers we subconsciously know that such mechanics are there and that they work pretty well but no one ever explains why. With a little bit of game theory I can show you why but first I'll need to give you some brief game theory definitions.

What is a game?
A game is a framework involving two or more players where each player's success is determined not only by his own strategy, but by the strategies of all the other players in the game.

What is a strategy?
A strategy is a complete plan of action for a player that explains how he will behave.

What is a dominant strategy?
A dominant strategy is a strategy that does at least as well as every other strategy in all situations but does strictly better than every other strategy in at least one situation. (In a game of rock, paper, shotgun, the shotgun would probably be the dominant strategy.)

One Way To Win

Let's stitch this together in a computer game example. Let's say there are 2 people playing an RTS called Lugaru Wars. Each player has just enough resources to either make one wolf unit or one rabbit unit. Let's assume that winning the game earns the winner one point. Let's also assume that wolves always beat rabbits (the rabbits are not like Turner). Finally let's assume that the result of a wolf fighting a wolf or a rabbit fighting a rabbit is a 50/50 toss up where each player's expected winnings are half a point. Here's what the game would look like in normal form:

Payoffs are represented in the form (X,Y) where X is what Player 1 has won and Y is the winnings for Player 2. For more information on how to read and understand normal form games click here.

From looking at the payoff matrix, it becomes clear that building a wolf is the strictly dominant strategy. If my opponent builds a rabbit and I counter with a wolf, I get 1 point whereas countering with a rabbit gives me an expected value of 1/2. If my opponent builds a wolf and I counter with a rabbit I am guaranteed to lose and get 0 points whereas countering with a wolf, I can expect 1/2. Choosing to build a wolf makes me better off in every scenario. This game is not balanced because any player who is trying to win, builds the wolf unit all the time every time and the rabbits might as well not be in the game at all. (Bonus Fact: the "Nash Equilibrium" of this game occurs when each player builds a wolf.)

Balanced But Boring

How can this be fixed? Let's pretend that wolves are twice as powerful as rabbits, so that when two rabbits meet one wolf, it's a 50/50 toss up as to who will win. A quick fix for balancing this RTS is to make the rabbit cost half as many resource points as the wolf. So now with the same resources each player can build either one wolf or two rabbits. Now the payoff matrix looks like this:

In this game the strategy of building 2 rabbits is just as effective as building one wolf. One could try to argue that our work is done and we will now see a healthy mix of both units being built. However, this game is still very boring because the players don't care at all what they build or what their opponent builds. Each person says, "Hey as long as I spend all my resources building something, I can always expect half a point no matter what."

Mixing It Up

Ok, enough boring examples. Let's spice this up by adding another character. Let's say that players can again only build one unit each but now they can choose among a rat, a wolf and a rabbit. In this game assume wolves always beat rabbits but rats are sneaky enough that they can always ambush and kill wolves. Finally, the rabbits have such good hearing that the rats can not sneak up on them and rabbits can destroy rats every time. Here's what the game's payoffs would look like:

Now is there one dominant unit type that is always the best to build? No. Do players still feel indifferent about what they build relative to what their opponent is building? No, quite the opposite. Now each player really wants to know what the other player is up to so that he can build the right counter unit. The game is again balanced (each unit has equal merit) but there is no obvious strategy. (Bonus Fact: This balance here coincides with the fact that there is no pure strategy Nash Equilibrium in this game, only a mixed strategy Nash Equilibrium where both players are equally likely to pick any of the three units).

If you're going to allow the player a super-strategy, make its cost to the player proportional to its power so they can't execute it frequently. More importantly, make sure that the player can't derive a super-strategy that works in every situation. Game designers have an obligation to combine some weaknesses with the strengths for a given course of action so that instead of dooming the player to repeat his same old dominant strategy again and again he finds himself forced into situations where a new strategy must be derived.

One of the reasons I like Lugaru so much is that not only is it structured to have no dominant strategy, no move to beat all moves, but David actually programmed the AI to punish users that repeat one type of attack too many times in a row. Players are thus forced to experiment and become comfortable with a lot of different moves.

Can you think of any games that are famous for embracing mixed strategies with their careful balance? Do you have any thoughts on how to take these game design concepts further?