Table of ContentsContribute An Article

The following extract is taken from a large, popular MUD. Not mine, because mine is currently neither large, nor popular. I won't mention the name, because it's not my intention to “call out” anyone about this problem. This is just to indicate that it's a norm that we expect within our games:

    <NPC> attempts to tidy up the shop a bit.
    <NPC> occasionally mutters something about a lawsuit against a certain <NPC2>.
    <NPC> says: Do you have a voucher? You can exchange it here.
    <NPC> says: I'm sure I'll win if <NPC2> takes me to court.
    <NPC> says: Feel free to browse the stock.
    <NPC> says: Feel free to browse the stock.
    <NPC> rearranges his hat.
    <NPC> says: I'm sure I'll win if <NPC2> takes me to court.
    <NPC> exclaims: That spell was mine, <NPC2>stole it!

The NPC says the same few things, on a loop, forever. You can try to get a rise out of him:

    > push <NPC>
    You push <NPC> over making him sit down.
    <NPC> stands up.
    <NPC> says: Please ask about talkers if you're not sure.

Or violate his civil rights:

    > slap <NPC>
    You slap <NPC>.
    <NPC> says: Please ask about talkers if you're not sure.
    <NPC> rearranges his hat.

It rarely seems to make a difference. The NPC just stands there, wittering through the same tiny collection of chats — a bit of window-dressing that is utterly, irrevocably disconnected from what's happening around it. It's unsatisfying. It's hugely unsatisfying, and on Epitaph we were as guilty of it as anyone. More, in fact, because I never really saw the point of these “vend a chat” type NPCs having much to say. Spending too long in the same room with such an NPC, it would grate painfully on my nerves and I'd find myself having to move elsewhere. As such, our NPC value came from their collection of responses. Each of our NPCs have keywords that, when you ask about them, give a little bit of lore and guidance. Those who played the Ultima games will recognise the conversational style:

    > ask shawn about winchester
    You ask Shawn a question about "winchester".
    Shawn whispers to you: This is perhaps the safest place in the entire city -
	we're far enough away from the hotspots that the zombies rarely wander this
	far, and even when they do we have enough people here to keep them out. You
	could think of us as something like the Switzerland of Dunglen - we're
	neutral in everything so everyone finds us useful enough to support.

Our NPCs also had “vend a chat” characteristics, and they'd go through the same tired set of six or so chat strings on a semi-random basis. It's a convention that is deeply ingrained into CRPGs — the memetic “arrow to the knee” in Skyrim is the same problem writ into the bones of a game that prides itself on how immersive it can be. You need to look beyond our usual conventions of RPG game-play to realise why this is such a poor state of affairs if you want a world that genuinely feels alive — truth be told, we're mostly numb to it. So, within Epitaph we resolved to find a way to make our NPCs more passively interesting. We wanted to have NPCs that felt as if they were engaging directly with you, remembering who you were, and also maintaining relationships with the other NPCs around them. We've now put the first version of that in the game, and we're working hard to improve how versatile and interesting the system is.

I am, perhaps, getting ahead of myself. So let's look at this problem from first principles. Let's look at how we put together the system that eventually became known as Mercurial.

What do we want from our NPCs?

If you don't really care about having a game world that feels alive, vend-a-chat NPCs are fine. All they need to do is stand there and make the world look as if it has people in it. If you're happy with that, fine — you don't need to put any more thought into how they should behave. On Epitaph, though, we're putting together a strongholding system that makes the presence of NPCs within a constrained space a major gameplay system. You can have that with vend-a-chat NPCs, but I wanted something more. I wanted living with a group of survivors to be more like a soap opera than a hack and slash — I wanted them to fall out, develop grudges, have arguments, make up, and pass on the day to day gossip of what was happening. I wanted the selection of an NPC for joining your stronghold to be a complex decision, weighing up skill-sets versus personality types versus the ongoing drama in your stronghold. I wanted played players to think “Wow, this new survivor has amazing skills at scavenging, and we really need that — on the other hand, she seems to be pretty aggressive and that won't work very well with my stronghold dynamic”. I wanted managing NPC moods to be an active task, requiring you to calm and soothe, bully and cajole as needed to get everything working. Rapidly I realised that what we needed was not an extension to our existing NPC chatter systems, but a complete redesign.

I wanted NPCs to have memories of interactions, and I wanted those memories to impact on what they did in the future. I also wanted them to be able to refer to things that had happened to them in the past, and explain upon questioning why they were behaving the way they were. I wanted them to have set vend-a-chats, because sometimes these contained cueing information for followup keywords, but I wanted most of their chat to be contextual. I wanted their mood to change too on the way they'd been feeling lately — if they'd been persistently in a bad mood, I wanted it to exacerbate to create a kind of depression cycle. If they'd had a string of good moods, I wanted them to have a relatively sunny disposition that made everything more likely to keep them happy. Then I wanted external events to cut into their moods like a knife. I wanted them to get upset if someone stole from them, or depressed at being surrounded by corpses, or fearful around players that had killed them in the past.

I also wanted it so that not every NPC worked the same way — I wanted them to be a kind of puzzle to solve. I wanted some to respond favourably to certain kind of events and not so favourably to others. I wanted some to brood on past injustices, and others to focus more on the here and now. I wanted some NPCs to be homophobic and others to be homophiliac. I wanted xenophobia and xenophilia all stitched in. I wanted you to have to consider how each NPC responded to you, and work out how best to manipulate their moods accordingly. I wanted NPCs to remember you, and how you'd treated them.

I wanted a lot.

What did we need to make that happen?

There were several things we needed to slot into Mercurial to allow all this to happen.

First, we needed NPCs to have a mood. For a long time we'd had a “wellbeing” system for hunger, thirst, health and energy. Along with that was a measure called “resolve”, which represented essentially your overall mood. It went down as you encountered zombie moans, it went up as you got drunk or ate good food or whatever. We removed resolve as a wellbeing measure and replaced it instead with a dynamically calculated “mood”, on a scale from 0 to 100. Every NPC had a baseline of 50, which meant largely “on an even keel”. They were neither in a good or bad mood — they were just okay.

Next, we needed ways to manipulate that mood. For this, we created “mercurials” which were little packages of data that represented specific things that could happen. “About to die”, for example, was a mercurial that could be applied when an NPC's health levels were very low, and would give a significant negative modifier to mood. “Ate good food” was a mercurial that could be applied which gave a small boost to mood. The positive moods were summed up, the negative moods were summed up, and then both of these were applied to the mood to give the overall disposition of the NPC. If more good things than bad things had happened, the mood would be higher, and vice versa. Then, when dealing with a player, we averaged out their current mood and the sum of interactions the player had had with them recently to create a “mood for that player” value. This then becomes the baseline for working out how an NPC should respond to player actions.

That gave us a way to give NPCs variable moods, but we also needed to solve the vend-a-chat problem. We did this by associating chat strings on a mercurial basis, rather than on a mood or NPC basis. NPCs started to say things depending on which mercurials they had applied. An NPC with the “hungry” mercurial might complain about a rumbling stomach or ask if anyone has any food to spare. An NPC that had to spend the night sleeping on the floor might complain about aches and pains. An NPC that gave a player a mission they failed might mutter about their unreliable allies. However, to make sure that the mercurial chats were appropriate we also added a “mood context” which included “what added this mercurial”, “when did they add this mercurial”, and “what other information do I need to know about this mercurial”. Thus, a chat string within a mercurial mood might look like this:

"say I would like to kick $cap_applied$ right in the backside."

When the game says to an NPC “it's time for you to say something”, it'll look for which mercurials have been been applied, what contexts it has for those moods, and then it'll construct a chat that is appropriate:

    "say I would like to kick Drakkos right in the backside."

In addition to the $applied$ token, there's also extra information that we can provide. We provide a hash-table of these when we apply the mercurial, so we might have the following available: ([ "argument" : "stealing from me" ]). That permits chats such as:

    "say I would like to kick $cap_applied$ right in the backside for $argument$."

That becomes:

    "say I would like to kick Drakkos right in the backside for stealing from me."

Now, none of these chats are great literature, and that remains true of the chats we currently have in the game. That's a small problem, though — the key thing is that our NPCs can now start to act like they are connected to the game world. If they pass a skill check, they might say something like “I didn't realise I was so good at climbing over obstacles”. If they critically pass, they might say “Nobody in the world is better than me at climbing over obstacles”. If things have been going good for a while, they might start humming cheerfully or cracking jokes. If things have been going badly, they'll be waspish and snap at people, and be less likely to look on the bright side in their own random interactions.

Some of these mercurials also came with new behaviours — for example, an NPC with a “hungry” mercurial will accept food from players if it is given. Eating that food will adjust their hunger, which in turn will alleviate the mood. This gives us a framework for not only having NPCs “talk the talk”, but also “walk the walk”. The way you interact with them is altered by the moods they have available.

Mercurials also come with responses, and so NPCs can respond based on what mood they're in. If I ask an NPC with the above mercurial about Drakkos, it might respond with “Drakkos is an asshole. That's all I can say about someone stealing from me”. These responses allow all the tokens to be used, and also for variation to be given when the mercurial is added. The NPC will say the same thing each time you ask, but another NPC with a different mood context might say something different.

What did we want from our chats

In addition to the chats being drawn from NPC moods, we also wanted them have little bit more naturalistic variability, as they are in real life. I didn't want it to just be “I would like to kick $cap_applied$ right in the backside” every time, I wanted that to have natural modifications. So, in addition to the global tokens applied from the mood, each chat also has some local tokens that give potential variability that can be slotted in in place of fixed text. For example, this is the (almost) full code of one of our existing mercurials (I removed some of the naughty words, and unset fields; Epitaph is mature content, so NPCs that need a cigarette are likely to swear at you):

	::item "needs a cigarette"::
	::->description:: "You really need a smoke."
	::->chats:: ({
	  "I could really do with $a_smoke$.",
	  "I need $a_smoke$ to $calm$.",
	  "I'm $tense$ - need $a_smoke$.",
	})
	::->actions:: ([
	  (: 1 :) : ": hums tensely.", 
	  (: 1 :) : ": stomps around grumpily.", 
	])
	::->categories:: ({ })
	::->duration:: MERCURIAL_DURATION_SHORT
	::->mood:: MERCURIAL_MODERATE
	::->intensity:: MERCURIAL_INTENSITY_LOW
	::->random_assignment:: 0
	::->can_stack:: 1
	::->local_tokens:: ([
	  "smoke" : ({
	    "smoke",
	    "fag",
	    "cigarette",
	    "good hit of nicotine",
	  }),
	  "calm" : ({
	    "calm my nerves",
	    "calm myself",
	    "take the edge off",
	  }),
	  "tense" : ({
	    "tense",
	    "on edge",
	    "all jangly",
	  }), 
	])

Inside the chats are local tokens such as $a_smoke$ and $tense$. When a chat is selected, a random element from the right hand side of the local_tokens mapping is selected and put in place of the original token. So, a selected chat may be:

    "I'm $tense$ - need $a_smoke$.",

When this is selected and processed, it might end up being parsed as any of:

    I'm on edge - need a fag.
    I'm tense - need a good hit of nicotine.
    I'm all jangly - need a smoke.

Thus, a single mood may only have a small number of chats attached, but each of those chats may have dozens, or hundreds, or thousands of possible variations. We're only limited in that respect by our imaginations. This system has been so useful for providing small variation around a theme that it has been ported over to our room chats — that's another area in which I've long felt MUDs don't do things well enough, and also another area for discussion in a later article.

What did we want from our players?

After a while, the mood system became sufficiently mature that I wanted to make it a thing for players too. So, not only did NPCs get their resolve surgically removed, players received a transplant of the mood system to go with it. Now, mood management became an active task rather than just keeping an eye on what had up until now been basically a “sanity meter”. But I also wanted players to take an active role in the management of NPC moods.

Soul commands, or socials, or emotes, are another common aspect of almost all online games. Rarely do they actually do anything — they're just a little message for players. I wanted them to do things, and so in connection with the mercurial system we wrote a new, powerful “interactions” framework that allowed you to manipulate NPC moods, and have them manipulate yours, through social interaction. This is a complex topic in and of itself, and will likely end up being a separate submission to Imaginary Realities in the future. Suffice to say for now that hugging a sad NPC, and being hugged in return, are ways for you to manage your moods. You also have pharmaceutical aids (a nerve pill, for example, which gives you a long lasting “feeling pretty mellow” mercurial). You can rely on alcohol to numb the edges of your mood (although sometimes drowning your troubles only shows you that they know how to swim). Or you can seek out positive encounters, or engage in activities you know to be psychologically healthy. Reading a book gives you a resolve boost depending on how good it has been set to be. You can manage your mood with chocolate, or home-cooked meals, or even just wearing nice clothes.

