Skip to main content
Branching dialogue allows you to create non-linear conversations where the dialogue flow can jump to different parts of your dialogue tree.

Understanding Branches

The Dialogue Engine uses two concepts to manage dialogue flow:
  • Branch IDs: Logical groups of dialogue entries (like chapters or conversation topics)
  • Goto IDs: Explicit jumps to specific dialogue entries

Branch IDs

Each dialogue entry belongs to a branch ID. By default, all entries use branch ID 0 (the default branch).
The DialogueEngine will only advance through entries in the current branch unless you use gotos to jump between branches.

Using Gotos Within the Same Branch

1

Create entries and store references

Store references to entries you want to jump to:
2

Set the goto

Use set_goto_id() to jump directly to another entry:
Now the dialogue will jump from “This is an example of…” directly to “a skipped dialogue!”, skipping the middle entry.

Jumping Between Different Branches

You can jump to entries in different branches to organize your dialogue into logical sections:
When you jump to a different branch, the DialogueEngine automatically updates its internal branch ID tracker, so subsequent advance() calls will only consider entries in the new branch.

Default Flow (No Goto)

If you don’t set a goto, the DialogueEngine automatically advances to the next entry in the same branch:
If you start on branch TOPIC_A, the dialogue will flow: Entry 0 → Entry 1 → Finished (Entry 2 is skipped because it’s in a different branch).

Complete Examples

Visualizing Your Dialogue

The built-in debugger automatically generates a graph visualization of your dialogue tree, showing:
  • All dialogue entries as nodes
  • Goto connections between entries
  • Branch IDs for each entry
  • Disconnected entries (unreachable dialogue)
Use the debugger to verify your dialogue flow is correct! It will show you any unreachable entries or broken connections.

Best Practices

Define branch IDs as enums for better readability:
The debugger will show disconnected nodes for entries that can never be reached. This helps you catch dialogue flow bugs.

Next Steps