Sponsored By

The Designer's Notebook: Numbers, Emotions, and Behavior

Can games be realistic emotional simulators? Game designer and writer Ernest Adams explores in depth how AI might actually emulate human emotions.

Ernest Adams, Blogger

January 27, 2009

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

[Can games be realistic emotional simulators? Game designer and writer Ernest Adams explores in depth how AI might actually emulate human emotions.]

Computers were first invented to crunch numbers for their own sake. Charles Babbage's Difference Engine was built to calculate polynomials, and Lady Lovelace wrote the first known program for his Analytical Engine to compute a sequence called the Bernoulli Numbers.

It wasn't until later that computers began to be used for applied tasks such as figuring out trajectories for artillery shells. Later still, computer games were invented. We put a veneer of meaning on top of a mathematical simulation to create an imaginary world, but often the veneer isn't very thick. It's particularly noticeable in economic simulations and role-playing games. You win the game by watching the numbers on the screen.

This makes sense in economic simulations, especially ones that are supposed to serve an educational purpose. Recently, I got a chance to play a beta version of a funky little game called Super Energy Apocalypse from Brain Juice Games. Its designer, Lars Doucet, characterizes it as "Sustainable energy use... AND ZOMBIES!"

Every night your community gets attacked by zombies (actually, garbage-eating aliens disguised as zombies... it's a long story). To win the game you have to develop non-polluting energy sources to power your defenses. Zombies love smog and nuclear waste, so you have to keep your eye on both the energy production rate and the amount of smog and waste you're creating in the process. It was fun, and, as it's based on real-world power generation systems, I learned some things.

For the most part, though, I'm starting to find myself a bit tired of games in which the mathematics are so close to the surface. I love role-playing games for the exploration, the stories, and their large variety of characters and locations, but I'm less enthused about the constant trading and upgrading.

All that emphasis on gear seems distinctly nerdy to me. There's not much difference between bragging about your Superior Glowing Voulge of Major Whacking, and bragging about your overclocked liquid-cooled Alienware PC with the Go-Faster LEDs in the case.

RPGs are about character growth, but it's all character growth as expressed in numerical terms. At the end of the game your character is faster, stronger, more dexterous, and so on; you have the figures to prove it. But he might as well be a robot as a human being. There's precious little of what we might call psychological character growth -- growth as a person.

So I'm starting to think about games that turn numbers into behavior. Of course, many games use finite state machines for their characters' AI, and the finite state machines take numerical values as input. ("If the enemy is within range, switch to attack mode.")

But these machines don't change -- the characters don't grow and learn to change their behavior. And as designer/professor Michael Mateas pointed out, finite state machines can't walk and chew gum at the same time -- i.e., they only exist in one state at a time, so they can't exhibit complicated mixtures of actions.

An early example of a "character" apparently changing its mood and behavior in a sophisticated way appeared in Chris Crawford's Balance of Power. I've written often about this game because it was both brilliant and unique -- a simulation of superpower geopolitical maneuvering that, so far as I know, has never been tried since.

It was a single-player game. You played either the USA or the USSR, and you tried to maximize your country's prestige at the expense of the other side, in part by facing them down in a series of diplomatic crises. (The Cuban Missile Crisis is the most famous real-world example.)

In each turn, both sides undertook various diplomatic activities (such as forming alliances) in smaller countries around the world, and in the next turn, each side had the chance to challenge the actions that the other side took -- a crisis. When a crisis erupted, one side or the other would eventually have to back down. It was essential to choose your battles carefully, because if you provoked the other side into nuclear war, you lost the game.

Balance of Power was such a hit that Crawford wrote a book explaining how it worked, right down to the equations he used. The book was called Balance of Power: International Politics as the Ultimate Global Game. It's long out of print, but Crawford has made a plain-text version available on his own website. I think it's a must-read for any game designer: a clear and intelligent explanation of how mathematical formulae turn into behavior.

There weren't really characters in Balance of Power, but the actions of your AI opponent sort of felt like the actions of a government, and Crawford enhanced this feeling with the diplomatic language he used to announce their activities. The language could be tougher or more conciliatory depending on how the other side was "feeling."

Crawford created a variable called pugnacity for each side, and another called nastiness which applied to the whole game. Pugnacity started at a slightly random neutral value (higher for the Russians than the Americans; this view is now rather outdated) and got higher or lower as its side engaged in aggressive or conciliatory behavior respectively. The overall nastiness of the game was increased by military activity and crises, and only went down with time.

As Crawford says in the book, "The effect of these two terms is to create a mood to the game. Players who pursue confrontational strategies will increase their own pugnacity and the game's nastiness.

Executed properly, such a ruthless strategy will encourage weak nations to Finlandize to the player. [note: in political parlance, "Finlandize" means to align themselves diplomatically with the player's country, a valuable achievement for the player.] But minor slips can cause the other superpower's pugnacity to increase and your own pugnacity to fall as you find yourself backing down too many times in crises."

If you play the game often enough, you can actually feel this mood. Aggressive actions will cause the other side to become more hostile as well, but showing too little backbone will cause the smaller countries to think you're weak and align themselves with the other side. You can tell when you're not getting any respect.

Pugnacity, diplomatic respect, and geopolitical prestige are emotional concepts that we don't often see in video games, and certainly not in 1985 when Balance of Power first came out.

About five years ago I wrote a column called "What Evil Lurks in the Hearts of NPCs?" In it I talked about making truly three-dimensional characters -- characters that behave inconsistently (and therefore realistically) because they have internal conflicts. For example, instead of characterizing one person's feelings about another with a single numeric attribute that runs from negative (I hate him) to positive (I like him), suppose we create two attributes, one for love and one for hate.

If there were a lot of love and no hate, they would be friends (or more!); if there were a lot of hate and no love, they would be enemies; but there could also be a lot of both, which does occur in certain circumstances. You would then have to craft a behavior system that expresses this internal conflict.

I don't know exactly what's going on inside Façade, Michael Mateas and Andrew Stern's brilliant experimental game about a failing marriage, but the characters definitely have mixed emotions about each other. The Sims, too, turns numbers into human behavior -- though perhaps in a less sophisticated way that Façade did. Façade is about a specific pair of individuals and their friend, the player's character.

The Sims allows the player to create any sort of person she wants, so it has to have a generic model of relationships and behaviors that would work for anyone. But in both cases, these games produce their visible output as human interactions. The player doesn't get any convenient digits or power bars. She's not supposed to be thinking about the game's characters as simulations, but as real people.

Façade uses language, which introduces all sorts of complications -- because a conversation has to flow intelligibly even as the words chosen reflect the speakers' emotional states. The Sims only uses Simlish, but the characters still express their feelings to a degree through the symbols that appear on the screen, and they still have certain decisions to make: do I continue to talk to this person or stop and walk away; do I interact with him or her physically, embracing, kissing, slapping, fighting, and so on.

Such a system is extremely complicated to develop and even more complicated to test, especially if the characters are capable of feeling conflicting emotions. If a character behaves inconsistently, is it a bug or a legitimate expression of his feelings?

I think there's another area where we could improve our emotional simulation and thereby produce richer behavior.

Sometimes in a movie, you'll see a scene in which a woman has been frightened or angered by something her lover has done. She attacks him ineffectually, shouting abuse, but a moment later slumps weeping into his arms. Her initial fury dissipates almost immediately and she forgives him -- especially if the audience knows he wasn't really at fault -- as her love for him and desire for the comfort he offers takes over.

The man does nothing except tolerate the abuse at first, and then behaves soothingly as she breaks down. I think Marion Ravenwood did it to Indiana Jones in the original Raiders of the Lost Ark, and I've seen in it several other films as well, but I've never seen it in a video game.

It's kind of gimmicky, dramatically speaking -- you don't see it very often in real life. But the whole point of making computer simulations of human emotions in video games is to produce dramatic results in a medium that is, at the moment, pretty dramatically lifeless. I mention it because it nicely illustrates a mechanism that we don't often use.

Most of our emotional simulations use a simple sensation/calculation/behavior loop. Someone says or does something to a character; this influences his emotional state; he acts upon his feelings. His emotional state then reverts to a more neutral state over time (I was angry half an hour ago, but I've calmed down now), or changes again in response to another sensation.

If these systems are really simple they produce absurd results: a character is furious one moment and cheerful a second later, like a Warner Brothers cartoon character. This is the kind of thing you get with finite state machines.

This approach doesn't take into account the fact that behavior itself changes emotions. Behavior is not merely an output to be exhibited; it also affects how we feel. It feeds back into our emotional state. When the woman in the movie attacks her lover, the act of hitting someone she loves drains her anger away, and she begins to seek comfort because she has experienced such traumatic and violent feelings.

We all have behavioral techniques we use for self-comfort, some more acceptable than others. We punch a pillow or kick the dog. This doesn't qualify as behavior to satisfy a need, as in The Sims, because punching a pillow does not actually remove the source of the problem. All it does is relieve our feelings. (Mark Twain wrote, "When angry, count four. When very angry, swear.") But I think it's something we could build into games with little difficulty.

Depending on the character of the individual, behaviors can dissipate an emotion, or they can reinforce it. In the example I gave, the woman's anger dissipates because she is not by nature a violent person; in fact, the very fact of having acted violently distresses her.

On the other hand, in real domestic violence situations, the abuser often becomes even more angry as they harm the person they are abusing. They only settles down once the victim has stopped reacting at all. Their emotional machinery is severely twisted. This isn't a particularly happy subject for video games, but I think it's one that we could simulate if we had a dramatic need for it.

To make a character actually grow in a psychological sense (or, for that matter, spiral tragically into self-destruction) we have to create a meta-simulation -- a simulation that is capable of altering the basic emotional simulation that the game starts with. It could be something that interrupts the sensation/calculation/behavior loop and resets its variables. A key event or stimulus could convert a negative feedback loop into a positive one, or vice versa.

Drug abuse, for example, is a classic downward spiral. Suppose an addict character could encounter someone -- a charismatic teacher, perhaps -- who was able to supply the emotional comfort originally sought through drugs. The alternate source of comfort would disrupt the drug-seeking behavior, replacing it with a new dependence on the teacher... which could introduce its own problems into the story.

I'll admit right now that I don't know for sure how to do it. Until somebody funds me, I just write columns, not code. But I'm convinced it can be done well enough to make an entertaining and believable game.

I'm not proposing that we aim for total psychological realism -- after all, psychology is still in its infancy. Rather, I'm suggesting that we try to build a bit more richness into our simulations, in an effort to evoke more dramatically interesting behavior from our AI characters.

Computer characters at the moment are far too rational, and their behavior is pretty Vulcan: act upon stimulus to achieve goals. Real people aren't like that. They act against their own self-interest; they do irrational things; they do just plain stupid things. There's plenty of opportunity for experimentation.

Read more about:

Features

About the Author

Ernest Adams

Blogger

Ernest Adams is a freelance game designer, writer, and lecturer, and a member of the International Hobo game design consortium. He is the author of two books, Andrew Rollings and Ernest Adams on Game Design, with Andrew Rollings; and Break Into the Game Industry: How to Get a Job Making Video Games. Ernest was most recently employed as a lead designer at Bullfrog Productions, and for several years before that he was the audio/video producer on the Madden NFL Football product line. He has developed on-line, computer, and console games for everything from the IBM 360 mainframe to the Playstation 2. He was a founder of the International Game Developers' Association, and a frequent lecturer at the Game Developers' Conference. Ernest would be happy to receive E-mail about his columns at [email protected], and you may visit his professional web site at http://www.designersnotebook.com. The views in this column are strictly his own.

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

You May Also Like