Hands-On: Using AI to Build a Game for About 20 Yuan
This article documents a hands-on experiment showing how generative AI can compress the cost of building a small browser game to roughly the price of a coffee. It explains why browser games make a practical validation vehicle, which three structural factors drive the cost down, and a reproducible six-stage workflow covering executable specs, layered prompting, core code such as frame-rate-independent updates and AABB collision detection, asset generation and screening, automated checks, and deployment. A cost breakdown and four hard limits clarify what AI cannot replace. The key takeaway: money spent on asset procurement shifts into time spent on judgment and debugging.
1. Introduction: Repricing What It Takes to Build a Game
Game development is traditionally tied to professional teams, long timelines, and large budgets. A full project cycle runs through design, art, programming, testing, and release, and rework at any single stage amplifies the total cost. Once generative AI entered the software production pipeline, that cost structure began to be rewritten: a small browser game with a clearly bounded mechanic can now go from idea to a playable build for about the price of a cup of coffee.
This article is not a review of any specific product. It addresses a more general technical question: can an ordinary person use AI coding tools to turn a game idea into a low-cost reality? The answer is yes, under strict preconditions. What follows uses one real hands-on run as the main thread and lays out a reproducible methodology.
2. Why a Browser Game Is the Validation Vehicle
Experienced players usually think of mature engines and professional toolchains first. Those options are irreplaceable for large projects, but they are too heavy when the goal is simply to test whether an idea holds up.
The core advantage of a browser game is minimal distribution friction: no installation, cross-platform by default, and a single link anyone can play. For the developer, that compresses the feedback loop to a matter of hours.
| Dimension | Traditional engine approach | Lightweight browser approach |
|---|---|---|
| Learning curve | Requires learning the editor and workflow | Relies on general front-end knowledge |
| Validation cycle | Days to weeks | Hours |
| Distribution | Packaging and channel distribution | One link, playable immediately |
| Cost of rework | High | Low |
The conclusion is clear: when the goal is validating a gameplay hypothesis rather than shipping a commercial title, the lightweight browser approach is the lowest-cost option.
3. What Actually Compresses the Cost
The extremely low cost does not come from any single “magic capability.” It is the result of three structural factors stacking together.
1) Asset generation replaces outsourced procurement. Models, sound effects, and textures built from scratch traditionally require art and audio resources. Generative methods can produce candidate assets in batches under prompt constraints, after which a human screens them, converting a procurement cost into a screening-time cost.
2) Code generation compresses implementation time. A large share of game logic is boilerplate: state machines, collision detection, input mapping, the render loop. These structures are highly patterned, which is exactly where AI coding tools are strong.
3) The validation scope is deliberately narrowed. The precondition for extremely low cost is building only a vertical slice: one core mechanic, one level, one minimal art set. Once the scope expands, cost rises non-linearly.
It is worth noting that existing industry practice shows a small game produced entirely through generative means can keep its total asset cost in the hundreds of dollars; narrowing the scope further and adopting a minimal approach makes a range of a few dozen yuan entirely realistic.
4. The Workflow: Six Stages
Stage 1: Converge the idea into an executable spec
A vague “I want to make a fun game” cannot be generated. It has to be rewritten as a spec with testable completion criteria:
Core mechanic: player moves left and right, dodges falling obstacles, survival time is the scoreControls: left/right arrow keys + touch drag on mobileSession length: 30–60 secondsFailure condition: collision detectedWin condition: none (endless mode, high score recorded)Art style: minimal geometry, single color schemeAudio: one collision sound, one score sound
The value of the spec is that every line can be tested, which prevents output that “looks right but plays wrong.”
Stage 2: A layered structure for prompt engineering
High-quality output depends on layered prompts, not a single short description. A four-layer structure is recommended:
- Role and constraints layer: fix the stack to the native front-end trio and forbid extra dependencies;
- Structure layer: require the file layout and module responsibilities first, then the implementation;
- Implementation layer: specify key algorithm requirements, such as frame-rate-independent updates based on time deltas;
- Acceptance layer: require a self-check list and notes on edge cases.
Sample prompt fragment:
Generate an implementation plan for an endless dodging browser game.Constraints: use only HTML/CSS/JavaScript, no external libraries.Requirements:1) Provide the module breakdown first (render, input, physics, state);2) Movement logic must be decoupled from frame rate;3) Use axis-aligned bounding boxes for collision detection;4) Append an edge-case self-check list after the output.
Stage 3: Skeleton implementation of the critical code
In the generated result, frame-rate-independent updates are both the easiest thing to get wrong and the one thing that must be right:
let last = performance.now();function loop(now) {const dt = Math.min((now - last) / 1000, 0.05); // cap the max step to prevent jumps after returning from backgroundlast = now;update(dt);render();requestAnimationFrame(loop);}requestAnimationFrame(loop);
Collision detection uses axis-aligned bounding boxes, which is simple logic and easy to verify:
function hit(a, b) {return a.x < b.x + b.w && a.x + a.w > b.x &&a.y < b.y + b.h && a.y + a.h > b.y;}
These two snippets are listed separately because they determine the game’s “feel” and “fairness,” and feel is precisely the part generative output tends to overlook.
Stage 4: Asset generation and human screening
The key in this stage is not generation but establishing screening criteria: textures must be recognizable at the target resolution; sound effects must have no clipping and stay under 200 milliseconds; the style must be consistent. Set three hard criteria per asset type and regenerate anything that fails, avoiding rework later.
Stage 5: Local debugging and automated checks
Do not rely on “playing it once by hand.” Cover at least three categories of checks:
- Logic checks: whether score accumulation, failure detection, and restart resets behave correctly;
- Edge checks: window resizing, backgrounding the page and resuming, rapid consecutive input;
- Compatibility checks: input differences between desktop and mobile.
Stage 6: Deployment and observability
Once local checks pass, publish. General-purpose cloud capabilities can handle the launch and operations, for example using object storage to host static assets, a content delivery network to reduce load latency, and log services with monitoring and alerting to track error rates and traffic. These are all standard capability categories in the industry; when choosing among them, pay attention to cold starts, bandwidth billing models, and static asset caching strategy.
5. Cost Breakdown: Where the Money Goes
| Item | Traditional path | This experiment |
|---|---|---|
| Art assets | Outsourced procurement, the largest share | Generated and screened, close to zero |
| Audio assets | Purchased or recorded | Generated, close to zero |
| Implementation | Human hours | Generated and debugged |
| Hosting | Servers and operations | Static hosting, pay-as-you-go |
| Total | Tens of thousands to hundreds of thousands of yuan | About 20 yuan |
The cost has not disappeared; it has migrated from procurement spending to time invested in judgment and debugging. That is the key to understanding the whole methodology.
6. Four Limits You Have to Face
- Feel and balance cannot be generated automatically. Number tuning and the difficulty curve require repeated playtesting, and that investment cannot be compressed.
- Complex systems still hit context limits. For medium and large projects with heavy module coupling, the consistency of generated output drops noticeably.
- Copyright and compliance need human review. The provenance and licensing of generated assets, along with the game’s privacy notice and content compliance, must all be confirmed by a person.
- Maintainability has to be designed in deliberately. Generated code tends to be “good enough to run,” with refactoring and comments often missing, so the acceptance checklist should require them explicitly.
7. Actionable Advice for Different Readers
- Developers validating an idea: lock down the spec first, limit it to a single-mechanic vertical slice, and get a playable link within 24 hours;
- Teaching and training scenarios: make “layered prompts plus a self-check list” the main thread of the course, so student output can be playtested in class;
- Corporate innovation teams: treat this kind of practice as a low-cost pre-research method and use real playtest data to decide whether to invest further.
8. Conclusion
The essence of building games at extremely low cost is replacing capital-intensive asset procurement with judgment-intensive generation and screening. It does not diminish professional value; it raises the weight of two capabilities: defining the problem and judging quality. For most people, the real barrier has never been the engine, but whether they can turn a vague idea in their head into a spec that can be verified.
