All skills
thedivergentai avatar

/godot-genre-visual-novel

@9d6e91e

Expert blueprint for visual novels (Doki Doki Literature Club, Phoenix Wright, Steins;Gate) focusing on branching narratives, dialogue systems, choice consequences, rollback mechanics, and persistent flags. Use when building story-driven, choice-based, or dating sim games. Keywords visual novel, dialogue system, branching narrative, typewriter effect, rollback, bbcode, RichTextLabel.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-genre-visual-novel

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ103 tokens always: the name and description. β‰ˆ3k when used: this file. β‰ˆ2.2k more on demand in 7 files.

Genre: Visual Novel

Branching narratives, meaningful choices, and quality-of-life features define visual novels.

Core Loop

  1. Read β†’ dialogue / narration
  2. Decide β†’ choice moment
  3. Branch β†’ flag or path change
  4. Consequence β†’ immediate line variation and/or lasting flag
  5. Conclude β†’ one of multiple endings

NEVER Do (Expert Anti-Patterns)

Narrative & Flow

  • NEVER create the "Illusion of Choice" exclusively; strictly provide Immediate Dialogue Variations or Flag Changes even if the plot converges later.
  • NEVER skip mandatory QoL features; strictly implement Auto-Play, Fast-Forward, and Backlog/History for replayability.
  • NEVER display "Walls of Text"; strictly limit dialogue boxes to 3-4 Lines max to avoid intimidating the reader.
  • NEVER hardcode dialogue text inside GDScripts; strictly store narrative scripts in External Files (JSON, CSV, or custom Resources) for iteration.
  • NEVER ignore the Rollback mechanic; strictly maintain a history stack so players can undo miss-clicks or reread missed lines.

Technical & UI

  • NEVER use plain text for emotional beats; strictly use RichTextLabel BBCode (e.g., [shake], [wave]) to add visual weight.
  • NEVER parse massive narrative files on the main thread; strictly use ResourceLoader.load_threaded_request() to prevent transition stutters.
  • NEVER use standard Strings for frequently accessed game flags; strictly use StringName (&"met_alice") for faster dictionary lookups.
  • NEVER use _process for letter-by-letter animation; strictly use a Tween on visible_ratio for smooth, frame-independent reveals.
  • NEVER neglect character Z-ordering; strictly ensure the active speaker is brought to the front for visual clarity.
  • NEVER use z_index for Control node priority if input handling is required; strictly use move_to_front() to ensure draw order and input propagation match.
  • NEVER use absolute pixel positioning for character sprites; strictly rely on Anchors & Percent-based Offsets for responsive scaling.
  • NEVER allow text animations to continue when the player skips; strictly set visible_ratio to 1.0 instantly on input.
  • NEVER leave orphaned character sprites; strictly use queue_free() when actors exit the stage to prevent memory leaks.
  • NEVER mutate flags before snapshotting rollback state β€” always push history, then apply the choice.

πŸ›  Expert Components (scripts/)

MANDATORY before implementing undo / branching / presentation:

  1. vn_rollback_manager.gd β€” history stack (flags/backgrounds/index)
  2. story_manager.gd β€” flag-aware dialog orchestration
  3. dialogue_ui.gd β€” typewriter + choice UI
  4. visual_novel_patterns.gd β€” BBCode, choice filtering, sprite layering

Catalog (deduped)

  • story_manager.gd - Flag-aware dialog orchestrator with branching logic and character state persistence.
  • dialogue_ui.gd - Presentation layer: typewriter tweens (visible_ratio) and choice-window generation.
  • vn_rollback_manager.gd - History stack for state rollback (flags/backgrounds/index).
  • visual_novel_patterns.gd - Reusable BBCode effects, choice filtering by flags, sprite layering.

Decision Tree: Script Storage vs Plugin

Approach When to choose Notes
JSON / CSV scripts Writers edit outside Godot; rapid iteration Load via FileAccess or threaded ResourceLoader; validate schema in StoryManager
Custom Resource dialogue trees Designer Inspector editing, typed fields Peer godot-resource-data-patterns; MANDATORY story_manager.gd
Dialogic (plugin) Full VN suite (timelines, characters, themes) with editor tooling Prefer when shipping a large route graph fast; still keep rollback + flag discipline. Skip building a second StoryManager if Dialogic already owns timelines
Build lightweight custom Tiny kinetic novel / learning project Use scripts in this skill; do not re-stub StoryManager inline

