Inspiration
We were inspired by a simple frustration with many “choice-based” narrative games: too often, choices only change the next line of dialogue, not the future structure of the story itself. We wanted to build a system where player decisions reshape the reachable narrative space.
Guy de Maupassant’s The Necklace became a strong foundation because it is already a story about perception, pride, class, misunderstanding, and irreversible consequences. Those themes fit naturally with a system centered on belief states, hidden information, and branching possibility.
We were also inspired by research in drama management, storylets, generative agents, and narrative planning. The goal was to combine literary structure with simulation, so the story could feel both authored and alive.
What it does
Threads of Fate is an AI-driven interactive narrative system in which player choices change not just immediate text, but the set of possible future events.
At a high level, the project combines four layers:
- A world state layer that tracks characters, relationships, knowledge, beliefs, social pressure, and route flags
- A character agent layer where each major character has evolving goals and reactions
- A narrative director layer that selects the next story event from a dynamic possibility space
- A generation layer that turns structured state into scene prose, dialogue, and player choices
Instead of following a fixed branching tree, the system continuously evaluates what events are still possible. A choice can close off some futures and make others newly reachable. In other words, the player is not just selecting dialogue, but transforming the event graph itself.
Formally, we think of the player as modifying a reachable future set:
$$ F_{t+1} = \Phi(F_t, a_t, s_t) $$
where \(F_t\) is the future possibility space, \(a_t\) is the player action, and \(s_t\) is the current world state.
How we built it
We built the project in Next.js, React, and TypeScript, with a modular architecture designed around narrative systems rather than around UI alone.
The implementation is organized roughly as:
engine/for world state, event templates, director logic, character goals, and game progressionai/for Gemini-based scene generation and structured promptingcomponents/for gameplay presentationpersistence/for local save/load supportavg/for offline visual novel asset definitions and mapping
The story engine works like this:
- Initialize world state, characters, and route variables
- Let the narrative director score all reachable events
- Select the next event based on coherence, pacing, tension, and player relevance
- Generate the scene with AI from structured context
- Apply player choice effects back into world state
- Repeat until an ending is reached
We also explored a visual novel mode on top of the same narrative core. That meant adding asset manifests, character expression mappings, reusable background definitions, and a toggleable AVG-style UI layer without changing the underlying story logic.
Challenges we ran into
One major challenge was balancing emergence and structure. If characters are too autonomous, the story loses shape. If the director is too controlling, player agency becomes cosmetic. We spent a lot of time thinking about where to let the system improvise and where to keep hard narrative constraints.
Another challenge was modeling information properly. Emotional state alone was not enough. The most interesting branching often came from who knew what, who misunderstood what, and who was acting on false beliefs.
AI integration also introduced practical issues. Runtime generation is powerful, but it is unreliable when quotas, permissions, latency, or model behavior become part of the experience. That forced us to distinguish between:
- structured narrative control
- text generation
- offline visual asset generation
- runtime UI presentation
That separation ended up being one of the most important architectural lessons of the project.
Accomplishments that we're proud of
We are proud that the system does not treat branching as a gimmick. The player’s actions genuinely affect future narrative reachability.
We are also proud of:
- building a director-driven event selection system instead of a static branch tree
- representing characters as agents with evolving goals rather than fixed personalities
- centering knowledge asymmetry and belief misalignment as drivers of drama
- adapting a canonical literary text into a replayable possibility engine
- designing the project so the same narrative core can support both text mode and future AVG mode
Most importantly, we built something that feels like a narrative system, not just a text generator.
What we learned
We learned that meaningful interactive narrative needs structure at a deeper level than dialogue generation. If the system cannot model state transitions, hidden information, and causal consequences, then even beautiful AI text will feel shallow.
We also learned that clean separation of concerns matters a lot:
- narrative state should stay independent of presentation
- presentation should stay independent of generation
- offline assets should stay independent of runtime gameplay
On the design side, we learned that information asymmetry is one of the strongest sources of dramatic branching. A secret, a false assumption, or a delayed revelation can be more powerful than a simple emotion score.
We also came away with a stronger appreciation for hybrid systems. Pure procedural generation can drift, and pure authored branching can feel rigid. The most promising space is in between.
What's next for Threads of Fate — A Narrative Possibility Engine
Next, we want to deepen both the simulation and the presentation.
On the narrative side, we want to:
- expand player modeling so the director can adapt to play style
- improve long-term memory and reflection for character agents
- strengthen mediation between character intent and narrative arc
- support more stories beyond The Necklace
On the presentation side, we want to:
- complete the offline AVG asset pipeline
- finalize reusable backgrounds and expression sets
- refine visual novel pacing, text flow, and transitions
- add a stable authoring workflow for asset preparation before runtime
Long term, we want Threads of Fate to become a reusable narrative engine where stories are not merely branched, but dynamically shaped by belief, consequence, and possibility.
Log in or sign up for Devpost to join the conversation.