Story-to-Game is a complete workflow toolkit for turning novels, scripts, and story outlines into interactive branching narrative games, and for playing those games directly in a browser. Created by Shanyin, a screenwriter, director, and writer and founder of Shanyin Studio, the project bridges creative writing and interactive fiction. It covers the full pipeline: adapting a text into a branching story structure, and then running that structure as an immersive, text-driven game.
“ Two Core Components at a Glance
The toolkit consists of two main parts. The first is the Branching Narrative Game Launcher, a single HTML file that loads JSON scripts and provides an immersive reading-and-choosing experience. The second is the Story-to-Game AI Skill, which takes source material of any size and produces JSON files that conform to the launcher's specification. Together they form a closed loop: create with AI, then play in the launcher.
“ Browser-Based Branching Narrative Game Launcher
The launcher is a dependency-free single file that runs in the browser without a server. Its bookshelf-style interface lets players import and manage JSON scripts, switch display modes, and load built-in sample works. During play, players advance the story by clicking or pressing Enter, make choices, roll back to earlier points, and save or load progress. The engine supports scene cards, chapter checkpoints, and transition animations. Under the hood, it handles a main state value, custom variables, flags, conditional choices, and automatic routing. Endings and achievements are recorded as they are unlocked, with special effects and closing remarks. Players can also customize dark or light mode, font size, animation intensity, and auto-play speed.
“ AI Skill: From Novel or Script to Playable JSON
The Story-to-Game AI Skill is more than a format converter. It is a full narrative adaptation system that follows a chain of understanding the original work, preserving its style, designing branches, and validating quality. It adapts to inputs of different scales, including short stories, novellas, long novels, scripts, and outlines, and plans node counts and estimated play time accordingly. To prevent style drift, it extracts the source's narrative temperature, dialogue rules, pacing patterns, and perspective-shifting strategies. Branches are distributed across attitude, route, and fate categories, with transition nodes filling gaps between events. Side branches receive the same depth as the main storyline. The state system includes dramatic main-state values and a matrix of endings with fallback rules that prevent dead ends. Finally, 13 automated checks verify node reachability, reference integrity, branch depth, and ending completeness.
“ Design Philosophy Behind the Toolkit
Several principles guide the project. First, it preserves the original work's character: branching exists to deepen understanding of the source, not to replace it. Second, every choice has consequences, with immediate, lasting, and ending-level effects, and when a path departs from the original, the system creates entirely new content. Third, side branches are as rich as the main line, so no route feels perfunctory. Fourth, smooth transitions between events keep players immersed. Fifth, spoilers are guarded throughout: the adaptation confirmation stage reveals only the basic direction, leaving room for surprise during play.
“ Quick Start: Playing Your First Interactive Story
To begin playing, download the launcher file, 剧情游戏启动器.html, and open it directly in Chrome or Edge. No server deployment is required. Click the option to insert a JSON script, select a generated game file, and start playing. The bundled test case and sample works are a good way to explore the engine's features before creating your own.
“ Quick Start: Generating Game JSON with AI
To generate your own game, place the SKILL.md file or the complete story-to-game archive into an AI tool that supports file reading. Then paste or upload your novel, script, or outline. Review the adaptation direction the AI proposes and confirm it. Once generation finishes, run the output through validate.py to catch broken links and dead ends, import the JSON into the launcher, and test the experience.
“ Recommended AI Tools and Browser Compatibility
For general use, ChatGPT and Claude are convenient because they accept direct file uploads. For long novels and full scripts, Codex and Claude Code are strongly recommended thanks to their extended context windows, which give more stable results on lengthy material. On the browser side, Chrome and Edge are recommended because they support the File System Access API, allowing the launcher to read a local folder as a resource library. Other browsers still work by importing JSON files manually, and core features remain intact.
“ Project Structure and Validation
The repository is organized into the single-file launcher, the story-to-game skill folder, and an examples folder. The skill folder contains SKILL.md as the main workflow with nine core rules, a references directory with detailed guides for each stage (JSON format specification, ingestion, style extraction, structure and branch design, state system and endings, segmented writing, and validation), and a scripts directory containing validate.py. Before importing any AI-generated JSON, run validate.py to avoid broken node links and dead-end paths.
“ Notes, Best Practices, and License
Keep several practical points in mind. Always validate AI-generated JSON before importing it. Save and game progress is stored in the browser's local storage, so clearing the cache will erase it, and manually saving key checkpoints is recommended. Ending design should follow the fallback rule, ensuring any path can reach at least one ending. The project is released under the MIT License, so it is free to use, modify, and distribute under its terms.
We use cookies that are essential for our site to work. To improve our site, we would like to use additional cookies to help us understand how visitors use it, measure traffic to our site from social media platforms and to personalise your experience. Some of the cookies that we use are provided by third parties. To accept all cookies click ‘Accept’. To reject all optional cookies click ‘Reject’.
Comment(0)