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.

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 →24 Nov How does a 2D game fake depth? Parallax scrolling and background layers explained Walk through a game level and the faraway mountains barely move while the trees rush past. That trick is parallax scrolling, and it makes a… Making Games
16 Nov Why do menus and movements feel smooth? Easing and tweening explained Press a button in a game menu and the panel slides in, slows down and settles. That feel comes from easing: changing the speed of a… Making Games
3 Nov How do games make fire, smoke and sparks? Particle systems explained Fire, smoke and sparks in games are usually not drawings or videos. They are swarms of tiny short-lived particles made by an emitter. This… Making Games
1 Nov How does an enemy find its way around a wall? Pathfinding and A* explained How does an enemy find its way around a wall? Walking straight at you works only until the first obstacle. Pathfinding treats the map as a… Making Games
30 Oct How do game mods work? Load order and why the last mod wins Ever installed two mods and watched one quietly stop working? A mod is a small package that swaps or adds the data files a game reads, and… Making Games
28 Oct How does a game know two things touched? Collision boxes, circles and bullets that pass through walls How does a game know that two things touched? It doesn't look at the artwork. Every object gets a simple invisible shape, and the game…