Sunday 15 November 2015

NPC Emotions, part 2

This series looks at potential future approaches to Interactive Fiction – not that there is anything wrong with current approaches, or that this is the only direction to go. It’s just fun to explore the possibilities.

“People are much more difficult to simulate than rocks and trees, not just because of relative complexity, but because we’re more wired to scrutinize our fellow humans” (Artificial Intelligence In The Uncanny Valley, 2007).

In the original context this was talking about graphics, but it applies equally to text based interactions with NPCs. On thing we are wired to look for is emotion; a character who never reacts to events or varies their emotional state seems a lot less real.

Continuing from part one, here are some more ways emotions work in real life that have potential for IF.

facial expressions

8. Intensity

Emotions have different levels of intensity, along with correspondingly dramatic behaviour. Someone who feels just a little afraid might look around nervously; a person who is very afraid might retreat or hide; someone who is terrified may run away screaming (though as mentioned in point 6, people’s emotions don’t rule them completely: they can still ultimately choose how they will react, even in the face of intense emotion).

To model emotional intensity, the game engine could have a set of reactions associated with different levels of each emotion, such as smiling, laughing and hugging everyone with increasing levels of happiness. This also depends on personality; a happy villain might celebrate by boasting to his minions.

Heightened emotions subside over time back to a person’s “baseline,” which is determined by personality and mood. For example, if an optimistic NPC (or a non-optimistic NPC in a good mood) receives some bad news, after a while she will be back in good spirits, unless the news was severe enough to modify her background mood.

If negative emotions such as fear, anger or worry keep on building up, people eventually reach breaking point (unless they are unusually resilient). In a work of IF, an NPC’s increasingly strong reactions could be used for serious or comedic effect.

9. Focus

Emotions are about something specific, which means they need to be modelled by more than just a number if they are to be translated into behaviour. Being afraid of a dangerous animal has very different effects to being afraid of your secret identity being discovered.

There is a set of appropriate responses for each combination of emotion, cause and intensity. For example, a person who is mildly upset because of an offensive remark might either respond in kind, smile sweetly or glare at the offender. There is a problem, though: the number of possible causes is very large, which makes this difficult to manage.

Rather than listing all possible situations and their associated emotions and behaviour, we can model this at a more fundamental level. Someone who is afraid of a creature that is chasing him is motivated by self-preservation to avoid being killed, by either fleeing or defending himself. The extreme danger causes a feeling of fear (adjusted according to personality), swaying the decision more towards escape than standing his ground. The game can calculate such an NPC’s reaction without needing a rule about this particular situation. There are many cases that do need specific rules (such as social conventions), but modelling behaviour in terms of motivation and plans in this way means that most cases can be handled using general rules.

We will look more deeply at NPC motivation in a later post.

10. Mood

Moods are mental states associated with a particular set of emotions and behaviour. They last longer then emotional reactions, and are not always in response to a specific event – someone might just be in a good or bad mood.

Some possible moods are:

Good: happy, cheerful, positive Bad: irritable, grumpy, negative Sad, gloomy, down, melancholy
Missing someone or something Playful, mischievous, hyperactive Serious, sombre
Amused, silly, mischievous Reflective, wistful Amazed, in awe
Peaceful, calm, relaxed Lonely Sociable, friendly
Antisocial, needing time alone Bored, apathetic, unmotivated Agitated, stir crazy
Generous, outward looking Miserly, self-centred Frustrated, impatient
Confused, bewildered Worn out, drained, exhausted Energetic, alert, stimulated
Excited, full of anticipation Loving, affectionate Flirty, romantic
Heartbroken Anxious, worried, stressed Fearful, nervous, jumpy, terrified
Shocked, stunned, numb Hopeful, optimistic Cynical, pessimistic
Defiant, rebelious, contrary Determined, focused, concentrating Curious, fascinated, obsessed
Distracted, unavailable Upset, enraged, hostile Guilty, ashamed
Confident, invincible Insecure, self-conscious Proud, satisfied
Arrogant, smug, boastful Jealous, bitter Sneaky, scheming, sly
Cruel Vengeful Virtuous, noble, patriotic
Uncomfortable, out of place

The moods a person experiences depends a lot on their personality. Many of the moods in this list could be regarded as personality traits; being in a certain mood represents that trait coming to the forefront.

Some emotions have closely related moods, such as happiness (good mood), sadness (feeling down), fear (general state of fear) and anger (mad / upset). Whether an emotion becomes a mood depends on its intensity and on personality. One person might recover quickly after a scary experience while another remains captivated by fear. Some people cool off fairly rapidly after getting angry while others stay stuck in it for a while.

Moods fade eventually, but feeling an emotion that is the opposite of a mood can cause the mood to end sooner. For example, it may be possible to cheer someone up who is feeling down by doing or reminding them of things that make them happy (but listening to and comforting someone who is sad might be more effective). Moods can also restrict people’s responses to things that are incompatible with that mood. For example, someone in a sombre mood might not laugh at a joke he would normally find funny; someone in a playful mood might not take anything seriously.

Moods can be used in various ways in IF. They can reveal another side to an NPC’s character, adding depth to their personality. The PC might need to help an NPC out of a negative mood such as fear or despair. An NPC’s mood can reinforce events in the story: feeling satisfied and relaxed after overcoming an obstacle, reflective after a profound experience, or getting into a silly mood as relief from a stressful situation.

11. Openness

Unless they are unusually trusting, people tend not to share their deepest feelings with others. It is an act of trust and vulnerability to let someone know what is going on inside: self doubts; what matters most to them; things at the core of who they are.

As the story progresses, an NPC could gradually open up to the PC, revealing things about herself: she loves the smell of spices in the marketplace; she misses her pet cheetah; she’s doesn’t want to marry the viceroy; she’s not sure she can handle ruling the kingdom.

However, it isn’t always necessary to verbalise emotions to share a moment of closeness:

“Seeing Yorda run up to Ico after they solve a cooperative puzzle, and he takes her hand as they move forward into the unknown – there is a very human, innocent quality to the way these characters interact with each other [...] Even the rare save points, which are stone benches where Ico and Yorda simply sit down to take a breather, manage to be memorable occasions every time. Few other games have managed to deliver such a meaningful relationship, and even more incredible is that this is done without so much as a spoken word between the two” (on the video game Ico).

However, some NPCs might despise or mock the very idea of emotional vulnerability; or less cruelly, they may just make a flippant comment or divert the conversation to another topic. In certain contexts, however, even “tough guy” characters may realise the significance of a situation and be direct about how they really feel.

Lastly ...

There are two more topics related to emotions that will be treated separately, since they are both fairly major:

  • Relationships – how people feel about and relate to others.
  • Personality – how people’s temperament, attitudes and values affect emotions and behaviour.

No comments:

Post a Comment