Inspiration
Games have been trying to allow players free choices for a long time but ultimately the possibilities always had to be constrained at the time of creating the game. This isn't true anymore with AI agents as we can now have an embedded scenarist manage the game live.
What it does
You start on a train. You tell the conductor who you are and what kind of life you're hoping for: era, mood, profession, anything. GPT-5.6 writes your arrival: the town, its seven residents, your workplace, your abilities, a welcome gathering already on the calendar. Your own words survive the trip, ask to be a pet-finding detective and that's what the story calls you.
After you step off, a Director keeps editing the world. It opens story threads, sends residents about their days, hands out items, shifts the ambience, stages the gathering, and can put up a new building on an empty plot because of where your story went. Commission an object in your own words ("a lantern shaped like a sleeping cat") and the village files it away: your pack, your journal, later conversations. Cost-capped image generation draws your avatar, your ability icons, and building art to match your life.
Everything that happens is an event in an append-only log, so the town remembers: across days, restarts, and saves. Answer the conductor differently and you get a different town, different work, a different life.
How we built it
A TypeScript monorepo: a shared domain package (Zod schemas, deterministic replay), a Fastify server that owns all the OpenAI calls, and a React + Phaser client. The deal between engine and model is simple: the model proposes complete, structured changes, and the engine checks them against schemas, catalogs, geometry, and replay rules. A bad proposal gets one chance at revision and is otherwise rejected, the engine never edits model output to make it valid. SQLite holds the events, and every image and voice call sits behind a per-session cost ceiling with authored fallbacks, so a model failure never blocks play.
The way we used Codex mirrored the game. One long-lived manager thread planned versions and spawned focused implementation threads with bounded goals, then switched to fixing things directly as the changes got smaller. A markdown wiki was our shared memory and a single checklist was the work queue: I added features and review findings, Codex landed them with tests. GPT-5.6 sat on both sides of the project: building the engine inside Codex, and playing the scenarist inside the game.
Challenges we ran into
The central one: letting the model be creative without letting it break the world. Everything above is our answer: the scenarist proposes, the engine decides.
A subtler one: validation caps versus a world that grows forever. Cap the size of something that only grows and an old save will eventually hit the cap and die. We kept finding versions of this in review and made it a standing question for every schema.
In one production run, the scenario model produced a template syntax that parsed fine but meant nothing to the game. The engine rejected it rather than guess, and the durable fix was changing the wire format so that mistake can't even be expressed.
For the video: we scripted real gameplay through the actual client so every frame of the demo comes from the runnable build.
Accomplishments that we're proud of
It's a complete story, not an endless sandbox: interview, generated town, living village, a staged gathering, and credits read from the log of what you actually did. And it survives restarts, model failures, and bad proposals without ever corrupting a save.
What we learned
Constrained freedom beats raw generation: the model does its best work proposing inside a world whose rules are enforced by code. And a manager thread plus a wiki plus one checklist turns an AI pair into an AI team, with the human owning exactly the decisions that matter.
What's next
Full-quality image lanes, richer Director storylines over longer lives, more town archetypes, and resident voices — all through the same validation gate.
Built With
- codex
- fastify
- gpt-5.6
- node.js
- openai
- phaser.js
- react
- sqlite
- typescript
- vite
- zod

Log in or sign up for Devpost to join the conversation.