Papers
Topics
Authors
Recent
2000 character limit reached

Story2Game: Transforming Narrative into Gameplay

Updated 15 September 2025
  • Story2Game is a framework that transforms narrative arcs into interactive, code-driven game experiences with defined preconditions and effects.
  • It employs a multi-stage pipeline including narrative generation, action parsing, world graph construction, and game engine code synthesis to maintain coherent gameplay.
  • Dynamic action generation blends player input with procedural content creation, balancing authorial intent with emergent game logic.

Story2Game refers to the technical, algorithmic, and theoretical paradigms for transforming narrative structures—stories—into fully interactive games, such that the emergent experience both preserves authorial intent and supports dynamic, player-driven agency. The field encompasses methodologies for generating interactive fiction, mapping high-level story arcs to concrete game mechanics, synthesizing multi-modal game content, and maintaining logical coherence between story progression and game state. The Story2Game paradigm represents an explicit response to the challenge of grounding open-ended story generation in actionable game logic, leveraging contemporary advances in LLMs, narrative design patterns, symbolic representation, and procedural generation.

1. Core Story2Game Workflow

The STORY2GAME system (Zhou et al., 6 May 2025) implements a multi-stage pipeline that begins with generating a narrative and culminates in the synthesis of an interactive fiction game:

  1. Narrative Prompting and Generation: An LLM (e.g., GPT-4o-mini) receives inputs specifying a title, a quest/plot outline (typically 2–6 high-level events), and a setting or goal declaration. The LLM generates a sequence of 5–18 “events,” each cast as a narrative action that implicitly suggests player interaction (e.g., “Unlock the castle gate using the silver key”).
  2. Action Parsing with Preconditions and Effects: Each action is annotated (via the LLM) with:
    • Fundamental preconditions (e.g., “player at location X”, “has object Y”)
    • Additional preconditions (e.g., custom flags such as “door is closed”)
    • Preceding event requirements (e.g., “event 2 must happen before event 3”)
    • Effects partitioned into operations (movement, attribute updates, object creation/destruction)

This formalizes each step in terms of constraints and consequences, producing a deterministic (albeit open-ended) causal graph for story progression.

  1. World Graph Construction: The system procedurally instantiates the world as a directed labeled graph:
    • Nodes correspond to rooms, characters, objects (inventory items, containers), or the player avatar.
    • Rooms are laid out on a 2D grid, with objects and characters placed according to their narrative references.
  2. Game Engine Code Synthesis: For each annotated action, the LLM translates preconditions and effects into backend code (typically Python), which is plugged into the game engine. This code governs:
    • Action availability (based on checking preconditions)
    • World state transitions (implementing effects upon success)

Default scaffold actions (e.g., “look around”, “open inventory”, “move to room”) are auto-generated to provide a minimal functional interface.

  1. Dynamic Action Generation: When a player issues an off-script action, the engine triggers a dynamic generation routine:
    • The LLM creates or locates necessary objects/attributes (e.g., if the action “break window” is attempted but no window exists, one is created and logically placed).
    • Preceding narrative events or dependencies are added recursively (to a bounded depth), ensuring story logic and causality are preserved.
    • The system retrofits prior actions to account for newly introduced state (e.g., a “broken” flag on a bucket might update later “fill bucket” actions).

This process maintains an interactive loop such that the playable fiction remains tightly coupled to both original authorial design and emergent player creativity.

2. State, Logic, and Causality in Game Modeling

At the heart of STORY2GAME is an explicit state transition system:

  • Each narrative action is expressed as a function mapping from the current game state (a labeling of the world graph) to a new state via well-defined effects, provided all preconditions are met.
  • Preconditions and effects are formalized at three levels: inventory/possession, location, and arbitrary attribute/flag levels.
  • Effects are composed of discrete graph operations: node relocation (movement), edge/attribute update (state change), node creation or deletion (object/entity management).

The system’s ability to recursively update past and future actions when introducing dynamically generated actions/attributes is critical for semantic coherence. This retrospection mechanism ensures that actions do not introduce logical contradictions into the progression, and that world state remains tractable with respect to object existence and properties.

3. Game Engine Integration and Automation

