Skip to content

Repository files navigation

Narrative Engine for Godot 4

Lightweight dialogue & narrative system inspired by Dialogic, stripped down to the essentials.

  • Character-based text events with portrait & color support
  • Branching choices with conditions and fallback actions
  • Sequence runner with signal-driven architecture
  • Decoupled UI layer — swap the display without touching logic

Architecture

` NarrativeSequence (Resource) ├── NarrativeTextEvent (text + character) ├── NarrativeChoiceEvent (choices + jump targets) └── ...

     │ loaded by
     ▼

NarrativeRunner (Node) ├── signal text_event(text, character, append) ├── signal choice_event(choices, prompt) ├── signal sequence_started / finished │ ▼ listened by NarrativeDisplay (Control) ├── NameLabel, TextLabel (RichText) └── Choices (dynamic buttons) `

Usage

`gdscript

1. Create a sequence in editor (or code)

var seq = NarrativeSequence.new() seq.sequence_id = "intro" seq.events = [ create_text("???: 你醒了...", null), create_text("老者: 这里是初始之地", elder_char), create_choice([ make_choice("你是谁?", 0), make_choice("我在哪?", 0), make_choice("...", -1), ]), ]

2. Run it

.start_sequence(seq)

3. Connect UI

.connect_runner() `

Key Design Decisions

Dialogic Narrative Engine
30K+ lines, editor-heavy ~250 lines, code-first
.dtl timeline files NarrativeSequence Resource
Complex subsystem architecture Single Runner + signals
Built-in UI only Decoupled display (swap freely)

Requirements

  • Godot 4.2+
  • No dependencies

License

MIT — extracted & adapted from concepts in dialogic-godot/dialogic (MIT)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages