One-note NPCs

Publication date: 26 June 2011
Originally published 2010 in Atomic: Maximum Power Computing
Last modified 03-Dec-2011.

 

Any game that contains NPCs who talk to you will also contain NPCs who say the same thing over and over. And over.

Some NPCs won't even wait for you to talk to them before they spout their sole line, like an extra who's been driven to insanity by the joy of their very first speaking part.

Often the same damn line is shared by multiple different NPCs. See, for a recent example, the countless male, female, human and Ghoul NCR troopers in New Vegas who all wish to inform you that patrolling the Mojave almost makes you wish for a nuclear winter.

There's a boring and prosaic reason for this. But first let's explore the obvious alternative:

Give NPCs a variety of things to say. Have them pick one randomly when their talk button is pressed. Simple, right?

Nope.

Actually, it's mathematically impossible for this strategy to not also, frequently, produce dialogue that repeats quite noticeably.

Let's suppose you're a game-maker and you've made the effort to give a particular NPC one hundred things they can say, and they randomly pick from that list.

When they speak again, there is therefore only a 1/100 chance they'll say the same thing they said before.

When they say their third line, though, then if the previous two lines didn't match, there's a 2/100 chance that this new one will match one of them.

If you use the standard probability-calculation dodge and calculate the probability that one or more matches won't happen, you get 1 for the first statement, 0.99 for the second, 0.98 for the third, 0.88 for the twelfth, and so on. To get the aggregate probability that a match won't happen after X choices, you multiply all X probabilities leading up to it. For the fourth statement, that's 1*0.99*0.98*0.97*0.96, a little more than 90%. But by the time you get to statement 12, the no-match probability is down to 0.44. At statement 13 it's a mere 0.39, and it gets rapidly worse from there.

(This explains the "birthday problem": You only need 23 random-birthdayed people in a room before the chance of at least two of them sharing a birthday exceeds 50%. Extending the concept, there's the cryptographic "birthday attack", based on the unintuitively high probability of matches between hashed versions of different inputs. There tend to be a lot more digits in the numbers in this application than when comparing birthdates, but the effort-reduction involved can be rather more dramatic. A birthday attack can turn a search that'd take more than ten thousand years into one that takes less than two minutes.)

So even with a hundred possible things to say, randomly picking from the list makes it more likely than not that a statement will be repeated only ten or so statements later.

This problem also affects random-play algorithms for music. A true random-play, even if the music library is large, is surprisingly likely to duplicate a recently-played track, more likely again to give you a track from the same album, and even more likely to give you a track from the same artist.

The simplest way to avoid this, and also to cure the repetitive-NPC problem, is how "shuffle"-play works: Prohibit a selection from being repeated until every other selection has already been made.

So our hundred-lined NPC randomly says something, and then randomly chooses another thing to say from the remaining 99 lines, et cetera. If two NPCs talk to each other they'll still sound as if they've suffered major brain injuries, but at least their aphasic conversational salad will have some variety.

So why do we still get so many one-note NPCs?

Well, here's that boring and prosaic reason. When you're making a game to a deadline, "NPC dialogue variety" often has about the same priority as "door of cupboard id #f3220a lacks squeaking sound". But dialogue is a lot harder to fix.

If you're making a modern voice-acted game, you'll often be neck-deep in recording extra dialogue to cover confusing events that playtesters discovered after all of the actors went home.

