04 / Interactive systems and game technology
Kotodama — LLM NPCs, interactive narrative, and a 3D world
Connects NPC memory, world state, structured scripts, and a shared story queue into one persistent interactive world.
The problem
Dialogue generation is only one part of an interactive world. Memory, relationships, location, activity, world events, and client-side execution must remain consistent after each model response. Kotodama keeps long-lived NPC state and feeds it back into later dialogue and behaviour.
What I built
- Short-term, long-term, and belief memory, with relationships, emotion, location, and activity state fed into later dialogue and behaviour.
- WorldScript, a constrained JSON protocol that separates LLM generation, server-owned world state, and client execution.
- NPC schedules, world events, offline interactions, surprise suppression, deterministic seeds, and controls for cost and generation frequency.
- A procedural SceneKit world with A* pathfinding, NPC behaviour, day and night, weather, particles, and shaders.
- A proposal, voting, and settlement queue for shared story continuation, with snapshots, heartbeats, failure recovery, and quota handling.
Architecture choice
The model cannot mutate the client scene directly. It emits constrained structured intent; the server validates that intent and advances the world state; the client then interprets the result. This lets model capabilities change without surrendering control over game state, cost, or failure boundaries.
System scope
NPC memory and state, interactive narrative, world simulation, 3D execution, and shared real-time systems.