Hands-On: Building a Browser Game with AI for About 20 RMB
This article documents a reproducible low-cost experiment in building a browser-based game with AI coding tools, where the total spend came to roughly 20 RMB. It explains why the web is the ideal minimum viable platform, how to write prompts that turn gameplay into measurable specs, and how procedural geometry, textures, and synthesized audio remove the two biggest cost drivers. It also includes a cost breakdown, a five-point quality checklist, a lightweight hosting setup, and a candid look at capability limits and risks. The takeaway: AI replaces asset production and boilerplate code, not the judgment required to define what makes a game fun.
1. Where It Started: A Browser FPS That Didn’t Look AI-Made
A first-person shooter running entirely in the browser recently drew attention in a community. Its lighting, material fidelity, and sound feedback were polished enough that many people assumed it was a commercial title streamed from the cloud. In reality, an AI coding tool produced it from a short natural-language description through roughly eight hours of continuous iteration. Every asset — models, textures, audio — was synthesized from scratch with generative methods, for a total cost in the range of a few hundred RMB.
The interesting part isn’t “can AI build games.” It’s that the cost structure of game development has been rewritten. Conventionally, making a game means engine licensing, outsourced art, a programming team, and a long timeline. On the web, that gap between an idea and something playable collapses to hours. This article uses one real, reproducible low-cost run as the main thread and abstracts the process into a method.
2. Why the Web Is the Minimum Viable Platform
For solo developers and small teams, the web has four structural advantages:
- Zero-friction distribution: once generated, a single link is enough. No install, no upfront platform review, and playtest feedback comes back fast.
- Low technical barrier: you don’t need to master an engine’s scene system, asset pipeline, and build toolchain first, so attention stays on rules and feel.
- Short iteration loop: change a line of prompt or a block of logic, refresh, and it’s live — well suited to rapid trial and error.
- Predictable cost: static hosting plus object storage costs almost nothing in traffic, so the validation phase carries virtually no fixed expense.
The boundary matters: the web is constrained by browser performance and input models, and is not suited to large scenes, complex physics, or high-precision action systems. It is not a replacement for a commercial engine but an accelerator for the validation phase.
3. Before Testing: What Existing AI Mini-Games Have in Common
Before starting, I played through every AI-generated browser mini-game I could get access to, and came away with two observations:
- Most of them use the maps and mechanics of well-known existing titles as a template, approximating the visuals and the gameplay.
- Once you go beyond the actions and moves the template covers, quality drops off fast — complex combos, precise hit detection, and state machine branches are essentially missing.
The conclusion: the core of a good game isn’t complexity, it’s whether it’s fun. Fun can come from narrative tension (even with only text and dialogue) or from hit feedback (even with only light effects, screen shake, and sound). That set the goal for this experiment — not to clone a blockbuster, but to make one core loop with feedback, rhythm, and a reason to replay.
4. Prompt Engineering: Writing Gameplay as an Executable Spec
Output quality depends on how complete the input spec is. An effective prompt has six sections:
[Genre] Top-down survival shooter, 3-minute runs[Core loop] Collect resources -> survive waves -> upgrade perks -> results[Controls] WASD move, mouse aim, left click shoot, space dodge (0.2s invincibility frames)[Feedback] Hit flash white + 0.05s hitstop, slight screen shake on kill, layered audio[Constraints] Single HTML file, no external assets, procedurally generated materials[Acceptance] Stable 60fps, difficulty curve shows a clear inflection at wave 3
The key is translating “feel” into measurable parameters: invincibility frame duration, hitstop in milliseconds, where the difficulty inflection sits. Once parameterized, the AI’s output can be evaluated rather than judged by gut feeling about whether it “looks right.”
5. Assets and Audio: Where Procedural Generation Cuts Cost
Art and audio are usually the biggest line items. This run used three strategies:
- Procedural geometry and materials: build silhouettes from basic primitives and generate textures with noise functions, avoiding external asset dependencies.
- Synthesized sound effects: oscillators and envelopes produce shoot, hit, and pickup sounds at zero licensing cost.
- Generate on demand: use generative images only for key visuals such as the title screen, keeping the number of calls down.
Illustrative code (audio synthesis approach):
function blip(freq = 440, dur = 0.08, type = 'square') {const ctx = new (window.AudioContext || window.webkitAudioContext)();const osc = ctx.createOscillator(), gain = ctx.createGain();osc.type = type; osc.frequency.value = freq;gain.gain.setValueAtTime(0.2, ctx.currentTime);gain.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + dur);osc.connect(gain).connect(ctx.destination);osc.start(); osc.stop(ctx.currentTime + dur);}
6. Cost Breakdown: How It Got to 20 RMB
Split the spending into four columns and the room for compression becomes clear:
| Item | Traditional approach | This experiment |
|---|---|---|
| Art assets | Outsource or purchase, four figures minimum | Procedural plus a few generated, roughly 0 |
| Audio | Licensed or recorded | Synthesized, 0 |
| Implementation | Mostly labor | AI coding tool subscription, about 20 RMB amortized per run |
| Hosting and distribution | Servers and operations | Static hosting plus object storage, near 0 during validation |
The conclusion isn’t that “AI is cheap.” It’s that assets and implementation were structurally replaced, leaving only minimal tool-call and traffic overhead.
7. Quality Checklist: Don’t Be Fooled by the Graphics
Every generated result needs an objective pass. Five fixed checks:
- Frame rate: does the target device hold a stable 60fps, and do drops cluster at peak waves;
- Hit detection consistency: do hitboxes align with the visuals, or is there damage without contact;
- State machine completeness: are hit, invincibility, death, and respawn a closed loop;
- Difficulty curve: do the first three waves teach the game, and is the inflection perceptible;
- Replay motivation: do random perks or scoring give a reason to play again.
8. Launch and Operations: A Lightweight Architecture Is Enough
Keep the architecture minimal: static assets in object storage, the frontend connecting directly, plus a content delivery network to reduce latency. Logging and monitoring alerts cover only frontend error reporting and traffic metrics. If a leaderboard comes later, add a message queue and a lightweight backend service then, rather than taking on distributed complexity from day one.
9. Capability Limits and Risks
- Complex systems remain a weak spot: multi-character state machines, fine-grained physics, and multiplayer synchronization still need manual rework.
- Maintainability: generated code is loosely structured and needs type constraints and module separation added.
- Compliance: keep records of asset provenance and generated content to avoid licensing disputes.
- Homogenization: leaning on template clones leads to sameness; differentiation has to come from gameplay design.
10. Conclusion: Producers Keep Their Jobs, the Validation Barrier Disappears
The real significance of this experiment is that the entry ticket to making games moved from team and budget to creativity and judgment. AI replaces asset production and boilerplate code; what it can’t replace is the authority to define what’s fun. When validation costs drop to the 20 RMB range, the only scarce resource left is the designer’s taste and decisiveness.
