# In figuring out what makes video games fun, the mystery is in the math

**FIRST OF TWO PARTS** — Most people don’t associate math with fun. Video games, on the other hand — whether *Angry Birds*, *World of Warcraft* or good old *Pac-Man* — send the fun meter berserk. U.S. video game sales topped $16 billion in 2011. Yet it turns out that math — not those sales numbers, but hardcore abstract mathematics — can tell us something about the fun of playing video games.

Video game designers spend a lot of time thinking about what makes games fun. Today, much of that thinking is influenced by the work of Nicole Lazzaro, an award-winning game designer with a psychology degree from Stanford. Several years ago Lazzaro and her team at XEODesign conducted some research: They watched and analyzed the faces of dozens of people playing popular video games.

Lazzaro realized that the more than 30 emotions experienced by game-players could be classified into four quadrants of fun: People Fun, which relates to interactions with others, teamwork and competition; Serious Fun, which creates emotions about something valued (like playing a game to lose weight or blow off steam); Easy Fun, which inspires curiosity or delight (such as choosing any car you want in *Grand Theft Auto* or that silly, spiraling sound effect when Pac-Man dies); and Hard Fun, which Lazzaro describes as the opportunity for challenge and mastery.

“People play games not because they are easy, but because they are hard,” Lazzaro writes in her chapter in *Game Usability*, a book published in 2008. Hard Fun is a cycle of three emotions: First there’s frustration. Then comes a feeling for which there is no English word, so gamers borrow *fiero* from the Italian. Fiero is akin to triumph, and is often accompanied by screams of “Yes!” and fist-pumping. As fiero’s glow fades, there’s relief. Game designers have lots of tricks for incorporating this cycle of Hard Fun into games, such as adding extra bonus coins, but creating Hard Fun is no small thing. It requires enough frustration that players aren’t bored, but not so much that players give up, perhaps destroying their game consoles in the process.

Strangely, that cycle of Hard Fun characterized by Lazzaro seems to have a mathematical doppelgänger. New work analyzing the computational complexity of more than a dozen video game classics from the 1980s and 1990s suggests that, computationally speaking, the complexity of a game directly relates to how fun that game is to play.

Giovanni Viglietta, a doctoral student in computer science at the University of Pisa in Italy, began by determining the category, or class of computational complexity, of games such as *Pac-Man*, *Lode Runner* and *TRON*. One way that scientists talk about this complexity is in terms of how many resources it takes to solve them. The traveling salesman problem, for example, wherein the task is to find the shortest route for a salesman traveling to several cities, visiting each only once, belongs to a class of problems known as NP. There’s no tidy algorithm for solving an NP problem, but if someone hands you a solution, you can verify if that solution is correct in a reasonable amount of computational time.

It turns out that in terms of the math, *Pipe Mania* is both “NP-hard” and “NP-complete,” two special classes of NP, Viglietta reported online January 27 at arXiv.org. *Pac-Man*: NP-hard. *Lode Runner* and *Starcraft*, also both NP-hard. And this mathematical hardness relates to its fun, says Viglietta. “If a game is NP-complete, or NP-hard, it means it is fun because you don’t have a simple strategy, but have to devise new strategies on the fly.”

A few of the games Viglietta assessed, such as *Prince of Persia*, fall into a different class, known as PSPACE-complete. These problems are solvable with a reasonable amount of computational memory. Both NP-complete and PSPACE-complete games are hard and demand creativity, says Viglietta. But the games described by PSPACE math can be frustrating to the point of boring. “Even if you have a strategy that you know works, it can take a really long time to achieve the goal,” he says.

Figuring out whether a problem belongs to a particular complexity class doesn’t relate only to how fun it is to tackle. Science’s brightest minds have long been frustrated by a more general puzzle: whether the category NP (the set of problems for which a computer can *verify* a solution quickly) is the same as the category P (problems for which the computer can *find* that solution quickly). Because computational difficulty relates to things like how hard it is to crack a security code or find the structure of a protein, the answer would fundamentally change computer science, cryptography and even biology. It would also win the bright mind who figured it out $1 million from the Clay Mathematics Institute in Cambridge. Fist-pumping would be in order.

SN Prime February 20, 2012 | Vol. 2, No. 7