Rule-Based Dialogue System

Event-driven conversation engine with contextual awareness, relationship tracking, and complex branching narratives.

The Challenge

Static dialogue systems break immersion in narrative games. I needed conversations that adapt to time of day, relationship history, story progress, and player choices - creating believable characters that remember past interactions.

Traditional branching dialogue becomes exponentially complex with multiple variables. I needed a dynamic system that could handle contextual awareness without requiring manual scripting of every possible conversation state.

Technical Implementation

Inspired by Elan Ruskin's GDC talk on dynamic dialogue, implemented with custom fact dictionaries and priority selection.

Fact & Priority System

Tracks facts: Past actions, current situation, relationships

Picks the best response: More specific situations have higher priority

Automatic fallback: Plays default dialogue, so never breaks

Event-Driven Flow

Triggers: Player actions update game state

Supports: Multi-character conversations

Integrates: Portrait and audio systems

Contextual Awareness

World-aware: Time, weather, location, story progress

Memory: NPCs remember past interactions

Dynamic: No manual scripting of combinations needed

Results

Before

Static dialogue trees with manual branching for every game state. Characters felt robotic and conversations became repetitive quickly.

After

Dynamic conversations that adapt automatically. Characters remember interactions and respond contextually to any game state.

GDScript, JSON, Markdown, Godot, Git