Do not paste incomplete JSON StoryManager demos β€” implement from MANDATORY story_manager.gd.


Golden Path (order matters)

  1. Snapshot before mutate β€” On every advance/choice, MANDATORY vn_rollback_manager.gd pushes {line_index, flags, background, music} before flag writes.
  2. Typewriter + skip β€” dialogue_ui.gd: Tween visible_ratio 0β†’1; on skip/advance input set visible_ratio = 1.0 and kill the tween.
  3. Choice filter by flags β€” Present only options whose requires StringName flags pass; apply choice β†’ mutate flags β†’ jump label (visual_novel_patterns.gd + story_manager.gd).
  4. Speaker focus β€” move_to_front() on Control actors (not z_index alone) + dim inactive.
  5. Heavy CG/BG β€” ResourceLoader.load_threaded_request for backgrounds; never sync-parse huge scripts on the main thread.
# Choice handler shape (flags after snapshot)
func make_choice(choice_id: StringName) -> void:
    rollback_manager.push_snapshot()  # BEFORE mutate
    match choice_id:
        &"be_nice":
            flags[&"relationship_alice"] = int(flags.get(&"relationship_alice", 0)) + 1
            story_manager.jump_to_label(&"alice_happy")
        &"be_mean":
            flags[&"relationship_alice"] = int(flags.get(&"relationship_alice", 0)) - 1
            story_manager.jump_to_label(&"alice_sad")

Common Pitfalls

  1. Walls of text β€” Cap dialogue to 3–4 lines.
  2. Illusion of choice β€” Always vary lines or flags even on converging plots.
  3. Missing QoL β€” Auto / Skip / Backlog / Save are mandatory genre features.
  4. Broken rollback β€” Mutating flags before snapshot makes undo lie.

Deep recipes (on demand)

Topic Reference / script
Story driver & typewriter UI architecture-overview.md
Branching / rollback / focus key-mechanics.md
RichText / async loads godot-tips.md

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

  • BBCode in RichTextLabel β€” shake/wave BBCode and append_text for emotional dialogue without plain Label walls.
  • Size and anchors β€” percent offsets and anchors so character sprites and dialogue boxes scale across resolutions.
  • GUI containers β€” VBox/HBox choice rows and dialogue chrome instead of absolute pixel layouts.
  • Background loading β€” ResourceLoader.load_threaded_request so heavy CG/background swaps never hitch the typewriter.
  • Saving games β€” FileAccess patterns for flags, history stacks, and multi-slot VN saves.
  • Resources β€” typed dialogue/choice Resources as an alternative to brittle hardcoded JSON strings.
  • Internationalizing games β€” tr() / CSV keys so script lines stay localization-ready.
  • Audio streams β€” BGM crossfades and optional voice lines tied to line advances.
  • Using InputEvent β€” skip/advance/ui_accept handling that finishes visible_ratio instantly.
  • Singletons (Autoload) β€” persistent flag/history owners across chapter scene changes.
  • Signals β€” line_advanced / options_presented wiring between StoryManager and DialogueUI.
  • Tween β€” tween_property on RichTextLabel.visible_ratio for frame-independent typewriter reveals.

Related Skills

Prerequisites
Complements
  • godot-dialogue-system β€” reusable dialogue runners and line data shapes that genre VNs specialize.
  • godot-tweening β€” typewriter tweens, sprite fades, and background crossfades without AnimationPlayer spam.
  • godot-resource-data-patterns β€” Resource-based dialogue trees and duplicate(true) for mutable flag state.
  • godot-input-handling β€” skip, auto-advance, and backlog input actions without fighting Control focus.
  • godot-audio-systems β€” BGM buses and voice ducking synced to line/choice beats.
  • godot-ui-theming β€” theme type variations for nameplates, choice buttons, and backlog chrome.
  • godot-monte-carlo-balancer β€” simulate affinity thresholds and ending distribution before shipping branch weights.
Downstream / consumers
Master
  • godot-master β€” library router and mirrored module entry for cross-skill discovery.

Source: SKILL.md on GitHub

1 warning16d4 checks Β· Risk SAFE
  • Gen Agent Trust Hub16d

    The analyzed skill provides standard Godot Engine templates and documentation for building visual novel games, including dialogue branching, UI management, and a state rollback manager. No security risks or malicious behaviors were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW Β· No issues

  • Runlayer7mo

    4/4 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-genre-visual-novel