(Patching of this sort of problem in voice-acted games can often be quite obvious, as a character's voice shifts dramatically in tone and/or reverb in the course of one conversation, because two adjacent lines were recorded two months and 200 miles apart from each other.)

And there's not even much to be gained. Even when there's a lots of dialogue and proper scripted conversations, the player can end up just as annoyed when, inevitably, the well of unused lines runs dry. Every dialogue tree has to end somewhere, after all - and look at Poker Night at the Inventory, which is twenty minutes of funny talking trying to distract you from a seriously defective Texas-hold-'em machine.

(After this page went up, a reader pointed out to me that sports games with commentators suffer terribly from this problem. Even if there are 20 things a commentator can say when your striker misses a shot at goal or you overtake Nick Heidfeld, you're going to get very sick of all of the options pretty darn soon. You can usually turn the commentators off...)

In days of yore, of course, spoken game dialogue was rare-to-impossible, and game designers could work directly with - or be the same person as - the dialogue writers. They could fix stuff in seconds, and put huge amounts of text-only "talking" in a game that came on four floppies. But even those games have repeating dialogue in them, and many of them even have healthy populations of one-line NPCs.

(Even in a game like Animal Crossing, which has no voice acting and a huge amount of possible text-only things for NPCs to say, letters you can receive and so on, duplication starts showing up very quickly.)

The reason for one-line NPCs in games without voice acting, when it isn't just laziness or lousy writing, is that repeating dialogue is a positive feature - it informs the player that even if you're determined to Talk To Everyone, You Need Speak No Longer To This Dude. The particularly glaring example where a bunch of NPCs all say the exact same thing in their various different voices sends an even clearer, if more distracting, message.

Likewise NPCs who spout their canned line whenever you come near. Even novice players quickly realise that such an NPC is not a person, just a pseudo-animate signpost directing adventurers to the cave to the north or telling you where the marketplace is.

It's still a rather large immersion-breaker, though.

Clearly, all those lazy game-writers need do is create sentient NPCs with greater intelligence than most players.

This always seemed to work out very well in Star Trek, after all.

Other columns

Learning to love depreciation

Overclockers: Get in early!

Stuff I Hate

Why Macs annoy me

USB: It's worth what you pay

"Great product! Doesn't work!"

The virus I want to see

Lies, damned lies and marketing

Unconventional wisdom

How not to e-mail me

Dan's Quick Guide to Memory Effect, You Idiots

Your computer is not alive

What's the point of robot pets?

Learning from spam

Why it doesn't matter whether censorware works

The price of power

The CPU Cooler Snap Judgement Guide

Avoiding electrocution

Video memory mysteries

New ways to be wrong

Clearing the VR hurdles

Not So Super

Do you have a license for that Athlon?

Cool bananas

Getting rid of the disks

LCDs, CRTs, and geese

Filling up the laptop

IMAX computing

Digital couch potatoes, arise!

Invisible miracles

Those darn wires

Wossit cost, then?

PFC decoded

Cheap high-res TV: Forget it.

V-Pr0n

Dan Squints At The Future, Again

The programmable matter revolution

Sounding better

Reality Plus™!

I want my Tidy-Bot!

Less go, more show

In search of stupidity

It's SnitchCam time!

Power struggle

Speakers versus headphones

Getting paid to play

Hurdles on the upgrade path

Hatin' on lithium ion

Wanted: Cheap giant bit barrel

The screen you'll be using tomorrow

Cool gadget. Ten bucks.

Open Sesame!

Absolutely accurate predictions

The truth about everything

Burr walnut computing

Nothing new behind the lens

Do it yourself. Almost.

The quest for physicality

Tool time

Pretty PCs - the quest continues

The USB drive time bomb

Closer to quietness

Stuff You Should Want

The modular car

Dumb smart houses

Enough already with the megapixels

Inching toward the NAS of our dreams

Older than dirt

The Synthetics are coming

Pr0nBack!

Game Over is nigh

The Embarrassingly Easy Case Mod

Dumb then, smart now

Fuel cells - are we there yet?

A PC full of magnets

Knowledge is weakness

One Laptop Per Me

The Land of Wind, Ghosts and Minimised Windows

Things that change, things that don't

Water power

Great interface disasters

Doughnut-shaped universes

Grease and hard drive change

Save me!

Impossible antenna, only $50!

I'm ready for my upgrade

The Great Apathetic Revolution

Protect the Wi-Fi wilderness!

Wi-Fi pirate radio

The benign botnet

Meet the new DRM, same as the old DRM

Your laptop is lying to you

Welcome to super-surveillance

Lemon-fresh power supplies

A>B>C>A!

Internet washing machines, and magic rip-off boxes

GPGPU and the Law of New Features

Are you going to believe me, or your lying eyes?

We're all prisoners of game theory

I think I'm turning cyborg-ese, I really think so

Half an ounce of electrons

Next stop, clay tablets

A bold new computer metaphor

Won't someone PLEASE think of the hard drives?!

Alternate history

From aerial torpedoes to RoboCars

How fast is a hard drive? How long is a piece of string?

"In tonight's episode of Fallout 4..."

How hot is too hot?

Nerd Skill Number One

What'll be free next?

Out: Hot rods. In: Robots.

500 gig per second, if we don't get a flat

No spaceship? No sale.

The shifting goalposts of AI

Steal This Education

Next stop: Hardware piracy

A hundred years of EULAs

The triumph of niceness

The daily grind

Speed kings

Alt-tCRASH

Game crazy

Five trillion bits flying in loose formation

Cannibalise the corpses!

One-note NPCs

Big Brother is watching you play

Have you wasted enough time today?

The newt hits! You die...

Stuck in the foothills

A modest censorship proposal

In Praise of the Fisheye

Filenames.WTF

The death of the manual

Of magic lanterns, and MMORPGs

When you have eliminated the impossible...

Welcome to dream-land

Welcome to my museum

Stomp, don't sprint!

Grinding myself down

Pathfinding to everywhere

A deadly mouse trap

If it looks random, it probably isn't

Identical voices and phantom swords

Boing!

Socialised entertainment

Warfare. Aliens. Car crashes. ENTERTAINMENT!

On the h4xx0ring of p4sswordZ

Seeing past the normal

Science versus SoftRAM

Righteous bits

Random... ish... numbers

I get letters

Money for nothing

Of course you'd download a car. Or a gun!

A comforting lie



Give Dan some money!
(and no-one gets hurt)