STORY2GAME uses a minimal game engine inspired by legacy interactive fiction platforms (e.g., Inform7, TextWorld, LIGHT). Key technical features include:

  • Graph-based world model where all entities are nodes with tagged attributes and mutable edges.
  • Engine-side runtime enforcement of preconditions before action execution, employing direct code translation of LLM-generated precondition logic.
  • Modular and statically analyzable code for each action, facilitating automated checking of compilation and runtime behavior.

The engine supports two modes of content injection:

  • Scripted (from author-generated story actions),
  • Dynamic/adaptive (in response to player-initiated, off-script commands).

Automatic code generation is statistically robust: >92% of initial story actions compile without error, but dynamic action compilation success drops to ~80%, with approximately 60% semantic (i.e., human-expected) correctness for novel actions. This dichotomy highlights ongoing challenges in open-ended procedural content integration.

4. Evaluation and Success Metrics

The system is evaluated on two axes:

  • Compilation Success: The fraction of generated action scripts (per story or per player event) that successfully compile and execute as part of the engine-driven game loop. Compilation errors typically stem from object/attribute naming mismatches or missed dependencies.
  • Semantic Success: A subjective evaluation of whether the generated code for a dynamic action produces the “expected” logical outcome from a player perspective (e.g., “drop bag” removes the item from inventory and places it in the room). These metrics are tallied for both initial story actions and dynamically generated, player-driven actions.
  • Playability: Operationally, the system’s end-to-end validity is measured by whether a player can proceed through the entirety of the generated story—leveraging both pre-compiled actions and those created on the fly—without entering a dead-end or violating narrative logic.

Empirical results indicate that while code compilation is reliable for story-generated actions, semantic plausibility lags for dynamically synthesized, off-script actions, especially when new game state variables must be retroactively propagated.

5. Technical Advantages and Limitations

STORY2GAME enables the transformation of open-ended narratives into interactive experiences without hard-coding every possible action or world state. Its use of LLM-derived preconditions and effects as the bridge between narrative and implementation is a practical innovation, providing both modularity and scalability.

However, automatic dynamic action generation presents unresolved challenges in consistent object management, attribute propagation, and the maintenance of semantic coherence, particularly as the depth of recursive updates increases. While the revisitation of prior actions for attribute adaptation is effective up to a point, scaling to complex narratives with nonlinear dependencies remains an open problem.

The system’s metrics capture the trade-off between creative freedom and executional reliability—a central theme in Story2Game research.

6. Context within Broader Story2Game Paradigms

STORY2GAME’s methodology stands at the intersection of narratology, procedural content generation, and AI-driven code synthesis. Its action-centric approach is complementary to related paradigms:

  • Graph-based approaches (e.g., SAGA (Beyak et al., 2011), TropeTwist (Alvarez et al., 2022)) which model story progression as state transitions or trope networks, but may not systematically generate specific, actionable code per narrative event.
  • Emotionally structured pipelines (e.g., (Wen et al., 4 Aug 2025)) that regulate narrative and difficulty in tandem with emotional arcs, but may abstract away explicit state/precondition/effect logic for individual actions.
  • LLM-driven dynamic world adaptation (e.g., StoryVerse (Wang et al., 17 May 2024), UGC text-to-game engines (Zhang et al., 11 Jul 2024)), which focus on emergent or co-authored plot at higher levels of abstraction.

STORY2GAME fully grounds generated narratives in a game-world graph and executes those logics via generated, code-level actions, enabling non-trivial, causal interactivity and extensibility by player input.

7. Implications and Future Directions

The STORY2GAME framework demonstrates that open-ended story generation can be systematically harnessed to produce logically coherent, playable games—provided rigorous state management protocols are fused with LLM-based narrative expansion. The objective evaluation through compilation and semantic success metrics represents an important step toward quantifying system fidelity.

Future research will focus on increasing semantic reliability for dynamically generated actions, improving attribute propagation tooled for non-local narrative ramifications, and scaling retrospection mechanisms for deeply nested story graphs. Integration with richer engines (supporting continuous environments, real-time updates, and more granular player agency) is a natural trajectory. The framework’s modularity readily supports adaptation to other genres, including multi-modal or emotionally-structured game generation.

In summary, STORY2GAME exemplifies an architecture where LLM-driven narrative creation is tightly bound to game logic, elevating procedural interactive fiction and advancing the practical interplay between AI, narrative design, and game systems.

Whiteboard

Follow Topic

Get notified by email when new papers are published related to Story2Game.