Writing Game Dialogue

A lot of you know I'm a multiclassed programmer/writer. Before I drafted four novels and got an agent, I had a Computer Science degree, scripted for Planescape: Torment, and completed a few dozen Project Euler problems (until they got too hard). Unfortunately, since I've been more focused on writing, my levels in programming have gone largely unused.

Until now. It turns out game dialogue is the perfect job for my class combination. It's nowhere near as complicated as writing a program to solve Sudoku, but it's got all the puzzle-solving aspects of programming that I love.

And it's not as hard as it sounds. Here, I'll show you.

Typical dialogue in a novel goes something like this (excerpt from Post-Apoc Ninjas):

     "Tell me who you really are," the Marshal said.
     Here we go. The Marshal had already guessed much. Kai would have to be careful. "As I said, I grew up among mercenaries in Rivaday, though the mercenaries themselves were from all over."
     "Ah, so the story changes. How much did my grandson pay you, then?"
     "Pay me?"
     "In reward. Surely a mercenary would not rescue the Lord of Gintzu and take nothing in return."
     Kai hesitated. Marshal Aryenu was much sharper than his appearance made it seem. It felt very much like talking to Domino. Better to turn the questions on him. "How much of what Lord Domino told me was true?"
     "Your reward, mercenary?"
     Both sharper and more stubborn than his grandson. "Two thousand."

     "A lie. The boy doesn't pay anyone he doesn't have to."

Game dialogue is not so different from this, at least for a game like Torment. Prose-wise, there are only a few changes:
  • Dialogue tags ("the Marshal said") are rarely necessary, since the character speaking is usually indicated on the game screen.
  • The Player Character's thoughts (in this example, our PC is Kai) are not tied to the PC's lines, if they're included at all; sometimes all information is conveyed through dialogue or item description instead.
  • PC lines are typically very brief. (In some games, you don't even get a line, just a motive or emotion that the game designers interpret for you).
  • Any description is written in present tense and second person (though I suppose it doesn't have to be).
So a more Tormenty version would look like this (speaker tags added for clarity):

Marshal: "Tell me who you really are."
PC: "As I said, I grew up among mercenaries in Rivaday."
Marshal: "Ah, so the story changes. How much did my grandson pay you, then?"
PC: "Pay me?"
Marshal: "In reward. Surely a mercenary would not rescue the Lord of Gintzu and take nothing in return." He examines you carefully. Suddenly, he seems much sharper than his appearance first suggested.
PC: "How much of what Lord Domino told me was true?"
Marshal: "Your reward, mercenary?"
PC: "Two thousand."
 
Marshal: "A lie. The boy doesn't pay anyone he doesn't have to."

Those differences are primarily cosmetic. The real difference, and the most fun, is that game dialogues allow the player to choose what they say.

Marshal: "Tell me who you really are."

1)
[Lie] "As I said, I grew up among mercenaries in Rivaday." 
2) "I'm a ninja."
3) "How much of what Lord Domino told me was true?"
4) Attack the Marshal.

Each one of those choices goes to a different branch of dialogue (or exits dialogue and starts combat, in the case of the last one). It's pretty much exactly like a Choose Your Own Adventure novel combined with a combat mini-game.

But a game should be better than that, no? We can respond, not just to what the player chooses to say, but to their other choices as well -- things they've done in the past, how they've customized their character, who they choose to travel with, etc. We call this reactivity.

Marshal: "Tell me who you really are."

1)
[Lie] "As I said, I grew up among mercenaries in Rivaday." 
2) "I'm a ninja."
3) "How much of what Lord Domino told me was true?"
4) Attack him.
5) (If the PC betrayed his clan) "I'm a ninja, and a fugitive from my clan."
6) (If the PC killed the guards outside the keep) "I'm the guy who killed your guards."  
7) (If the player took the Read Minds ability) Try to read his mind.

And then each of those responses might have reactivity as well. The lie in (1) might succeed if you have a high deception skill, for example. What you learn from (7) might change depending on your level in the ability.

What you end up with is a branching, interlinking dialogue tree, hopefully one that is every bit as interesting for the player to navigate as combat or exploration.


It might seem overwhelming, but really such a thing evolves gradually as you write each line and think about what the player might want to say in reply. In fact, it's difficult NOT to write a huge, unwieldy conversation tree. For me, that's half the fun: trying to figure out how to guide the player to all the information I want them to get, without forcing them.

Here, if you want to play with a free, online example, try this online game where you play a dragon. But, um, don't blame me for any productivity loss.

12 comments:

Matthew MacNish said...

If, then.

Steve MC said...

4! 4! I keep hitting 4, but nothing's happening. :p

Thanks for the inside look, and I just tried the dragon game. Didn't like eating the horse, but it did let me tell it to call me GOD. And a female GOD, too. :-)

Cap'n Heine said...

Thanks to my time at Liquid, I was able to write all the dialogue for one of the levels of Desperate Housewives: The Game. I also learned how important a good dialogue tree writing tool really is. Especially if you want to get complicated and have lots of conditional dialogue lines...

Unknown said...

Hey there adam,
I would really like to thank you for your post as i could see it just in the right time.
Recently i have been very much into the idea of creating my own game, starting out by maybe making abit of mods for other known games with the ideas and stories i have in mind but i was quite afraid of the prospect and the task of creating a good enough conversation was quite daunting... until i read your post.
Now i know it is obviously not easy but your post made it seem more "humaine" and less scary which only strenghtens my resolve to go and try.
So i want to thank you very much for it.
Konstantin

Eliza Tilton said...

FASCINATING.

I always pick intimidate but never have the feat high enough to execute.

And now I must return to Skyrim.

Susan Kaye Quinn said...

It might seem overwhelming, but...

Um, what? I think my head just exploded.

JuanPi Carbajal said...

Well, I do think good dynamic dialogs are uch more difficult than Sudoku solving. Indeed, there is plenty of the latter and none of the former (best I've seen in a long time is Facade).

Do go on! Bes tof lucks and looking forward to Torment.

Unknown said...

I have to say.. If it's so easy, why don't more people do it? What I tend to see in video games isn't dialogue like this.

Of course, perhaps writing video game dialogue like this is only easy if you can write novel dialogue like this, and writing good dialogue is one of the things many people struggle with, or so I'm led to believe.

What I mostly see in video game dialogue is:

NPC: This is who I am and this is why I need you to go to the dungeon/mercenary base/Volcano of Doom/orbital platform and fetch the Sword of Truth/secret attack plans/Amulet of Uberness/deathray schematics.

PC: Ok.


That's not dialogue. That turns the NPC into an expositional order-giving infodump.

I agree with you, by the way. This is how dialogue -should- look. Give and take. Back and forth. To and fro. Call and response. You say something, I say something, you say something, I say something. Too many "writers" for video games forget that that's how conversations work, and they just load up the NPC with exposition and throw it at the player.

As someone for whom dialogue is one of the most important parts of the storytelling experience, I frequently find myself rolling my eyes ;)

Chris Conley said...

No fuzzy logic or nonbinary variables? Not reactive enough. >:(

Unknown said...

Thanks for the post.

linda said...

Dude, this stuff is fascinating. Just last week I was randomly reading stuff about Planescape and Torment and stumbled on Emily Short's interactive fiction, starting with Galatea. I thought the actual games weren't that exciting (I'm too impatient! And I want to know all the endings without doing the game five million times!) but I was fascinated by the additional materials she provided, like source code and dialogue flow charts. Makes me want to learn programming so I can play around with writing my own IF and frustrating players with tragic endings, ha. I'm so envious you get to do this for real. :)

shangoat said...

I was redirected here from the recent Torment: ToN update. Many thanks to this informative post as I'm trying to construct something very similar to Planescape/Fallout's dynamic/reactive dialog system in my own Game-Maker-made RPG - actually, I'm trying to counterfeit it.