Building a Web Game Prototype from Scratch with AI: A Low-Cost, End-to-End Retrospective
This article reviews a low-cost workflow for building a playable web game prototype with AI, covering why web games are well suited for AI-assisted prototyping, a four-step process from gameplay definition to a playable build, a reusable acceptance checklist, common failure modes, and risks around copyright, code review, and compatibility testing.
Background: Why Low-Cost Prototyping Is Worth Doing
A recent case has drawn considerable discussion among developers: an engineer reportedly used a fairly short prompt and, after roughly eight hours of generation and debugging, produced a visually polished web game with all assets generated by AI, at a total cost said to be in the hundreds of dollars. This figure comes from public discussion and has not been independently verified; it should be cited against the original source.
Cases like this matter because they shift the main cost of game prototyping from labor to compute and time. On the traditional path, a team often spends weeks learning an engine, then works through art, audio, programming, and testing. A mid-sized indie game typically takes years, with labor costs in the hundreds of thousands. For an individual developer who just wants to validate a gameplay idea, that barrier is too high.
A prototype also has a different goal than a finished product. The question a prototype needs to answer is very specific: is the core gameplay fun, and will players come back to it? Only once that question has an answer does further investment make sense.
Why Start with a Web Game Prototype
Choosing a web game for prototyping comes down to three judgments.
First, distribution costs are close to zero. A web game requires no installation—sharing a link is enough for others to try it. Getting feedback from real players quickly often influences decisions more than polishing visuals.
Second, the tech stack is AI-friendly. Web games are typically built on HTML, CSS, and JavaScript, using Canvas for rendering, requestAnimationFrame for the game loop, and Web Audio for sound. These patterns are heavily represented in public code, so AI-generated code is more likely to pass a simple run test.
Third, the cycle is short. A small gameplay loop can often be running within hours, which makes it fast to judge whether an idea holds up.
That said, web games are not right for every genre. Projects that depend heavily on physics engines, large open worlds, multiplayer synchronization, or complex rendering are better suited to professional engines. In those projects, AI prototyping can only serve as a starting point for gameplay validation.
The Process: From Gameplay Definition to a Playable Build
The goal of this exercise was clear: build a small game with a complete core loop—not to chase scale, but to validate the gameplay. The following four steps summarize the workflow.
Step 1: Define the Gameplay with Constraints
The gameplay description needs to be specific, ideally covering the core loop, controls, and win/loss conditions. Vague descriptions lead AI to generate content that looks rich but is not actually playable.
A prompt can follow this structure:
Goal: Build a single-file HTML5 web mini-game.Technical constraints: Use only vanilla HTML, CSS, and JavaScript. Render with Canvas. No external libraries or network resources.Gameplay: The player controls a character with arrow keys or touch swipes, collecting falling items within 60 seconds. Hitting an obstacle deducts 1 point.Visuals: Plain vector shapes are fine; no art assets needed for now.Acceptance criteria: The game starts immediately when the page opens, with start, end, and restart buttons, and the score displayed in real time.
This structure covers four kinds of information: technical constraints, gameplay rules, presentation requirements, and acceptance criteria. The “single file, no external dependencies” requirement lets the generated result run directly in a browser, skipping environment setup.
Step 2: Generate Assets and Code in Separate Sessions
Assets such as textures, sound effects, and character sprites should be generated in separate conversation sessions from the game logic code. This has two benefits. Assets can be reviewed one by one, and unsatisfactory ones replaced individually. And when the code has issues, long asset descriptions won’t interfere with the debugging process.
Asset review can check four things: whether the style is consistent, whether dimensions and transparent backgrounds are correct, whether audio duration and volume are appropriate, and whether file sizes affect loading speed.
Step 3: Fix Only One Category of Issues per Round
The first generated version usually only reaches “it runs.” Game feel, difficulty curve, and UI feedback require multiple rounds of adjustment. In practice, raising only one category of issue per round produces more stable results. For example, round two adjusts only movement speed and collision detection; round three adjusts only score prompts and audio synchronization. Changing game feel and UI at the same time makes it easy for the AI to drop one while fixing the other, and hard to tell which change produced which effect.
After each round, play the game on the target device and record three things: whether the issue was resolved, whether new issues were introduced, and how the change affected the experience.
Step 4: Account for Costs with a Clear Methodology
Cost figures must come with a stated methodology, or they can’t be compared. In this retrospective, the author’s total spend was about 20 RMB, mainly model invocation fees. Labor time was not included, and it was not stated whether domain or hosting fees were covered.
A suggested formula for tracking cost:
Total cost = model invocation fees + asset generation fees + hosting fees (if any) + other tool fees
Model invocation fees can be estimated as “number of calls × average input/output tokens per call × unit price,” with the billing currency and exchange rate noted. Labor time should be recorded separately—it is often higher than the invocation fees.
A common mistake is directly comparing “AI generates an image for a few cents” with “outsourced character art costs hundreds.” The two differ in delivery scope, revision counts, and copyright ownership, so a direct comparison leads to misleading conclusions.
Methodology: A Reusable Checklist
The following checklist can be used for every prototype acceptance review.
Core gameplay:
- Can a player understand the controls within one minute?
- Is there clear win/loss or scoring feedback?
- After three consecutive rounds, does the player still want one more?
Assets:
- Is the style consistent?
- Are transparent backgrounds and dimensions correct?
- Are sound effects synchronized with actions?
Performance and compatibility:
- Does the frame rate stay stable on a mid-to-low-end phone?
- Does the game work properly in both desktop and mobile browsers?
- Are both touch and keyboard input supported?
Copyright and compliance:
- Do the terms of the model services used allow commercial use?
- Could any generated assets resemble existing works, and should they be replaced?
- Are any unauthorized fonts, music, or images being used?
Code security:
- Is user input sanitized before being rendered to the page?
- Are there any third-party scripts from unknown sources?
- Does the front end expose any keys or API endpoints?
Common Failure Modes
Four failures show up repeatedly in practice. First, tuning visuals while ignoring gameplay, producing something polished that nobody wants to play. Second, mixing multiple problems into a single round of prompting, making the results hard to attribute. Third, generating assets and code in the same session, where contexts pollute each other and fixes get slower and slower. Fourth, publishing the first generated result directly as a finished product, skipping edge-case testing.
Risk Notes
AI-generated assets may carry copyright and licensing uncertainty. Before commercial use, confirm the terms of the model services and keep generation records. Code needs human review, especially around input handling and external resource references. Performance and compatibility cannot be assumed—they must be tested on real devices.
Deployment can stay simple. A finished static page can be hosted on object storage or a static hosting service, with no server to maintain. But if the page involves user data or accounts, it must be handled to the standards of a production product.
Conclusion: AI Lowers Implementation Cost—Judgment Remains Critical
The concrete conclusion from this exercise: AI has cut the cost of validating a creative idea from “assemble a team, spend months” to “one person, one evening.” It shortens the implementation stage, but whether gameplay is fun still requires the developer’s own judgment. Among the AI mini-games tested, the best-looking ones were not necessarily the most replayable—small games with solid gameplay retained players better.
For developers, the skills worth building include: writing gameplay as testable constraints, splitting asset and code generation, solving only one category of problem per round, and using a checklist for acceptance. This workflow helps you quickly decide whether a gameplay idea deserves further investment.
