· 14 min read

How to write perfect dialogue trees for games

One of the key times players get to make a choice is during dialogue. But how exactly do you create and plan all those branching paths?

Branching paths and dialogue trees go hand-in-hand with games. If you’re developing a game with even a modicum of story, the likelihood is that you want to give players an element of choice, too.

It can seem a little daunting at first. But creating a dialogue tree – a flowchart of the player’s choices in a conversation – doesn’t need to be complicated. Even the smallest changes can really immerse a player into your game. It’s about making them feel like they matter. I did this, therefore that is different.

How gaming studios use DataSuite to find hit games

Get the guide

The same principles for creating a single dialogue tree apply when planning your plot. So whether you’re coming up with a single conversation in a mobile game or developing a completely story-driven RPG, let’s dive into how you can plan out your dialogue trees.

Separate your choices from your hubs

There are two main reasons you’ll want to write a dialogue tree. You either want to advance the story or give information – give a choice or create a question hub.

  • Choices are a one-way street. These are dialogue options where the player picks a response and there aren’t any takebacks. They make a decision and there’s a clear fork in the road.
  • Hubs are for information dumping. These options are about answering questions. While speaking to a character, your player can pick an option, get the answer, and then return to a central hub – listing all the options once more.

It’s important to recognize this difference. When writing a choice, you need to make the response in-line with the character’s personality. Whereas you should write hubs in a more neutral, straightforward style.

So when you design your dialogue tree, make sure you distinguish between these two types of dialogue. Both in your planning, but also in your game’s design. (Maybe you only give hubs to NPCs that don’t affect the overall story, so people don’t accidentally make a choice when they thought they were in a hub.)

Not every choice needs huge consequences

Just because you’re giving a player a choice, doesn’t mean it needs to result in an entirely different ending. Not every choice is a huge branching path. Some – if not most – might affect your game in other ways.

Beholder Game Example

In Beholder, all of your choices affect how other characters treat you, what happens to your environment, and even the ending of the game.

There are four ways a choice might affect your game:

  • Story changes. These are those critical moments that create an entirely new branch on your tree. Maybe a character’s life hangs in the balance, and whether they live or die takes you down a completely different path.
  • Power changes. These choices affect the gameplay itself. If a player successfully persuades an ally, maybe the final battle is easier. Or perhaps they gain more uses of a specific power because they were kind to a small child.
  • Character changes. A player’s choice affects how a character treats them throughout the story. If you’re rude, they’re rude back. If you’re sarcastic, they tell everyone how funny you are. These reward a player for roleplaying. (For example, in Fable if you act aggressively then the NPCs will show that they’re afraid of you.)
  • World changes. More subtle changes happen because of the player’s behaviour. Maybe a character grows roses in their garden because the player idly mentioned that was their favourite flower. Or maybe when the player was rude to the queen, they later overhear two NPCs gossiping about it.

Fable Game example

Fable is a prime example of character changes. The more evil deeds you do, the more terrified the villagers are of you. 

So when planning your dialogue tree, note down what affect the decision will have on the rest of the game. Tagging these choices will help you keep track of what you need to add to the final version.

Signpost critical choices

One of the most frustrating experiences for a player is to make a choice, and not have any idea how it’s going to impact the story. If most of your dialogue has been question hubs or the choices generally led to simple power changes, they might not expect a sudden story-changing option.

So try to make it clear when a choice matters. You don’t need to literally flash a message on the screen. (We’re looking at you, The Wolf Among Us.) You can let the characters explain the importance to the player. It’s much more natural if a character says something like: “It’s all down to you. No turning back. What’ll it be?”

Give big choices time to breathe

If a choice is going to have huge, game-changing consequences – it’s good to leave time between that choice and the final result. Mass Effect was infamous for its ending branches, because it felt as though everything the player did up until the ending was pointless. It was only the final choice that mattered.

But imagine they’d offered the same choice much earlier – and more subtly. Throughout the story, characters could’ve asked the player what they felt about artificial intelligence: Would you kill or control them? How you responded to each of those characters could’ve determined which option Commander Shepard took at the end.

Mass Effect gameplay

