Saturday, 5 December 2015

NPC Relationships

What are the different ways one character can feel about another? Many video games use a scale like the following:

love > like > neutral > dislike > hate

This doesn’t leave much room for subtlety. A courtier might be openly friendly but inwardly envious of another member of the court, unwilling to betray their secrets because their rival could just as easily give away theirs, grudgingly admiring their drive and ambition while despising their family pedigree. Summarising this relationship as “dislike” loses a lot of interesting detail about how the characters relate to one other.

In this follow up to NPC Emotions part one and two, we take a look at how relationships form, what influences their quality and what might be possible in an advanced IF system.



Some people can’t remember a time when they didn’t know each other. Others only know each other by reputation or observation at a distance before they meet for the first time. Still others begin as total strangers with no knowledge of each other at all.

In the last case, first impressions can have a big effect on the direction of the relationship. This includes things like appearance and manner – someone might come across as intimidating, dashing, friendly, course, intelligent, naive, someone not to be taken seriously or a potential romantic interest. Sometimes people attempt to impress (or intimidate or fawn to) others in order to influence the kind of relationship they end up with.

Even if two people have no history at all, prejudices and preconceptions still influence how they approach each other. An NPC might see all adventurers (or dwarves or accountants or Northerners) as being the same in some way, perhaps from bitter experience or cultural prejudice, or perhaps they had a positive experience with that group of people and expect all of them to be just as brave, wise or trustworthy.

People with common interests, values or backgrounds tend to gravitate towards each other and become friends, while clashing values or personality can spawn a hostile relationship. But differences don’t necessarily result in conflict; opposites can attract, and there can be a fascination towards people with very different lives and backgrounds. Unlikely friendships are always possible.

Some relationships are not voluntary: people just find themselves thrown together unavoidably. For example, growing up in the same family, social groups at work or school, fellow prisoners or survivors of a shipwreck. Since those involved didn’t choose to have the relationship, interesting things can happen as they adapt to each other.

If a relationship is voluntary, people enter it with something in mind – they have a set of expectations, hopes and intentions towards the other person. Each party may have a different set of goals, however (or may not want any kind of relationship).

Some examples of what people could want out of a relationship are:

Relationship Intention
FriendshipMeet social and other needs
AllianceShared resources; mutual benefit
RomanceCompanionship; intimacy
PragmaticHelp each other but keep emotional distance
MentorPass on knowledge; be proud of mentoree
MentoreeLearning and growth
AdmirationAttention and affirmation (e.g. hero worship)
RivalryProve superiority over rival
EnmityKill or otherwise defeat enemy
DuplicityGain something (e.g. popularity, money)
DominationPower over others

Enmity is a kind of anti-relationship: enemies usually know each other to a degree, but the result is hostility rather than closeness. There is also the possibility of a love/hate relationship where a person is conflicted about his feelings towards someone else.

Although someone might want a relationship to go a certain way, things might not go as intended. An offer of friendship may seem overeager, causing suspicion about motives; an attempt to impress or intimidate someone may just come across as showing off; a romantic overture could end with embarassed stuttering; an attempt to dupe someone may be completely transparent.

Influences on Relationships

