Sponsored By

Using payoff matrices to analyze game actions

Finding dominant strategies in strategy games can be a time consuming task. Often we try to brute force it with lots and lots of playtests. But if your game has well defined actions and rewards you can shorten the process by calculating a payoff matrix.

Filip Wiltgren, Blogger

June 22, 2015

6 Min Read
Game Developer logo in a gray background | Game Developer

Sneaky Snails cardI’ve got a game design in progress, a very simple one, where kids race snails around a track. It’s aimed at the 4+ age market with a very simple mechanic: chose a card depicting a snail, reveal simultaneously. Cards are the snails you want to poke. If your snail isn’t poked it moves one step. If it’s poked exactly once it moves two steps. But if it’s poked two or more times it gets scared and crawls into its shell. Easy enough that a small child could understand it.

I’ve got a game design in progress, a very simple one, where kids race snails around a track. It’s aimed at the 4+ age market and I couldn’t “#¤!”# understand why it didn’t work.

With two players it worked like a charm, letting the players play each other, letting you try to guess if the other would play their own snail, yours or none. But once I added in a third player the whole thing fell apart and I couldn’t understand why.

Here’s a hint: A beautiful mind. Yeah, the movie with Russel Crowe (if you haven’t seen it, go do so now, I’ll wait). It’s a great dramatization of John Nash’s brilliant mathematical theories and subsequent fall into schizophrenia. Except that it gets the math parts wrong because the game theory situation depicted in the movie isn’t a Nash equilibrium.

What’s a Nash equilibrium you ask? (If you didn’t ask that, let’s pretend you did so I can look smart.) Well, a Nash equilibrium is a situation in a game where each player has decided upon a course of action and for each player, if that player would unilaterally change their course of action they would get a worse payoff.

AbaccusThat’s what was happening in my Sneaky Snails game. With three players you always wanted to poke your own snail so that you’d go two steps and every other player wanted to do the same thing. Sure, you could poke someone else’s snail and since they were poking their own snail you’d stop them. But that would mean that they’d go 0 steps, you’d go 1 step and the third and last player would go 2 steps. By changing you’d get a worse result than before. (Ok, so I lied, this isn’t a true Nash equilibrium as you’re improving your position against one of the other players.)

Then I came up with a brilliant solution. I’d have each snail card depict two colors: yours an another. And you’d still get to chose not to poke a snail or to poke your own snail and nobody else’s. But I couldn’t figure out if this would solve the problem.

What to do?

Analyze each possible outcome using a payoff matrix.

A payoff matrix is a tool where you write down every single outcome of every single combination of events. In my case that’s four choices for three players, or 4 * 4 * 4 = 64 events. Each of these events has three payoffs (one for each player), meaning 192 different payoffs.

Payout matrixThat sounds a lot but in reality, even giving each payoff 3 seconds to fill in that’s only 576 seconds or about 10 minutes of work. It doesn’t take quite that long, the match is extremely simplistic and you can fill in the payoffs en masse as you’ve got stretches of numbers that are combinations of the same two elements and I could omit an entire line as the payoffs for playing B and C cards for player A are exactly the same (albeit mirrored).

Then you add up all the payoffs for each card played by the player you’re looking at. That will give you one of the small matrices bellow. In the right one, looking at a no-poke card (the 0 on the first line) shows that it’s slightly more advantageous for the other players, playing an S card is somewhat more advantageous but playing a B or C card is very bad for one player. However, if you total up the scores for each column you’ll notice that they all sum up to 75, meaning that there’s no clear advantage for any one player – the outcomes are equal and the gameplay falls back to playing the players (as is intended) rather than breaking the game system.

More importantly, if you look to the payoffs themselves you’ll notice that for any given combination there’s no situation where no player can get a better result by changing the card they play. That means that there are no Nash equilibriums in this version of the game. It really does go down to outguessing your opponents.

A concrete example of this: assume that A and B play 0 cards (they don’t poke any snails, depicted in the first four columns of the top row) then there is no square where neither A nor B nor C can profit by changing the card they’ve played (moving to the payoffs in a lower row for A, skipping to the right by an increment of four squares for B or choosing another of the four original squares for C). Note that you’ve got plenty of squares where you’ve got a 2/2/2 payoff, that is a maximum payoff for each player. It’s easy to be fooled into thinking that this is a Nash equilibrium since each player scores the maximum possible points. But that’s a false equilibrium since a player can change their card and block another player (that player gets zero) without lowering their score, meaning that they’ll improve their position. Their relative payout will increase, and this is a game where the relative payoffs matter, that is, a payoff of 0/0/0 is equal to a payoff of 2/2/2 (so I should perhaps have written payoffs down as their relative value but that would take more counting and their absolute value is enough for me to do the analysis).

As you can see, what I’ve done here is to write out a three dimensional matrix in two dimensions, the “skip to the right by four squares” is really saying “move up one matrix from the level of the paper” as all of C’s matrices are written to the right of each other (that’s what the top row, the one starting with A and B/C does, show which combination of B’s and C’s matrices we’re in).

Err… I’m starting to feel that the more I write the more complex this seems. It’s not. It really is quite easy. Just google “payoff matrix” if you don’t believe me. Or better yet, google payoff matrix and find someone who’s better at explaining this than I am.

It will make it easier for you to analyze your games.

------------

This post previously appeared on Wiltgren.com - Game Design, Writing, Productivity

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like