It still would’ve been the same choice. But it would’ve felt much more impactful. You said you’d kill them all. You said it every time. You chose to make Shepard this way. The result wouldn’t be arbitrary. It’d be inevitable.

Signposting how critical those decisions were would be a challenge. But not impossible. Characters could hint that the player ought to watch what they say. “Careful, Shepard. You oughta watch your mouth. Say something enough, and it changes you to your core, you know.”

Keep your branches down

The more branches in your dialogue tree, the more work you’re going to give yourself. Even if it’s an isolated conversation, be wary of exponential growth. There are two parts of a conversation to consider:

  • Branching points. These are the moments where the conversation is going to branch completely in at least two directions. Even if you loop back around, you’re going to be writing two separate versions of the conversation.
  • Dialogue options. How many options do you give your player at those branching points?

If you have three branching points in a conversation, each with two options, you’re going to have eight branches to write. Add one more option to each, you’ve got 27 branches. Another option? 64.

Walking dead game example

The equation is simple: It’s the number of options to the power of the branches. So the more branches you want, the fewer options you’ll want to give.

Consider your resources

How complex you want to make your dialogue tree really depends on the resources you have. How many people do you have in your team? If it’s only a few, you probably want to keep your dialogue tree pretty tight. What platform are you publishing on? If you’re making a mobile game, you’ll want to keep your dialogue short and sweet to fit on the screen.

Reigns gameplay example

Reigns is renowned for its choices. We’ve lost count of how many endings they have. Which is something Nerial could easily do. Because their core gameplay and design are so simple, they could spend more time crafting endings.

Any size studio – for any platform – can use a dialogue tree. But make sure that you don’t take on more than you can chew. Good dialogue takes time to refine. And when there are lots of moving parts and branches, you’ll need to go over the whole story multiple times to make sure it’s consistent.

Draw out your structure

The best way to design your dialogue tree is to draw out the structure like a flowchart, either by hand or with a tool like Microsoft Visio. If you want a tool specifically for gaming, Twine is a good alternative. Though it takes a little getting used to.

Once you’ve decided exactly how you’re going to draw your tree, start with the main path. What’s the main line through your game? This is the trunk of your tree. You can decide where to branch off the main path once you’ve got the main structure sorted.

It can help to write segments of the main path first, so that you have a better idea of how the story will flow.

How should it look?

Bandersnatch was a Netflix show with lots of branching parts, endings and deadends. It’s a very useful model to use when planning out dialogue trees. In fact, Reddit user alpine- recreated the flow.

Bandersnatch example

As you look through the tree, you’ll notice a few key features:

  • Loops and returns. Quite often, there are moments where the choice either loops back around or two choices only branch for a little while before returning to the main trunk.
  • Skips. Occasionally, a dialogue choice is there just to bypass a lengthier section. If you use these yourself, ask yourself whether the skip might affect what the character knows and any future dialogue.
  • Notes. You’ll notice that rather than drawing a completely separate branch, they’ve used dotted lines to indicate when a choice affects a different section and then added a note. For example, near the top right, it says: “Now Stefan knows about this pathway.” And this causes a small dialogue change in the scene.

Bandersnatch is probably denser than you’ll need for your game. With five different endings, and a huge number of options, it can get a little messy and intricate. So we’d recommend trying to have fewer endings and more sidenotes – where decisions cause other effects in your game, such as world or character changes. Rather than a completely alternative path.

Create variants, not just branches

The trick to creating an immersive experience isn’t to have loads of endings. It’s to have a mix of loops, skips and notes. Choices don’t have to affect the main branch that you’re creating immediately.

One way to do this is with variants – a slightly altered version of a scene or dialogue. Rather than a completely separate branch, you just have two versions of the same conversation. For example, if a player is rude to a character – maybe add a tag to all the scenes where that character appears. You now know that you need to create a variant of each of those scenes to keep the whole story consistent.

These smaller variants of scenes make it feel like every decision matters – even if they don’t completely change the main storyline. If you combine these choices that cause world or power changes, you won’t need to write hundreds of different scenes.

Think about locks and keys