Many different factors affect the relationship people have with each other.

  • Blood ties
    • Most parents have an inbuilt inclination to love and protect their children, though some can be neglectful or otherwise unfit. Parents may spoil their children or show favouritism.
    • Children can have a range of attitudes towards their parents (closeness, ambivalence or hostility).
    • Siblings may be close, distant, rivals or antagonistic towards each other.
    • In some cultures there is a strong loyalty to members of the extended family.
    • Because of the intense emotions involved, family relationships have a lot of dramatic potential: “No! You’re not my father!” .. “You killed my father. Prepare to die!” .. “I have no son. You are dead to me.”
  • History
    • Just encountering someone regularly can result in a level of friendship, but familiarity is no guarantee of really knowing someone (“a prophet is not without honour except in his hometown and in his own household”).
    • Jealousy and other destructive attitudes can creep into a relationship over time.
    • Consistent kindness can win over a distrusting person (perhaps resulting in a fierce loyalty).
    • People who have gone through an ordeal together have a common bond – for example, survivors of a natural disaster.
    • Two people who have known each other a long time may develop habitual ways of relating to each other: humour (in-jokes, pranks, teasing), activities (games, hunting, sparring), acts of friendship (letters, presents), arguments and criticism (“you always ...”) – or in the case of enemies, escalating vengeance and retaliation.
  • Similarity
    • People often “click” with others who have similar personalities, values, background or interests.
    • Someone with a totally unfamiliar background (such as a different nationality) might seem interesting, scary or just strange. Prejudice and assumptions come into play.
  • Groups
    • Being in the same group (race, gender, social class, home town) can cause people to identify with each other, bringing them closer. This not always true: someone who sees their own group as inferior might despise others in that group.
    • If the group is very small, such as two entities being the last of their kind, they might feel particularly close.
    • There can also be a relationship between two groups: they could be sworn enemies or close allies. This can lead to divided loyalties, such as being childhood friends with someone who becomes a member of an opposing faction.
  • Personality traits
    • A compassionate person might form an instant bond with someone who is vulnerable or unjustly treated. For example, she might feel protective towards an orphan and take him under her wing. This has the potential for conflict if she is a member of a group and the others see the orphan as a liability.
    • Someone who is friendly and trusting by nature will act that way with new people.
    • A scheming character might see another person as a means to an end and act in a friendly way in order to gain something from them.
    • An intellectual might find someone else’s company stimulating, be curious about them or get bored with them.
    • An insecure person might see someone as a potential rival, and either challenge, intimidate or plot against them.
  • Observations
    • A person’s opinion of someone else is affected by the way they see them act. An internal picture of the other person’s character and values is constructed over time, which might be approved or disapproved of.
    • This includes the way they treat the observer’s friends and enemies (“the enemy of my enemy is my friend”).
    • If someone sees a person they know well do something they disapprove of, instead of lowering their opinion of the other person they might see it as being out of character and perhaps confront them about it (“this is not like you ...”). Someone who trusts another person’s character might struggle with internal conflict if they see evidence to the contrary.
    • Before really knowing them, people tend to put others in categories. Some replies to the question, “What do you think about X?” could be: they seem like a real joker, a stuck up snob, gentle and kind, a weirdo, a bit dull or perfect in every way.
    • If someone observes a person acting inconsistently, the conclusion might be that they are mentally unstable, or perhaps deceitful – either way they are untrustworthy (unlike some video games where good and bad actions cancel each other out).
  • Gossip and reputation
    • People can be preceded by their reputation, which can be positive or negative. A reputation can be to do with past actions that reveal their character (acts of cruelty, bravery, kindness and so on), habitual activities (“the Black Pearl never leaves survivors”) or attributes (“they say no man can defeat him”).
    • Reputation can set the initial tone of a relationship, causing feelings of admiration, fear, intimidation, trust, or even love / infatuation. Someone might seek out a person based on reputation alone: for help from a hero, to challenge an evildoer (or a champion), to get counsel from a wise person and so on.
    • Gossip and slander can be used to turn others against someone (fueled by jealousy or vindictiveness). A friend might not believe gossip. If someone discovers who spread gossip about her, the relationship with that person will be badly damaged.
    • A person who has been slandered usually wants to be vindicated and clear their name.
  • Secrets
    • People often have a desire to share their secrets, which is an act of trust that can strengthen a relationship. Revealing the secret to someone inappropriate feels like a betrayal.
    • A person’s secrets can be discovered by others (by eavesdropping, reading mail and so on). Shameful secrets can be used for blackmailing purposes.
    • Someone may want to hide their past, fearing what others will think if they discover the truth. Instead of thinking badly of him, another person might overlook or forgive his past (“that’s not the man I know”) or interpret it in a different light (“you were a pirate? Cool!”).
    • On the other hand, discovering something negative about someone may undermine all trust in that person and change the relationship completely. Learning a positive secret can inspire new found admiration and respect.
    • People can be strongly motivated to hide secrets, sometimes to the point of silencing those who discover them.
  • Lies
    • People lie to manipulate others or to protect themselves (or sometimes other people). Personality and values determine people’s level of honesty.
    • As well as lying explicitly, people can act deceitfully, such as ingratiating themselves with someone in order to gain some object.
    • If someone discovers they have been deceived or lied to, they will usually confront the person, and the relationship will be damaged (unless they are convinced the lie was unintentional or meant to protect them).
    • Confessing a lie before it is discovered can prevent damage to a relationship.
    • Deceiving an enemy is often regarded as acceptable.
    • When someone acts honestly when he could have avoided trouble just by lying, this generally increases other people’s respect for him (though a less scrupulous observer might think he is an idiot).
  • Trust and betrayal
    • Trust can be expressed in many ways, such as sharing secrets or otherwise putting yourself in a vulnerable position, giving someone responsibility or an important task, or putting your safety in someone else’s hands.
    • Some people find it easier to trust than others; someone who has been betrayed or otherwise let down will find it difficult to trust others. Winning the trust of someone like this results in a strong emotional bond.
    • Being trusted by someone who has a reason not to has a strong positive effect on the relationship.
    • Betrayal is a violation of trust, such as siding with an enemy or being “sold out” (choosing personal gain above the relationship).
    • The impact of a betrayal depends on the level of closeness and trust (and the difficulty the person has in showing trust). Someone who feels betrayed could become an instant enemy and seek revenge.
    • Betrayal can make it more difficult to trust anyone in the future.
  • Hurt
    • Believing someone close has mistreated you can result in hurt feelings.
    • Someone who feels hurt might brush it off, retaliate in anger, seek to be reconciled, act coldly towards the other person, hide their pain (perhaps unsuccessfully) or feel sorry for themselves.
    • The offender could then retaliate, apologise, clarify a misunderstanding, try to appease the other person or defend himself.
    • An unresolved emotional wound can fester and damage a relationship. If the idea of losing the relationship distresses one or both parties enough, they will make an effort to be reconciled.
  • Faithfulness
    • Someone is seen as faithful and loyal if they consistently behave as a friend/ally. This causes trust in the person to increase.
    • Examples: defending the person (physically or verbally); paying a cost for the friendship/alliance (such as being insulted for associating with them); not abandoning the person; keeping your word.
    • Acts of devotion and self sacrifice can have a powerful emotional impact.
    • Loyalties can be divided, causing internal conflict.
  • Forgiveness and reconciliation
    • A person can choose to forgive those who did him harm. Some things are harder to forgive than others.
    • Enemies can potentially be reconciled to each other through mutual forgiveness, but one party might refuse the offer.
    • Reconciliation can cause a relationship to be closer than ever before.
    • Giving and receiving forgiveness can involve strong emotions, and can be a crisis point involving a shift in viewpoint (from blaming the other person to grief for their own actions).