Players were something of an afterthought for this system, but in the end it turned out that I liked how it worked for NPCs so much that I wanted it for myself when I play. Mood management now is an interesting task in the game, in a way that it wasn't previously. It's not a perfectly implemented task, of course — we are constantly revising and expanding and redesigning bits of the system — but it has a good set of bones on which we can continue to meaningfully build.

What I wanted for players was two-fold — I wanted them to feel as if the NPCs in the game were actually paying attention, and developing their views of what was going on based on the world around them. I also wanted to provide players rewards for paying attention to NPCs, such as quests for feeding the hungry or giving those craving cigarettes a fix. I wanted them to have an opportunity, and a motivation, for developing long term social interactions with their NPCs. Much of the real benefit of this is still to come, since it's tied to a game-play system that is still under development. We can however see the first steps of that in the game already, and I'm very pleased by the options it has given us as developers. We can now have quests, and missions, and achievements that pay as much attention to social skills as they do to combat skills, and we can fully support a play-style that allows someone to focus on diplomacy rather than death-dealing. It's always been one of my key design goals to make activities other than hack and slash viable for advancement (Epitaph really isn't a hack and slash game unless you explicitly build a character for it, so if you try to kill everything you see in Epitaph, you'll rapidly find yourself in a very sorry state). I think this offers a new way of doing just that.

Where do we currently stand?

The Mercurial system is still in its infancy — I class it as being in its 1.0 state, but there's still a long way for it to go before it does everything I want of it. What's remarkable though is the level of flexibility it gives us. According to our internal stats, we now have 291 discrete mercurial data files, each handling a particular kind of mood. These get triggered from commands and situations all over the game, from solving quests (for players only), to killing zombies (everyone). It's easy to add a mercurial and its trigger — an act of maybe 60 seconds of technical time. However, none of those data files are currently where I want them to be in terms of richness, complexity or significance. More than anything else, they hold placeholders for a larger and more exciting set of NPC conversations. We're still to do a proper pass over that to ensure that the moods are as deep and involving as they can be — we've been running in the system in the live game for a few weeks, and our key focus has been on making sure it works as a mechanic before it works for thematic dressing.

There's a lot of tweaking that still remains to be done, too — NPCs and players at the moment are somewhat bipolar, switching wildly from positive to negative moods as mercurials time out and are applied. That however is an issue of polish — functionally speaking, we've added a lot to the game, in my view, with this new system of managing NPC conversation and ambient chat.

More than that though, Mercurial has given us a framework for making stronghold social management as important a game element as putting up barricades or fighting off raiders. It allows us to model the kind of cabin fever that would be important to mitigate within a tightly constrained, geographically fixed group of survivors. It allows for tactical decision making, such as “Oh, Billy is in a huff because Jessica slapped him. But he's our best scavenger, so do I want to send him out to look for food regardless? Or do I send out Jessica and take the risk of losing her because she's been causing a lot of trouble recently”. Or, “Do I go spend the next ten minutes calming Billy so that he's in a fit state to send out on this mission?”. That kind of thing was always going to be a major part of what I wanted from a stronghold system, and I am very happy that it's not going to be constrained purely to there. This kind of thing makes the whole game richer, and I won't be satisfied until I can sit in any populated room in the game and watch my NPCs play out social soap operas in front of me.

Conclusion

Version 1.0 of Mercurial has given us a compelling proof of concept for a new way of thinking about NPCs in our world. The next stage is to develop that proof of concept into a fully fledged game system. It's already adding considerable value to the game, but I'm conscious that the value is limited until we have both a wider range of mercurials being applied, and a more consistent approach to how they are written and configured. Primarily, our next job with Mercurial is to flesh it out, adding more chats, more responses, and more sense of consistent behaviour for our NPCs. I want them to separate people in fights, or warn their allies about someone sneaking around. I want them to mourn for the deaths of their friends, and celebrate the deaths of their enemies. As sad as it is, I want people to be able to feel the same attachment to the NPCs in their strongholds as they do to characters in works of literature — I don't want people sending off a package of statistics on a perilous mission. I want them to send their friend. The Mercurial system has given me confidence that, given enough time and evolution of the system, we'll be able to accomplish that.

Drakkos is lead developer of Epitaph.

References

« issue « article article » issue »