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 ID0 (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 Now the dialogue will jump from “This is an example of…” directly to “a skipped dialogue!”, skipping the middle entry.
set_goto_id() to jump directly to another entry:Jumping Between Different Branches
You can jump to entries in different branches to organize your dialogue into logical sections:Default Flow (No Goto)
If you don’t set a goto, the DialogueEngine automatically advances to the next entry in the same 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)
Best Practices
Use enums for branch IDs
Use enums for branch IDs
Define branch IDs as enums for better readability:
Store entry references when you need to jump to them
Store entry references when you need to jump to them
Check the debugger for unreachable entries
Check the debugger for unreachable entries
The debugger will show disconnected nodes for entries that can never be reached. This helps you catch dialogue flow bugs.
Next Steps
- Add player choices to let players influence the dialogue flow
- Use conditional branching to branch based on game state
- Learn about save/load to preserve dialogue state
