You click “Show me the stairs,” read “Use the east stairs,” and hear the attendant say, “Take the lift.”
If you’ve connected voice clips to branching choices, you know the frustration: a perfectly good recording is answering a choice the player didn’t make.
I'm Nora Bennett. In my game dialogue work, I check which line a player’s choice triggers and whether the game plays the matching recording.
Bellow, we’ll build a three-branch dialogue tree, map each reply to its recording in a copyable voice-line table, and test one route all the way from choice to playback.
Deliver distinct voiceovers for game missions and emergency broadcasts within a branching dialogue tree.
Map Choices to Stable Line IDs
Give each spoken line in your dialogue tree a persistent identifier before recording. Keep the choice ID separate: it identifies what the player selects, while the line ID identifies the utterance that follows. Moving a menu option should preserve both identifiers and their connection.
For voiced content, I want voice line IDs that remain useful after someone rearranges the scene. Yarn Spinner’s asset documentation shows this principle: a line’s ID connects its translated text, voice clip, and other assets.
Use Yarn Spinner line tags to map voice clips and localized text inside your game dialogue tree script.
Keep a line’s ID through a wording revision, increment its text revision, and mark the old recording stale. Give a new utterance its own ID. Sorting a spreadsheet or inserting a branch should leave existing IDs intact.
A Three-Branch Example
In this original scene, lift attendant Sera speaks to a courier at a mountain station. The courier can show a permit, ask for stairs, or leave. Lift access requires both a valid permit and a running lift.
This planning sketch shows branching choices, their conditions, and their resulting lines. Implement its rules in your project’s dialogue system.
INITIAL STATE
has_permit = true
lift_running = true
route = unset
START -> LIFT_001 -> CHOICE MENU
├─ C_PERMIT: "Show my permit."
│ Requires: has_permit AND lift_running
│ Reply: LIFT_010
│ On valid reply advance: route = lift -> END
│
├─ C_STAIRS: "Show me the stairs."
│ Requires: always
│ Reply: LIFT_020
│ On valid reply advance: route = stairs -> END
│
└─ C_LEAVE: "I'll come back."
Requires: always
Reply: LIFT_030
On valid reply advance: route = leave -> END
Hide C_PERMIT when its condition fails. Recheck the condition when the player selects it, since the world may have changed while the menu was open. Ink’s conditional-choice reference provides an example of choices controlled by story state.
Explore Inkle's open-source ink scripting language on GitHub for writing an interactive dialogue tree.
Here, advancing a valid reply applies its route change once, including when audio is skipped or absent. An invalidated reply returns to the refreshed menu without applying its route change.
Build a Voice-Line Table for Those IDs
Use this voiced dialogue template as the handoff between narrative and audio. The tree selects an ID; the table supplies the speaker, approved text, and corresponding recording. The courier’s menu choices stay unvoiced in this example.
Speaker, Text, and Audio File Fields
All paths below are planned English assets. A filename becomes usable after the matching recording is reviewed, approved, and imported into the game.
Trigger
Line ID
Speaker
Spoken text
Planned audio file
Start
LIFT_001
Sera
Need a way to the upper platform?
en-US/LIFT_001_r1.wav
C_PERMIT
LIFT_010
Sera
Take the lift. I’ll send you up.
en-US/LIFT_010_r1.wav
C_STAIRS
LIFT_020
Sera
Use the east stairs. Keep the red door shut.
en-US/LIFT_020_r1.wav
C_LEAVE
LIFT_030
Sera
All right. Mind the ice outside.
en-US/LIFT_030_r1.wav
Add locale, text revision, audio status, duration, and reviewer to the production sheet. Use explicit statuses such as planned, approved, stale, or text_only. A blank audio field needs a documented fallback. Resolve recordings by line ID, locale, and approved revision so a matching filename cannot quietly conceal outdated words. If Sera’s “east” changes to “west,” I’d mark the old recording stale immediately, even if the line ID stays the same.
For a synthetic source, VUI Labs’ current TTS reference lists Luna-TTS 1.5 with Chinese, English, Japanese, and Korean support. Its complete-output endpoint returns WAV by default. For these English lines, select a compatible system voice available to your account and generate each utterance separately. Keep IDs and production notes outside the spoken input. Your game implements the dialogue tree, state changes, asset lookup, and audio playback.
Maintain natural speech pacing and emotional cues across real-time conversations in a dialogue tree.
Record the chosen voice and settings beside the takes. Have a person compare each recording with its text before approval, then verify the imported asset. An export that plays on your desktop still needs to play through the game’s audio system.
Test a Choice from Text to Playback
Start with the initial state above, English text and audio, and all four approved files imported. Run the conversation from its opening rather than triggering a reply directly in the asset browser.
Confirm that Sera’s opening resolves to LIFT_001 and its matching clip.
Select “Show me the stairs.” Log C_STAIRS, the current state, and the selected reply ID.
Confirm that LIFT_020 supplies both the displayed text and en-US/LIFT_020_r1.wav.
Play the reply. Check the direction, complete sentence, and speaker identity against the table.
Advance once. Confirm route=stairs, conversation completion, and no second reply from another branch.
This preview follows the “Show me the stairs” branch.
sera-stairs-branch-preview
I’d pay particular attention to “east.” The direction needs to remain easy to catch when the reply plays against station ambience. Preview the opening and stairs reply together, then check them in the game at its intended listening level. That preview helps judge the recordings; the logged choice and asset establish which path actually ran.
Repeat with the other two choices, resetting state each time. Then set has_permit=false: the permit choice should disappear, while stairs and leave remain available. Restore the permit, select its branch, and stop the lift before the reply starts. The lift reply should stay silent, its route change should remain unapplied, and the refreshed menu should offer the valid choices.
Finally, remove one test recording and exercise the configured text fallback. The dialogue tree should still advance correctly. Keep a short result record containing the choice, state, line ID, locale, revision, resolved asset, and observed outcome.
Frequently asked questions
Can two branches reuse the same recorded line?
Yes, when the words, speaker, delivery, and surrounding meaning fit both paths. Point both branches to the same line record, or use an explicit shared-asset reference. Sera’s opening already serves all three routes. Keep separate records when identical words need different performances, so a later retake can change one without affecting the other.
When should a branch stay text-only?
Use text-only branches while prototyping unsettled dialogue or for interactions designed to be read. The courier’s options here are menu text, so they need no recordings. Mark replies intended to ship without audio as text_only, and give them readable display time or player-controlled advance. Keep their state effects consistent with voiced replies.
What happens when a line is skipped after a state change?
If the state makes the line invalid, cancel its queued or playing audio and discard its pending route effect. Refresh the available choices. If the player merely skips a still-valid recording, advance it and apply its route effect once. Ignore completion callbacks from canceled playback so they cannot advance a newer line.
How should subtitles follow a branch with optional audio?
Resolve text and audio from the same selected line record. Xbox’s subtitle guidance calls for text equivalents of speech and clear speaker identification. With audio present, synchronize the text to that recording. Without audio, use the project’s reading-time or manual-advance policy. Cancel obsolete subtitle cues when a branch is invalidated.
What if one localized branch has no approved voice file?
Use approved localized text with the project’s declared audio fallback, such as text-only playback or a supported fallback voice language. Track missing audio separately from missing translation, identifying the line ID and locale. Check reading time and state progression. If the release requires complete voice coverage, hold that locale’s approval until the recording is ready.