Open-source project
zonghaoyuan/infiplot avatar
zonghaoyuan/infiplot

InfiPlot: a self-hosted AI story game where every scene is generated live

InfiPlot is the world's first interactive plot game that AI generates all text and images in real-time. InfiPlot是全球首个在游玩过程中由 AI 实时生成全部图文内容的互动剧情游戏

380 stars56 forksTypeScriptAGPL-3.0

At a glance

What is it?
InfiPlot is an open source Next.js game that generates its narration, dialogue, artwork and voice acting at play time through a four-agent pipeline. The repository is documented for Vercel, Cloudflare and Docker, but it is a bring-your-own-API-key project with real cost and latency trade-offs.
Who is it for?
Adopt InfiPlot if you want a working reference for multi-agent content generation in a Next.js app, or a self-hosted AI story game you can point at your own model endpoints. Skip it if you need a zero-config game, a stable save format, or a platform that runs without paid model keys.
Can I use it commercially?
Yes, with strict conditions. AGPL-3.0 is a network copyleft licence: if people use a modified version over a network, for example as a hosted service, you must offer them its source code under the same licence.
Is it still maintained?
Yes. The repository last received commits 72 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 17, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What InfiPlot actually is, and who it is built for

InfiPlot is not a game with a story in it. It is a game engine whose story does not exist until you play. The README describes it as an interactive plot game where AI generates all text and images in real time, and the repository backs that up: the package is a Next.js 16 app with React 19, the openai SDK, Supabase packages and a Cloudflare Workers build target. There is no content directory full of authored scenes. The content is the pipeline.

The intended audience is narrow and specific. This is for developers who want to run a generative narrative system on their own infrastructure, and for players willing to bring their own model credentials. The README points casual users at infiplot.com for a free online trial and says local deployment is not required. If you just want to play, the hosted site is the path. If you want to inspect how a four-agent story engine is wired, or you want your own instance with your own keys, the repository is the path.

The pitch in the README is unusually direct about its reference point: the authors describe the goal as an AI-generated version of a Chinese dating-sim style visual novel, and list example fantasies including a Harry Potter magic school, a palace-intrigue setting, and going back in time to remake a regretted choice. That framing tells you what the engine is optimized for: second-person, choice-driven, character-centric scenes, not open-world simulation.

Four agents, a beat tree, and the scene boundary that decides when an image is drawn

The README documents a multi-agent framework split into four roles: screenwriter, character designer, scene designer and painter. The stated purpose of the split is consistency. The screenwriter also owns the overall plot architecture, which means the same agent that writes a line of dialogue is also responsible for where the story is going.

The unit of play is the story, and a story unfolds as a sequence of scenes. Each scene is one AI-drawn background plus a short tree of beats: narration, dialogue, and occasional choices. The mechanism worth understanding is when the painter fires. According to the README, as you click through beats inside a scene, the image does not change. A new scene image is drawn only when a choice moves you somewhere genuinely new, meaning a different space, a different point of view, or a jump in time. That is a deliberate cost boundary. Without it, every beat would be an image generation call.

The second mechanism is predictive generation. While you are reading a scene, the engine generates the scenes your choices might lead to, and for unavoidable next steps it goes one scene further. When you commit to a direction, the README states the image is usually already drawn, so the transition is immediate. The README also admits the honest caveat: if you still notice latency, the authors say they are working on it. That sentence is the most useful line in the document, because it tells you predictive generation reduces the wait rather than eliminating it.

Third, clicking the background itself rather than a button routes through a vision model. It reads the click position and decides whether you are exploring the current scene, in which case it inserts a beat and draws no new image, or moving forward, in which case it generates a new scene. The README attributes this idea to lessons learned from flipbook and calls it a candidate for a key feature. Note the wording: it is described as something the authors believe will matter in the future, not as a finished strength.

Docker install and a first real session

The README gives a self-hosting path that does not require cloning the repository. It downloads two files into a new directory: the compose file and the environment template.

bash
mkdir -p infiplot && cd infiplot
curl -fsSL https://raw.githubusercontent.com/zonghaoyuan/infiplot/main/docker-compose.yml -o docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/zonghaoyuan/infiplot/main/.env.example -o .env.example
[ -f .env.local ] || cp .env.example .env.local

After that you edit .env.local with your API keys and start the stack. The compose file in the repository runs the published image, maps port 3000, reads .env.local, and sets restart to unless-stopped.

bash
docker compose up -d

Then open http://localhost:3000. If you prefer not to use Compose, the README shows the equivalent single-container form with the same port and env file.

bash
docker run -d -p 3000:3000 --env-file .env.local ghcr.io/zonghaoyuan/infiplot:latest

The container is built from node:22-alpine with pnpm 9.12.0 and runs the Next.js standalone server as a non-root user on port 3000, so the port you map must match the port you open. Before any of this produces a playable game, the environment file has to be filled in. The .env.example header states that the recommended setup is a Xiaomi MiMo token plan covering text, vision and TTS with one key, plus Runware for images. Text, vision and image all speak the OpenAI wire format, and the file notes that Anthropic and Google Gemini are reachable through their OpenAI-compatible endpoints. TTS is the exception: it uses Xiaomi MiMo's own voice design and clone protocol and is not OpenAI-compatible. Image has two supported shapes, Runware's task-array protocol and OpenAI gpt-image, selected by IMAGE_PROVIDER. The README's deployment section also notes that the Cloudflare route needs a Workers Paid plan because the scene pipeline requires longer CPU time, and that the build command there is pnpm build:cf.

