The moment I realized I could run a language model locally in the browser without uploading a single byte to a server, I knew I had to build a game around it. The result is NeonHeist, an infinite cyberpunk heist simulator where the narrative is generated on-the-fly by a private on-device AI.
This isn't just a gimmick. It’s a fundamental shift in how we think about interactive fiction and privacy.
The Problem with Cloud-Based AI Games
Most AI-driven games today rely on heavy cloud infrastructure. You type your action, your input is sent to a data center, processed by a massive model, and the response is sent back. This introduces latency, requires a stable internet connection, and raises obvious privacy concerns. Every conversation you have with the game’s narrator is stored somewhere else.
For a game that thrives on immersion and spontaneity, that round-trip delay is a friction point. More importantly, the idea of a personal, reactive narrative engine being hosted on a third-party server feels wrong. We’ve accepted this trade-off for convenience, but with the advent of WebGPU and efficient quantized models, we no longer have to.
The Wedge: 100% On-Device Processing
NeonHeist runs entirely in your browser. There is no backend server processing your narrative choices. When you make a decision—whether to hack the security terminal or sneak through the ventilation shaft—that input is processed by a small model running directly on your machine.
The technical challenge here was significant. Running inference in the browser requires careful management of memory and compute resources. We utilize WebGPU to accelerate the matrix multiplications involved in neural network inference, ensuring that the game remains responsive even on mid-range hardware. Because nothing is uploaded, your session is private by design. If your internet cuts out mid-heist, the game doesn’t break; it simply continues generating the next scene locally.
Building the "Game Master"
The core mechanic of NeonHeist is the AI Game Master. This isn’t a pre-written script with a few branches. The AI maintains context about your character’s stats, inventory, and previous decisions, using that state to generate coherent, reactive narrative text.
Implementing this required a specific approach to prompt engineering and context window management. Since we are running a smaller model locally to ensure performance, we can’t afford to feed it the entire conversation history every time. Instead, we use a sliding window of relevant context, prioritized by recency and importance. This allows the Game Master to remain coherent without overwhelming the local compute budget.
For example, if you picked up a "decryption key" three turns ago, the model needs to remember that item is in your inventory when you encounter a locked door later. Achieving this consistency with a constrained context window is the real engineering puzzle. We’ve found that structuring the prompt to explicitly separate "world state" from "recent dialogue" helps the model prioritize correctly.
The Player Experience
The result is a game that feels alive. Because the generation happens locally, the feedback loop is tight. You type an action, and the narrative responds almost instantly. There’s no "spinner" waiting for a cloud API. This immediacy is crucial for maintaining the flow state that good games require.
The cyberpunk setting was chosen deliberately. The genre’s themes of surveillance, data privacy, and decentralized networks mirror the technical architecture of the game itself. You are playing a story about a world that values autonomy, powered by technology that respects your own.
Pricing and Accessibility
NeonHeist is a paid tool, designed to be sustainable for independent development. There is a 7-day trial that lets you explore the mechanics fully. For the ongoing experience, the games themselves offer free turns, allowing you to sample the infinite heist generation before committing. This model ensures that the cost of running these local models is covered while keeping the barrier to entry low for new players.
Why This Matters for Developers
If you’re a developer exploring AI in the browser, NeonHeist is a case study in what’s possible now. We are moving past the era where AI required a cloud connection. The combination of WebGPU, efficient model quantization, and modern JavaScript runtimes allows for rich, interactive experiences that respect user privacy and work offline.
The codebase is open for inspection regarding how the local inference loop is structured. I’ve avoided using concrete model names in the documentation to emphasize that the experience is defined by the architecture, not the specific weights. The goal is to prove that a compelling, narrative-driven game can be built without relying on external APIs.
You can try it out at NeonHeist.
Final Thoughts
Building NeonHeist has been a lesson in constraints. Working with on-device compute forces you to be disciplined about context and efficiency. But the payoff is a product that is truly yours. No data leaks, no server downtime, no latency spikes. Just you, the browser, and an infinite cyberpunk world generating itself in real-time.
If you’ve been curious about local AI or WebGPU gaming, I’d love to hear your thoughts on the technical approach.
Top comments (0)