How Much to Model

Human relationships are intricate and complex. How much would actually be useful to model?

One argument is that you should only model what a game is “about” – everything else becomes a distraction to the player, or at least bloats the code with peripheral cases. Another issue is that events that happen invisibly can be confusing to the player:

... a case where a character was rude and aggressive to the protagonist at the first meeting, even though they’d never interacted before. Tracing back through the simulation history, it turned out that that character had exchanged gossip with another NPC offstage and had heard negative things about the protagonist. Here the simulation was still working (in a sense) as intended, but the problem was that the system wasn’t designed to show the player that that was what had happened, so instead of being an instance of persuasive, interesting NPC autonomy, it was a thing that looked like a bug.

– Emily Short on the IF Forum, talking about Versu

Bearing these things in mind, I think a game with autonomous PCs who understand and act according to these kinds of relationship rules would be a lot of fun, especially seeing relationships change over time. But some additional approaches might be needed as well: a drama manager to redirect NPC behaviour for the good of the story, and a method of communicating relevant information about NPC attitudes and emotional states.

Limiting NPC Autonomy

The main problem with autonomous NPCs is that they have the potential to completely wreck the story. The Hobbit by Melbourne House is a classic example:

The game had a cast of non-player characters that were entirely independent of the player and bound to precisely the same game rules ... The volatility of the characters [could] lead to problems (such as an important character being killed early on and rendering the game unfinishable).