Where InfiPlot breaks: keys, latency and the missing configuration docs

The first failure mode is that InfiPlot does nothing without model credentials. There is no bundled local model and no offline mode. The README's configuration section says the app talks to four kinds of model provider, and the .env.example enumerates text, image, vision and TTS slots. The Vercel deploy button in the README lists three required providers plus optional TTS. If you cannot fill those slots, the Docker image will start and serve pages, but the game loop has nothing to call.

The second is latency, and the README is candid about it. Predictive generation is the mitigation, not a cure. The authors write that if you still feel some delay, they are working on optimizing it. A player on a slow text model will feel that delay on every scene boundary, because the boundary is exactly where generation happens.

The third is documentation depth. The README repeatedly points to docs/configuration.md for environment variables, and the .env.example excerpt in the repository is truncated mid-comment. Provider selection, base URL normalization and the choice between Runware and OpenAI image protocols are all described in the environment template rather than in the README itself. The README does not document rollback, save-file portability or migration between versions, and no releases were retrieved for this repository, so there is no changelog to consult before upgrading.

The fourth is the Cloudflare path specifically. The README states that Cloudflare deployment requires a Workers Paid plan because the scene pipeline needs more CPU time. That is a hard prerequisite stated as a plan requirement, not a tuning suggestion.

How InfiPlot differs from hosted AI story apps and from visual-novel engines

The closest comparison is a hosted AI storytelling product, where you sign in, type a premise and play. The difference is control and cost. A hosted product bundles the model bill into a subscription and hides the pipeline. InfiPlot inverts both: you supply the keys, and the four-agent split, the beat tree and the scene-boundary rule are visible in the repository. That is better if you want to swap models, cap spending, or change what the screenwriter agent is told. It is worse if you want to play within five minutes, because you first have to assemble provider credentials for four slots.

The other comparison is a conventional visual-novel engine such as Ren'Py. The difference in approach is total. Ren'Py ships a script you author in advance; the engine's job is to render branches you wrote. InfiPlot has no authored script. Its output is non-deterministic, which means you cannot review a build before shipping it and you cannot promise a player that a given scene will appear. For a studio shipping a fixed narrative, Ren'Py's approach is the correct one. InfiPlot only makes sense where the unpredictability is the product.

Worth noting for anyone evaluating the codebase: the .env.example states that native Anthropic and Google protocols were removed when the Vercel AI SDK was dropped, and that base URLs tolerate a missing or extra /v1 or a trailing /chat/completions because the engine normalizes them. That is a deliberate simplification toward one wire format, and it is the kind of decision that makes the provider layer easier to reason about at the cost of losing vendor-native features.

Licence, maintenance and what an upgrade costs you

InfiPlot is licensed AGPL-3.0-only, stated in both the LICENSE file and the package.json license field. The practical consequence of AGPL for a network-served application is that users interacting with a modified version over a network are entitled to the corresponding source. If you fork this and run it as a public service, that obligation follows the fork. This is a description of the licence identifier, not legal advice; the CLA.md and CLA.zh.md files in the repository indicate a contributor licence agreement is in place, which matters if you intend to send patches upstream.

The repository is not archived, and the last push was on 2026-07-08. No releases were retrieved, so there is no tagged version to pin against and no release notes describing breaking changes. The package version is 0.1.0, which is consistent with an early-stage project. The practical upgrade cost is that you are tracking the main branch of a pre-1.0 app whose configuration surface lives in an environment template. Any change to the provider slots, the base URL normalization rules, or the build commands for Cloudflare will reach you through a git pull rather than through a versioned release. If you deploy this, keep your .env.local under version control in a private repository so you can diff it against a future .env.example.

Editorial conclusion

Adopt InfiPlot if you want a working reference for multi-agent content generation in a Next.js app, or a self-hosted AI story game you can point at your own model endpoints. Skip it if you need a zero-config game, a stable save format, or a platform that runs without paid model keys. Before deploying, read docs/configuration.md and confirm which of the four provider slots you can fill, then check whether the image provider you plan to use speaks the Runware task-array protocol or the OpenAI gpt-image format, because that choice decides whether IMAGE_PROVIDER needs to be set at all.

Frequently asked questions

Do I need my own API keys to run InfiPlot?

Yes. The README's configuration section says InfiPlot communicates with four kinds of model provider, and the .env.example enumerates text, image, vision and TTS slots. The Vercel deploy button lists three required providers plus optional TTS.

Can I run InfiPlot locally with Docker?

Yes. The README gives a Docker path for a VPS, home server or local machine, and says it supports x86 and ARM including Apple Silicon Macs. It downloads docker-compose.yml and .env.example, then runs docker compose up -d, after which the game is at http://localhost:3000.

Which model providers does InfiPlot support?

Text, vision and image all speak the OpenAI wire format, and the .env.example notes Anthropic Claude and Google Gemini are reachable through their own OpenAI-compatible endpoints. Image additionally supports Runware's task-array protocol via IMAGE_PROVIDER, and TTS uses Xiaomi MiMo's own voice design and clone protocol, which is not OpenAI-compatible.

Official sources

  1. Issues
  2. License: AGPL-3.0
  3. Project website
  4. README
  5. zonghaoyuan/infiplot on GitHub
Community notes

Community notes