AI Reshapes Game Development: How Domestic LLMs Are Closing the Gap
This article examines how game development serves as a comprehensive stress test for large language models, evaluates the real capabilities of Chinese open-source models through structured benchmarking, and provides a practical workflow for building small games with LLM assistance. Readers will learn a four-dimension evaluation framework, the specific strengths and weaknesses of domestic models in game generation tasks, a staged development methodology with code examples, and the engineering considerations for moving AI-generated demos to production.
Game Development as a Comprehensive Stress Test for LLMs
When evaluating a model’s coding ability, people once relied on simple questions like “can it write a correct function?” Game development, however, operates at an entirely different level of complexity. A successful game generation requires the model to simultaneously handle UI rendering, interaction events, state management, numerical design, and exception handling.
Consider a typical test prompt: “Implement a Snake game where arrow keys control movement, eating food adds score, and hitting a wall or the snake’s own body ends the game.” These few dozen words correspond to hundreds of lines of structured code: canvas and coordinate systems, snake body data structures, collision detection, speed control, scoring, and pause/resume logic. If any single component fails, the game simply won’t run.
For this reason, “making the model build a game” is becoming a popular community stress test. Compared to solving algorithm problems, it better exposes a model’s true capability in long-horizon planning, code organization, and attention to detail. Recent batches of game generation tests on domestic open-source models have produced results that are “both disappointing and surprising,” giving the industry judgment that “the gap between domestic models and top-tier performance is rapidly narrowing” its first tangible reference point.
Rigorous Evaluation: Don’t Just Check Whether It Runs
If you only want to see a demo, getting it to run is enough. But if you want to use test results as a reference for technology selection, you need a more rigorous evaluation framework. Based on common community practices, evaluation can be organized along four dimensions.
1. Task Set Design
- Replication tasks: Classic gameplay such as Snake, Breakout, match-3, and space shooters—high logical determinism makes these suitable for cross-model comparison;
- Original tasks: Providing a natural language gameplay description to test the model’s ability to translate requirements into implementation;
- Modification tasks: Adding requirements to existing game code (e.g., “add power-ups and a leaderboard”) to test understanding of existing code and iterative compliance.
2. First-Pass Rate
The proportion of generated games that run and are playable without any manual modification is the most hardcore reliability metric.
3. Code Quality
“Playable” is only the passing grade. What truly matters includes: whether module separation is clear, whether magic numbers are consolidated into constants, whether the animation loop uses requestAnimationFrame instead of crude setInterval, and whether there are potential memory leaks.
4. Iteration Efficiency
Real development never happens in one shot. When given modification instructions like “speed increases with score” or “add touch controls for mobile,” whether the model can precisely locate the change point without breaking existing logic often reflects practical value more than first-pass generation.
A reference evaluation prompt template:
Please implement [game name] in a single HTML file with the following requirements:1. Gameplay rules: ...2. Controls: ...3. End and win/lose conditions: ...4. Visual style: ...5. Constraints: No third-party libraries, use Canvas rendering,clear code layering (constant definitions / state management / rendering / main loop).First output your implementation approach, then output the complete code.
The step “output approach before writing code” is critical: it forces the model to do a global planning pass first, significantly reducing the probability of logical breaks in long code.
Gaps and Highlights: Where Domestic Models Really Stand
Based on multiple recent community test results, domestic open-source models show a clear dual nature in game generation tasks.
Areas where gaps remain
- Insufficient long-horizon complexity: When facing gameplay with multiple coupled systems (such as dungeon crawlers with inventory systems and random maps), generated code tends to exhibit state desynchronization between systems and broken logic chains;
- Weak engineering organization: Logic tends to pile up in a few large functions, with insufficient modularity and maintainability, leading to high costs for secondary development;
- Lack of detail polish: Boundary conditions in collision detection and state consistency during pause/resume are frequent failure points.
Areas where competitiveness already exists
- Better Chinese requirement understanding: When describing gameplay rules and control details in Chinese, semantic comprehension tends to be closer to intent, reducing back-and-forth communication costs;
- Lightweight web mini-games are a strength: HTML5 Canvas-based casual games have mature gameplay patterns and clear paradigms, and domestic models perform quite competitively on such tasks;
- Good iteration compliance: For precise instructions like “only change this part, don’t touch that,” they locate accurately and make restrained modifications.
The selection insight is straightforward: rather than agonizing over “which model has the highest overall score,” design a small set of tasks using your project’s actual gameplay types and tech stack for hands-on testing. Model capabilities are vertical-specific, and which vertical your business falls into matters far more than leaderboard rankings.
Practical Methods: Efficiently Building a Small Game with LLMs
1. Structured Requirements: “Say It Clearly”
Game requirements are naturally suited to block-based description. Rather than writing a long narrative, break them down by five elements: gameplay / controls / rules / visuals / technical constraints. In practice, structured prompts yield noticeably higher first-pass rates than casual descriptions.
2. Staged Generation—Don’t Expect One-Shot Success
A three-step approach is recommended:
- Step one: Request only “a playable core loop”—movement, collision, and scoring, nothing else;
- Step two: Layer on UI, sound effects, levels, and difficulty curves;
- Step three: Tune numerical values and game feel.
Run and verify at each step before proceeding to the next. Short per-step context and timely verification yield far higher success rates than “asking for a complete game all at once.”
3. A Minimal Playable Skeleton Example
Below is the core skeleton of a Snake game (excerpt), demonstrating three good habits: centralized constants, separated logic and rendering, and a fixed-timestep loop:
<canvas id="game" width="400" height="400"></canvas><script>const ctx = document.getElementById('game').getContext('2d');const GRID = 20, CELL = 400 / GRID; // Grid and cell size defined in one placelet snake = [{x:10, y:10}], dir = {x:1, y:0},food = {x:15, y:15}, score = 0, over = false;document.addEventListener('keydown', e => {const m = {ArrowUp:{x:0,y:-1}, ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0}, ArrowRight:{x:1,y:0}};const d = m[e.key];if (d && (d.x !== -dir.x || d.y !== -dir.y)) dir = d; // Prevent 180-degree reversal});function step() { // Logic layer: state changes onlyconst head = {x: snake[0].x + dir.x, y: snake[0].y + dir.y};const hitWall = head.x < 0 || head.y < 0 || head.x >= GRID || head.y >= GRID;const hitSelf = snake.some(s => s.x === head.x && s.y === head.y);if (hitWall || hitSelf) { over = true; alert('Game Over: ' + score); return; }snake.unshift(head);if (head.x === food.x && head.y === food.y) {score++;food = {x: (Math.random() * GRID) | 0, y: (Math.random() * GRID) | 0};} else {snake.pop();}}function draw() { // Render layer: read state onlyctx.clearRect(0, 0, 400, 400);ctx.fillStyle = 'red';ctx.fillRect(food.x * CELL, food.y * CELL, CELL, CELL);ctx.fillStyle = 'green';snake.forEach(s => ctx.fillRect(s.x * CELL, s.y * CELL, CELL, CELL));}let last = 0;function loop(ts) { // Fixed-timestep main loopif (over) return;if (ts - last >= 120) { step(); draw(); last = ts; }requestAnimationFrame(loop);}requestAnimationFrame(loop);</script>
Feed this skeleton back to the model, then request incremental features like “add a speed boost mechanic” or “support touch swipe controls.” Iterating on clear anchor code yields much better stability.
4. Manual Review Checklist
Before shipping model-generated code, run through at least these three items:
- Boundary conditions: Is state consistent after pause/resume? Is the old game thoroughly cleaned up on restart?
- Performance: Are there hidden issues like per-frame DOM manipulation or un-preloaded resources?
- Maintainability: Are constants centralized? Are logic and rendering decoupled?
From Demo to Launch: The Last Mile
An AI-generated game demo still has an engineering distance to cover before it becomes a shippable product: static assets need hosting, access needs acceleration, backend logic like scoring and leaderboards needs to be supported, and post-launch runtime data (such as level drop-off points) requires logging and monitoring services. This step can be accomplished with a combination of general cloud capabilities—using object storage to host game static assets, CDN for distribution acceleration, and function compute or container services to carry lightweight backend APIs. For example, Baidu AI Cloud’s object storage, content delivery network, and other general cloud services can cover this chain, allowing developers to push a gameplay prototype to real users for validation without building infrastructure from scratch.
Conclusion: AI Is a Lever, Not a Replacement
“Before you knew it, the gaming world has been turned upside down by AI”—behind this quip lies a serious trend judgment: code-generating AI is lowering the barrier to small game development to the level of “one sentence,” and domestic models, while still having an overall gap, have already achieved practical competitiveness in multiple vertical scenarios.
For developers, a healthier mindset is to treat AI as a lever for amplifying productivity: what models excel at is rapidly codifying mature gameplay patterns; but architecture design, gameplay creativity, and experience tuning—the parts that truly determine a product’s ceiling—remain in human hands. Evaluate before selecting, use before observing, and bring AI into your R&D workflow as quickly as possible—that is the right posture for riding this wave.
