← /browse

Making Games / 3 min /

How do games branch a conversation? Dialogue choices, flags and locked answers

Dialogue in games is a map: each line of text is a node, and each answer is a road to another node. Add a few flags and numbers the game remembers, and the same conversation changes depending on what you did before.

Talk to a gatekeeper in the interactive, watch the game's memory change as you choose, and see why some answers are locked until you earn them. Then learn how to keep a branching story small enough to finish.

Diagram of connected dialogue boxes branching into different paths, two marked with flags

A conversation is a map, not a script

In a game with dialogue, you rarely read one fixed script. You read a small map. Each piece of text is a stop on that map (developers call it a node), and each answer you can pick is a road to another stop. Pick a different road and the story goes somewhere else.

That is all "branching dialogue" is. A node holds a line of text and a list of choices, and each choice names the node it leads to. You can build a working conversation with nothing more than that.

The game has a memory

A map alone feels flat, because the character forgets everything the moment you leave a node. The trick that makes a conversation feel alive is a bit of memory: a few flags (yes/no facts such as "the player helped the baker") and a few numbers (such as trust). Choices can change them, and later nodes can read them.

Try it below. Talk to the gatekeeper and watch the memory panel change as you choose. Some answers only appear once the game remembers something earlier.

Locked choices and the gate

Look at the "I have a pass" answer. At first it is greyed out. The game checks a flag, has_pass, and shows or hides the choice depending on its value. This is called a condition (or a gate). It is the single most useful idea in dialogue writing: the same node can offer different choices to different players.

Games handle a locked choice in two ways. Some hide it completely, so the player never knows it existed. Others show it greyed out, as above, which tells the player that an earlier decision matters. Neither is right for every game. Hiding keeps surprises; showing makes consequences easier to learn.

Why the map gets big fast

Every extra choice multiplies the work. If each node has three answers and you want the story to go five steps deep, you could end up writing many different paths. Most games avoid this with a few habits:

  • Branch and merge. Different answers lead to different replies, then the paths join again at the same node. The player feels heard, but you write far less.
  • Remember, don't branch. Instead of a whole new path, set a flag and let a later line react to it with a single sentence.
  • Keep a few big forks. Save the truly different story paths for moments that matter.

How to make your own

You do not need an engine to start. Free tools such as Twine let you draw the map of nodes and write the text, and the free Ink and Yarn Spinner languages are made for dialogue that you can plug into a game later. Godot, Unity and other engines can read the same idea: a node, a few choices and a handful of variables.

Where to start

  • Write one scene of five nodes on paper before opening any tool.
  • Add exactly one flag and one locked choice that depends on it.
  • Let two paths merge back together.
  • Play it yourself and check that every node has a way out, so nobody gets stuck.

More in Making Games

all Making Games →