Sep 2026 · age 17 · browser game
Pixel Publisher
A publishing tycoon where you write a real short story, and a language model quietly plays the critic, the readers and the market.
- Status
- Shipped, playable on itch.io
- Built in
- ~11 days, 39 commits
- Size
- One HTML file, no build step
Why I made it
I'd been following the discussion around GTA VI not using AI. The worry about AI replacing human artistry in games is completely valid, but it made me think about a different use: what if AI powered really smart NPCs and a world that reacts to anything the player does, in a completely free sandbox? I don't have the time or resources of a AAA studio, so I made the closest thing I could. That's Pixel Publisher.
The problem
In every writing or publishing game I played, the book you "write" is a number. You pick a genre, a slider moves, a score comes out. You never actually write anything, so nothing you make can surprise the game.
I wanted the opposite: you type a real story, in any language, and the world reacts to that story, its characters and its plot.
What I built
You start as a broke writer with $500 and a desk. Write a story, pay the printer, set a price and a marketing budget, hit Publish. A critic scores it, readers post about what actually happens in it, copies sell week by week, and rent is due every month. Hit $0 and you are bankrupt.
- 68 events, film, game and stage adaptations, rival publishers bidding on your manuscript, sequels that inherit readers, co-authors, fan mail.
- Interviews where you type the answer, and the engine judges it against your real sales record.
- Full controller support, so it plays from a sofa (it even runs in the Xbox browser).
How it works
- The model only returns judgement, never money. Each publish sends the manuscript to Gemini (strict
responseSchema) or OpenAI (json_schema, strict). It returns a critic verdict, a mass-appeal score and seven social posts. Plain JavaScript turns those into a sales curve, rent, reputation and royalties, so the economy stays deterministic and tunable. - It never loses your book. The key box takes several Gemini keys and rotates to the next one when a key is rate-limited. If every key fails, a backup engine (OpenAI, or an offline mock) takes over and the game says so. If everything fails, the printing fee is refunded.
- Prompts do real design work. Reviews come back in the story's language, must reference concrete things from the text, and follow a stated score scale ("most amateur stories land 30–65"). A 150-word story is judged as a finished short work, not as an excerpt.
- Tested in Node. A small DOM shim runs the real game script outside the browser: 48 assertions plus a structure check.
What went wrong / what I learned
One bad save froze the whole game. A book saved without a colour palette threw an error on every animation frame, which killed the render loop: the printing press turned into a black rectangle mid-publish. Fix: every part of the loop now runs inside a guard that logs and keeps going, and old saves get repaired on load.
Closing a window could lock Publish forever. Six dialogs returned promises that only their own buttons resolved. Pressing Escape left publish() waiting forever. Now closing any window settles its promise with the passive choice (decline, do nothing), because dismissing a window should never count as saying yes.
My checker lied to me once. A bad patch duplicated 2,400 lines after </html>, and my first syntax check only read up to the first </script>, so it said OK. It now asserts there is exactly one of each before checking anything else.
Built with an AI coding assistant as pair programmer; the design, the architecture and the testing are mine. The itch.io page is tagged as using AI-generated code, graphics, audio and text, because that's true.
lesson: "it passed" means nothing if the test can't failStack
- JavaScript
- HTML / CSS
- Canvas pixel art
- Web Audio
- Gemini API
- OpenAI API
- Node (tests)
Links
You bring your own Gemini or OpenAI key (the free Gemini tier works), or pick the offline mock engine to try the loop without any AI. The source is private for now.