– a comment on YouTube

A drama manager could help with this problem. Events that undermine the plot could be expressly forbidden: instead of killing another character, a fight could result in a draw, or a murder attempt could be made to fail. There are also many situations where an NPC has a choice of actions which might usually be chosen at random, but could be overridden by the drama manager.

Instead of attacking another character, an NPC could merely display anger towards them; or the drama manager could decide a conflict between those two characters is not a good fit for the rest of the story, and decrease their level of hostility. But this would need to be done in a believable way (enemies suddenly becoming friends for no reason would not sit right with the player).

Alternatively, the drama manager could incorporate these characters’ conflict into the plot. For example, it could add tension if the two start fighting at a moment where the PC can’t really afford the distraction.

Jimmy Maher writes about The Hobbit:

In my recent game, a warg somehow got into the wood elves’ compound long before I got there. I arrived to find him prancing atop the corpse of the one who should have captured me and thrown me in a cell. Suddenly my problem was not how to escape from the elves but how to get past the warg, a very tough customer – not exactly how it played out in the book, but an exciting experience nevertheless. Sometimes, when it works, The Hobbit can be kind of amazing.

For me the purpose of a drama manager is to create these kinds of moments purposefully, instead of relying on emergence to create them by accident.

Communicating NPC Attitudes and Emotions

One way to communicate how NPCs are feeling is to make the PC telepathic. In games like The Sims NPCs have a thought bubble above their heads showing what is on their mind. The text equivalent might be to add a short sentence when an NPC is examined revealing a character’s primary emotion and current goal.

But telepathy is usually not an option, so what are some ways of letting the player know what is going on inside an NPC’s head? Here are some possibilities:

  • If an NPC is feeling a strong emotion (especially one that influences his behaviour towards the PC), the game could pick an appropriate moment for the NPC to say something to reveal the emotion and the reason for it. For example, “We could have saved them, but you just ran away!”
  • Alternatively, the NPC could just reveal her emotions through her behaviour, such as laughing, scowling or burying her head in her hands, which prompts the player to ask about it.
  • One character could tell the PC what he thinks another character is feeling, or encourange the PC to go and talk to them.
  • The PC might overhear two other characters talking and discover how one of them feels.
  • The game could comment on what is obvious to the PC. For example, “Something really must be bugging Sam today; that’s the fourth doughnut he’s had in a row.”
  • Without directly talking about their emotions, NPCs can still communicate how they feel with their choice of language. Instead of replying “yes” to a question, a character who is feeling down might just say, “I guess” or “Not that it matters.” A cheerful character might say, “Absolutely!”
  • For foreshadowing purposes, the game might drop hints about a character’s attitudes and motivations so that later actions make sense. For example, the drama manager might be setting up a particular NPC to betray the PC, so that character should show signs: disagreements; growing hostility, perhaps veiled with a veneer of niceness; body language revealing tension or anger.
  • The game could also adjust the tone of the writing depending on the mood of the characters (a difficult thing to automate). For example, a bright dawn with intoxicating scents filling the air might convey a sense of renewed hope or joy in life.

This could easily be overdone, though. If a game constantly mentions NPC emotions it might seem overly dramatic or become repetitive.

No comments:

Post a Comment