All skills
thedivergentai avatar

/godot-dialogue-system

@9d6e91e

Expert patterns for branching dialogue systems including dialogue graphs (Resource-based), character portraits, player choices, conditional dialogue (flags/quests), typewriter effects, localization support, and voice acting integration. Use for narrative games, RPGs, or visual novels. Trigger keywords: DialogueLine, DialogueChoice, DialogueGraph, dialogue_manager, typewriter_effect, branching_dialogue, dialogue_flags, localization, voice_acting.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-dialogue-system

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ118 tokens always: the name and description. β‰ˆ2.9k when used: this file. β‰ˆ1.4k more on demand in 2 files.

Dialogue System

Data-driven dialogue routing β€” not beginner typewriter tutorials.

NEVER Do in Dialogue Systems

  • NEVER hardcode dialogue text in GDScript β€” Store lines in Resources / JSON / CSV so localization works.
  • NEVER show choices the player has not unlocked β€” Hide (or intentionally gray) gated options.
  • NEVER use unvalidated loose strings for node transitions β€” Typos in next_node_id soft-lock mid-convo; assert / registry IDs.
  • NEVER force a typewriter without skip β€” Click/confirm must finish the line immediately.
  • NEVER drive reveal with per-character Timer / OS.delay_msec() β€” Use visible_ratio / visible_characters + Tween (see typebox_effect.gd).
  • NEVER store dialogue cursor state only in the UI node β€” Scene changes drop the player; keep progress in the manager Autoload / session object.
  • NEVER get_node() from NPCs into Dialogue UI β€” Start via manager signals (start_dialogue(res)).
  • NEVER invent regex for BBCode β€” Prefer RichTextLabel BBCode / custom effects.
  • NEVER save/load inside a dialogue node Resource β€” Nodes are data; persistence belongs to SaveSystem.
  • NEVER hardcode portrait paths in code β€” Assign textures on node Resources or a portrait database.

Decision Tree: Authoring Engine

Authoring need Engine MANDATORY scripts Do NOT Load
Designer-friendly .tres graphs in-repo Resource Autoload graph dialogue_resource.gd β†’ dialogue_manager_singleton.gd β†’ dialogue_ui_controller.gd β†’ typebox_effect.gd dialogue_engine.gd JSON path
External writers / spreadsheet β†’ JSON JSON graph engine dialogue_engine.gd (+ optional dialogue_manager.gd) β†’ UI + typebox Resource Autoload stack
Visual node editor in-project GraphEdit authoring Keep runtime on Resource or JSON export; GraphEdit is editor-only tooling Shipping GraphEdit as the runtime walker
Conditions / quest gates Either branching_condition_validator.gd Embedding flag checks in UI buttons
Portraits / expressions Either dialogue_portrait_manager.gd β€”
Localization keys Either localized_dialogue_resource.gd Hardcoded language if trees
Quest / gameplay hooks from lines Either dialogue_event_bridge.gd Side effects inside UI controller

Default golden path: Resource Autoload β†’ UI controller β†’ typebox_effect. Pick one runtime engine; do not run Resource manager and JSON engine in parallel.

Available Scripts (single catalog)

Runtime (golden path)

Supporting

Alternate engines (load only if decision tree says so)

Typewriter Contract (skip-safe)

Use typebox_effect.gd: set full text, tween visible_ratio (or RichTextLabel visible_characters) from 0β†’1. On skip input: kill tween and snap visibility to complete. Do not spawn a Timer per character.

Elite Deltas

MANDATORY for GraphEdit tooling, TTS/lipsync, analytics, and moved inline manager/UI tutorials: elite-dialogue-patterns.md. Do NOT Load for Resource Autoload golden path only.

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain β€” do not preload the whole lattice.

Official Documentation

  • Resources β€” Why dialogue graphs belong in Resource / .tres data instead of hardcoded strings in scripts.
  • BBCode in RichTextLabel β€” Native markup for speaker emphasis, custom tags, and effects without rolling your own parser.
  • RichTextLabel β€” visible_characters / image helpers and BBCode APIs the dialogue UI should drive for typewriter and portraits.
  • Internationalizing games β€” tr() / TranslationServer workflow so line text stays key-based across locales.
  • Localization using spreadsheets β€” CSV translation tables that map cleanly onto dialogue text_key fields.
  • Importing translations β€” How Godot imports CSV/PO so localized dialogue resources resolve at runtime.
  • Using signals β€” Emit line/choice/end events upward so UI, quests, and audio never hard-reference the manager internals.
  • Singletons (Autoload) β€” Register a DialogueManager that survives scene changes and owns traversal state.
  • Tween β€” Drive visible_ratio / character reveal timing without blocking the main thread.
  • Text-to-speech β€” DisplayServer TTS callbacks for placeholder VO and lipsync-adjacent timing.
  • GraphEdit β€” Editor surface for authoring branching dialogue graphs when .tres lists become unwieldy.
  • JSON β€” Parse external dialogue graph files when designers prefer JSON over Resources.

Related Skills

Prerequisites
  • godot-project-foundations β€” Autoload registration, input for advance/skip, and project layout dialogue UI scenes plug into.
  • godot-gdscript-mastery β€” Typed Resources, signals, await, and Callables required before branching engines and UI bridges.
  • godot-resource-data-patterns β€” Canonical patterns for DialogueLine / graph Resources, exports, and avoiding duplicated mutable state.
  • godot-autoload-architecture β€” Singleton ownership and boot order for a global DialogueManager that must outlive scene swaps.
Complements
  • godot-signal-architecture β€” Signal-up / call-down contracts for line_displayed, choice selection, and narrative event bridges.
  • godot-ui-rich-text β€” RichTextLabel BBCode, custom effects, and image embedding beyond the basics used in typewriter UIs.
  • godot-ui-containers β€” Layout choice buttons and dialogue panels without fighting Control sizing and focus.
  • godot-tweening β€” Skip-safe Tweens for character reveal, portrait entry, and panel transitions.
  • godot-audio-systems β€” Voice-line players, bus ducking during dialogue, and subtitle sync with spoken audio.
  • godot-quest-system β€” Quest flags and objectives that gate conditional choices and fire from dialogue event bridges.
  • godot-save-load-systems β€” Persist dialogue flags / seen-node state outside UI nodes so progress survives reloads.
Downstream / consumers
  • godot-genre-visual-novel β€” Full VN presentation loops consume this skill’s graph traversal, portraits, and choice UI patterns.
  • godot-inventory-system β€” Dialogue effects often grant/require items; keep grant logic in inventory, not inside line Resources.
  • godot-monte-carlo-balancer β€” Simulate skill-check / branching choice trees when narrative gates or reward paths need balance passes.
Master
  • godot-master β€” Library router and mirrored module entry; open when discovering which Domain Skill owns narrative, UI, or quest concerns.

Source: SKILL.md on GitHub

No alerts17d4 checks Β· Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides a secure and well-structured implementation of a branching dialogue system for the Godot Engine, adhering to best practices such as resource-based data management and signal-based communication.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW Β· No issues

  • Runlayer7mo

    2/3 files flagged

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-dialogue-system