Guizang Game Skill Browser 3D Action Game Production and Packing

Document type
Field manual
Updated
Reading time
11 min

Reference manual for op7418/guizang-game-skill covering its eight-stage workflow, AI asset pipeline, combat-feel checklist, frame-stepping self-test hooks, four reusable scripts, and three build targets for three.js WebGL action games.

Source
Document details
op7418/guizang-game-skill
License
AGPL-3.0

An agent skill for Claude Code and Codex that guides three.js WebGL action game development with AI asset pipelines, frame-stepping self-verification, combat-feel rules, and three packaging targets.

Delivery stages
8Stage 0 research through Stage 7 packing
Topic references
6Assets, rigs, feel, VFX, pitfalls, packing
Reusable scripts
4Input, local server, and two build pipelines
Output targets
3Hosted site, single HTML, and 10 MiB mini-app

01Scope and Deliverables

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 targetSize and network profileUse case and runtime behavior
Hosted site (dist/site/)About 22 MB tested; staged downloadsStatic 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 requestsOpens 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 WASMRestricted containers such as Xiaohongshu mini-tools; bundles as ES2017 / Chrome 61 IIFE without fetch or module scripts, enforced by a static gate

02Environment and Setup

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 system ffmpeg binary.

  • 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:

bash
# Claude Code install path
git clone https://github.com/op7418/guizang-game-skill ~/.claude/skills/guizang-game-skill

For 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:

text
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.

03Eight-Stage Flow and Testing

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:

StageCore deliverableAcceptance method
0 Research and designResearch note, world design, staged planWritten user confirmation
1 Rendering baseEmpty scene, HDR, volumetric fog, multi-pass bloom, gradingBrowser screenshot inspection
2 Scene assemblyTerrain, instanced foliage, prop placementApprove static shots before motion
3 Characters and motion3D models, rig alignment, combat animationsDedicated showcase page close-ups
4 Core combatCombos, dodge, guard, parry, mob encounterUser playtest
5 Cutscenes and bossCamera cutscenes, boss phases and movesetUser playtest
6 UI and audioHUD, skill bar, music, SFX, voice linesUser playtest and audio review
7 Polish and packingAsset compression and single-HTML / site / container buildsUser local double-click verification

Because hidden browser tabs pause requestAnimationFrame, SKILL.md requires installing frame-stepping debug hooks and URL flags on day one:

javascript
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.

04Documentation and Code Modules

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.

05Assets, Motion, Combat, and Packing

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

06Inputs, Checks, and Three Outputs

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:

Local checks and three packaging builds
# 1. Run ES module syntax check (avoids silent passes from plain node --check)
$ node --input-type=module --check < src/game.js
# 2. Start the zero-dependency local static server (default http://localhost:5173)
$ node serve.mjs
ok: serving /path/to/game on http://localhost:5173
# 3. Build single HTML (dist/wusuo.html) and static hosting site (dist/site/)
$ node tools/build.mjs
ok: wrote dist/site 22.00MB code game.a1b2c3d4.js
ok: wrote dist/wusuo.html 30.00MB
# 4. Build Xiaohongshu 10 MiB offline mini-tool package (dist/wusuo-minitool.zip)
$ node tools/build_mini.mjs
ok: static gate: clean

build_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.

07Troubleshooting and Constraints

Common Failures and Licensing Boundaries

Common symptoms and fixes from references/pitfalls.md and references/packaging.md:

SymptomCommon causeFix
Page stuck on loading or unresponsive clicksSyntax error in the entry module (such as a trailing // comment on a long line swallowing code) or external CDN dependency for three.jsCheck 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 ringPreset animation root motion was zeroed only on the root track, ignoring tilted hip parent transformsTransform 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 movementShortcuts or focus changes dropped keyup; Shift was included in the modifier clear list; key release was inferred from missing auto-repeatUse 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 packingmeshopt vertex quantization alters mesh scale, and preset scale tracks overwrite the inverse scale to 1 on playbackApply 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 buildRemaining fetch, WASM, module/inline scripts, outbound links, disallowed .glb/.mp3 files, or zip over 10 MiBUse scripts/build_minitool.mjs to rewrite fetch to __lf, disable createImageBitmap, stub MeshoptDecoder, and verify static gate: clean

08Further Reading

Next Steps and References

  1. Play the reference demo: Open Mist-Locked Gate on desktop and mobile to inspect progressive loading, touch controls, quality settings, and combat-feel baselines.

  2. 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.

  3. Adapt the scripts to your project layout: Copy scripts/input.js, scripts/serve.mjs, and the target build script into your game directory, align assets/chars.json, assets/props.json, and assets/loot.json, and begin Stage 0 research.

References