System Overview
op7418/guizang-game-skill (Guizang Game Skill) is an Agent Skill for AI coding assistants such as Claude Code and Codex. It organizes the workflow, stage checkpoints, and troubleshooting rules for building a browser 3D action game from scratch using AI-generated assets, three.js, and plain WebGL, then packaging the result into a single HTML file.
The skill comes from a single end-to-end build of the top-down xianxia 3D action demo Mist-Locked Gate using Fable 5.2. That build took about 6 hours and 450M tokens (including Opus 5.5 test runs) across 7 manual playtest rounds of 5 to 10 reported issues each. The demo includes 1 area, 5 rigged 3D characters, 2 weapons, 12 kinds of props, 5 kinds of loot, 8 voiced lines, and a two-phase boss encounter, starting from nearly 100 MB of raw assets.
The included build scripts emit three distribution targets from one codebase:
| Build target | Size and network profile | Use case and runtime behavior |
|---|---|---|
Hosted site (dist/site/) | About 22 MB tested; staged downloads | Static hosting such as GitHub Pages; renders the scene first while models load in the background, with touch controls, quality settings, and an optional high-resolution texture set (assets-hd) |
Single HTML (dist/wusuo.html) | About 30–33 MB; 0 network requests | Opens locally by double-clicking in a browser; embeds models, textures, and audio as data URLs through window.__A and a fetch proxy |
Mini-app container (dist/wusuo-minitool.zip) | About 8 MiB (10 MiB cap); offline, no WASM | Restricted containers such as Xiaohongshu mini-tools; bundles as ES2017 / Chrome 61 IIFE without fetch or module scripts, enforced by a static gate |
Installation and Prerequisites
Node.js 18 or newer is the only required local runtime; external asset generators are optional. Without asset tools, the workflow falls back to free asset libraries and procedural geometry with lower visual fidelity.
- Not completed:
Node.js 18+ (required): Runs the local static server and packaging scripts.
- Not completed:
Packaging dependencies and ffmpeg (required for build scripts):
@gltf-transform/core,@gltf-transform/extensions,@gltf-transform/functions,meshoptimizer,sharp,esbuild, and the systemffmpegbinary. - Not completed:
Tripo (optional): Image-to-3D model generation and automatic skeletal rigging.
- Not completed:
Jimeng or another image generator (optional): Character turnaround sheets, prop concept art, skill icons, calligraphy title graphics, and dedicated voice synthesis.
- Not completed:
Suno (optional): Seamless instrumental background tracks for exploration, mob combat, and boss fights.
Give the repository URL directly to your coding agent to install, or clone it manually into the agent's skills directory:
# Claude Code install path
git clone https://github.com/op7418/guizang-game-skill ~/.claude/skills/guizang-game-skillFor Codex or other compatible tools, clone the repository into that tool's skills directory. After installation, specify the theme, camera perspective, scope, and available asset tools in your prompt:
Make a top-down wuxia 3D action game for the web: one area, one wave of enemies, one boss.
I have Tripo and an image generator available.Development Stages and Self-Verification
SKILL.md requires four alignments before writing code: obtain reference videos or games and break down camera, skill pacing, and UI style; confirm an isometric top-down perspective with a one-area, one-boss scope; inventory available CLI asset tools and per-call credit costs (connecting user-supplied tools immediately); and write a research note plus staged plan for user confirmation.
Development runs across 8 stages. Each stage ends with a verifiable deliverable and a checklist separating items observed by sight or sound, items that merely did not throw errors, and items requiring manual playtesting:
| Stage | Core deliverable | Acceptance method |
|---|---|---|
| 0 Research and design | Research note, world design, staged plan | Written user confirmation |
| 1 Rendering base | Empty scene, HDR, volumetric fog, multi-pass bloom, grading | Browser screenshot inspection |
| 2 Scene assembly | Terrain, instanced foliage, prop placement | Approve static shots before motion |
| 3 Characters and motion | 3D models, rig alignment, combat animations | Dedicated showcase page close-ups |
| 4 Core combat | Combos, dodge, guard, parry, mob encounter | User playtest |
| 5 Cutscenes and boss | Camera cutscenes, boss phases and moveset | User playtest |
| 6 UI and audio | HUD, skill bar, music, SFX, voice lines | User playtest and audio review |
| 7 Polish and packing | Asset compression and single-HTML / site / container builds | User local double-click verification |
Because hidden browser tabs pause requestAnimationFrame, SKILL.md requires installing frame-stepping debug hooks and URL flags on day one:
G.step = (n = 60, dt = 1/60) => { for (let i = 0; i < n; i++) frame(0, dt); }; // Manually advance n frames (with rendering)
G.upd = (n = 30, dt = 1/60) => { for (let i = 0; i < n; i++) updatePlayer(dt); }; // Movement logic only, for full-map stuck-point scans
G.press = (...codes) => codes.forEach(c => pressed.add(c)); // Simulate a key press
// Also expose G.keys, G.mouse, G.pl(), G.fx, G.spawn(kind, pos)With four URL parameters (?stage=court to jump to a stage, ?auto to skip the title screen, ?god for invincibility, and ?show=char for a standalone character viewer), the agent runs an automated loop of advancing frames, reading numeric state, and inspecting zoomed screenshots. Verification prioritizes numeric state over screenshots, caps G.step at 1000 frames per call, mutes audio during automated runs, and returns to the title screen afterward.
Reference Modules and Reusable Scripts
SKILL.md acts as the index for 6 on-demand topic references and 4 scripts meant to be copied directly into the game project.
Master workflow
SKILL.md
Eight-stage flow and verification rules
Defines the four pre-build alignments, Stage 0–7 deliverables, frame-stepping hooks, three-tier status reporting, and seven common failure modes.
Asset pipeline
references/assets.md
Models, textures, audio, and credit control
Covers clean-background concept art before image-to-3D, turnaround checks, resumable batch scripts, dedicated voice models, and CC0 texture/SFX libraries.
Characters
references/characters-animation.md
Rig alignment, root-motion stripping, two-bone IK
Details facing calibration, model-space horizontal root-motion locking, five-keyframe combat poses, numeric joint probes, and weapon socket swaps.
Combat and camera
references/combat-feel.md
Hit feel, guard/parry, and arena scanning
Covers attack magnetism, per-character hit-stop, input buffering, top-priority dodge cancel, turn-taking enemies, camera focus tethering, and eight-direction map scans.
VFX and UI
references/vfx-ui-audio.md
Mesh-shader VFX, HUD, and audio mix
Specifies the half-float render pipeline, slash/rune/falling-sword/telegraph shaders, bloom peak 2–3, code-drawn health bars, loot pillars, and volume ratios.
Troubleshooting
references/pitfalls.md
Symptom-indexed pitfall list
Documents blank loaders, ES module syntax checks, stuck direction keys, Shift clearing bugs, trapped arena islands, bloom washout, and automated test traps.
Packaging
references/packaging.md
Compression, progressive loading, and containers
Details WebP texture resizing, animation-only pruning, disabling mesh quantization on rigged characters, touch adaptation, and 10 MiB mini-app static gates.
Input layer
scripts/input.js
Stuck-key-resistant input and F3 panel
Exports keys, pressed, mouse, endFrame, and debugPanel; handles IME, opposite-direction cancel, Meta/Alt/Ctrl reset (excluding Shift), and RMB resync.
Local server
scripts/serve.mjs
Zero-dependency static HTTP server
Binds 127.0.0.1 (default port 5173, configurable via PORT) with path-traversal protection and cache-control: no-store.
Dual builder
scripts/build_single_html.mjs
Single-HTML and static-site bundler
Uses glTF-Transform, meshoptimizer, sharp, ffmpeg, and esbuild to emit dist/wusuo.html and dist/site/ (including assets-hd), with a --no-meshopt flag.
Container builder
scripts/build_minitool.mjs
Xiaohongshu 10 MiB offline packager
Simplifies meshes, extracts WebP textures, stores geometry and low-bitrate mono audio in data/*.js, bundles ES2017 IIFE, and enforces a banned-API static scan.
Core Implementation Rules
Key implementation rules from the six reference guides address the most frequent quality gaps and rework triggers in AI-built 3D browser games.
Generate clean concept art before image-to-3D
Direct text-to-3D yields inconsistent meshes. First generate concept images of a single object on a seamless light-grey background with even studio lighting and zero glow or particles (plus front/side/back views for characters), then run Tripo image-to-3D with a 5000–8000 triangle cap for props. Log submission IDs in batch scripts so retries do not double-charge credits.
references/assets.md
Use dedicated voice models and normalize before trimming
Dedicated voice models cost about 12 credits per line versus roughly 240 credits per 12 seconds on video models. Normalize raw voice clips to -2 dB peak before trimming leading and trailing silence; reversing the order clips quiet speech. Set music to roughly one-third of SFX volume and duck music during dialogue.
references/assets.md / references/vfx-ui-audio.md
Author moves in character space with two-bone IK and five beats
Guessing Euler joint angles produces twisted poses. Define hand targets, sword direction, and foot placement in character space (+Y up, +Z forward, right hand at -X), solve arms and legs with two-bone IK, and bake into clips. Give every attack at least five keyframes: wind-up, hold (about 0.08 seconds), quartic ease-out swing, follow-through overshoot, and return to combat idle.
references/characters-animation.md
Apply per-character hit-stop and top-priority dodge cancel
Global slow-motion makes combat feel sluggish; freeze only the attacker and target on impact (0.06–0.09 seconds light, 0.1–0.13 seconds heavy) while buffering inputs during hit-stop. Allow dodge to cancel attacks, casts, guard, healing, and hit-stop, blocked only during hitstun and ultimates.
references/combat-feel.md
Build VFX with meshes and shaders; cap bloom peaks at 2–3
Flat textured quads read as cheap. Author slashes, rune circles, falling swords, and enemy telegraphs with trajectory-aligned meshes, scrolling noise, and erosion shaders across charge, burst, and dissipate beats. Under strong bloom, keep HDR color peaks between 2 and 3 to avoid whiteout.
references/vfx-ui-audio.md
Skip vertex quantization on rigged characters and drop scale tracks
Default meshopt quantization rescales geometry and places an inverse scale on the armature, skewing bounding-box height checks; preset clips carrying scale = 1 tracks then overwrite that compensation and shrink the character. Run only reorder plus EXT_meshopt_compression on skinned characters, and strip .scale tracks when loading animations.
references/packaging.md
Build and Packaging Example
After copying scripts/ into a game directory (for example game/ and game/tools/), run syntax validation, local playtesting, single-HTML plus static-site bundling, and restricted-container packaging in sequence:
$ node --input-type=module --check < src/game.js
$ node serve.mjs
ok: serving /path/to/game on http://localhost:5173
$ node tools/build.mjs
ok: wrote dist/site 22.00MB code game.a1b2c3d4.js
ok: wrote dist/wusuo.html 30.00MB
$ node tools/build_mini.mjs
ok: static gate: cleanbuild_single_html.mjs accepts --no-meshopt to produce an uncompressed control build when diagnosing skinning regressions. After generating the single HTML file, confirm 0 network requests in DevTools (excluding data URLs) and compare head height, root scale, and run-cycle limb swing for every character against the dev build.
Common Failures and Licensing Boundaries
Common symptoms and fixes from references/pitfalls.md and references/packaging.md:
| Symptom | Common cause | Fix |
|---|---|---|
| Page stuck on loading or unresponsive clicks | Syntax error in the entry module (such as a trailing // comment on a long line swallowing code) or external CDN dependency for three.js | Check the browser console first; use /* */ on long lines; validate with node --input-type=module --check < file.js; vendor three.js and addons locally |
| Character drifts sideways or leaves its ground ring | Preset animation root motion was zeroed only on the root track, ignoring tilted hip parent transforms | Transform position tracks to model space, pin horizontal components to rest values while keeping vertical bob, then transform back |
| Movement sticks after key release, or pressing Shift halts movement | Shortcuts or focus changes dropped keyup; Shift was included in the modifier clear list; key release was inferred from missing auto-repeat | Use scripts/input.js: drop opposite WASD keys on press, clear only on Meta/Alt/Control and focus loss, exclude Shift, and capture state with the F3 panel |
| Characters shrink or boss appears half-height after packing | meshopt vertex quantization alters mesh scale, and preset scale tracks overwrite the inverse scale to 1 on playback | Apply only reorder and EXT_meshopt_compression (without quantize) on skinned characters, and drop .scale tracks on load |
| Restricted mini-app container rejects or errors on the build | Remaining fetch, WASM, module/inline scripts, outbound links, disallowed .glb/.mp3 files, or zip over 10 MiB | Use scripts/build_minitool.mjs to rewrite fetch to __lf, disable createImageBitmap, stub MeshoptDecoder, and verify static gate: clean |
Next Steps and References
Play the reference demo: Open Mist-Locked Gate on desktop and mobile to inspect progressive loading, touch controls, quality settings, and combat-feel baselines.
Prepare upstream inputs: Select 1 or 2 reference combat videos and verify available credits and CLI pricing commands for Tripo, your image generator, and Suno.
Adapt the scripts to your project layout: Copy
scripts/input.js,scripts/serve.mjs, and the target build script into your game directory, alignassets/chars.json,assets/props.json, andassets/loot.json, and begin Stage 0 research.
References
- Guizang Game Skill README(中文)
- Guizang Game Skill README(English)
- SKILL.md 流程與檢查點
- references/assets.md 素材生成與免費素材來源
- references/characters-animation.md 角色、骨骼與動畫
- references/combat-feel.md 戰鬥手感、交互與鏡頭
- references/vfx-ui-audio.md 特效、掉落物、介面與音量
- references/pitfalls.md 常見問題與排錯清單
- references/packaging.md 壓縮、單檔打包、線上託管與受限容器
- scripts/input.js 鍵鼠輸入與 F3 除錯面板
- scripts/serve.mjs 本機靜態伺服器
- scripts/build_single_html.mjs 單一 HTML 與靜態網站打包腳本
- scripts/build_minitool.mjs 小紅書小工具離線封裝腳本
- LICENSE (GNU AGPL-3.0)
- 演示遊戲《霧鎖山門》線上試玩