AI-Assisted Browser Game Development: Building a Playable Prototype for Around CNY 20
This hands-on experiment explores how AI-generated code, procedural graphics, and synthesized audio can reduce the direct cost of building a browser game prototype. It covers the development workflow, a cost breakdown, debugging lessons, and engineering practices for keeping iteration manageable. The result highlights both the value of clear gameplay specifications and the human effort still needed to refine the experience.
AI-Assisted Browser Game Development: Building a Playable Prototype for Around CNY 20
Introduction: Can Anyone Turn a Game Idea into a Playable Prototype?
A story recently circulated in the industry about an engineer who used a large language model and short prompts to generate a visually polished browser game. According to the account, the AI ran for several hours, creating all models, sound effects, and textures from scratch, at a total cost of only a few hundred dollars.
That raised a straightforward question: can someone without a conventional game development workflow turn an idea into something playable?
To explore that question, I completed a hands-on experiment and brought the prototype’s direct costs down to around CNY 20. This article documents the technical approach, the iteration process, and the problems encountered along the way.
1. Why Build for the Browser?
Game development often brings to mind heavyweight engines, specialist teams, and months of work. For quickly testing a gameplay idea, however, the browser offers several advantages:
- No-install distribution: Once the game is packaged as a static site, a link is enough to let others try it. That keeps the feedback cycle short.
- A focused technology stack: A prototype can be built with HTML, JavaScript, and Canvas or WebGL rendering. These front-end technologies are well suited to AI code generation.
- Low deployment costs: Static hosting or object storage, combined with a content delivery network, can serve the game.
- Fast iteration: Change a function, refresh the page, and inspect the result. This works well with a frequent “generate, run, provide feedback” loop.
The browser still has limits. Complex 3D rendering, large asset loads, and intensive physics simulation are more demanding targets. For validating a gameplay prototype, though, it was sufficient.
2. Technical Approach: Generate the Game in Three Layers
I divided the game into three layers and used AI to work on each separately.
Gameplay Logic
Structured prompts described the core gameplay loop. For example:
Implement a top-down shooter with WASD movement and mouse aiming and shooting. Spawn enemies in three waves, and give the player three lives.
The key is to express rules as conditions that can be evaluated, rather than as vague descriptions of how the game should feel.
The generated code generally used a game loop driven by requestAnimationFrame:
function gameLoop(timestamp) {const dt = timestamp - lastTime;updatePlayer(input, dt); // Input and player stateupdateEnemies(dt); // Enemy AI and collisionscheckCollisions(); // Bullets, enemies, and playerrender(ctx); // Frame renderingrequestAnimationFrame(gameLoop);}
Visual Assets
Pixel art and vector-style visuals were practical choices for AI-generated assets. Instead of asking for bitmap files, I had the AI generate procedural drawing code, including Canvas paths and particle effects.
This avoided managing separate art assets and made it easier to adjust the visual style during development.
Much of the satisfaction of combat came from immediate feedback: hit flashes, screen shake, and particle bursts. These effects could be implemented in a few dozen lines of code, making them a cost-effective way to improve the experience.
Sound Effects
Simple sounds for shooting, explosions, and scoring were synthesized with oscillators through the Web Audio API.
No audio files were needed, which further reduced asset costs and management overhead.
3. Cost Breakdown: Where the CNY 20 Went
| Item | Cost | Notes |
|---|---|---|
| AI generation calls | Approximately CNY 18 | Token-based charges for the initial version and roughly 30 rounds of revisions |
| Static hosting | CNY 0 | The hosting setup’s free allowance was sufficient during prototyping |
| Assets | CNY 0 | All assets were generated procedurally, with no external resources |
The direct cost was around CNY 20, but the main cost driver was not the first generation—it was the number of iterations.
Prompt quality helped keep that number under control. Defining the rules, edge cases, and visual style clearly at the outset reduced rework.
4. Three Findings from the Experiment
AI Performs Best When the Reference and Rules Are Clear
AI handled recognizable gameplay patterns reasonably well. Whether the reference was a classic shooter map layout or an action-game framework with movement, dodging, and light and heavy attacks, clear specifications helped it produce basic scenes, interactions, and mechanics.
More complex attack branching and precise tuning of game feel still required human intervention.
A Fun Game Does Not Have to Be a Complex Game
In early attempts, I asked the AI to add more systems. The result was a less enjoyable game rather than a better one.
The final version removed unnecessary mechanics and focused on a short loop: move, shoot, receive feedback. Lighting effects, screen shake, and pacing strengthened that loop.
The approach echoed the appeal of classic Flash games: a small set of mechanics, supported by responsive feedback, can be enough for an engaging experience.
Debugging Is the Largest Hidden Cost
The generated code could run, but it still had edge-case bugs. Enemies became stuck against walls, collision checks missed interactions, and frame rates dropped unexpectedly.
Specific runtime observations were much more useful than a generic “something is wrong.” For example:
After the third enemy wave spawns, the frame rate drops to 20.
Combining that feedback with runtime logs or the browser’s performance panel helped locate bottlenecks.
The low direct spending therefore did not mean the prototype required no effort. Debugging and refinement remained substantial parts of the work.
5. Engineering Practices That Helped
- Generate and validate modules separately. Rather than requesting an entire game at once, work through the scene, player character, enemies, UI, and audio one module at a time.
- Save working versions. Keep a snapshot after each usable iteration. AI-generated revisions can introduce regressions.
- Add automated smoke tests. Even a simple script that checks whether the game loads can catch basic failures.
- Set a performance budget early. Include a target frame rate and an upper limit on active entities in the prompt constraints.
Conclusion
This experiment suggests that AI can shift the entry barrier for game prototyping from writing engine code to describing gameplay clearly.
The roughly CNY 20 direct cost reflects a change in the developer’s role: less time implementing everything from scratch, and more time expressing rules, diagnosing problems, and tuning the experience.
AI does not instantly make everyone a game producer. It does, however, make “build it and see whether it is fun” far more accessible—provided that low generation costs are not confused with the absence of debugging and design work.
