Inspiration

Forked Fates started with a simple question that many of us ask: What would have happened if someone had made a different decision or learned an important piece of information earlier?

In complex situations, the consequences of a decision are not limited to one moment. A small change can affect what people know, whom they trust, where they go, and the decisions they make later. These indirect consequences can be difficult to understand when they are only described in text.

I wanted to turn this idea into an interactive, game-like experience where users could change one condition in a virtual world and then observe how the consequences develop step by step.

What it does

Forked Fates allows users to explore how a small change in information, a decision, or a circumstance can reshape the future of a virtual world.

The current version includes a prebuilt scenario called The Last Antidote. Four characters are involved in a crisis in which only one antidote exists. Each character has their own knowledge, goals, relationships, limitations, and available actions.

The user first runs the original timeline and observes how the story progresses without intervention. They can then return to an earlier moment, create a fork, and give a character new information or change one of the conditions.

The original timeline remains fixed and unchanged. A separate alternate future is created from the selected point. At the end, the system compares the two timelines and shows differences in decisions, character locations, knowledge, trust, evidence, object ownership, and story outcomes.

The purpose is not to guarantee a better ending. Two timelines may reach a similar outcome while following completely different causal paths.

How we built it

I designed the project around a strict separation between character decisions and the authoritative state of the world.

The characters act as agents, but they cannot directly modify the world. Each agent proposes a structured action or intent. A validator checks whether the proposed action is legal and possible in the current state.

For example, a character cannot move an object they do not possess, enter an inaccessible location, or introduce an object that did not previously exist.

Only the World Engine is allowed to update the authoritative world state. This makes the simulation more controlled, testable, and explainable.

The application includes three execution modes:

  • Recorded Demo for a quick and reliable demonstration
  • Deterministic Simulation for repeatable results without an external model
  • AI Live for generating character decisions through a language model

I used Codex throughout the development process to design the architecture, implement the World Engine and agents, add validation, manage timeline forks, integrate the language-model provider, debug failures, restructure the repository, and build regression tests.

I used GPT-5.6 Sol through Codex for architectural reasoning, implementation review, debugging, and correcting critical parts of the system. GPT-5.6 Sol is not the runtime model controlling the characters. The optional AI Live mode uses a separately configured model through OpenRouter.

Challenges we ran into

One of the main challenges was allowing characters to make independent decisions without giving them unrestricted control over the virtual world. I needed a clear boundary between what an agent proposes and what is actually allowed to happen.

Another major challenge was preserving the original timeline. After creating a fork, changes in the alternate future could not be allowed to leak back into the original history. Both timelines had to share the correct historical state before the fork while remaining fully isolated afterward.

Comparing the timelines was also more complicated than comparing only their final outcomes. The system needed to detect observable differences in decisions, movement, trust, knowledge, evidence, communication, and object ownership.

Language-model integration introduced additional difficulties. Model outputs had to be structured, valid, and processable. Arbitrary free-form output could not be executed directly as an action in the world. Structured outputs, validation, retries, error handling, and fallback execution modes therefore became important parts of the implementation.

During development, I also encountered issues related to the fork boundary, frozen-state recovery, structured outputs, and compatibility with different model providers. Codex helped me investigate these problems, implement fixes, and create regression tests for them.

Accomplishments that we're proud of

I am proud that Forked Fates became a working and coherent application rather than only a technical experiment.

The project now supports an immutable original timeline, isolated alternate futures, deterministic replay, structured agent decisions, centralized world-state management, and detailed comparison between timelines.

In the demonstrated scenario, one new piece of information changes Mara’s first action from Investigate to Move. This change affects later decisions and causes the antidote to be held by a different character. The truth is also exposed in one timeline and obscured in the other.

Although Niko is lost in both timelines, the system successfully shows that the decisions, information flow, movement, evidence, ownership, and causal paths leading to the outcomes are different.

I am also proud that the project includes a deterministic, judge-friendly mode and a full regression test suite, with all 224 tests passing in the final version.

What we learned

I learned that autonomous agents should not be given direct control over authoritative application state. Separating agent proposals from validated state changes creates a much more reliable and understandable system.

I also learned that building alternate timelines is not simply a matter of copying a story and changing one response. The system must preserve the shared history, isolate future state, and track how changes propagate through multiple characters and world variables.

Another important lesson was that the final outcome alone does not fully describe the effect of an intervention. Two futures can reach the same visible ending while having very different causal structures.

Finally, I learned that integrating language models into a stateful application requires much more than sending prompts and receiving text. Structured output, validation, retries, provider compatibility, deterministic alternatives, testing, and error recovery are all essential.

What's next for Forked Fates

The current version demonstrates the core idea through one prebuilt scenario. My long-term goal is to turn Forked Fates into a virtual world-building platform.

Users should eventually be able to provide their own scenarios, create characters, and define their goals, relationships, knowledge, locations, objects, rules, and possible actions. They could then run those worlds, introduce interventions, and explore multiple alternate futures.

Forked Fates could be used for gaming and interactive storytelling, but the idea is not limited to entertainment. In the future, the same type of environment could also support training, scenario exploration, decision-making practice, and the study of possible consequences before choices are made.

Built With

  • agents
  • ai
  • codex
  • counterfactual-simulation
  • deterministic-simulation
  • gpt-5.6
  • interactive-storytelling
  • javascript
  • multi-agent-system
  • node.js
  • openai
  • openrouter
Share this project:

Updates