One way to help a player feel accomplished is to lock certain choices. Did they pick up a key item? Do they have the relevant stat for this interaction? Has a major character died – so the player is forced down a specific path?

In Detroit: Become Human, they actually show the player the flowchart for the game as a way to encourage players to explore every outcome.

Detroit become human example

You’ll notice that certain choices are unlocked because of what the player has done in the past. For example, “Used friendly approach in ‘the interrogation.’” Because the player made that choice, this option is now open to them.

Interestingly, you’ll also notice that this is all within a returning branch. All these choices lead to the same result: The player finds Jericho. At this point, the main story continues. The small choices they made in the past merely affect how they discover Jericho – and how hard it’ll be.

There are four kinds of locks that you can use:

  • Open. These are dialogue options that have no restrictions. The player can choose these freely, without needing to have done anything in the past. Often you’ll use these.
  • Direct. These are where a specific choice has led to certain options opening up. For example, having enough intelligence, picking a certain background for the character, or having a specific item in your inventory.
  • Convergent. This is where two or more choices need to come together to unlock a specific option. For example, if they persuade the three army generals to join their cause, perhaps they could strongarm the foe into a truce rather than fight.
  • Accumulative. Multiple options scattered throughout the dialogue add up to unlock an option. Morality systems are a good example of this. The higher your morality, the more ‘good’ options you unlock. Or perhaps it’s tied to a specific character. If you’re kind to them, maybe their loyalty meter increases, unlocking more choices.

You’ll notice that games like Fallout or Cyberpunk use a combination of these locks to feel more immersive. While smaller titles like the text-based adventure game, Lifeline, primarily use open or direct paths.

Lifeline example

Think about both sides of the conversation

Remember, you’re not only writing the dialogue for your characters. You’re writing what the player can say, too. When writing that dialogue, there are a few principles that can help make sure they land well:

  • Use questions for hub items. If the player can repeat the dialogue – like in a question hub – questions can help make sure the player understands they’re not actually making a choice. So be careful using questions for actual choices.
  • Make the option specific. You often won’t have room to write out the whole dialogue the player will say. So it’s probably best to try and summarize the first few lines. Giving just an emotion can lead the player to think: “Wait, I didn’t mean that.” Vague options make it difficult for the player to know which to pick.
  • Decide if the player actually talks. When the player chooses an option, do they see what they said? Do they actually speak or do you skip straight to the NPCs dialogue? Just avoid making your dialogue choices a press-a-to-continue button – otherwise it might seem like the player has only said about ten sentences the entire game.

Whatever you choose, it’s important to write the dialogue in a character’s voice. But remember that the player is affecting the character’s personality. So if they’re always picking the angry options, maybe they take on a rougher tone.

Red dead redemption example

For example, in Red Dead Redemption 2 there are many subtle changes to the dialogue depending on the player’s honor. For example, the low honor Arthur comes across as greedy and callous, while high-honor Arthur comes across as much more empathetic.

Make the conversation feel natural

It can be rather silly if a character is crying about their dead parents one moment, and jovially answering questions the next. If you have any dialogue that the player can repeat – like a question hub – think about how that should change depending on where they’re at in the story. Write different variants of the dialogue so that it feels right.

Oxenfree example

Another way to make a conversation feel natural is to allow the player to interrupt the other characters. This is much harder to implement, but Oxenfree does it beautifully.

In Oxenfree, the player can choose dialogue choices at any point, even while other characters monologue. The interruption itself isn’t what’s so great, though. It’s how they get the dialogue back on track. Using phrases like “Anyway…” or “As I was saying…” they can seamlessly cut back to the original dialogue as though it was a real conversation.

See how players react

As Ernest Hemingway apparently said: “The first draft of anything is s**t.

You never know how smooth your dialogue is or whether it feels quite right, until you start getting people to play your game. So it’s important to test out how players react, which options they choose and which options they miss.

If you’re looking to craft your own dialogue tree, you can use our tool to track where your beta testers are jumping ship or which choices might be falling flat. Give it a try.

Looking for more insights?

Other posts we think you’ll like

Join 30,000+ leading games industry professionals for weekly insights