跪拜 Guibai
← All articles
Frontend · Artificial Intelligence · Game Development

vivo's vGame Replaces Hand-Coded Ad Mini-Games with Structured Prompts and an AI Agent Pipeline

By vivo互联网技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Ad mini-games are a high-volume, low-margin factory job: 3–7 day cycles, heavy asset churn, repetitive mechanics. A pipeline that replaces manual coding with structured prompts and automated asset generation turns a craft bottleneck into a configurable production line, directly cutting labor cost and time-to-campaign for any team running frequent marketing activations.

Summary

vivo's vGame platform turns advertising mini-game development into a prompt-driven pipeline. Instead of hand-coding each 3-to-7-day campaign, developers describe a scene tree in JSON and let AI Agents generate assets, write scripts, and fix runtime errors inside a pre-built Galacean engine template. The system enforces a mandatory asset-first workflow — no placeholder images allowed — so every output is launch-ready, not a designer-dependent draft.

The platform layers 17 domain-specific Agent Skills over a three-part governance model (Agents, Rules, Hooks) to keep AI output within engine specs. A closed runtime-error loop catches JS exceptions via postMessage, feeds stack traces back into the next conversation context, and lets the AI propose and apply fixes directly. The chat panel exposes every file change per conversation round with keep/revert controls, making the whole process auditable and iterable.

Under the hood, a cloned game-template base provides the full lifecycle state machine, UI framework, and engine integration. AI only touches scene.json and scripts/, which slashes the comprehension cost that normally makes LLMs stumble on full-stack game projects.

Takeaways
A single scene.json node tree serves as the sole source of truth for both the editor and the runtime, eliminating manual data-format conversion between tools.
The AI is forced to generate real image files and write them to disk; procedural textures or placeholder images are forbidden unless the user explicitly requests them.
A pre-cloned game-template base provides the Galacean engine integration, Pinia lifecycle state machine, and three-stage UI (start/HUD/end), so the AI only modifies scene.json and scripts/.
17 Agent Skills, each a Markdown file with trigger conditions, allowed tools, and step-by-step instructions, encapsulate engine-specific knowledge like physics, collision, animation, and shader writing.
Runtime JS errors are captured via postMessage, logged to .runtime-errors.json, and automatically injected as context in the next AI conversation for a closed-loop fix cycle.
The chat panel tracks every file change per conversation round and offers one-click keep/revert, turning AI code generation into a version-controlled, auditable workflow.
Sprite animation uses a video-generation → frame-extraction → background-removal → sprite-sheet pipeline rather than direct AI animation output, prioritizing motion smoothness and control.
3D model generation is paired with pre-made skeletal animation assets; a large model handles automatic skeleton mapping to bypass the industry bottleneck of AI-driven character animation.
Conclusions

The template-base strategy solves the core LLM weakness in game dev: context overload. By pre-installing the engine, build tooling, and lifecycle state machine, the AI's task shrinks from 'build a game' to 'configure a scene and write scripts,' which fits within current token windows and reasoning depth.

Forcing real asset generation instead of allowing procedural fallbacks is a hard constraint that changes the output from a prototype to a deployable. Most AI coding tools optimize for code correctness; vGame optimizes for production-readiness across code and assets simultaneously.

The runtime-error feedback loop inverts the usual debugging sequence. Instead of a human describing a bug, the error itself becomes the prompt. This is a pattern that generalizes to any AI-assisted IDE: capture runtime telemetry, feed it back as structured context, and let the agent self-correct.

The three-layer governance (Agents/Rules/Hooks) acknowledges that prompt engineering alone is brittle. Path-level constraints on coupling surfaces like schema↔runtime prevent the kind of cascading breakage that makes AI-generated projects rot after a few iterations.

Concepts & terms
Galacean Engine
An open-source Web-based game engine used as the runtime foundation in vGame. The template base pre-integrates its resource loading, entity management, physics, and rendering so AI scripts can manipulate game objects without touching engine internals.
Agent Skill
A Markdown file that packages domain-specific knowledge — trigger conditions, allowed tools, step-by-step instructions, and pitfalls — for a narrow game-dev task (e.g., collision detection setup). The AI agent loads the relevant Skill when it detects a matching scenario.
scene.json as Single Source of Truth
A design pattern where the scene node tree (nodes, transforms, asset references, script bindings) is the one data structure shared between the visual editor and the runtime engine. Changes to scene.json propagate directly to the running game with no intermediate conversion layer.
Runtime Error Closed Loop
A feedback mechanism where JavaScript exceptions caught during game preview are serialized (type, message, stack trace, file location), stored server-side, and injected into the AI's next conversation context so it can propose and apply a fix without human bug-report mediation.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