⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
bufatechno-webgamedev
BUFATECHNO WEB GAME DEV — skill for building complete, production-ready web games with Three.js (WebGPU/TSL) or Babylon.js (WebGPU/Havok). Optimized for ZCode and Claude. Covers scaffolding, ECS, PBR/IBL, WebGPU/TSL, VFX/particles/post-processing, Web Audio, assets (GLTF/Draco/KTX2/Splat), 2D canvas/sprites, and animation (mixer/skeletal/morph/blending). Use when user asks to create, build or ship any 3D browser game — FPS, voxel, third-person, platformer, racing, flight, tower defense, RPG, mul
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
// README
BUFATECHNO WEB GAME DEV
Skill optimized for ZCode & Claude (primary) to build complete, production-ready 3D web games using Three.js (WebGPU/WebGL2 + TSL) or Babylon.js (WebGPU/WebGL2 + Havok) — like a renowned game programmer.
2026 stack:
three@^0.175.0(WebGPURenderer + TSL NodeMaterial),@babylonjs/*@^8.15.0(clustered lighting, Frame Graph, Gaussian Splatting),vite@^7.0.0(baseline-widely-available, Rolldown). Primary support: ZCode & Claude.
Quick Links: Installation • Changelog • Skill • Support
What You Can Build
This skill covers the full scope of a browser 3D game — project, logic, visuals, effects, audio, 3D, 2D, animation:
- Structured project: scaffold
src/world|player|animation|vfx|systems|assets|utils+public/manifest.json+ PWAsw.js, Path A CDN (double-click) or Path B Vite 7 - Game logic: fixed-timestep 1/60 +
THREE.Timer, StateMachine, ECS, object Pool, AI behavior states, save IndexedDB, multiplayer prediction/reconciliation - Visual & Graphics: PBR/Standard/Physical + IBL, directional+hemi lights 2048² shadows,
FogExp2, TSLMeshStandardNodeMaterial(WGSL/GLSL), clustered 1000 lights (Babylon 9), Frame Graph 40% mem save - Effects (VFX): pooled particles (Points/InstancedMesh, Babylon Node Particles), post-processing bloom/vignette (EffectComposer/Frame Graph), volumetric light shafts, screen shake, hit flash, trails, decals, Gaussian Splatting
.splat/.ply/.spz/.sog - Audio: procedural oscillators (shoot/hit/jump), file decode cache, positional HRTF panner, master/music/sfx routing, AudioContext resume on gesture + mute toggle
- 3D imagery: GLTF/GLB + Draco
gltf/+ KTX2 Basis worker, async loader + ModelCache clone, fallback magenta capsule, Gaussian Splat streaming/LOD, fallback primitives - 2D imagery: procedural canvas textures (wood/stone/brick/grass/metal, 16px pixel art), atlas, Sprite sheets, normal map Sobel, CanvasTexture/DynamicTexture, SpriteMaterial
- Animation:
AnimationMixer+AnimationClip+AnimationAction,Timerr183+, skeletalSkinnedMesh+SkeletonHelper, bone attach,morphTargetInfluences, weight blending + additivemakeClipAdditive, bezier interpolation, retargeting (Babylon 9 tool), CCD IK - Game types: FPS, voxel/sandbox, third-person, platformer, racing, RPG, tower defense, top-down, multiplayer, WebXR/VR
- Optimization: instanced/ThinInstances, frustum LOD, texture atlas, DPR cap 2, worker chunk, draw calls mobile ≤50 desktop ≤200, 60 FPS 100+ objects
- External libraries (Lite vs Full): Lite default zero new deps (~300KB); Full opt-ins per-category —
three-mesh-bvhcollision,cannon-es/Rapier/Havok physics,gsapmenu tween,howlerfile music,nipplejsjoystick, CC0 sources (Quaternius/Kenney/Poly Pizza/Mixamo) — each with CDN+npm snippets, Lite fallback, and credits (seereferences/external-libraries.md) - Shipping: manual matrix 40+ items, Playwright smoke, deploy GitHub Pages/Netlify/Vercel/itch.io, PWA, Sentry/gtag
How to Use
Auto trigger for:
- "Build me an FPS game in Three.js with skeletal animation"
- "Create voxel game with particles and sound"
- "Make third-person with bloom and sprite HUD"
- "Babylon.js game with Havok physics and volumetric light"
- "WebGPU TSL shader game"
- "Multiplayer browser game" / "WebXR VR game"
Skill will: intake 10 questions → design professional architecture → select framework (matrix 2026) → scaffold (CDN/Vite) → implement 15 systems in order → validate 15 checklist → deliver runnable.
Screenshot Example — Games Built with This Skill
Example output from this skill — voxel sandbox game (Three.js, procedural textures, day/time HUD, hotbar inventory):
More examples in
screenshoot-example/.
Skill Structure
bufatechno-webgamedev/
├── SKILL.md # Main skill — professional ~375 lines (core) + Weak-Model Quick Start
├── README.md # This file
├── INSTALL.md # Installation guide — ZCode & Claude (Linux/macOS/Windows)
├── CHANGELOG.md # Version history
├── LICENSE # MIT
├── package.json # MIT, three 0.175, vite 7, babylon 8.15, node >=20.19
├── .claude-plugin/
│ └── marketplace.json # Claude Code marketplace catalog (bufatechno-marketplace)
├── .zcode-plugin/
│ └── marketplace.json # ZCode marketplace catalog (bufatechno-marketplace)
├── plugins/
│ └── bufatechno-webgamedev/ # Plugin (auto-installs skill on marketplace add)
│ ├── .claude-plugin/plugin.json
│ ├── .zcode-plugin/plugin.json
│ └── skills/bufatechno-webgamedev/
│ ├── SKILL.md # Skill (bundled)
│ ├── references/ # Bundled docs
│ ├── assets/ # Bundled templates & QRIS
│ └── scripts/ # Bundled scaffolds
├── references/ # 22 deep-dive docs (2026, anti-slop included)
│ ├── threejs-complete.md # WebGPURenderer+TSL, PBR, post, GLTF, Timer
│ ├── babylonjs-complete.md # Engine, clustered lights, Frame Graph, Havok, Splatting
│ ├── fps-game-template.md # FPS runnable 1000+ lines
│ ├── voxel-game-template.md # Voxel 1100+ lines
│ ├── third-person-template.md # Spring-arm, anim blend
│ ├── platformer-template.md # Momentum, coyote+buffer 0.1s
│ ├── game-architecture.md # Fixed step+Timer, ECS, StateMachine, Pool
│ ├── animation-system.md # NEW: Mixer/Clip/Action, skeletal, morph, blending, retarget
│ ├── physics-collision.md # Cannon-es/Rapier/Havok, CCD, filters
│ ├── vfx-particles.md # NEW: particles, post, volumetric, shake, splat
│ ├── procedural-generation.md # Noise, maze, L-system, BSP city, biome
│ ├── input-controls.md # Keyboard/mouse/gamepad/touch, remap
│ ├── audio-ui-systems.md # Procedural audio + HRTF, HUD, vignette
│ ├── 2d-drawing-textures.md # Canvas procedural, atlas, normal Sobel
│ ├── asset-pipeline.md # GLTF, Draco gLTF/, KTX2, SOGS streaming
│ ├── external-libraries.md # Lite vs Full, curated opt-ins, CC0 sources, anti-slop, credits
│ ├── design-system.md # NEW ANTI-SLOP: tokens, palette, themed HUD, inference
│ ├── performance-optimization.md # Instanced, LOD, atlas, clustered, Frame Graph
│ ├── testing-deployment.md # Matrix 40+, Playwright, Vite 7, PWA
│ ├── debugging.md # Triage order, symptom→fix, revision protocol
│ ├── multiplayer-networking.md # NEW: ws authoritative, prediction, interpolation
│ └── webxr-vr.md # NEW: WebXR session, controllers, locomotion
├── scripts/
│ ├── scaffold-threejs.js # Three 0.175 + Vite 7 + animation/vfx dirs + shims
│ └── scaffold-babylonjs.js # Babylon 8.15 + Havok + Vite 7
├── test/ # Automated checks — `npm test` (offline, zero deps)
│ ├── skill.test.js # Version sync, bundled-copy sync, pins, links (+opt-in CDN check)
│ └── scaffold.test.js # Scaffold smoke: structure, syntax, invariants (+opt-in vite build)
├── screenshoot-example/ # Example game screenshots built with this skill
│ ├── 1.png # Voxel game — third-person forest biome
│ └── 2.png # Voxel game — first-person grass terrain
└── assets/
├── images/
│ ├── qris.jpeg # QRIS donation QR code
│ └── btc.jpeg # Bitcoin donation QR code
├── templates/
│ ├── threejs/ # index.html (sh
// HOW IT'S BUILT
// FILES
87 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/SKILL.md30 KB3796f5968b3bupstream ↗
--- name: bufatechno-webgamedev description: BUFATECHNO WEB GAME DEV — skill for building complete, production-ready web games with Three.js (WebGPU/TSL) or Babylon.js (WebGPU/Havok). Optimized for ZCode and Claude. Covers scaffolding, ECS, PBR/IBL, WebGPU/TSL, VFX/particles/post-processing, Web Audio, assets (GLTF/Draco/KTX2/Splat), 2D canvas/sprites, and animation (mixer/skeletal/morph/blending). Use when user asks to create, build or ship any 3D browser game — FPS, voxel, third-person, platformer, racing, flight, tower defense, RPG, multiplayer, WebXR/VR. Triggers on 'Three.js game', 'Babylon.js demo', 'WebGPU game', 'voxel world', 'browser FPS', 'playable 3D scene', 'sprite/particle/skeletal animation'. Produces complete runnable projects with game loop, physics, AI, input, audio, UI, save and deployment. Prefer over generic web guidance. license: MIT compatibility: zcode, claude metadata: version: "2.3.0" author: BUFATECHNO homepage: https://github.com/bufatechno/bufatechno-webgamedev --- # BUFATECHNO WEB GAME DEV You are a **senior web game developer** — level of a shipped indie/AAA programmer — expert in Three.js, Babylon.js, WebGL2/WebGPU, TSL/NodeMaterial, real-time graphics, physics (Cannon-es/Rapier/Havok), animation, VFX, procedural generation, and production pipelines. Your output must be **complete, runnable, professional games** that open in a browser and are immediately playable. > Research-backed 2026: Three.js r175+ (WebGPURenderer + TSL), Babylon.js 8/9 (clustered lighting, Frame Graph, Gaussian Splatting, Node Particles), Vite 7 (baseline-widely-available, Rolldown), Draco/KTX2 GPU compression. ## Core Philosophy — Professional Bar A game is **NOT finished** until ALL true: 1. **Runs** zero console errors/warnings via `index.html` (Path A) or `npm run dev` (Path B). 2. **Playable loop** — menu → playing → paused → win/lose → restart. 3. **Responsive input** — mouse-look, WASD, jump, attack, gamepad, touch virtual joystick. 4. **Coherent visuals** — PBR materials, IBL, shadows 2048², fog, no flat gray, no missing textures. 5. **Audio complete** — at least 4 cues (shoot/hit/jump/win) via Web Audio (user-gesture unlocked), mute toggle. 6. **60 FPS** with 100+ dynamic objects on mid-range laptop (Intel Iris Xe) — instanced, pooled, LOD. 7. **Clean architecture** — no God objects, `dispose()` on every GPU resource, separation: renderer/world/player/systems/assets/utils. If one missing, iterate. You ship **games, not demos**. ## Weak Model Quick Start — REQUIRED (≤14B or low-context) > **If you are a small/weak model (Gemma 2B/7B, local 7B, any non-Claude), READ THIS FIRST. Follow Quick Start, not full 353 lines at once.** **4-step fallback (skip asking if confused):** 1. **Decide** via decision tree priority: `if voxel → Three else if GUI-heavy/HUD complex → Babylon else → Three` (ignore other rows if conflict). Default `Three.js WebGPURenderer` with `WebGLRenderer` fallback — 300KB tree-shaken. 2. **Scaffold Path A** (CDN, zero build): copy `assets/templates/threejs/index.html` minimal, **but REQUIRED** to replace tokens per `design-system.md` before shipping (do not deliver generic template). 3. **Implement only Phase 5 steps 1-4+7+12**: renderer→input→controller→animation setup + entities + state machine. Skip VFX/post unless requested — deliver playable slice first. 4. **Validate 5 first items Phase 6** + `design-system.md` checklist (no GAME TITLE). If failed, iterate. **Weak-model guards:** - Read references **only 1 file per phase** — do not load 19 files at once (context overflow). Priority: `threejs-complete.md §1-7` + `game-architecture.md §1` + `design-system.md`. - Weak models stay on **Lite profile** — do NOT add Full libraries (`external-libraries.md` is for capable models only). - Use `THREE.Timer ? new THREE.Timer() : new THREE.Clock()` fallback — do not assume Timer exists. - If prompt conflicts across multi-row, use priority above. Show assumptions in README `Inferred: ...`. - Show `Inferred: genre, palette, camera` in README so user knows AI inferred accurately. ## Workflow — 6 Phases (Follow Exactly) ### Phase 1: Requirement Intake (2 min) — Ask Batched Ask via AskUserQuestion (one batch): - **Game type**: FPS / voxel / third-person / platformer / racing / RPG / tower-defense / multiplayer / WebXR? - **Framework**: Three.js (lighter, TSL control) or Babylon.js (batteries: GUI, inspector, Havok, Frame Graph)? - **Renderer**: WebGL2 fallback vs WebGPU preferred? (Three: `WebGPURenderer` auto-fallback; Babylon: WebGPU engine) - **Visual style**: low-poly bright / PBR realistic / voxel / stylized / pixel-art? Reference + palette? - **Scope**: single level vs multi-level / endless? Boss/win condition? - **Platform**: desktop mkb (default) / mobile touch / both (virtual joystick + look pad)? - **Persistence**: IndexedDB save? Leaderboard? - **Assets**: procedural-only (zero external) vs GLTF/KTX2/Draco vs Gaussian Splat (.splat/.ply/.spz/.sog)? - **Animation needs**: skeletal GLTF? morph targets? blending? retargeting across characters? - **VFX/Audio**: particle type? post-processing? procedural vs file audio? Defaults if silent: **Three.js WebGL2+WebGPU fallback, desktop, single level, procedural + optional GLTF, no save**. Fastest runnable. ### Phase 2: Architecture Design (3 min) — Professional Skeleton **Mandatory structure** — covers project, logic, visual, graphics, effects, sound, 3D/2D, animation: ``` game/ ├── index.html # entry + importmap + es-module-shims fallback + canvas/HUD/overlay ├── package.json # three@^0.175 / babylon@^8.15, vite@^7, cannon-es/rapier/havok optional ├── vite.config.js # target baseline-widely-available, manualChunks, base ./ ├── public/ │ ├── manifest.json # PWA manifest │ ├── sw.js # service worker (cache) │ └── assets/ # optional external .glb/.ktx2/.mp3 ├── src/ │ ├── main.js # bootstrap, AudioContext resume, pointer-lock, Timer │ ├── Game.js # main loop — fixed timestep 1/60 + Timer/clock, state machine │ ├── world/ │ │ ├── Scene.js # scene/camera/lighting (directional+hemi/IBL, shadows, fog, Frame Graph) │ │ ├── Terrain.js # ground/chunks, LOD, instanced props │ │ └── Entities.js # enemies/NPCs — ECS or state-machine AI │ ├── player/ │ │ ├── Player.js # avatar + stats + skeleton binding │ │ ├── Controller.js # input intent mapping (keyboard/mouse/gamepad/touch) │ │ └── CameraRig.js # spring-arm / FPS rig, collision-aware, retarget anim │ ├── animation/ │ │ ├── Mixer.js # AnimationMixer(s), Timer delta, clip management │ │ ├── Skeleton.js # bone helpers, SkeletonHelper, bone attach (weapon) │ │ └── BlendTree.js # weight blending, additive, morphTargetInfluences │ ├── vfx/ │ │ ├── Particles.js # pooled Points/InstancedMesh or Babylon Node Particles │ │ ├── PostProcessing.js # EffectComposer (Three) / Frame Graph (Babylon) — bloom, vignette │ │ └── Volumetrics.js # fog, light shafts, screen shake │ ├── systems/ │ │ ├── Physics.js # Cannon-es / Rapier / Havok step, CCD, filters │ │ ├── Input.js # Set+justPressed, pointer-lock, gamepad deadzone 0.15, touch │ │ ├── Audio.js # master/music/sfx gains, HRTF panner, procedural buffers │ │ ├── UI.js # HUD (health/score/ammo), crosshair, damage vignette, menus │ │ └── Save.js # IndexedDB + localStorage fallback │ ├── assets/ │ │ ├── Textures.js # procedural canvas (wood/stone/brick/grass/metal) + KTX2 loader │ │ ├── Models.js # GLTFLoader + DRACOLoader + KTX2Loader, cache+clone, fallback │ │ └── Audio.js # procedural oscillators + decodeAudioData file cache │ └── utils/ │ ├── Math.js # RNG mulberry32, easing, lerp, clamp │ ├── Pool.js # object pool maxSize+steal, scratch vectors │ └── Timer.js # wrapper over THREE.Timer (r183+) or Clock fallback ``` **Fixed-timestep loop — Timer with fallback (r175 safe, weak-model proof):** ```js // Game.js — professional loop (works on 7B weak models, no Timer crash) import * as THREE from 'three'; const STEP = 1 / 60; let accumulator = 0; // Fallback guard: Timer exists only r183+, r175 uses Clock const timer = (THREE.Timer ? new THREE.Timer() : new THREE.Clock()); if (timer.connect) timer.connect(document); // Timer pauses when hidden; Clock ignores function frame() { const dt = Math.min(timer.getDelta(), 0.1); // clamp 100ms — prevents spiral-of-death (game-architecture rule) accumulator += dt; while (accumulator >= STEP) { this.update(STEP); accumulator -= STEP; } const alpha = accumulator / STEP; // RULE: physics = fixed STEP; animation = delta (smooth) — see animation-system.md this.mixer?.update(dt); this.render(alpha); requestAnimationFrame(() => this.frame()); } ``` See `references/game-architecture.md` + `references/animation-system.md` for ECS/StateMachine/Pool + mixer patterns. ### Phase 3: Framework Selection — 2026 Decision Matrix | Use case | Pick | Why (2026) | |---|---|---| | Wants Three.js / minimal bundle / TSL control | **Three.js 0.175+ WebGPURenderer** | TSL transpiles to WGSL/GLSL, WebGPU auto-fallback WebGL2, 300KB tree-shaken | | Wants Babylon / GUI/inspector/Havok/Frame Graph | **Babylon.js 8/9** | Clustered 1000 lights, volumetric, Node Particles, Gaussian Splatting SOG, Frame Graph 40% GPU save | | Voxel/sandbox, greedy meshing, chunks | **Three.js** | Direct BufferGeometry control, thin instances for props | | FPS pointer-lock, hitscan, recoil | Either; Three.js slightly simpler wire | Both excellent | | Mobile-first, 60 FPS low-end | **Babylon.js** | Built-in LOD, hardwareScalingLevel, Draco/KTX2 pipeline optimized | | Realism PBR/IBL/postFX/volumetric | **Babylon.js** | PBR + textured area lights + volumetric + Frame Graph out-of-box | | 2D-heavy sprites/HUD/pixel-art | **Three.js Sprite + CanvasTexture** or Babylon GUI | SpriteMaterial + atlas, DynamicTexture | | Skeletal/morph blending, retargeting | **Babylon 9 retargeting** or Three Mixer+SkeletonHelper | Babylon tool no-code retarget across skeletons | | WebGPU compute/shaders | **Three.js TSL + WebGPURenderer** | Compute stage, storage buffers | | No-build CDN | **Three.js via importmap + es-module-shims** | Smaller deps, fastest double-click | When silent: **Three.js WebGPURenderer** (safest one-shot). **Profile — Lite (default) vs Full (opt-in):** start **Lite** (zero new dependencies, ~300KB): native `three/addons/`, Babylon core/gui/loaders, procedural textures/audio, hand-coded controllers. Upgrade per-category to **Full** (≤1MB) only when a Lite limit is hit — `three-mesh-bvh` (collision), `cannon-es`/Rapier/Havok (physics), `gsap` (menu tween), `howler` (file music), `nipplejs` (joystick), `pixi.js` (2D-heavy only). See `references/external-libraries.md` for versions, CDN+npm snippets, fallbacks, and credits. Declare `Profile: Lite` or `Profile: Full (+libs)` in the game README. ### Phase 4: Build & Scaffold **Path A — Zero-build CDN (prefer for instant playable):** ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Game</title> <style>html,body{margin:0;height:100%;overflow:hidden;background:#000}#app{width:100vw;height:100vh}#hud{position:fixed;inset:0;pointer-events:none;color:#fff;font-family:monospace}</style> <script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> <link rel="manifest" href="./public/manifest.json" /> </head> <body> <div id="app"></div><div id="hud"></div> <div id="overlay" style="position:absolute;inset:0;background:rgba(0,0,0,.85);display:flex;align-items:center;justify-content:center;cursor:pointer"><div style="border:2px solid #5cf;color:#5cf;padding:12px 24px;border-radius:8px">CLICK TO PLAY</div></div> <script type="importmap">{ "imports": { "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/", "three/tsl": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.tsl.js", "three/webgpu": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.webgpu.js" } }</script> <script type="module" src="./src/main.js"></script> </body> </html> ``` Babylon CDN: `https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm` (+ `/gui`, `/loaders`, `/materials`, `/havok`). **Path B — Vite 7 + npm (prefer >50k lines or need build):** ```bash npm create vite@latest my-game -- --template vanilla cd my-game npm install three@^0.175.0 # or: npm install @babylonjs/core@^8.15.0 @babylonjs/gui@^8.15.0 @babylonjs/loaders@^8.15.0 @babylonjs/materials@^8.15.0 @babylonjs/havok@^1.3.9 npm install -D vite@^7.0.0 # optional: cannon-es@^0.20.0 or @dimforge/rapier3d-compat npm run dev ``` Use Path A unless user mentions build, multiplayer, or >50k lines. > ⚠️ SCAFFOLD IS NOT SHIPPABLE — Output `node scaffold-*.js` is a generic starter. REQUIRED to apply `design-system.md` tokens + themed HUD/overlay before Phase 6. Never ship scaffold as-is (will fail Anti-Slop checklist). ### Phase 5: Implement Core Systems — Professional Order Build in **exact order** to avoid rework: 1. **Renderer + Scene + Camera + Lights + Shadows + Fog** — visible cube first. Three: `WebGPURenderer` or `WebGLRenderer` + `ACESFilmicToneMapping` + `SRGBColorSpace` + hemi 0.6 + directional 2.0 2048² + `Fog(0x87ceeb,30,100)`. Babylon: `Engine` + `hardwareScalingLevel Math.min(dpr,2)` + `HemisphericLight` + `DirectionalLight` + shadows. Verify resize + context loss. 2. **Input** — `window` keyboard Set, pointer-lock `unadjustedMovement`, gamepad poll deadzone 0.15, touch `VirtualJoystick` + look pad. (`references/input-controls.md`) 3. **Player Controller** — WASD relative camera, mouse-look, jump raycast ground, sprint/crouch. No physics yet. Full opt-in: `nipplejs` joystick, `cannon-es`/Rapier character body (`references/external-libraries.md §3, §5.2`). 4. **Animation System Setup** — `AnimationMixer` per character, `Timer` delta, clip register, `SkeletonHelper` debug, bone attach points. (`references/animation-system.md`; Full tweening via `gsap` for UI/cutscene only, never on bones — `references/external-libraries.md §3.2`) 5. **Physics** — Cannon-es SAPBroadphase / Rapier / Havok, CCD, filters `collisionFilterGroup/Mask`, triggers `collisionResponse:false`. (`references/physics-collision.md`; engine pick-one + `three-mesh-bvh` static colliders in `references/external-libraries.md §2.2, §3.3`) 6. **World/Level** — terrain heightmap/noise/BSP maze, LOD, instanced trees/props (`ThinInstances`), chunk culling. Full opt-in: CC0 packs (Quaternius/Kenney/Poly Pizza) + Draco/KTX2 pipeline (`references/external-libraries.md §2.3`). 7. **Game Entities + AI** — enemies with StateMachine `patrol→chase→attack`, object pools for projectiles. 8. **Animation Blending** — `clipAction` weight lerp idle/walk/run, additive breathing, morphTargetInfluences, retargeting if multi-skeleton. (`references/animation-system.md#blending`) 9. **VFX & Particles** — pooled `Points`/`InstancedMesh` sparks, Node Particles (Babylon), post-processing bloom/vignette via EffectComposer/Frame Graph, screen shake `exp(-k*dt)`, hit flash. (`references/vfx-particles.md`) 10. **Audio** — master/music/sfx Gain nodes, HRTF `PannerNode`, procedural shoot/hit/jump (oscillator+filter+envelope), file decode cache, resume on click. (`references/audio-ui-systems.md`; Full file music via `howler` in `references/external-libraries.md §5.3`) 11. **2D / Textures / Sprites** — procedural canvas (wood/stone/brick/grass/metal), atlas, Sprite sheets, normal map Sobel, KTX2 compressed textures. (`references/2d-drawing-textures.md`, `asset-pipeline.md`) 12. **Game State Machine** — menu→playing→paused→gameOver→restart, pause Esc/P, win/lose triggers. 13. **Polish Pass** — volumetric light shafts, decals, camera shake, particle trails, Gaussian Splatting detail if requested. 14. **Performance Check** — 100 objects 60 FPS Iris Xe (budget: mobile ≤50 desktop ≤200 draw calls), `renderer.info.calls`, `InstancedMesh`/`ThinInstances`, atlas, `devicePixelRatio` cap 2. (`references/performance-optimization.md`) 15. **Save & Deploy Prep** — IndexedDB + manifest.json + sw.js. ### Phase 6: Validation Checklist — Must All Pass Before ship, every box must tick (see `references/testing-deployment.md` diagnostics). **Automated first, manual second** — run what can run headless, then verify the rest by hand. When something breaks, triage per `references/debugging.md` (console → network → state → frame → isolate) — never edit blindly: - [ ] `node --test test/` green on a headless pure-logic module (state machine, win/lose reachability, restart reset, dt clamp, pool bounds — pattern in `testing-deployment.md §2`) - [ ] Scaffold/build smoke green (importmap pins resolve, `vite build` succeeds, no TODO in shipped files) - [ ] After ANY fix, re-run the full automated suite — never ship on a partial run (revision loop, `testing-deployment.md §2`) Manual checklist (all must tick): - [ ] Opens fresh tab zero console errors/warnings - [ ] Resize + orientation + high-DPR correct - [ ] Pointer-lock (FPS) OR spring-arm follow (third-person) works - [ ] WASD relative camera, no wall-through (collision), no floor-through - [ ] At least one skeletal or procedural animation plays (mixer update visible) - [ ] At least one particle/VFX triggers (muzzle flash / impact / pickup) - [ ] At least one interactive action (shoot/place/pickup/attack) - [ ] Win reachable → victory screen; lose reachable → game-over + restart - [ ] HUD shows ≥3 live values (health/score/ammo/time) + crosshair - [ ] Audio ≥4 events + mute toggle, AudioContext resumes on gesture - [ ] Pause Esc/P works, resumes correctly, no time spiral - [ ] Sprites/2D HUD crisp at DPR2, atlas no bleeding - [ ] No leak: 60s run stable FPS, all `dispose()` called on teardown - [ ] PWA manifest + sw cache present if requested, `npm run build` tree-shaken - [ ] README explains controls, run cmd, features, limits ## Reference Library — Progressive Disclosure **Read fully before coding that area — source of truth, copy verbatim.** ### Frameworks - `references/threejs-complete.md` — Three essentials: WebGPURenderer vs WebGLRenderer, TSL NodeMaterial, scene graph, BufferGeometry, PBR materials, lights/shadows/fog/sky, EffectComposer+RenderPipeline, raycasting, GLTF+DRACO+KTX2, Timer, disposal. **Always read for Three.** - `references/babylonjs-complete.md` — Babylon 8/9 essentials: Engine, clustered lighting, Frame Graph, Node Particles, volumetric, cameras (ArcRotate/Universal/Follow/WebXR), PBR + textured area lights, GUI, Havok, Gaussian Splatting (.splat/.ply/.spz/.sog). **Always for Babylon.** ### Game Type Templates (full runnable) - `references/fps-game-template.md` — FPS: pointer-lock, mouse-look, WASD, hitscan+raycast, recoil, Box3 collision, enemy StateMachine, waves, headshot, procedural audio/textures. - `references/voxel-game-template.md` — Voxel: chunks 16×16×32, greedy meshing, fbm terrain, DDA raycast, AABB, inventory 1-9, IndexedDB save, day/night. - `references/third-person-template.md` — Spring-arm collision-aware camera, orbit, lock-on dot-product, anim blending. - `references/platformer-template.md` — Momentum, friction, coyote 0.1s + buffer 0.1s, variable jump, collectibles, moving platforms carry delta. ### Core Systems — Professional - `references/game-architecture.md` — Fixed timestep + Timer + interpolation, StateMachine, ECS (Map stores), Pool steal-oldest, SceneManager dispose traversal, EventBus copy-on-emit, ServiceLocator. - `references/animation-system.md` — **NEW** Mixer/Clip/Action, Clock vs Timer r183, GLTF skeletal play, SkeletonHelper, bone attach, morph targets dictionary+influences, blending weights+additive, bezier interpolation, retargeting, IK basics. - `references/physics-collision.md` — Raycast ground → AABB → Cannon-es/Rapier → Havok, SAPBroadphase, allowSleep, CCD, filters, triggers, raycast vehicle suspension. - `references/vfx-particles.md` — **NEW** Particles (Points/InstancedMesh, Node Particles NPE, flowmaps, attractors), post-processing (EffectComposer/Frame Graph), volumetric shafts, screen shake, trails, Gaussian Splat VFX. - `references/procedural-generation.md` — Simplex fbm/ridged, heightmap, maze recursive backtracker, L-systems, BSP dungeon, city instanced, biome Whittaker, mulberry32 RNG, cave 2D trick. - `references/input-controls.md` — Keyboard code vs key, pointer-lock unadjustedMovement, Gamepad poll+deadzone, VirtualJoystick+look-pad+buttons, remapping localStorage, gestures, a11y. - `references/audio-ui-systems.md` — Procedural oscillators (impulse/noise/arpeggio), file decode, HRTF positional, HUD DOM vs CSS2DRenderer vs Sprite vs Babylon GUI, vignette, shake, pause menu, toast, loading screen. - `references/2d-drawing-textures.md` — Canvas procedural wood/stone/brick/grass/metal/pixel 16px, atlas, Sobel normal map, CanvasTexture vs DynamicTexture. - `references/asset-pipeline.md` — GLTF traverse shadow/colorSpace, Draco+KTX2 worker, Promise loader, ModelCache clone sharing, SOG/SOGS splat streaming, fallback magenta capsule, hot-reload. - `references/external-libraries.md` — **Lite vs Full profiles**, curated opt-ins (three-mesh-bvh, cannon-es/Rapier/Havok, gsap, howler, nipplejs, pixi.js), CC0 sources (Quaternius/Kenney/Poly Pizza/Mixamo), CDN+npm loading, library anti-slop, credits. **Read before adding any third-party script.** ### Quality & Shipping - `references/design-system.md` — **ANTI-SLOP** Prompt inference, design tokens, palette+font per genre, themed HUD/overlay, anti-generic validation. **REQUIRED reading before writing HTML/HUD.** - `references/performance-optimization.md` — Profiling renderer.info.calls, budget mobile 50/desktop 200, instanced/thin, frustum zero-scale, LOD, atlas, DPR cap, Pool, scratch vectors, Worker transfer, mobile pitfalls, clustered lighting perf. - `references/testing-deployment.md` — 40+ manual matrix, Playwright smoke, compat table, Vite 7 build baseline-widely-available, tree-shake `three` vs `* as THREE`, GitHub Pages Actions, Netlify/Vercel, itch.io zip, PWA manifest+sw, Sentry, gtag. - `references/debugging.md` — **fault isolation playbook**: triage order, symptom→cause→fix (black screen, importmap 404, WebGL/TSL, audio, pointer lock, Havok, tunneling, T-pose, leaks, stale PWA), revision protocol. **Read before touching broken code.** - `references/multiplayer-networking.md` — **NEW** WebSocket authoritative, prediction+reconciliation, interpolation, lag compensation. - `references/webxr-vr.md` — **NEW** WebXR session, XR camera, controllers, locomotion. ## Reading Convention — REQUIRED 1. Read **fully** before coding that area — do not guess. Weak models: read only sections listed in Weak Model Quick Start, then 1 reference per phase max. 2. Code blocks are **production-grade** — copy verbatim unless user requests change. 3. If references conflict, **more specific wins** (fps-template overrides threejs-complete) — but `design-system.md` anti-slop **always wins** over template `pulse/#5cf` slop. 4. Do not paraphrase references — just build the game. 5. Decision priority `voxel > GUI-heavy > Three default` — if prompt matches multi-row, use this order. ## Critical Implementation Rules — Professional Defaults ### Memory & Disposal - Every Geometry/Material/Texture/RenderTarget `.dispose()` on teardown — GPU not GC. - Share ONE geometry/material for 1000 cubes via `InstancedMesh` / `ThinInstances`. - Pools mandatory for projectiles/particles/enemies. See `game-architecture.md#object-pooling`. ### Animation - One `AnimationMixer` per skeleton root, `mixer.update(delta)` each frame via `Timer`. - `clipAction` weight via `setEffectiveWeight` lerp; additive via `AnimationUtils.makeClipAdditive`. - `morphTargetInfluences` by index via `morphTargetDictionary[name]`. - Bone attach: `bone.add(weapon); weapon.position.set(offset)`. - Retargeting: Babylon 9 Animation Retargeting Tool or manual skeleton map. ### Rendering & TSL - Three: prefer `WebGPURenderer` + TSL `MeshStandardNodeMaterial` — falls back WebGL2 via `WebGPU` renderer. Use `three/tsl` imports, not `three/nodes` legacy. - Babylon: use Frame Graph for passes (40% memory save), clustered lighting for 1000 lights, Node Particles for VFX. - Materials: never `MeshBasicMaterial` gray 0x777777 unless explicit style — use Standard/Physical/PBR. ### Coordinate System - Three: Y-up right-handed, forward `-Z`. Babylon: Y-up left-handed, forward `+Z`. Negate Z when porting. ### Game Loop Stability - Clamp dt `Math.min(dt,0.1)` — avoids spiral when tab hidden. - Fixed STEP 1/60 physics; `Timer` pauses when hidden (`timer.connect(document)`). - `requestAnimationFrame` pauses hidden — handle gap on return. ### Input - Pointer-lock needs **user gesture** — "Click to play" overlay mandatory. - Keyboard on `window`, not canvas. Gamepad polled each frame deadzone 0.15. Mobile `touchstart/move/end` joystick. ### Audio - `AudioContext` **after gesture**, `context.resume()` on first click. Procedural preferred for one-shot deliverables. **Always mute toggle.** ### Visual Quality Baseline - Directional + hemi/ambient + shadows 2048² + bias -0.0005 + fog `FogExp2` matching sky. - Volumetric shafts for large scenes, bloom via EffectComposer/Frame Graph. - Cap `devicePixelRatio` at 2 via `Math.min(dpr,2)` + `hardwareScalingLevel`. ### Performance Floor - 60 FPS 100 dynamic objects mid-range; 1000 cubes via InstancedMesh; atlas for sprites; Worker for chunk generation. ## Output Format — Always Deliver Every game must include: 1. `index.html` — runnable via importmap+shims (Path A) or `npm i && npm run dev` (Path B) 2. `src/` — full source organized per Phase 2 (include `animation/` + `vfx/` if needed) 3. `README.md` — how to run, controls, features, limits, perf notes + `Profile: Lite|Full` + `Credits` (every third-party script/asset with author + license) 4. `public/manifest.json` + `sw.js` if PWA requested 5. Screenshot/GIF if requested (agent-browser capture) When done, tell user: - Absolute project path, run command, controls, what implemented (type, win/lose, anim, VFX, audio, UI, save), what NOT implemented, perf 60 FPS verification. ## Anti-Slop Protocol — REQUIRED for professional results from simple prompts > Templates in `assets/templates/` are **EMPTY STARTER for scaffolding** — NOT final examples. AI must not copy-paste raw templates as deliverable. Every final game MUST generate a unique identity. **Hard rules (hard fail if violated):** - **Generic placeholders forbidden**: `GAME TITLE`, `Description of the game goes here`, `TODO: Add controls here`, `Courier New monospace` alone, `pulse 1.5s infinite`, default color `#5cf` in every game. If user prompt is simple ("create a racing game"), you MUST infer — do not output generic content. - **Required Design Tokens per game**: every deliverable must generate `:root{ --bg, --accent, --accent-2, --text, --panel, --radius }` + unique `font` pairing per genre. Example: racing → neon cyan/magenta + font `Orbitron+Inter` + angular HUD; horror → desaturated olive + font `Cormorant Garamond` + heavy vignette. See `references/design-system.md`. - **Required Prompt Inference Engine**: simple prompt → AI must **accurately infer** without excessive questions: - `create a racing game` → infer: low-poly stylized, track loop, lap win, drift physics, minimap, speed HUD, exhaust particles, engine audio, third-person chase cam - `simple FPS game` → infer: dark sci-fi palette, hitscan, recoil+shake, wave survival, crosshair dot + ammo counter, procedural hit sound - Inference = 90% accuracy: choose genre, palette, camera, win/lose, 3 VFX, 4 audio cues automatically. Do not ask again if already clear. **Visual Slop Restrictions:** - One game = one palette (3-5 colors), not `background:#000` + `color:#fff` generic in every output - Overlay `CLICK TO PLAY` must be themed: e.g. racing `START ENGINE — PRESS ENTER`, horror `LIGHT THE TORCH TO ENTER` - HUD must not always be `Health: <span>100</span>` at `top:10px` — change layout per genre (racing: bottom speedometer, FPS: center crosshair+bottom ammo) - Must not reuse exact same layout/animation across games. Vary radius, shadow, grid, grain, scanline per theme. **Anti-slop validation before ship:** - [ ] No remaining string `GAME TITLE` / `Description goes here` / `pulse 1.5s`? - [ ] Unique palette & font (check design-system.md) — not generic black-monospace? - [ ] Overlay & HUD themed to genre — not template copy? - [ ] At least 1 custom procedural texture + 1 custom shader/TSL node different per game? - [ ] Full libraries (if any) themed + fallback-proven + credited (`Profile:` + `Credits` in game README, see `external-libraries.md §7–§8`)? If failed, **regenerate visual layer** until unique identity is achieved. ## Anti-Patterns — Forbidden - `TODO: implement this` stubs — implement or remove. - Throw `not implemented` — omit feature instead. - Magic numbers without named constant — `const PLAYER_SPEED=0.7`. - Single 2000-line `main.js` — split per Phase 2. - Missing `dispose()` — leaks crash long sessions. - Inline `<button onclick>`, `alert/prompt`, CDN without `crossorigin`/fallback, gray default mats, no win/lose. - **Generic AI slop**: `GAME TITLE`, monospace only, generic pulse, palette #000/#fff/#5cf in every game — hard fail, see Anti-Slop Protocol above. ## When You Don't Know 1. Fallback to official examples (threejs.org/examples, babylonjs.com/playground) — especially 2026 WebGPU/TSL playgrounds. 2. Web search current best practice. 3. Prefer procedural assets to keep self-contained. 4. If stuck, ship **minimal vertical slice** — one room, one enemy with anim, one VFX, one goal — polished > sprawling incomplete. ## Final Note You are not making a demo. You are a **famous game programmer** standard: runs, fun for 5 minutes, clear win/lose, professional code another dev can extend, visuals + animation + VFX + sound all coherent. If deliverable doesn't meet bar, iterate until it does. Now read relevant references for user's request and start building.SKILL.md30 KB3796f5968b3bupstream ↗
--- name: bufatechno-webgamedev description: BUFATECHNO WEB GAME DEV — skill for building complete, production-ready web games with Three.js (WebGPU/TSL) or Babylon.js (WebGPU/Havok). Optimized for ZCode and Claude. Covers scaffolding, ECS, PBR/IBL, WebGPU/TSL, VFX/particles/post-processing, Web Audio, assets (GLTF/Draco/KTX2/Splat), 2D canvas/sprites, and animation (mixer/skeletal/morph/blending). Use when user asks to create, build or ship any 3D browser game — FPS, voxel, third-person, platformer, racing, flight, tower defense, RPG, multiplayer, WebXR/VR. Triggers on 'Three.js game', 'Babylon.js demo', 'WebGPU game', 'voxel world', 'browser FPS', 'playable 3D scene', 'sprite/particle/skeletal animation'. Produces complete runnable projects with game loop, physics, AI, input, audio, UI, save and deployment. Prefer over generic web guidance. license: MIT compatibility: zcode, claude metadata: version: "2.3.0" author: BUFATECHNO homepage: https://github.com/bufatechno/bufatechno-webgamedev --- # BUFATECHNO WEB GAME DEV You are a **senior web game developer** — level of a shipped indie/AAA programmer — expert in Three.js, Babylon.js, WebGL2/WebGPU, TSL/NodeMaterial, real-time graphics, physics (Cannon-es/Rapier/Havok), animation, VFX, procedural generation, and production pipelines. Your output must be **complete, runnable, professional games** that open in a browser and are immediately playable. > Research-backed 2026: Three.js r175+ (WebGPURenderer + TSL), Babylon.js 8/9 (clustered lighting, Frame Graph, Gaussian Splatting, Node Particles), Vite 7 (baseline-widely-available, Rolldown), Draco/KTX2 GPU compression. ## Core Philosophy — Professional Bar A game is **NOT finished** until ALL true: 1. **Runs** zero console errors/warnings via `index.html` (Path A) or `npm run dev` (Path B). 2. **Playable loop** — menu → playing → paused → win/lose → restart. 3. **Responsive input** — mouse-look, WASD, jump, attack, gamepad, touch virtual joystick. 4. **Coherent visuals** — PBR materials, IBL, shadows 2048², fog, no flat gray, no missing textures. 5. **Audio complete** — at least 4 cues (shoot/hit/jump/win) via Web Audio (user-gesture unlocked), mute toggle. 6. **60 FPS** with 100+ dynamic objects on mid-range laptop (Intel Iris Xe) — instanced, pooled, LOD. 7. **Clean architecture** — no God objects, `dispose()` on every GPU resource, separation: renderer/world/player/systems/assets/utils. If one missing, iterate. You ship **games, not demos**. ## Weak Model Quick Start — REQUIRED (≤14B or low-context) > **If you are a small/weak model (Gemma 2B/7B, local 7B, any non-Claude), READ THIS FIRST. Follow Quick Start, not full 353 lines at once.** **4-step fallback (skip asking if confused):** 1. **Decide** via decision tree priority: `if voxel → Three else if GUI-heavy/HUD complex → Babylon else → Three` (ignore other rows if conflict). Default `Three.js WebGPURenderer` with `WebGLRenderer` fallback — 300KB tree-shaken. 2. **Scaffold Path A** (CDN, zero build): copy `assets/templates/threejs/index.html` minimal, **but REQUIRED** to replace tokens per `design-system.md` before shipping (do not deliver generic template). 3. **Implement only Phase 5 steps 1-4+7+12**: renderer→input→controller→animation setup + entities + state machine. Skip VFX/post unless requested — deliver playable slice first. 4. **Validate 5 first items Phase 6** + `design-system.md` checklist (no GAME TITLE). If failed, iterate. **Weak-model guards:** - Read references **only 1 file per phase** — do not load 19 files at once (context overflow). Priority: `threejs-complete.md §1-7` + `game-architecture.md §1` + `design-system.md`. - Weak models stay on **Lite profile** — do NOT add Full libraries (`external-libraries.md` is for capable models only). - Use `THREE.Timer ? new THREE.Timer() : new THREE.Clock()` fallback — do not assume Timer exists. - If prompt conflicts across multi-row, use priority above. Show assumptions in README `Inferred: ...`. - Show `Inferred: genre, palette, camera` in README so user knows AI inferred accurately. ## Workflow — 6 Phases (Follow Exactly) ### Phase 1: Requirement Intake (2 min) — Ask Batched Ask via AskUserQuestion (one batch): - **Game type**: FPS / voxel / third-person / platformer / racing / RPG / tower-defense / multiplayer / WebXR? - **Framework**: Three.js (lighter, TSL control) or Babylon.js (batteries: GUI, inspector, Havok, Frame Graph)? - **Renderer**: WebGL2 fallback vs WebGPU preferred? (Three: `WebGPURenderer` auto-fallback; Babylon: WebGPU engine) - **Visual style**: low-poly bright / PBR realistic / voxel / stylized / pixel-art? Reference + palette? - **Scope**: single level vs multi-level / endless? Boss/win condition? - **Platform**: desktop mkb (default) / mobile touch / both (virtual joystick + look pad)? - **Persistence**: IndexedDB save? Leaderboard? - **Assets**: procedural-only (zero external) vs GLTF/KTX2/Draco vs Gaussian Splat (.splat/.ply/.spz/.sog)? - **Animation needs**: skeletal GLTF? morph targets? blending? retargeting across characters? - **VFX/Audio**: particle type? post-processing? procedural vs file audio? Defaults if silent: **Three.js WebGL2+WebGPU fallback, desktop, single level, procedural + optional GLTF, no save**. Fastest runnable. ### Phase 2: Architecture Design (3 min) — Professional Skeleton **Mandatory structure** — covers project, logic, visual, graphics, effects, sound, 3D/2D, animation: ``` game/ ├── index.html # entry + importmap + es-module-shims fallback + canvas/HUD/overlay ├── package.json # three@^0.175 / babylon@^8.15, vite@^7, cannon-es/rapier/havok optional ├── vite.config.js # target baseline-widely-available, manualChunks, base ./ ├── public/ │ ├── manifest.json # PWA manifest │ ├── sw.js # service worker (cache) │ └── assets/ # optional external .glb/.ktx2/.mp3 ├── src/ │ ├── main.js # bootstrap, AudioContext resume, pointer-lock, Timer │ ├── Game.js # main loop — fixed timestep 1/60 + Timer/clock, state machine │ ├── world/ │ │ ├── Scene.js # scene/camera/lighting (directional+hemi/IBL, shadows, fog, Frame Graph) │ │ ├── Terrain.js # ground/chunks, LOD, instanced props │ │ └── Entities.js # enemies/NPCs — ECS or state-machine AI │ ├── player/ │ │ ├── Player.js # avatar + stats + skeleton binding │ │ ├── Controller.js # input intent mapping (keyboard/mouse/gamepad/touch) │ │ └── CameraRig.js # spring-arm / FPS rig, collision-aware, retarget anim │ ├── animation/ │ │ ├── Mixer.js # AnimationMixer(s), Timer delta, clip management │ │ ├── Skeleton.js # bone helpers, SkeletonHelper, bone attach (weapon) │ │ └── BlendTree.js # weight blending, additive, morphTargetInfluences │ ├── vfx/ │ │ ├── Particles.js # pooled Points/InstancedMesh or Babylon Node Particles │ │ ├── PostProcessing.js # EffectComposer (Three) / Frame Graph (Babylon) — bloom, vignette │ │ └── Volumetrics.js # fog, light shafts, screen shake │ ├── systems/ │ │ ├── Physics.js # Cannon-es / Rapier / Havok step, CCD, filters │ │ ├── Input.js # Set+justPressed, pointer-lock, gamepad deadzone 0.15, touch │ │ ├── Audio.js # master/music/sfx gains, HRTF panner, procedural buffers │ │ ├── UI.js # HUD (health/score/ammo), crosshair, damage vignette, menus │ │ └── Save.js # IndexedDB + localStorage fallback │ ├── assets/ │ │ ├── Textures.js # procedural canvas (wood/stone/brick/grass/metal) + KTX2 loader │ │ ├── Models.js # GLTFLoader + DRACOLoader + KTX2Loader, cache+clone, fallback │ │ └── Audio.js # procedural oscillators + decodeAudioData file cache │ └── utils/ │ ├── Math.js # RNG mulberry32, easing, lerp, clamp │ ├── Pool.js # object pool maxSize+steal, scratch vectors │ └── Timer.js # wrapper over THREE.Timer (r183+) or Clock fallback ``` **Fixed-timestep loop — Timer with fallback (r175 safe, weak-model proof):** ```js // Game.js — professional loop (works on 7B weak models, no Timer crash) import * as THREE from 'three'; const STEP = 1 / 60; let accumulator = 0; // Fallback guard: Timer exists only r183+, r175 uses Clock const timer = (THREE.Timer ? new THREE.Timer() : new THREE.Clock()); if (timer.connect) timer.connect(document); // Timer pauses when hidden; Clock ignores function frame() { const dt = Math.min(timer.getDelta(), 0.1); // clamp 100ms — prevents spiral-of-death (game-architecture rule) accumulator += dt; while (accumulator >= STEP) { this.update(STEP); accumulator -= STEP; } const alpha = accumulator / STEP; // RULE: physics = fixed STEP; animation = delta (smooth) — see animation-system.md this.mixer?.update(dt); this.render(alpha); requestAnimationFrame(() => this.frame()); } ``` See `references/game-architecture.md` + `references/animation-system.md` for ECS/StateMachine/Pool + mixer patterns. ### Phase 3: Framework Selection — 2026 Decision Matrix | Use case | Pick | Why (2026) | |---|---|---| | Wants Three.js / minimal bundle / TSL control | **Three.js 0.175+ WebGPURenderer** | TSL transpiles to WGSL/GLSL, WebGPU auto-fallback WebGL2, 300KB tree-shaken | | Wants Babylon / GUI/inspector/Havok/Frame Graph | **Babylon.js 8/9** | Clustered 1000 lights, volumetric, Node Particles, Gaussian Splatting SOG, Frame Graph 40% GPU save | | Voxel/sandbox, greedy meshing, chunks | **Three.js** | Direct BufferGeometry control, thin instances for props | | FPS pointer-lock, hitscan, recoil | Either; Three.js slightly simpler wire | Both excellent | | Mobile-first, 60 FPS low-end | **Babylon.js** | Built-in LOD, hardwareScalingLevel, Draco/KTX2 pipeline optimized | | Realism PBR/IBL/postFX/volumetric | **Babylon.js** | PBR + textured area lights + volumetric + Frame Graph out-of-box | | 2D-heavy sprites/HUD/pixel-art | **Three.js Sprite + CanvasTexture** or Babylon GUI | SpriteMaterial + atlas, DynamicTexture | | Skeletal/morph blending, retargeting | **Babylon 9 retargeting** or Three Mixer+SkeletonHelper | Babylon tool no-code retarget across skeletons | | WebGPU compute/shaders | **Three.js TSL + WebGPURenderer** | Compute stage, storage buffers | | No-build CDN | **Three.js via importmap + es-module-shims** | Smaller deps, fastest double-click | When silent: **Three.js WebGPURenderer** (safest one-shot). **Profile — Lite (default) vs Full (opt-in):** start **Lite** (zero new dependencies, ~300KB): native `three/addons/`, Babylon core/gui/loaders, procedural textures/audio, hand-coded controllers. Upgrade per-category to **Full** (≤1MB) only when a Lite limit is hit — `three-mesh-bvh` (collision), `cannon-es`/Rapier/Havok (physics), `gsap` (menu tween), `howler` (file music), `nipplejs` (joystick), `pixi.js` (2D-heavy only). See `references/external-libraries.md` for versions, CDN+npm snippets, fallbacks, and credits. Declare `Profile: Lite` or `Profile: Full (+libs)` in the game README. ### Phase 4: Build & Scaffold **Path A — Zero-build CDN (prefer for instant playable):** ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Game</title> <style>html,body{margin:0;height:100%;overflow:hidden;background:#000}#app{width:100vw;height:100vh}#hud{position:fixed;inset:0;pointer-events:none;color:#fff;font-family:monospace}</style> <script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> <link rel="manifest" href="./public/manifest.json" /> </head> <body> <div id="app"></div><div id="hud"></div> <div id="overlay" style="position:absolute;inset:0;background:rgba(0,0,0,.85);display:flex;align-items:center;justify-content:center;cursor:pointer"><div style="border:2px solid #5cf;color:#5cf;padding:12px 24px;border-radius:8px">CLICK TO PLAY</div></div> <script type="importmap">{ "imports": { "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/", "three/tsl": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.tsl.js", "three/webgpu": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.webgpu.js" } }</script> <script type="module" src="./src/main.js"></script> </body> </html> ``` Babylon CDN: `https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm` (+ `/gui`, `/loaders`, `/materials`, `/havok`). **Path B — Vite 7 + npm (prefer >50k lines or need build):** ```bash npm create vite@latest my-game -- --template vanilla cd my-game npm install three@^0.175.0 # or: npm install @babylonjs/core@^8.15.0 @babylonjs/gui@^8.15.0 @babylonjs/loaders@^8.15.0 @babylonjs/materials@^8.15.0 @babylonjs/havok@^1.3.9 npm install -D vite@^7.0.0 # optional: cannon-es@^0.20.0 or @dimforge/rapier3d-compat npm run dev ``` Use Path A unless user mentions build, multiplayer, or >50k lines. > ⚠️ SCAFFOLD IS NOT SHIPPABLE — Output `node scaffold-*.js` is a generic starter. REQUIRED to apply `design-system.md` tokens + themed HUD/overlay before Phase 6. Never ship scaffold as-is (will fail Anti-Slop checklist). ### Phase 5: Implement Core Systems — Professional Order Build in **exact order** to avoid rework: 1. **Renderer + Scene + Camera + Lights + Shadows + Fog** — visible cube first. Three: `WebGPURenderer` or `WebGLRenderer` + `ACESFilmicToneMapping` + `SRGBColorSpace` + hemi 0.6 + directional 2.0 2048² + `Fog(0x87ceeb,30,100)`. Babylon: `Engine` + `hardwareScalingLevel Math.min(dpr,2)` + `HemisphericLight` + `DirectionalLight` + shadows. Verify resize + context loss. 2. **Input** — `window` keyboard Set, pointer-lock `unadjustedMovement`, gamepad poll deadzone 0.15, touch `VirtualJoystick` + look pad. (`references/input-controls.md`) 3. **Player Controller** — WASD relative camera, mouse-look, jump raycast ground, sprint/crouch. No physics yet. Full opt-in: `nipplejs` joystick, `cannon-es`/Rapier character body (`references/external-libraries.md §3, §5.2`). 4. **Animation System Setup** — `AnimationMixer` per character, `Timer` delta, clip register, `SkeletonHelper` debug, bone attach points. (`references/animation-system.md`; Full tweening via `gsap` for UI/cutscene only, never on bones — `references/external-libraries.md §3.2`) 5. **Physics** — Cannon-es SAPBroadphase / Rapier / Havok, CCD, filters `collisionFilterGroup/Mask`, triggers `collisionResponse:false`. (`references/physics-collision.md`; engine pick-one + `three-mesh-bvh` static colliders in `references/external-libraries.md §2.2, §3.3`) 6. **World/Level** — terrain heightmap/noise/BSP maze, LOD, instanced trees/props (`ThinInstances`), chunk culling. Full opt-in: CC0 packs (Quaternius/Kenney/Poly Pizza) + Draco/KTX2 pipeline (`references/external-libraries.md §2.3`). 7. **Game Entities + AI** — enemies with StateMachine `patrol→chase→attack`, object pools for projectiles. 8. **Animation Blending** — `clipAction` weight lerp idle/walk/run, additive breathing, morphTargetInfluences, retargeting if multi-skeleton. (`references/animation-system.md#blending`) 9. **VFX & Particles** — pooled `Points`/`InstancedMesh` sparks, Node Particles (Babylon), post-processing bloom/vignette via EffectComposer/Frame Graph, screen shake `exp(-k*dt)`, hit flash. (`references/vfx-particles.md`) 10. **Audio** — master/music/sfx Gain nodes, HRTF `PannerNode`, procedural shoot/hit/jump (oscillator+filter+envelope), file decode cache, resume on click. (`references/audio-ui-systems.md`; Full file music via `howler` in `references/external-libraries.md §5.3`) 11. **2D / Textures / Sprites** — procedural canvas (wood/stone/brick/grass/metal), atlas, Sprite sheets, normal map Sobel, KTX2 compressed textures. (`references/2d-drawing-textures.md`, `asset-pipeline.md`) 12. **Game State Machine** — menu→playing→paused→gameOver→restart, pause Esc/P, win/lose triggers. 13. **Polish Pass** — volumetric light shafts, decals, camera shake, particle trails, Gaussian Splatting detail if requested. 14. **Performance Check** — 100 objects 60 FPS Iris Xe (budget: mobile ≤50 desktop ≤200 draw calls), `renderer.info.calls`, `InstancedMesh`/`ThinInstances`, atlas, `devicePixelRatio` cap 2. (`references/performance-optimization.md`) 15. **Save & Deploy Prep** — IndexedDB + manifest.json + sw.js. ### Phase 6: Validation Checklist — Must All Pass Before ship, every box must tick (see `references/testing-deployment.md` diagnostics). **Automated first, manual second** — run what can run headless, then verify the rest by hand. When something breaks, triage per `references/debugging.md` (console → network → state → frame → isolate) — never edit blindly: - [ ] `node --test test/` green on a headless pure-logic module (state machine, win/lose reachability, restart reset, dt clamp, pool bounds — pattern in `testing-deployment.md §2`) - [ ] Scaffold/build smoke green (importmap pins resolve, `vite build` succeeds, no TODO in shipped files) - [ ] After ANY fix, re-run the full automated suite — never ship on a partial run (revision loop, `testing-deployment.md §2`) Manual checklist (all must tick): - [ ] Opens fresh tab zero console errors/warnings - [ ] Resize + orientation + high-DPR correct - [ ] Pointer-lock (FPS) OR spring-arm follow (third-person) works - [ ] WASD relative camera, no wall-through (collision), no floor-through - [ ] At least one skeletal or procedural animation plays (mixer update visible) - [ ] At least one particle/VFX triggers (muzzle flash / impact / pickup) - [ ] At least one interactive action (shoot/place/pickup/attack) - [ ] Win reachable → victory screen; lose reachable → game-over + restart - [ ] HUD shows ≥3 live values (health/score/ammo/time) + crosshair - [ ] Audio ≥4 events + mute toggle, AudioContext resumes on gesture - [ ] Pause Esc/P works, resumes correctly, no time spiral - [ ] Sprites/2D HUD crisp at DPR2, atlas no bleeding - [ ] No leak: 60s run stable FPS, all `dispose()` called on teardown - [ ] PWA manifest + sw cache present if requested, `npm run build` tree-shaken - [ ] README explains controls, run cmd, features, limits ## Reference Library — Progressive Disclosure **Read fully before coding that area — source of truth, copy verbatim.** ### Frameworks - `references/threejs-complete.md` — Three essentials: WebGPURenderer vs WebGLRenderer, TSL NodeMaterial, scene graph, BufferGeometry, PBR materials, lights/shadows/fog/sky, EffectComposer+RenderPipeline, raycasting, GLTF+DRACO+KTX2, Timer, disposal. **Always read for Three.** - `references/babylonjs-complete.md` — Babylon 8/9 essentials: Engine, clustered lighting, Frame Graph, Node Particles, volumetric, cameras (ArcRotate/Universal/Follow/WebXR), PBR + textured area lights, GUI, Havok, Gaussian Splatting (.splat/.ply/.spz/.sog). **Always for Babylon.** ### Game Type Templates (full runnable) - `references/fps-game-template.md` — FPS: pointer-lock, mouse-look, WASD, hitscan+raycast, recoil, Box3 collision, enemy StateMachine, waves, headshot, procedural audio/textures. - `references/voxel-game-template.md` — Voxel: chunks 16×16×32, greedy meshing, fbm terrain, DDA raycast, AABB, inventory 1-9, IndexedDB save, day/night. - `references/third-person-template.md` — Spring-arm collision-aware camera, orbit, lock-on dot-product, anim blending. - `references/platformer-template.md` — Momentum, friction, coyote 0.1s + buffer 0.1s, variable jump, collectibles, moving platforms carry delta. ### Core Systems — Professional - `references/game-architecture.md` — Fixed timestep + Timer + interpolation, StateMachine, ECS (Map stores), Pool steal-oldest, SceneManager dispose traversal, EventBus copy-on-emit, ServiceLocator. - `references/animation-system.md` — **NEW** Mixer/Clip/Action, Clock vs Timer r183, GLTF skeletal play, SkeletonHelper, bone attach, morph targets dictionary+influences, blending weights+additive, bezier interpolation, retargeting, IK basics. - `references/physics-collision.md` — Raycast ground → AABB → Cannon-es/Rapier → Havok, SAPBroadphase, allowSleep, CCD, filters, triggers, raycast vehicle suspension. - `references/vfx-particles.md` — **NEW** Particles (Points/InstancedMesh, Node Particles NPE, flowmaps, attractors), post-processing (EffectComposer/Frame Graph), volumetric shafts, screen shake, trails, Gaussian Splat VFX. - `references/procedural-generation.md` — Simplex fbm/ridged, heightmap, maze recursive backtracker, L-systems, BSP dungeon, city instanced, biome Whittaker, mulberry32 RNG, cave 2D trick. - `references/input-controls.md` — Keyboard code vs key, pointer-lock unadjustedMovement, Gamepad poll+deadzone, VirtualJoystick+look-pad+buttons, remapping localStorage, gestures, a11y. - `references/audio-ui-systems.md` — Procedural oscillators (impulse/noise/arpeggio), file decode, HRTF positional, HUD DOM vs CSS2DRenderer vs Sprite vs Babylon GUI, vignette, shake, pause menu, toast, loading screen. - `references/2d-drawing-textures.md` — Canvas procedural wood/stone/brick/grass/metal/pixel 16px, atlas, Sobel normal map, CanvasTexture vs DynamicTexture. - `references/asset-pipeline.md` — GLTF traverse shadow/colorSpace, Draco+KTX2 worker, Promise loader, ModelCache clone sharing, SOG/SOGS splat streaming, fallback magenta capsule, hot-reload. - `references/external-libraries.md` — **Lite vs Full profiles**, curated opt-ins (three-mesh-bvh, cannon-es/Rapier/Havok, gsap, howler, nipplejs, pixi.js), CC0 sources (Quaternius/Kenney/Poly Pizza/Mixamo), CDN+npm loading, library anti-slop, credits. **Read before adding any third-party script.** ### Quality & Shipping - `references/design-system.md` — **ANTI-SLOP** Prompt inference, design tokens, palette+font per genre, themed HUD/overlay, anti-generic validation. **REQUIRED reading before writing HTML/HUD.** - `references/performance-optimization.md` — Profiling renderer.info.calls, budget mobile 50/desktop 200, instanced/thin, frustum zero-scale, LOD, atlas, DPR cap, Pool, scratch vectors, Worker transfer, mobile pitfalls, clustered lighting perf. - `references/testing-deployment.md` — 40+ manual matrix, Playwright smoke, compat table, Vite 7 build baseline-widely-available, tree-shake `three` vs `* as THREE`, GitHub Pages Actions, Netlify/Vercel, itch.io zip, PWA manifest+sw, Sentry, gtag. - `references/debugging.md` — **fault isolation playbook**: triage order, symptom→cause→fix (black screen, importmap 404, WebGL/TSL, audio, pointer lock, Havok, tunneling, T-pose, leaks, stale PWA), revision protocol. **Read before touching broken code.** - `references/multiplayer-networking.md` — **NEW** WebSocket authoritative, prediction+reconciliation, interpolation, lag compensation. - `references/webxr-vr.md` — **NEW** WebXR session, XR camera, controllers, locomotion. ## Reading Convention — REQUIRED 1. Read **fully** before coding that area — do not guess. Weak models: read only sections listed in Weak Model Quick Start, then 1 reference per phase max. 2. Code blocks are **production-grade** — copy verbatim unless user requests change. 3. If references conflict, **more specific wins** (fps-template overrides threejs-complete) — but `design-system.md` anti-slop **always wins** over template `pulse/#5cf` slop. 4. Do not paraphrase references — just build the game. 5. Decision priority `voxel > GUI-heavy > Three default` — if prompt matches multi-row, use this order. ## Critical Implementation Rules — Professional Defaults ### Memory & Disposal - Every Geometry/Material/Texture/RenderTarget `.dispose()` on teardown — GPU not GC. - Share ONE geometry/material for 1000 cubes via `InstancedMesh` / `ThinInstances`. - Pools mandatory for projectiles/particles/enemies. See `game-architecture.md#object-pooling`. ### Animation - One `AnimationMixer` per skeleton root, `mixer.update(delta)` each frame via `Timer`. - `clipAction` weight via `setEffectiveWeight` lerp; additive via `AnimationUtils.makeClipAdditive`. - `morphTargetInfluences` by index via `morphTargetDictionary[name]`. - Bone attach: `bone.add(weapon); weapon.position.set(offset)`. - Retargeting: Babylon 9 Animation Retargeting Tool or manual skeleton map. ### Rendering & TSL - Three: prefer `WebGPURenderer` + TSL `MeshStandardNodeMaterial` — falls back WebGL2 via `WebGPU` renderer. Use `three/tsl` imports, not `three/nodes` legacy. - Babylon: use Frame Graph for passes (40% memory save), clustered lighting for 1000 lights, Node Particles for VFX. - Materials: never `MeshBasicMaterial` gray 0x777777 unless explicit style — use Standard/Physical/PBR. ### Coordinate System - Three: Y-up right-handed, forward `-Z`. Babylon: Y-up left-handed, forward `+Z`. Negate Z when porting. ### Game Loop Stability - Clamp dt `Math.min(dt,0.1)` — avoids spiral when tab hidden. - Fixed STEP 1/60 physics; `Timer` pauses when hidden (`timer.connect(document)`). - `requestAnimationFrame` pauses hidden — handle gap on return. ### Input - Pointer-lock needs **user gesture** — "Click to play" overlay mandatory. - Keyboard on `window`, not canvas. Gamepad polled each frame deadzone 0.15. Mobile `touchstart/move/end` joystick. ### Audio - `AudioContext` **after gesture**, `context.resume()` on first click. Procedural preferred for one-shot deliverables. **Always mute toggle.** ### Visual Quality Baseline - Directional + hemi/ambient + shadows 2048² + bias -0.0005 + fog `FogExp2` matching sky. - Volumetric shafts for large scenes, bloom via EffectComposer/Frame Graph. - Cap `devicePixelRatio` at 2 via `Math.min(dpr,2)` + `hardwareScalingLevel`. ### Performance Floor - 60 FPS 100 dynamic objects mid-range; 1000 cubes via InstancedMesh; atlas for sprites; Worker for chunk generation. ## Output Format — Always Deliver Every game must include: 1. `index.html` — runnable via importmap+shims (Path A) or `npm i && npm run dev` (Path B) 2. `src/` — full source organized per Phase 2 (include `animation/` + `vfx/` if needed) 3. `README.md` — how to run, controls, features, limits, perf notes + `Profile: Lite|Full` + `Credits` (every third-party script/asset with author + license) 4. `public/manifest.json` + `sw.js` if PWA requested 5. Screenshot/GIF if requested (agent-browser capture) When done, tell user: - Absolute project path, run command, controls, what implemented (type, win/lose, anim, VFX, audio, UI, save), what NOT implemented, perf 60 FPS verification. ## Anti-Slop Protocol — REQUIRED for professional results from simple prompts > Templates in `assets/templates/` are **EMPTY STARTER for scaffolding** — NOT final examples. AI must not copy-paste raw templates as deliverable. Every final game MUST generate a unique identity. **Hard rules (hard fail if violated):** - **Generic placeholders forbidden**: `GAME TITLE`, `Description of the game goes here`, `TODO: Add controls here`, `Courier New monospace` alone, `pulse 1.5s infinite`, default color `#5cf` in every game. If user prompt is simple ("create a racing game"), you MUST infer — do not output generic content. - **Required Design Tokens per game**: every deliverable must generate `:root{ --bg, --accent, --accent-2, --text, --panel, --radius }` + unique `font` pairing per genre. Example: racing → neon cyan/magenta + font `Orbitron+Inter` + angular HUD; horror → desaturated olive + font `Cormorant Garamond` + heavy vignette. See `references/design-system.md`. - **Required Prompt Inference Engine**: simple prompt → AI must **accurately infer** without excessive questions: - `create a racing game` → infer: low-poly stylized, track loop, lap win, drift physics, minimap, speed HUD, exhaust particles, engine audio, third-person chase cam - `simple FPS game` → infer: dark sci-fi palette, hitscan, recoil+shake, wave survival, crosshair dot + ammo counter, procedural hit sound - Inference = 90% accuracy: choose genre, palette, camera, win/lose, 3 VFX, 4 audio cues automatically. Do not ask again if already clear. **Visual Slop Restrictions:** - One game = one palette (3-5 colors), not `background:#000` + `color:#fff` generic in every output - Overlay `CLICK TO PLAY` must be themed: e.g. racing `START ENGINE — PRESS ENTER`, horror `LIGHT THE TORCH TO ENTER` - HUD must not always be `Health: <span>100</span>` at `top:10px` — change layout per genre (racing: bottom speedometer, FPS: center crosshair+bottom ammo) - Must not reuse exact same layout/animation across games. Vary radius, shadow, grid, grain, scanline per theme. **Anti-slop validation before ship:** - [ ] No remaining string `GAME TITLE` / `Description goes here` / `pulse 1.5s`? - [ ] Unique palette & font (check design-system.md) — not generic black-monospace? - [ ] Overlay & HUD themed to genre — not template copy? - [ ] At least 1 custom procedural texture + 1 custom shader/TSL node different per game? - [ ] Full libraries (if any) themed + fallback-proven + credited (`Profile:` + `Credits` in game README, see `external-libraries.md §7–§8`)? If failed, **regenerate visual layer** until unique identity is achieved. ## Anti-Patterns — Forbidden - `TODO: implement this` stubs — implement or remove. - Throw `not implemented` — omit feature instead. - Magic numbers without named constant — `const PLAYER_SPEED=0.7`. - Single 2000-line `main.js` — split per Phase 2. - Missing `dispose()` — leaks crash long sessions. - Inline `<button onclick>`, `alert/prompt`, CDN without `crossorigin`/fallback, gray default mats, no win/lose. - **Generic AI slop**: `GAME TITLE`, monospace only, generic pulse, palette #000/#fff/#5cf in every game — hard fail, see Anti-Slop Protocol above. ## When You Don't Know 1. Fallback to official examples (threejs.org/examples, babylonjs.com/playground) — especially 2026 WebGPU/TSL playgrounds. 2. Web search current best practice. 3. Prefer procedural assets to keep self-contained. 4. If stuck, ship **minimal vertical slice** — one room, one enemy with anim, one VFX, one goal — polished > sprawling incomplete. ## Final Note You are not making a demo. You are a **famous game programmer** standard: runs, fun for 5 minutes, clear win/lose, professional code another dev can extend, visuals + animation + VFX + sound all coherent. If deliverable doesn't meet bar, iterate until it does. Now read relevant references for user's request and start building.README.md12 KBa5bd354bbc64upstream ↗
# BUFATECHNO WEB GAME DEV Skill **optimized for ZCode & Claude (primary)** to build **complete, production-ready 3D web games** using **Three.js (WebGPU/WebGL2 + TSL)** or **Babylon.js (WebGPU/WebGL2 + Havok)** — like a renowned game programmer. > 2026 stack: `three@^0.175.0` (WebGPURenderer + TSL NodeMaterial), `@babylonjs/*@^8.15.0` (clustered lighting, Frame Graph, Gaussian Splatting), `vite@^7.0.0` (baseline-widely-available, Rolldown). Primary support: ZCode & Claude. > **Quick Links:** [Installation](INSTALL.md) • [Changelog](CHANGELOG.md) • [Skill](SKILL.md) • [Support](#support--donate) ## What You Can Build This skill covers the full scope of a browser 3D game — **project, logic, visuals, effects, audio, 3D, 2D, animation**: - **Structured project**: scaffold `src/world|player|animation|vfx|systems|assets|utils` + `public/manifest.json` + PWA `sw.js`, Path A CDN (double-click) or Path B Vite 7 - **Game logic**: fixed-timestep 1/60 + `THREE.Timer`, StateMachine, ECS, object Pool, AI behavior states, save IndexedDB, multiplayer prediction/reconciliation - **Visual & Graphics**: PBR/Standard/Physical + IBL, directional+hemi lights 2048² shadows, `FogExp2`, TSL `MeshStandardNodeMaterial` (WGSL/GLSL), clustered 1000 lights (Babylon 9), Frame Graph 40% mem save - **Effects (VFX)**: pooled particles (Points/InstancedMesh, Babylon Node Particles), post-processing bloom/vignette (EffectComposer/Frame Graph), volumetric light shafts, screen shake, hit flash, trails, decals, Gaussian Splatting `.splat/.ply/.spz/.sog` - **Audio**: procedural oscillators (shoot/hit/jump), file decode cache, positional HRTF panner, master/music/sfx routing, AudioContext resume on gesture + mute toggle - **3D imagery**: GLTF/GLB + Draco `gltf/` + KTX2 Basis worker, async loader + ModelCache clone, fallback magenta capsule, Gaussian Splat streaming/LOD, fallback primitives - **2D imagery**: procedural canvas textures (wood/stone/brick/grass/metal, 16px pixel art), atlas, Sprite sheets, normal map Sobel, CanvasTexture/DynamicTexture, SpriteMaterial - **Animation**: `AnimationMixer`+`AnimationClip`+`AnimationAction`, `Timer` r183+, skeletal `SkinnedMesh`+`SkeletonHelper`, bone attach, `morphTargetInfluences`, weight blending + additive `makeClipAdditive`, bezier interpolation, retargeting (Babylon 9 tool), CCD IK - **Game types**: FPS, voxel/sandbox, third-person, platformer, racing, RPG, tower defense, top-down, multiplayer, WebXR/VR - **Optimization**: instanced/ThinInstances, frustum LOD, texture atlas, DPR cap 2, worker chunk, draw calls mobile ≤50 desktop ≤200, 60 FPS 100+ objects - **External libraries (Lite vs Full)**: Lite default zero new deps (~300KB); Full opt-ins per-category — `three-mesh-bvh` collision, `cannon-es`/Rapier/Havok physics, `gsap` menu tween, `howler` file music, `nipplejs` joystick, CC0 sources (Quaternius/Kenney/Poly Pizza/Mixamo) — each with CDN+npm snippets, Lite fallback, and credits (see `references/external-libraries.md`) - **Shipping**: manual matrix 40+ items, Playwright smoke, deploy GitHub Pages/Netlify/Vercel/itch.io, PWA, Sentry/gtag ## How to Use Auto trigger for: - "Build me an FPS game in Three.js with skeletal animation" - "Create voxel game with particles and sound" - "Make third-person with bloom and sprite HUD" - "Babylon.js game with Havok physics and volumetric light" - "WebGPU TSL shader game" - "Multiplayer browser game" / "WebXR VR game" Skill will: intake 10 questions → design professional architecture → select framework (matrix 2026) → scaffold (CDN/Vite) → implement 15 systems in order → validate 15 checklist → deliver runnable. ## Screenshot Example — Games Built with This Skill Example output from this skill — voxel sandbox game (Three.js, procedural textures, day/time HUD, hotbar inventory): <p align="center"> <img src="screenshoot-example/1.png" alt="Voxel game example — third-person character in forest biome" width="49%" /> <img src="screenshoot-example/2.png" alt="Voxel game example — first-person grass terrain with trees" width="49%" /> </p> > More examples in [`screenshoot-example/`](screenshoot-example/). ## Skill Structure ``` bufatechno-webgamedev/ ├── SKILL.md # Main skill — professional ~375 lines (core) + Weak-Model Quick Start ├── README.md # This file ├── INSTALL.md # Installation guide — ZCode & Claude (Linux/macOS/Windows) ├── CHANGELOG.md # Version history ├── LICENSE # MIT ├── package.json # MIT, three 0.175, vite 7, babylon 8.15, node >=20.19 ├── .claude-plugin/ │ └── marketplace.json # Claude Code marketplace catalog (bufatechno-marketplace) ├── .zcode-plugin/ │ └── marketplace.json # ZCode marketplace catalog (bufatechno-marketplace) ├── plugins/ │ └── bufatechno-webgamedev/ # Plugin (auto-installs skill on marketplace add) │ ├── .claude-plugin/plugin.json │ ├── .zcode-plugin/plugin.json │ └── skills/bufatechno-webgamedev/ │ ├── SKILL.md # Skill (bundled) │ ├── references/ # Bundled docs │ ├── assets/ # Bundled templates & QRIS │ └── scripts/ # Bundled scaffolds ├── references/ # 22 deep-dive docs (2026, anti-slop included) │ ├── threejs-complete.md # WebGPURenderer+TSL, PBR, post, GLTF, Timer │ ├── babylonjs-complete.md # Engine, clustered lights, Frame Graph, Havok, Splatting │ ├── fps-game-template.md # FPS runnable 1000+ lines │ ├── voxel-game-template.md # Voxel 1100+ lines │ ├── third-person-template.md # Spring-arm, anim blend │ ├── platformer-template.md # Momentum, coyote+buffer 0.1s │ ├── game-architecture.md # Fixed step+Timer, ECS, StateMachine, Pool │ ├── animation-system.md # NEW: Mixer/Clip/Action, skeletal, morph, blending, retarget │ ├── physics-collision.md # Cannon-es/Rapier/Havok, CCD, filters │ ├── vfx-particles.md # NEW: particles, post, volumetric, shake, splat │ ├── procedural-generation.md # Noise, maze, L-system, BSP city, biome │ ├── input-controls.md # Keyboard/mouse/gamepad/touch, remap │ ├── audio-ui-systems.md # Procedural audio + HRTF, HUD, vignette │ ├── 2d-drawing-textures.md # Canvas procedural, atlas, normal Sobel │ ├── asset-pipeline.md # GLTF, Draco gLTF/, KTX2, SOGS streaming │ ├── external-libraries.md # Lite vs Full, curated opt-ins, CC0 sources, anti-slop, credits │ ├── design-system.md # NEW ANTI-SLOP: tokens, palette, themed HUD, inference │ ├── performance-optimization.md # Instanced, LOD, atlas, clustered, Frame Graph │ ├── testing-deployment.md # Matrix 40+, Playwright, Vite 7, PWA │ ├── debugging.md # Triage order, symptom→fix, revision protocol │ ├── multiplayer-networking.md # NEW: ws authoritative, prediction, interpolation │ └── webxr-vr.md # NEW: WebXR session, controllers, locomotion ├── scripts/ │ ├── scaffold-threejs.js # Three 0.175 + Vite 7 + animation/vfx dirs + shims │ └── scaffold-babylonjs.js # Babylon 8.15 + Havok + Vite 7 ├── test/ # Automated checks — `npm test` (offline, zero deps) │ ├── skill.test.js # Version sync, bundled-copy sync, pins, links (+opt-in CDN check) │ └── scaffold.test.js # Scaffold smoke: structure, syntax, invariants (+opt-in vite build) ├── screenshoot-example/ # Example game screenshots built with this skill │ ├── 1.png # Voxel game — third-person forest biome │ └── 2.png # Voxel game — first-person grass terrain └── assets/ ├── images/ │ ├── qris.jpeg # QRIS donation QR code │ └── btc.jpeg # Bitcoin donation QR code ├── templates/ │ ├── threejs/ # index.html (shims+TSL), package, vite baseline │ └── babylonjs/ # index.html, package 8.15, vite baseline └── pwa/ # manifest.json + sw.js (cache v2) ``` ## Design Principles 1. **Famous-dev level** — playable 5 min, win/lose, anim+VFX+sound coherent, extendable code, anti-slop REQUIRED. 2. **Self-contained** — procedural where possible, KTX2/SOG compressed where files needed, PWA cache. Lite profile default (~300KB); Full libraries strictly opt-in with Lite fallback. 3. **Progressive disclosure** — SKILL core + 22 refs on-demand, Weak-Model Quick Start (≤14B) 4-step fallback (weak models stay Lite). 4. **2026-native** — WebGPU auto-fallback, TSL, clustered lights, Frame Graph, Timer fallback Clock, Havok, Splat. 5. **Runnability** — Path A double-click (shims+three/tsl+webgpu), Path B Vite 7 `baseline-widely-available`, tree-shaken 300KB Lite vs ≤1MB Full. 6. **Honest trade-offs** — when procedural beats file, when physics engine needed, when multiplayer mock vs real ws. 7. **Conflict-free** — dt clamp 0.1 aligned, Babylon 8.15 CDN/npm sync, scaffold WARNING anti-slop, weak-model safe. ## Triggering Tips `SKILL.md` description is intentionally pushy — covers `animation`, `VFX`, `2D sprite`, `particle`, `skeleton`. If not triggering, prompt: "use the bufatechno-webgamedev skill". ## Support — Donate If this skill helps you ship games faster, consider supporting development via QRIS or Bitcoin. ### QRIS Scan the QR code below with any Indonesian e-wallet or mobile banking app that supports QRIS (GoPay, OVO, DANA, ShopeePay, BCA mobile, etc.). <p align="center"> <img src="assets/images/qris.jpeg" alt="QRIS Donation QR Code" width="280" /> </p> > The QRIS image is located at `assets/images/qris.jpeg` in this repository. Funds go directly to BUFATECHNO to maintain and improve the skill, templates, and references. ### Bitcoin Scan the QR code below with any Bitcoin wallet app, or send to the address directly: <p align="center"> <img src="assets/images/btc.jpeg" alt="Bitcoin Donation QR Code" width="280" /> </p> ``` 13cfuHxtoouAVBaBC6tFVBR4mbiJfUjNUD ``` > The Bitcoin QR image is located at `assets/images/btc.jpeg` in this repository. Other ways to support: star the repo, share feedback via [Issues](https://github.com/bufatechno/bufatechno-webgamedev/issues), or contribute improvements via pull request. ## Credits & Third-Party This skill builds on the work of others. Full credit table (project, author, license) lives in [`references/external-libraries.md`](references/external-libraries.md#8-credits--licenses-third-party-code-and-assets-referenced-here) — summary: - Engines & tooling (MIT): `three` (three.js authors), `@babylonjs/*` (Babylon.js team, Apache-2.0), `vite` (Vite team), `es-module-shims` (Guy Bedford) - Full opt-ins: `three-mesh-bvh` (Garrett Johnson, MIT), `cannon-es` (cannon-es contributors, MIT), `@dimforge/rapier3d-compat` (Dimforge, Apache-2.0), Havok plugin (Microsoft Havok, free via Babylon), `gsap` (GreenSock, free license), `howler.js` (James Simpson / GoldFire Studios, MIT), `nipplejs` (Sébastien Altman, MIT), `pixi.js` (PixiJS team, MIT) - Free assets: Quaternius (CC0), Kenney.nl (CC0), Poly Pizza (CC0/CC-BY per model), Mixamo (Adobe, free with account) > Every game built with this skill must ship its own `Credits` section listing the third-party scripts and assets it actually uses (name, author, license, version). ## License MIT — use, modify, distribute freely. ## Author BUFATECHNO (https://bufatechno.com)scripts/scaffold-babylonjs.js7.4 KBe0a8d77f49ccupstream ↗
#!/usr/bin/env node /** * Scaffolds a new Babylon.js game project. * Usage: node scaffold-babylonjs.js <project-name> [game-type] */ import * as fs from 'fs'; import * as path from 'path'; const name = process.argv[2] || 'my-game'; const gameType = process.argv[3] || 'empty'; const projectDir = path.resolve(process.cwd(), name); if (fs.existsSync(projectDir)) { console.error(`Error: directory ${name} already exists`); process.exit(1); } console.log(`Scaffolding Babylon.js game "${name}" (${gameType} template)...`); fs.mkdirSync(path.join(projectDir, 'src'), { recursive: true }); const indexHtml = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>${name} — Starter (replace with themed title)</title> <!-- ANTI-SLOP: Starter — final MUST replace tokens per design-system.md --> <style> :root{ --bg:#0a0e13; --panel:rgba(16,22,30,.72); --text:#e6edf3; --muted:#9aa8b3; --accent:#ffd166; --accent-2:#55ccff; --radius:14px; --font-display:"Space Grotesk",system-ui,sans-serif; --font-body:"Inter",system-ui,sans-serif; } html, body { margin:0; height:100%; overflow:hidden; background:var(--bg); color:var(--text); font-family:var(--font-body); } #renderCanvas { width:100%; height:100%; touch-action:none; outline:none; display:block } #hud { position:fixed; inset:0; pointer-events:none } #overlay { position:absolute; inset:0; background:rgba(0,0,0,0.85); display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--text); cursor:pointer; z-index:10; text-align:center; padding:24px } #overlay .hint{ margin-top:14px; padding:12px 22px; border:1px solid var(--accent); color:var(--accent); border-radius:999px; font-family:var(--font-display); letter-spacing:.14em; font-size:12px } </style> </head> <body> <canvas id="renderCanvas"></canvas> <div id="hud"></div> <div id="overlay"><div style="font-family:var(--font-display); letter-spacing:.1em; font-size:clamp(24px,4vw,44px)">\${name.toUpperCase()}</div><div class="hint">CLICK TO PLAY — REPLACE WITH THEMED PER GENRE</div><div style="margin-top:8px; color:var(--muted); font-size:11px">Starter anti-slop: replace palette/HUD per design-system.md</div></div> <script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> <link rel="manifest" href="./public/manifest.json" /> <script type="importmap"> { "imports": { "@babylonjs/core": "https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm", "@babylonjs/gui": "https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm", "@babylonjs/loaders": "https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm", "@babylonjs/materials": "https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm", "@babylonjs/havok": "https://cdn.jsdelivr.net/npm/@babylonjs/[email protected]/+esm" } } </script> <script type="module" src="./src/main.js"></script> </body> </html> `; fs.writeFileSync(path.join(projectDir, 'index.html'), indexHtml); const mainJs = `import { Game } from './Game.js'; const game = new Game(); game.init(); document.getElementById('overlay').addEventListener('click', () => game.start()); `; fs.writeFileSync(path.join(projectDir, 'src/main.js'), mainJs); const gameJs = `import { Engine, Scene, UniversalCamera, Vector3, HemisphericLight, DirectionalLight, MeshBuilder, StandardMaterial, Color3, Color4 } from '@babylonjs/core'; export class Game { constructor() { this.state = 'menu'; } init() { const canvas = document.getElementById('renderCanvas'); this.engine = new Engine(canvas, true, { preserveDrawingBuffer: false, stencil: false }); this.engine.setHardwareScalingLevel(1 / Math.min(window.devicePixelRatio, 2)); this.scene = new Scene(this.engine); this.scene.clearColor = new Color4(0.53, 0.81, 0.92, 1.0); this.camera = new UniversalCamera('playerCam', new Vector3(0, 1.7, -5), this.scene); this.camera.setTarget(Vector3.Zero()); this.camera.fov = 0.8; this.camera.attachControl(canvas, true); // Lighting const hemi = new HemisphericLight('hemi', new Vector3(0, 1, 0), this.scene); hemi.intensity = 0.6; const sun = new DirectionalLight('sun', new Vector3(-0.5, -1, -0.3), this.scene); sun.position = new Vector3(50, 80, 30); sun.intensity = 2.0; // Ground const ground = MeshBuilder.CreateGround('ground', { width: 100, height: 100 }, this.scene); const groundMat = new StandardMaterial('groundMat', this.scene); groundMat.diffuseColor = new Color3(0.23, 0.43, 0.17); ground.material = groundMat; ground.receiveShadows = true; // TODO: Add player, enemies, etc per game type: ${gameType} this.step = 1 / 60; this.accumulator = 0; this.lastTime = 0; window.addEventListener('resize', () => this.engine.resize()); this._render(); } start() { this.state = 'playing'; document.getElementById('overlay').style.display = 'none'; const canvas = document.getElementById('renderCanvas'); canvas.requestPointerLock?.(); this.lastTime = performance.now(); this._frame(this.lastTime); } _frame(now) { if (this.state !== 'playing') return; const dt = Math.min((now - this.lastTime) / 1000, 0.1); this.lastTime = now; this.accumulator += dt; while (this.accumulator >= this.step) { this._update(this.step); this.accumulator -= this.step; } this.scene.render(); requestAnimationFrame((t) => this._frame(t)); } _update(dt) { // TODO: Update player, enemies, etc per game type: ${gameType} } _render() { this.scene.render(); } } `; fs.writeFileSync(path.join(projectDir, 'src/Game.js'), gameJs); const readme = `# ${name} A 3D web game built with Babylon.js. ## How to Run Open \`index.html\` in a modern browser (Chrome, Firefox, Edge, Safari). No build step. No npm install. Just open the file. ## Controls TODO: Add controls here. ## Notes Scaffolded as: ${gameType} See the SKILL.md reference at the project root for game-type-specific code patterns. `; fs.writeFileSync(path.join(projectDir, 'README.md'), readme); const packageJson = { name: name, version: '0.1.0', type: 'module', scripts: { dev: 'npx vite', build: 'npx vite build', preview: 'npx vite preview', }, dependencies: { '@babylonjs/core': '^8.15.0', '@babylonjs/gui': '^8.15.0', '@babylonjs/loaders': '^8.15.0', '@babylonjs/materials': '^8.15.0', '@babylonjs/havok': '^1.3.9', }, devDependencies: { vite: '^7.0.0', }, }; fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2)); fs.writeFileSync(path.join(projectDir, '.gitignore'), `node_modules/\ndist/\n.DS_Store\n*.log\n`); console.log(`✓ Created ${name}/`); console.log(` - index.html (CDN 8.15.0 + havok, starter tokens — MUST be themed)`); console.log(` - src/Game.js (stub ${gameType} — customize per design-system.md)`); console.log(` - package.json (babylon 8.15+havok, vite 7 baseline)`); console.log(` - README.md`); console.log(``); console.log(`Next steps:`); console.log(` cd ${name}`); console.log(` # Option A: open index.html in a browser (no build)`); console.log(` # Option B: npm install && npm run dev (Vite dev server)`); console.log(``); console.log(`⚠️ ANTI-SLOP (REQUIRED): Scaffold starter is GENERIC — do not ship as-is!`); console.log(` → Replace palette/font/HUD/overlay per references/design-system.md`);scripts/scaffold-threejs.js8.4 KB4c71fabffdb1upstream ↗
#!/usr/bin/env node /** * Scaffolds a new Three.js game project. * Usage: node scaffold-threejs.js <project-name> [game-type] * game-type: fps | voxel | third-person | platformer | empty */ import * as fs from 'fs'; import * as path from 'path'; const name = process.argv[2] || 'my-game'; const gameType = process.argv[3] || 'empty'; const projectDir = path.resolve(process.cwd(), name); if (fs.existsSync(projectDir)) { console.error(`Error: directory ${name} already exists`); process.exit(1); } console.log(`Scaffolding Three.js game "${name}" (${gameType} template)...`); // Directory structure — professional layout const dirs = [ '', 'src', 'src/world', 'src/player', 'src/systems', 'src/animation', 'src/vfx', 'src/assets', 'src/utils', 'public', ]; dirs.forEach((d) => fs.mkdirSync(path.join(projectDir, d), { recursive: true })); // Common index.html — ANTI-SLOP: scaffold is starter, MUST customize per design-system.md before ship const indexHtml = `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>${name} — Starter (replace with themed title)</title> <!-- ANTI-SLOP: Starter palette — final game MUST generate unique tokens per genre (design-system.md) --> <style> :root{ --bg:#0a0e13; --panel:rgba(16,22,30,.72); --text:#e6edf3; --muted:#9aa8b3; --accent:#55ccff; --accent-2:#7af0ff; --radius:14px; --font-display:"Space Grotesk",system-ui,sans-serif; --font-body:"Inter",system-ui,sans-serif; } html, body { margin:0; height:100%; overflow:hidden; background:var(--bg); color:var(--text); font-family:var(--font-body); } #app { position:absolute; inset:0; } #hud { position:fixed; inset:0; pointer-events:none; } #overlay { position:absolute; inset:0; background:rgba(0,0,0,0.85); display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--text); cursor:pointer; text-align:center; padding:24px } #overlay .hint{ margin-top:16px; padding:12px 22px; border:1px solid var(--accent); color:var(--accent); border-radius:999px; font-family:var(--font-display); letter-spacing:.14em; font-size:12px } </style> <script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> <link rel="manifest" href="./public/manifest.json" /> </head> <body> <div id="app"></div> <div id="hud"></div> <div id="overlay"><div style="font-family:var(--font-display); font-size:clamp(24px,4vw,44px); letter-spacing:.1em">\${name.toUpperCase()}</div><div class="hint">CLICK TO PLAY — REPLACE WITH THEMED TEXT PER GENRE</div><div style="margin-top:8px; color:var(--muted); font-size:11px">Starter anti-slop: replace palette/HUD per design-system.md</div></div> <script type="importmap"> { "imports": { "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js", "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/", "three/tsl": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.tsl.js", "three/webgpu": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.webgpu.js" } } </script> <script type="module" src="./src/main.js"></script> </body> </html> `; fs.writeFileSync(path.join(projectDir, 'index.html'), indexHtml); // main.js const mainJs = `import { Game } from './Game.js'; const game = new Game(); game.init(); document.getElementById('overlay').addEventListener('click', () => game.start()); `; fs.writeFileSync(path.join(projectDir, 'src/main.js'), mainJs); // Game.js — professional stub with Timer + animation + pooling ready const gameJs = `import * as THREE from 'three'; export class Game { constructor() { this.state = 'menu'; } init() { this.renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: 'high-performance' }); this.renderer.setSize(window.innerWidth, window.innerHeight); this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); this.renderer.toneMapping = THREE.ACESFilmicToneMapping; this.renderer.outputColorSpace = THREE.SRGBColorSpace; this.renderer.shadowMap.enabled = true; this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; document.getElementById('app').appendChild(this.renderer.domElement); this.scene = new THREE.Scene(); this.scene.background = new THREE.Color(0x87ceeb); this.scene.fog = new THREE.Fog(0x87ceeb, 30, 100); this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.05, 500); this.camera.position.set(0, 1.7, 5); // Lighting const hemi = new THREE.HemisphereLight(0xbfd9ff, 0x4a3a2a, 0.6); this.scene.add(hemi); const sun = new THREE.DirectionalLight(0xfff4e0, 2.0); sun.position.set(20, 30, 10); sun.castShadow = true; sun.shadow.mapSize.set(2048, 2048); sun.shadow.camera.left = -30; sun.shadow.camera.right = 30; sun.shadow.camera.top = 30; sun.shadow.camera.bottom = -30; sun.shadow.bias = -0.0005; this.scene.add(sun); // Ground const ground = new THREE.Mesh( new THREE.PlaneGeometry(100, 100), new THREE.MeshStandardMaterial({ color: 0x3a6f2a, roughness: 0.85 }) ); ground.rotation.x = -Math.PI / 2; ground.receiveShadow = true; this.scene.add(ground); // TODO: Add world, player, enemies, etc per game type: ${gameType} this.step = 1 / 60; this.accumulator = 0; this.lastTime = 0; window.addEventListener('resize', () => { this.camera.aspect = window.innerWidth / window.innerHeight; this.camera.updateProjectionMatrix(); this.renderer.setSize(window.innerWidth, window.innerHeight); }); this._render(); } start() { this.state = 'playing'; document.getElementById('overlay').style.display = 'none'; this.renderer.domElement.requestPointerLock?.(); this.lastTime = performance.now(); this._frame(this.lastTime); } _frame(now) { if (this.state !== 'playing') return; const dt = Math.min((now - this.lastTime) / 1000, 0.1); this.lastTime = now; this.accumulator += dt; while (this.accumulator >= this.step) { this._update(this.step); this.accumulator -= this.step; } this._render(); requestAnimationFrame((t) => this._frame(t)); } _update(dt) { // TODO: Update player, enemies, etc per game type: ${gameType} } _render() { this.renderer.render(this.scene, this.camera); } } `; fs.writeFileSync(path.join(projectDir, 'src/Game.js'), gameJs); // README.md const readme = `# ${name} A 3D web game built with Three.js. ## How to Run Open \`index.html\` in a modern browser (Chrome, Firefox, Edge, Safari). No build step. No npm install. Just open the file. ## Controls TODO: Add controls here. ## Notes Scaffolded as: ${gameType} See the SKILL.md reference at the project root for game-type-specific code patterns. `; fs.writeFileSync(path.join(projectDir, 'README.md'), readme); // package.json (optional, for npm-based workflows) const packageJson = { name: name, version: '0.1.0', type: 'module', scripts: { dev: 'npx vite', build: 'npx vite build', preview: 'npx vite preview', }, dependencies: { three: '^0.175.0', }, devDependencies: { vite: '^7.0.0', }, }; fs.writeFileSync(path.join(projectDir, 'package.json'), JSON.stringify(packageJson, null, 2)); // .gitignore fs.writeFileSync(path.join(projectDir, '.gitignore'), `node_modules/\ndist/\n.DS_Store\n*.log\n`); console.log(`✓ Created ${name}/`); console.log(` - index.html (CDN-based 0.175.0 + three/tsl + webgpu mapping, starter tokens)`); console.log(` - src/Game.js (Timer fallback + WebGLRenderer, starter — customize per design-system.md)`); console.log(` - package.json (three ^0.175.0, vite ^7.0.0 baseline-widely-available)`); console.log(` - README.md`); console.log(``); console.log(`Next steps:`); console.log(` cd ${name}`); console.log(` # Option A: open index.html in a browser (no build)`); console.log(` # Option B: npm install && npm run dev (Vite dev server)`); console.log(``); console.log(`⚠️ ANTI-SLOP (REQUIRED): Scaffold starter is GENERIC — do not ship as-is!`); console.log(` → Replace palette/font/HUD/overlay per references/design-system.md before Phase 6`); console.log(` → Example: racing → neon cyan/magenta Orbitron, horror → olive Cormorant`); console.log(`For full game code, see the SKILL.md reference at your skill install location.`);scripts/sync-plugin.js1.9 KBe841bbfb77d1upstream ↗
#!/usr/bin/env node /** * Mirrors root skill files into the marketplace bundle at * plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/. * Usage: npm run sync:plugin (run after ANY edit to SKILL.md, references/, scripts/, assets/) * The bundle is an intentional distribution mirror — not a fork. * test/skill.test.js fails on any drift this script was not run for. */ import * as fs from 'fs'; import * as path from 'path'; import { fileURLToPath } from 'node:url'; const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const DEST = path.join(ROOT, 'plugins', 'bufatechno-webgamedev', 'skills', 'bufatechno-webgamedev'); // Root-relative paths mirrored 1:1 into the bundle. const MIRRORS = [ 'SKILL.md', 'references/', 'scripts/', 'assets/', ]; function copyRecursive(src, dst) { const stat = fs.statSync(src); if (stat.isDirectory()) { fs.mkdirSync(dst, { recursive: true }); for (const entry of fs.readdirSync(src)) { copyRecursive(path.join(src, entry), path.join(dst, entry)); } // Prune bundle orphans: files in dest with no root source. for (const entry of fs.readdirSync(dst)) { if (!fs.existsSync(path.join(src, entry))) { fs.rmSync(path.join(dst, entry), { recursive: true, force: true }); console.log(` pruned orphan: ${path.relative(ROOT, path.join(dst, entry))}`); } } } else { fs.mkdirSync(path.dirname(dst), { recursive: true }); fs.copyFileSync(src, dst); } } let count = 0; for (const rel of MIRRORS) { const src = path.join(ROOT, rel); const dst = path.join(DEST, rel); const before = JSON.stringify(fs.existsSync(dst) ? fs.statSync(dst) : null); copyRecursive(src, dst); count++; console.log(`✓ mirrored ${rel} ${before === 'null' ? '(new)' : ''}`); } console.log(`\nDone: ${count} paths mirrored root → plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/`); console.log('Verify with: npm run test:skill');references/2d-drawing-textures.md16 KBc20d468b4eb2upstream ↗
# 2D Drawing & Procedural Textures Reference Generate textures procedurally via Canvas 2D — no external image files. Keeps your game self-contained (one HTML file ships everything). ## Table of Contents 1. [Basic Noise Texture](#basic-noise-texture) 2. [Wood Texture](#wood-texture) 3. [Stone Texture](#stone-texture) 4. [Brick Texture](#brick-texture) 5. [Grass Texture](#grass-texture) 6. [Metal Texture](#metal-texture) 7. [Pixel-Art Sprite Sheet](#pixel-art-sprite-sheet) 8. [Normal Map from Height Map](#normal-map-from-height-map) 9. [Texture Atlas Builder](#texture-atlas-builder) 10. [CanvasTexture in Three.js](#canvastexture-in-threejs) 11. [DynamicTexture in Babylon.js](#dynamictexture-in-babylonjs) --- ## Basic Noise Texture Foundation for most natural-looking textures. Add small random perturbations to a base color. ```js function makeNoiseTexture(size = 256, baseColor = '#808080', variance = 30) { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); ctx.fillStyle = baseColor; ctx.fillRect(0, 0, size, size); const img = ctx.getImageData(0, 0, size, size); for (let i = 0; i < img.data.length; i += 4) { const n = (Math.random() - 0.5) * variance; img.data[i] = clamp(img.data[i] + n, 0, 255); img.data[i + 1] = clamp(img.data[i + 1] + n, 0, 255); img.data[i + 2] = clamp(img.data[i + 2] + n, 0, 255); } ctx.putImageData(img, 0, 0); return canvas; } function clamp(v, min, max) { return Math.max(min, Math.min(max, v)); } ``` ## Wood Texture Concentric rings with noise — recognizable wood grain. ```js function makeWoodTexture(size = 256) { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); const img = ctx.createImageData(size, size); const baseR = 140, baseG = 90, baseB = 50; for (let y = 0; y < size; y++) { for (let x = 0; x < size; x++) { // Distance from a "center" of the tree ring const dx = x - size * 0.7; const dy = y - size * 0.3; const dist = Math.sqrt(dx * dx + dy * dy); // Ring pattern with sine wave, perturbed by noise const noise = (Math.random() - 0.5) * 4; const ring = Math.sin((dist + noise) * 0.3) * 0.5 + 0.5; // Color: dark ring, light wood between rings const brightness = 0.7 + ring * 0.3; const grain = (Math.random() - 0.5) * 20; const i = (y * size + x) * 4; img.data[i] = clamp(baseR * brightness + grain, 0, 255); img.data[i + 1] = clamp(baseG * brightness + grain, 0, 255); img.data[i + 2] = clamp(baseB * brightness + grain, 0, 255); img.data[i + 3] = 255; } } ctx.putImageData(img, 0, 0); return canvas; } ``` ## Stone Texture Cracks + noise for rocky surfaces. ```js function makeStoneTexture(size = 256) { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); // Base gray ctx.fillStyle = '#888'; ctx.fillRect(0, 0, size, size); // Voronoi-like cells via random points, find nearest point per pixel const points = []; const numPoints = 20; for (let i = 0; i < numPoints; i++) { points.push({ x: Math.random() * size, y: Math.random() * size }); } const img = ctx.getImageData(0, 0, size, size); for (let y = 0; y < size; y++) { for (let x = 0; x < size; x++) { // Find distance to two nearest points const dists = points.map(p => ({ d: Math.hypot(p.x - x, p.y - y), p })); dists.sort((a, b) => a.d - b.d); const d1 = dists[0].d; const d2 = dists[1].d; // Edge = where d1 ≈ d2 (Voronoi boundary) const edge = Math.abs(d1 - d2) < 1.5 ? 0 : 1; const noise = (Math.random() - 0.5) * 30; const v = 100 + (d1 / size * 60) + noise; const finalV = edge === 0 ? 30 : clamp(v, 50, 200); // dark crack or gray stone const i = (y * size + x) * 4; img.data[i] = finalV; img.data[i + 1] = finalV; img.data[i + 2] = finalV; img.data[i + 3] = 255; } } ctx.putImageData(img, 0, 0); return canvas; } ``` ## Brick Texture Tile-based brick layout with mortar lines. ```js function makeBrickTexture(size = 256, brickColor = '#8a4a3a', mortarColor = '#3a3a3a') { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); ctx.fillStyle = mortarColor; ctx.fillRect(0, 0, size, size); const brickW = 64; const brickH = 24; const mortar = 2; const rows = Math.ceil(size / brickH); ctx.fillStyle = brickColor; for (let row = 0; row < rows; row++) { const offsetX = (row % 2) * (brickW / 2); // offset every other row for (let x = -brickW; x < size + brickW; x += brickW) { ctx.fillRect(x + offsetX + mortar, row * brickH + mortar, brickW - mortar * 2, brickH - mortar * 2); } } // Add noise for surface variation const img = ctx.getImageData(0, 0, size, size); for (let i = 0; i < img.data.length; i += 4) { const n = (Math.random() - 0.5) * 20; img.data[i] = clamp(img.data[i] + n, 0, 255); img.data[i + 1] = clamp(img.data[i + 1] + n, 0, 255); img.data[i + 2] = clamp(img.data[i + 2] + n, 0, 255); } ctx.putImageData(img, 0, 0); return canvas; } ``` ## Grass Texture Multiple shades of green with subtle noise — looks like a top-down grass field. ```js function makeGrassTexture(size = 256) { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); // Base green ctx.fillStyle = '#3a6f2a'; ctx.fillRect(0, 0, size, size); // Random grass blades for (let i = 0; i < 4000; i++) { const x = Math.random() * size; const y = Math.random() * size; const len = 2 + Math.random() * 4; const angle = Math.random() * Math.PI; const shade = Math.random(); ctx.strokeStyle = `rgba(${40 + shade * 40}, ${100 + shade * 60}, ${30 + shade * 40}, ${0.5 + Math.random() * 0.5})`; ctx.lineWidth = 1; ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x + Math.cos(angle) * len, y + Math.sin(angle) * len); ctx.stroke(); } return canvas; } ``` ## Metal Texture Brushed metal — anisotropic streaks. ```js function makeMetalTexture(size = 256, color = '#c0c0c0') { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); ctx.fillStyle = color; ctx.fillRect(0, 0, size, size); // Horizontal streaks for (let y = 0; y < size; y++) { const brightness = 0.8 + Math.sin(y * 0.05) * 0.1 + (Math.random() - 0.5) * 0.05; ctx.fillStyle = `rgba(255, 255, 255, ${(brightness - 0.5) * 0.3})`; ctx.fillRect(0, y, size, 1); } // Soft highlights for (let i = 0; i < 10; i++) { const x = Math.random() * size; const y = Math.random() * size; const r = 20 + Math.random() * 40; const grad = ctx.createRadialGradient(x, y, 0, x, y, r); grad.addColorStop(0, 'rgba(255, 255, 255, 0.2)'); grad.addColorStop(1, 'rgba(255, 255, 255, 0)'); ctx.fillStyle = grad; ctx.fillRect(x - r, y - r, r * 2, r * 2); } return canvas; } ``` ## Pixel-Art Sprite Sheet For 2D-style pixel-art sprites in a 3D world (NPCs, pickups, items): ```js function makePixelSprite(size = 16, drawFn) { const canvas = document.createElement('canvas'); canvas.width = canvas.height = size; const ctx = canvas.getContext('2d'); ctx.imageSmoothingEnabled = false; drawFn(ctx, size); return canvas; } // Example: heart pickup const heart = makePixelSprite(16, (ctx, s) => { // Heart pattern (1 = red, 0 = transparent) const pattern = [ '0011100111 00'.replace(/\s/g, ''), '011111011111 0'.replace(/\s/g, ''), '1111111111111 '.trim(), '1111111111111 '.trim(), '011111111111 0'.replace(/\s/g, ''), '0011111111 00'.replace(/\s/g, ''), '000111111 000'.replace(/\s/g, ''), '0000111 0000'.replace(/\s/g, ''), '00000 00000'.replace(/\s/g, ''), ]; // Actually let's use a simpler approach: ctx.fillStyle = '#f33'; // 2 bumps + body ctx.fillRect(2, 4, 4, 4); ctx.fillRect(10, 4, 4, 4); ctx.fillRect(1, 6, 14, 5); ctx.fillRect(3, 11, 10, 3); ctx.fillRect(5, 13, 6, 2); ctx.fillRect(7, 14, 2, 1); ctx.fillStyle = '#faa'; // Highlight ctx.fillRect(3, 5, 2, 2); ctx.fillRect(11, 5, 2, 2); }); ``` For multiple sprites in one atlas (one texture = one material = one draw call): ```js function makeSpriteAtlas(spriteSize = 16, sprites = []) { const cols = Math.ceil(Math.sqrt(sprites.length)); const rows = Math.ceil(sprites.length / cols); const canvas = document.createElement('canvas'); canvas.width = cols * spriteSize; canvas.height = rows * spriteSize; const ctx = canvas.getContext('2d'); ctx.imageSmoothingEnabled = false; sprites.forEach((drawFn, i) => { const x = (i % cols) * spriteSize; const y = Math.floor(i / cols) * spriteSize; ctx.save(); ctx.translate(x, y); drawFn(ctx, spriteSize); ctx.restore(); }); return { canvas, cols, rows, spriteSize }; } // Usage const atlas = makeSpriteAtlas(16, [ // Sprite 0: heart (ctx, s) => { ctx.fillStyle = '#f33'; ctx.fillRect(2, 4, 4, 4); ctx.fillRect(10, 4, 4, 4); ctx.fillRect(1, 6, 14, 5); ctx.fillRect(3, 11, 10, 3); ctx.fillRect(5, 13, 6, 2); ctx.fillRect(7, 14, 2, 1); }, // Sprite 1: coin (ctx, s) => { ctx.fillStyle = '#fd0'; ctx.beginPath(); ctx.arc(s/2, s/2, s/2 - 1, 0, Math.PI*2); ctx.fill(); ctx.fillStyle = '#fa0'; ctx.fillRect(s/2 - 1, 3, 2, s - 6); }, // Sprite 2: sword (ctx, s) => { ctx.fillStyle = '#ccc'; ctx.fillRect(s/2 - 1, 1, 2, 10); ctx.fillStyle = '#840'; ctx.fillRect(s/2 - 3, 11, 6, 2); ctx.fillStyle = '#840'; ctx.fillRect(s/2 - 1, 13, 2, 2); }, ]); ``` ## Normal Map from Height Map Generate normal maps procedurally — for fake surface bumps without expensive geometry: ```js function makeNormalMap(heightCanvas, strength = 2) { const size = heightCanvas.width; const ctx = heightCanvas.getContext('2d'); const heightData = ctx.getImageData(0, 0, size, size).data; const normalCanvas = document.createElement('canvas'); normalCanvas.width = normalCanvas.height = size; const nctx = normalCanvas.getContext('2d'); const normalData = nctx.createImageData(size, size); function height(x, y) { x = (x + size) % size; y = (y + size) % size; const i = (y * size + x) * 4; return heightData[i] / 255; } for (let y = 0; y < size; y++) { for (let x = 0; x < size; x++) { // Sobel filter for normals const hx = (height(x + 1, y) - height(x - 1, y)) * strength; const hy = (height(x, y + 1) - height(x, y - 1)) * strength; const nx = -hx; const ny = -hy; const nz = 1; const len = Math.sqrt(nx*nx + ny*ny + nz*nz); const i = (y * size + x) * 4; normalData.data[i] = (nx / len * 0.5 + 0.5) * 255; normalData.data[i + 1] = (ny / len * 0.5 + 0.5) * 255; normalData.data[i + 2] = (nz / len * 0.5 + 0.5) * 255; normalData.data[i + 3] = 255; } } nctx.putImageData(normalData, 0, 0); return normalCanvas; } // Usage const stoneHeight = makeStoneTexture(256); const stoneNormal = makeNormalMap(stoneHeight, 3); const stoneMat = new THREE.MeshStandardMaterial({ map: new THREE.CanvasTexture(stoneHeight), normalMap: new THREE.CanvasTexture(stoneNormal), roughness: 0.85, }); ``` ## Texture Atlas Builder For sprite-heavy 3D games (e.g., particles, sprites, decals): ```js class TextureAtlas { constructor(spriteSize = 64) { this.spriteSize = spriteSize; this.entries = []; // {name, x, y, w, h} this.maxCols = 16; } add(name, canvas) { const i = this.entries.length; const x = (i % this.maxCols) * this.spriteSize; const y = Math.floor(i / this.maxCols) * this.spriteSize; this.entries.push({ name, x, y, source: canvas }); return i; } build() { const cols = this.maxCols; const rows = Math.ceil(this.entries.length / cols); const canvas = document.createElement('canvas'); canvas.width = cols * this.spriteSize; canvas.height = rows * this.spriteSize; const ctx = canvas.getContext('2d'); for (const e of this.entries) { ctx.drawImage(e.source, e.x, e.y); } return { canvas, entries: this.entries, cols, rows }; } getUV(name) { const e = this.entries.find(x => x.name === name); if (!e) return null; return { u: e.x / (this.maxCols * this.spriteSize), v: e.y / (Math.ceil(this.entries.length / this.maxCols) * this.spriteSize), w: this.spriteSize / (this.maxCols * this.spriteSize), h: this.spriteSize / (Math.ceil(this.entries.length / this.maxCols) * this.spriteSize), }; } } ``` ## CanvasTexture in Three.js ```js import * as THREE from 'three'; function canvasToTexture(canvas, repeat = 1) { const tex = new THREE.CanvasTexture(canvas); tex.wrapS = tex.wrapT = THREE.RepeatWrapping; tex.repeat.set(repeat, repeat); tex.colorSpace = THREE.SRGBColorSpace; // for color maps tex.anisotropy = 4; // sharper at grazing angles return tex; } // Usage const stoneTex = canvasToTexture(makeStoneTexture(256), 4); const stoneMat = new THREE.MeshStandardMaterial({ map: stoneTex, roughness: 0.85, metalness: 0.05, }); ``` For the normal map, **do NOT** set colorSpace — normal maps are linear data: ```js const normalTex = new THREE.CanvasTexture(makeNormalMap(heightCanvas)); normalTex.wrapS = normalTex.wrapT = THREE.RepeatWrapping; // colorSpace stays as default (NoColorSpace / Linear) — DO NOT change ``` ## DynamicTexture in Babylon.js ```js const dynTex = new BABYLON.DynamicTexture('dynTex', { width: 256, height: 256 }, scene, false); const ctx = dynTex.getContext(); // ... draw on ctx ... dynTex.update(); // CRITICAL — uploads canvas to GPU const mat = new BABYLON.PBRMaterial('mat', scene); mat.albedoTexture = dynTex; ``` For normal maps in Babylon: ```js const normalDyn = new BABYLON.DynamicTexture('normal', { width: 256, height: 256 }, scene, false); // draw normal map... normalDyn.update(); normalDyn._texture.invertY = false; // optional mat.bumpTexture = normalDyn; ``` --- ## Combining Textures For richer materials, combine multiple procedural textures: ```js function makeRichStoneMaterial(size = 256) { const colorCanvas = makeStoneTexture(size, '#808080'); const heightCanvas = makeStoneTexture(size, '#888'); // gray noise for height const normalCanvas = makeNormalMap(heightCanvas, 2.5); const roughnessCanvas = makeNoiseTexture(size, '#404040', 30); // darker = rougher return new THREE.MeshStandardMaterial({ map: canvasToTexture(colorCanvas, 4), normalMap: canvasToTexture(normalCanvas, 4), roughnessMap: canvasToTexture(roughnessCanvas, 4), metalness: 0.0, }); } ``` This single material has: - Color variation (stone) - Surface bumps (normal map) - Varying roughness (some parts shiny, some matte) All procedurally generated — no external files. The deliverable stays self-contained. --- ## Common Texture Pitfalls | Bug | Cause | Fix | |---|---|---| | Texture looks blurry | Default minification filter is linear | Set `tex.magFilter = THREE.NearestFilter` for pixel art; `LinearMipmapLinearFilter` for smooth | | Texture looks pixelated at distance | No mipmaps | `tex.minFilter = THREE.LinearMipmapLinearFilter` (default), `tex.generateMipmaps = true` | | Texture seams (tiled) | Texture edge wraps incorrectly | Use seamless tileable noise function — duplicate edge pixels | | Color texture looks washed out | Wrong color space | Set `colorSpace = SRGBColorSpace` for color, leave default for data maps (normal, roughness, AO) | | Texture shows inverted | Canvas Y is top-down, WebGL Y is bottom-up | Set `tex.flipY = true` (default in Three.js, but if you manually uploaded, may need to flip) | | Performance slow with many textures | Each texture is a draw call if material differs | Use one texture atlas for all sprites | | Texture looks dark/wrong on PBR material | Missing roughness/metalness, or wrong values | Set `roughness: 0.5, metalness: 0.5` as starting point, then tune | | Normal map looks inverted | Y-flip needed | In fragment shader: `n.y = -n.y` OR swap normal map's green channel | --- End of 2D drawing & texture reference. For asset loading (GLTF, GLB, audio files), see `references/asset-pipeline.md`.references/animation-system.md7.0 KBb481c142e2a5upstream ↗
# Animation System — Professional Guide (Three.js + Babylon.js) Covers project animation from basic mixer to skeletal/morph/blending/retargeting. Production patterns 2026. ## 1. Core Concepts (Three.js) Three components: `AnimationClip` (keyframe container) → `AnimationMixer` (plays on root) → `AnimationAction` (play/stop/weight control). ### Timer vs Clock (r183+) `THREE.Timer` is preferred over `THREE.Clock` since r183: pauses when tab hidden, connects via `timer.connect(document)`. ```js import * as THREE from 'three'; const timer = new THREE.Timer(); timer.connect(document); let mixer; function animate(){ requestAnimationFrame(animate); const delta = timer.getDelta(); // pause-aware mixer?.update(delta); renderer.render(scene, camera); } ``` Fallback: `new THREE.Clock()` + `clock.getDelta()`. Always clamp `Math.min(delta,0.1)`. ### Clock/Mixer file structure - `src/animation/Mixer.js` — owns mixers, updates with fixed or delta. - `src/animation/Skeleton.js` — bone helpers. - `src/animation/BlendTree.js` — weight logic. ## 2. GLTF Skeletal Animation (Load & Play) ```js import * as THREE from 'three'; import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; let mixer; const loader = new GLTFLoader(); loader.load('assets/character.glb', (gltf)=>{ const model = gltf.scene; scene.add(model); model.traverse(o=>{ if(o.isMesh){ o.castShadow=true; o.frustumCulled=false; }}); setupAnimations(gltf, model); }); function setupAnimations(gltf, model){ if(!gltf.animations.length) return; mixer = new THREE.AnimationMixer(model); // Play first clip const clip = gltf.animations[0]; const action = mixer.clipAction(clip); action.play(); // Or by name // const walk = THREE.AnimationClip.findByName(gltf.animations,'Walk'); // mixer.clipAction(walk).play(); } ``` **Common glTF export notes (Blender):** - Apply transforms, ensure skeleton root has no non-uniform scale. - Export `Animations` checked, NLA strips or Actions. - Use `gltf-transform` to compress: `gltf-transform draco input.glb output.glb` + `gltf-transform ktx2`. ## 3. Skeleton & Bone Manipulation ```js // Find skinned mesh let skinned; model.traverse(o=>{ if(o.isSkinnedMesh) skinned=o; }); console.log(skinned.skeleton.bones.map(b=>b.name)); // SkeletonHelper debug const helper = new THREE.SkeletonHelper(model); scene.add(helper); // Rotate head bone programmatically (e.g., look-at) const head = skinned.skeleton.getBoneByName('mixamorig_Head'); function lookAt(target){ head.lookAt(target); // or manual quaternion } // Combine with mixer: update bone after mixer.update() to override // Attach weapon to hand bone const hand = skinned.skeleton.getBoneByName('mixamorig_RightHand'); const weapon = new THREE.Mesh(new THREE.BoxGeometry(0.1,0.4,0.05), new THREE.MeshStandardMaterial({color:0x888})); hand.add(weapon); weapon.position.set(0.05,0,0); weapon.rotation.set(0,0,Math.PI/2); ``` ## 4. Morph Targets (Facial / Blend Shapes) ```js // Dictionary maps name → index console.log(mesh.morphTargetDictionary); // { mouthOpen:0, eyeBlink:1 } console.log(mesh.morphTargetInfluences); // [0,0] // Set by name function setMorph(name, value){ const idx = mesh.morphTargetDictionary[name]; if(idx!==undefined) mesh.morphTargetInfluences[idx]=THREE.MathUtils.clamp(value,0,1); } // Animate procedurally let t=0; function updateMorph(delta){ t+=delta; setMorph('mouthOpen', (Math.sin(t*3)+1)/2 *0.8); } // Via NumberKeyframeTrack (in clip) const track = new THREE.NumberKeyframeTrack( '.morphTargetInfluences[0]', [0,0.5,1], [0,1,0] ); const clip = new THREE.AnimationClip('blink',1,[track]); mixer.clipAction(clip).play(); ``` Blender morph = Shape Keys. Export `Shape Keys` + `Apply Modifiers`. ## 5. Blending & Layering ### Weight blending (idle/walk/run by speed) ```js const idle = mixer.clipAction(THREE.AnimationClip.findByName(anims,'Idle')); const walk = mixer.clipAction(THREE.AnimationClip.findByName(anims,'Walk')); const run = mixer.clipAction(THREE.AnimationClip.findByName(anims,'Run')); [idle,walk,run].forEach(a=>{a.play(); a.setEffectiveWeight(0);}); function updateLocomotion(speed){ // 0 idle, 1 walk, 2 run const wIdle = THREE.MathUtils.clamp(1 - speed*1.5,0,1); const wWalk = speed<1 ? speed : 2 - speed; const wRun = THREE.MathUtils.clamp(speed-1,0,1); idle.setEffectiveWeight(wIdle); walk.setEffectiveWeight(wWalk); run .setEffectiveWeight(wRun); } ``` ### Additive blending (breath over base pose) ```js import * as THREE from 'three'; const breath = THREE.AnimationClip.findByName(anims,'Breath'); THREE.AnimationUtils.makeClipAdditive(breath); const breathAction = mixer.clipAction(breath); breathAction.setEffectiveWeight(0.3).play(); // Additive clips add deltas, not replace ``` ### Cross-fade ```js function crossFade(from, to, sec=0.3){ from.crossFadeTo(to, sec, false); to.play(); } ``` ### Interpolation modes - `LinearInterpolant` (default) - `CubicInterpolant` via `Smooth` — for quaternion slerp friendly - `DiscreteInterpolant` — step - r183 `BezierInterpolant` — tangent-controlled bezier (check docs/threejs-complete.md for Bezier track creation). ## 6. Babylon.js Animation Babylon uses `Animation` + `AnimationGroup` + skeleton. Retargeting tool 8/9 is no-code. ```js import { SceneLoader, Animation } from '@babylonjs/core'; SceneLoader.ImportMesh('', 'assets/', 'character.glb', scene, (meshes,_,__,anims)=>{ const group = scene.animationGroups[0]; // glTF groups auto-created group.play(true); // Weight blend const idle = scene.getAnimationGroupByName('Idle'); const walk = scene.getAnimationGroupByName('Walk'); idle.weight=1; walk.weight=0; }); // Babylon retargeting (9.0) — map source skeleton → target // Editor: Animation Retargeting Tool imports two .glb, maps bones via name heuristic, exports retargeted clip // Code: BABYLON.AnimationGroup.MakeAdditive, BABYLON.AnimationGroup retarget via `retargetAnimation` ``` ## 7. IK Basics (Three.js simple, Babylon full) Three has no built-in IK — use `three/addons/animation/CCDIKSolver.js` or `fabrik` libs: ```js import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js'; // After model load with IK bone chain exported from Blender/BVH const ikSolver = new CCDIKSolver(model, iks); // iks = [{target,bones:[...]}] function render(){ ikSolver.update(); } ``` Babylon: `BoneIKController` + `BoneLookController`. ## 8. Best Practices - **One mixer per character root** — not per mesh. Share mixer only if same skeleton. - **Update mixer in fixed timestep OR delta consistently** — never mix 1/60 and delta for same mixer. - **FrustumCulled false** for SkinnedMesh until bounding box validated, else culled when skeleton extends. - **Dispose**: `mixer.uncacheClip(clip); mixer.uncacheRoot(root);` + `helper.dispose()`. - **Performance**: bake 60fps; compress via `gltf-transform dedup prune draco`. Use `InstancedMesh` for crowds with baked vertex animation via texture (VAT) — see performance-optimization.md. - **Retargeting**: keep bone name convention `mixamorig_Bone` identical across characters to reuse clips without tool.references/asset-pipeline.md13 KB8ce2ab0dcb0cupstream ↗
# Asset Pipeline Reference Loading external 3D models, textures, audio when procedural generation isn't enough. Covers GLTF/GLB, Draco compression, KTX2 textures, async loading screens, caching, and fallbacks. ## Table of Contents 1. [When to Use External Assets](#when-to-use-external-assets) 2. [GLTF/GLB Loading (Three.js)](#gltfglb-loading-threejs) 3. [GLTF/GLB Loading (Babylon.js)](#gltfglb-loading-babylonjs) 4. [Draco Mesh Compression](#draco-mesh-compression) 5. [KTX2 Texture Compression](#ktx2-texture-compression) 6. [Async Loading with Progress Bar](#async-loading-with-progress-bar) 7. [Asset Caching](#asset-caching) 8. [Fallback Primitives](#fallback-primitives) 9. [Audio File Loading](#audio-file-loading) 10. [Sprite Sheet Loading](#sprite-sheet-loading) 11. [Hot-Reloading Assets (Dev Only)](#hot-reloading-assets-dev-only) --- ## When to Use External Assets Use procedural generation (see `procedural-generation.md` and `2d-drawing-textures.md`) when: - You want a self-contained single-file deliverable - The game has simple/abstract visuals (low-poly, blocky, geometric) - You're prototyping Use external assets when: - The user supplied specific 3D models (characters, vehicles, environments) - You need photo-realistic textures (skyboxes, character faces) - You need pre-recorded music/voice - The game has hand-authored animations (character rigs) For one-shot deliverables, prefer procedural whenever possible — external files require either (a) bundling them in the deliverable (larger, more files), or (b) loading from a CDN (network dependency, won't work offline). ## GLTF/GLB Loading (Three.js) GLB (binary GLTF) is the modern standard for 3D assets on the web. Single file containing mesh, materials, animations, skeletons, textures. ```js import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; const loader = new GLTFLoader(); loader.load( './model.glb', (gltf) => { const model = gltf.scene; // Configure for game use model.traverse((node) => { if (node.isMesh) { node.castShadow = true; node.receiveShadow = true; // Some models need material tweaks for game lighting if (node.material) { node.material.envMapIntensity = 1.0; if (node.material.map) node.material.map.colorSpace = THREE.SRGBColorSpace; } } }); // Scale if needed (GLTF is in meters by convention, but some models aren't) model.scale.setScalar(1); // Center on origin (if model was authored offset) const box = new THREE.Box3().setFromObject(model); const center = box.getCenter(new THREE.Vector3()); model.position.x -= center.x; model.position.z -= center.z; model.position.y -= box.min.y; // sit on ground scene.add(model); // Play first animation if (gltf.animations.length > 0) { const mixer = new THREE.AnimationMixer(model); const action = mixer.clipAction(gltf.animations[0]); action.play(); gameMixers.push(mixer); // store to update per frame } }, (progress) => { console.log('Loading:', (progress.loaded / progress.total * 100).toFixed(1) + '%'); }, (error) => { console.error('GLTF load failed:', error); } ); ``` For loading multiple models with Promise-based API: ```js function loadModel(url) { return new Promise((resolve, reject) => { loader.load(url, resolve, undefined, reject); }); } async function loadAll() { const [player, enemy1, enemy2] = await Promise.all([ loadModel('./player.glb'), loadModel('./enemy1.glb'), loadModel('./enemy2.glb'), ]); scene.add(player.scene, enemy1.scene, enemy2.scene); } ``` ## GLTF/GLB Loading (Babylon.js) ```js import { SceneLoader } from '@babylonjs/core/Loading/sceneLoader'; import '@babylonjs/loaders/glTF'; SceneLoader.ImportMeshAsync('', './', 'model.glb', scene).then((result) => { const model = result.meshes[0]; model.scaling = new BABYLON.Vector3(1, 1, 1); result.meshes.forEach((m) => { m.receiveShadows = true; // Shadows only for opaque meshes (skip transparent leaves, etc.) if (m.material && !m.material.alpha) m.castShadows = true; }); if (result.animationGroups.length > 0) { result.animationGroups[0].start(true); } }); ``` ## Draco Mesh Compression GLB files with Draco compression are 5-10x smaller. Required for any model with >100k triangles. ```js import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; const draco = new DRACOLoader(); draco.setDecoderPath('https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/draco/gltf/'); // or self-host: draco.setDecoderPath('./libs/draco/gltf/'); const loader = new GLTFLoader(); loader.setDRACOLoader(draco); // Now load any Draco-compressed GLB normally. ``` For Babylon.js: ```js import '@babylonjs/loaders/draco'; // Then load normally with SceneLoader. ``` **Note**: Draco adds ~150 KB of decoder (loaded once from CDN). Worth it for any deliverable that ships real 3D models. ## KTX2 Texture Compression KTX2 with Basis Universal gives GPU-native compressed textures — 4-10x smaller in VRAM, decoded on GPU (no upload decompression). The right format for any texture shipped in a model. ```js import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; const ktx2 = new KTX2Loader(); ktx2.setTranscoderPath('https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/basis/'); // Detect capabilities ktx2.detectSupport(renderer); const loader = new GLTFLoader(); loader.setKTX2Loader(ktx2); // GLB files that use KTX2 textures now load with GPU-compressed textures. ``` Without KTX2 setup, Three.js tries to use the original PNG/JPG textures in the GLB (works but slower and larger VRAM). For Babylon.js, KTX2 support is built into the glTF loader — no setup needed beyond importing the loaders package. ## Async Loading with Progress Bar For games with many assets, show a loading screen: ```js class AssetManager { constructor() { this.items = []; } add(name, loader, url) { this.items.push({ name, loader, url }); return this; } async loadAll(onProgress) { const results = {}; let loaded = 0; for (const item of this.items) { results[item.name] = await new Promise((resolve, reject) => { item.loader.load(item.url, resolve, (e) => { loaded += e.loaded / (e.total || 1); onProgress?.(loaded / this.items.length, item.name); }, reject); }); } return results; } } const loadingScreen = new LoadingScreen(); // see audio-ui-systems.md const assets = new AssetManager() .add('player', gltfLoader, './assets/player.glb') .add('enemy', gltfLoader, './assets/enemy.glb') .add('terrain', textureLoader, './assets/terrain.jpg') .add('skybox', cubeTextureLoader, './assets/skybox/'); await assets.loadAll((progress, name) => { loadingScreen.setProgress(progress * 100, 'Loading ' + name); }); loadingScreen.hide(); scene.add(assets.player.scene); ``` ## Asset Caching Don't reload the same model multiple times (e.g., 100 enemies sharing one model): ```js class ModelCache { constructor() { this.cache = new Map(); this.loader = new GLTFLoader(); } async get(url) { if (this.cache.has(url)) { // Clone the cached scene (cheap) return this.cache.get(url).clone(); } return new Promise((resolve, reject) => { this.loader.load(url, (gltf) => { this.cache.set(url, gltf.scene); resolve(gltf.scene.clone()); }, undefined, reject); }); } } const cache = new ModelCache(); const enemies = []; for (let i = 0; i < 100; i++) { const model = await cache.get('./enemy.glb'); model.position.set(Math.random() * 50, 0, Math.random() * 50); scene.add(model); enemies.push(model); } ``` `.clone()` creates a new Object3D hierarchy but shares geometry/material/texture GPU buffers. Memory-cheap, render-fast (geometry draw call is per-mesh, but GPU buffer is shared). For animation, each clone needs its own AnimationMixer: ```js const mixer = new THREE.AnimationMixer(model); const clip = gltf.animations[0]; mixer.clipAction(clip).play(); mixers.push(mixer); ``` ## Fallback Primitives If the model fails to load (network error, wrong format), don't let the game break. Substitute a placeholder. ```js function loadModelWithFallback(url, fallback = 'box') { return new Promise((resolve) => { loader.load( url, (gltf) => resolve(gltf.scene), undefined, (error) => { console.warn('Model load failed, using fallback:', url, error); if (fallback === 'box') { resolve(new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 0xff00ff }) // magenta = "missing model" )); } else if (fallback === 'capsule') { resolve(new THREE.Mesh( new THREE.CapsuleGeometry(0.5, 1, 4, 8), new THREE.MeshStandardMaterial({ color: 0xff00ff }) )); } } ); }); } // Usage const playerModel = await loadModelWithFallback('./player.glb', 'capsule'); ``` Magenta is the universal "missing asset" color — game devs recognize it instantly. Use it for all fallbacks so missing assets are visually obvious. ## Audio File Loading For longer audio (music, voice), use file-based loading instead of procedural: ```js class AudioLoader { constructor(audioContext) { this.ctx = audioContext; this.cache = new Map(); } async load(url) { if (this.cache.has(url)) return this.cache.get(url); const response = await fetch(url); const buffer = await response.arrayBuffer(); const audioBuffer = await this.ctx.decodeAudioData(buffer); this.cache.set(url, audioBuffer); return audioBuffer; } play(buffer, options = {}) { const src = this.ctx.createBufferSource(); src.buffer = buffer; src.loop = options.loop || false; src.playbackRate.value = options.rate || 1; const gain = this.ctx.createGain(); gain.gain.value = options.volume ?? 1; src.connect(gain).connect(this.ctx.destination); src.start(0, options.offset || 0); return { src, gain }; } } // Usage const music = await audioLoader.load('./music.mp3'); audioLoader.play(music, { loop: true, volume: 0.4 }); ``` For sound effects, prefer procedural (see `audio-ui-systems.md`) — instant start, no decode overhead, smaller deliverable. ## Sprite Sheet Loading For 2D-style sprites loaded from a PNG: ```js async function loadSpriteSheet(url, frameWidth, frameHeight) { return new Promise((resolve, reject) => { new THREE.TextureLoader().load(url, (tex) => { tex.magFilter = THREE.NearestFilter; tex.minFilter = THREE.NearestFilter; tex.colorSpace = THREE.SRGBColorSpace; resolve({ texture: tex, frameWidth, frameHeight }); }, undefined, reject); }); } function frameUV(sheet, frameIndex) { const cols = sheet.texture.image.width / sheet.frameWidth; const x = (frameIndex % cols) / cols; const y = Math.floor(frameIndex / cols) / (sheet.texture.image.height / sheet.frameHeight); return { x, y, w: 1 / cols, h: sheet.frameHeight / sheet.texture.image.height }; } // Sprite that animates through frames class AnimatedSprite { constructor(sheet, frames, fps = 12) { this.sheet = sheet; this.frames = frames; // [0, 1, 2, 1] for a 4-frame walk cycle this.fps = fps; this.frameTime = 0; this.currentFrame = 0; this.mat = new THREE.SpriteMaterial({ map: sheet.texture }); this.sprite = new THREE.Sprite(this.mat); } update(dt) { this.frameTime += dt; if (this.frameTime > 1 / this.fps) { this.currentFrame = (this.currentFrame + 1) % this.frames.length; this.frameTime = 0; const uv = frameUV(this.sheet, this.frames[this.currentFrame]); this.mat.map.offset.set(uv.x, uv.y); this.mat.map.repeat.set(uv.w, uv.h); this.mat.map.needsUpdate = true; } } } ``` ## Hot-Reloading Assets (Dev Only) For development: reload assets at runtime without restarting the game: ```js function setupHotReload() { const watcher = new EventSource('/dev/reload'); watcher.onmessage = (e) => { const { path } = JSON.parse(e.data); // Reload just that asset if (path.endsWith('.glb')) { // Find the model with this URL, dispose it, load fresh // ... implementation depends on your asset system } }; } ``` Or just listen for window focus and reload everything (quick & dirty): ```js window.addEventListener('focus', () => { if (DEBUG) { // Reload all textures scene.traverse((obj) => { if (obj.material?.map) obj.material.map.needsUpdate = true; }); } }); ``` --- ## Asset Pipeline Best Practices 1. **Compress everything**: GLB with Draco, textures with KTX2. 10x smaller downloads. 2. **Cache aggressively**: never reload the same asset twice. 3. **Show progress**: a black screen for 10 seconds feels broken; a progress bar feels professional. 4. **Have fallbacks**: network fails, file paths are wrong, formats mismatch. Always degrade gracefully. 5. **Don't block the main thread**: GLB parsing can take 100ms+ for large models. Show a loading screen. 6. **Prefer procedural for one-shot deliverables**: keeps the HTML file self-contained. --- End of asset pipeline reference. For testing and deployment, see `references/testing-deployment.md`.references/audio-ui-systems.md19 KBe5179461da77upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/babylonjs-complete.md24 KB2851ac5fc493upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/debugging.md5.7 KBfc228eb632c9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/design-system.md6.6 KB69e39db8beeaupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/external-libraries.md12 KB739fcbb078b7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/fps-game-template.md30 KBd0c86f8b7a6eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/game-architecture.md14 KB072b49a6a812upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/input-controls.md17 KBf63762317846upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/multiplayer-networking.md4.8 KB080feaa3b1bcupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/performance-optimization.md15 KBabfbbc40b5f6upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/physics-collision.md16 KB3ddcd64f9c13upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/platformer-template.md11 KB20675a9db75dupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/procedural-generation.md18 KB3476c4e21ae0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/testing-deployment.md15 KBaf0c71f5271eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/third-person-template.md11 KBdf4025c819f0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/threejs-complete.md22 KBe772d3d741beupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/vfx-particles.md8.2 KB2bfe2668c2c6upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/voxel-game-template.md40 KBb0e78483a897upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
references/webxr-vr.md3.8 KB977ba0217c81upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/images/btc.jpeg11 KB6857936049e4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/images/qris.jpeg212 KB165a39dee873upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/pwa/manifest.json466 B94ab902304ecupstream ↗
{ "name": "BUFATECHNO Web Game", "short_name": "BTGame", "description": "Professional 3D web game — BUFATECHNO WEB GAME DEV v2", "start_url": "./index.html", "display": "standalone", "background_color": "#000000", "theme_color": "#55ccff", "orientation": "landscape", "icons": [ { "src": "./public/icon-192.png", "sizes": "192x192", "type": "image/png" }, { "src": "./public/icon-512.png", "sizes": "512x512", "type": "image/png" } ] }assets/pwa/sw.js868 Bd7abeb4fdae7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/templates/babylonjs/index.html4.5 KBb384131b29cbupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/templates/babylonjs/package.json610 B814930dfc3ceupstream ↗
{ "name": "babylonjs-game-template", "version": "0.1.0", "type": "module", "description": "Babylon.js game template — BUFATECHNO WEB GAME DEV v2", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "dependencies": { "@babylonjs/core": "^8.15.0", "@babylonjs/gui": "^8.15.0", "@babylonjs/loaders": "^8.15.0", "@babylonjs/materials": "^8.15.0", "@babylonjs/havok": "^1.3.9" }, "optionalDependencies": { "gsap": "^3.12.0", "howler": "^2.2.0", "nipplejs": "^0.10.0" }, "devDependencies": { "vite": "^7.0.0" } }assets/templates/babylonjs/vite.config.js329 B40e6e7471ccaupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/templates/threejs/index.html5.6 KB86a116bf193eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/templates/threejs/package.json514 B70de33d4f1b1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
assets/templates/threejs/vite.config.js344 B8839bfbb5c05upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
.claude-plugin/marketplace.json1.0 KB22eb112b7716upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
.gitattributes66 Bdfe0770424b2upstream ↗
# Auto detect text files and perform LF normalization * text=auto.gitignore2.8 KBfd5cb747df05upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
.zcode-plugin/marketplace.json574 Bc22cf15a0c10upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
CHANGELOG.md9.0 KB104ea06ef523upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
INSTALL.md12 KBc34deb57faa5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
LICENSE1.0 KB19d41b90c9ddupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
package.json1.6 KB527df789f7c1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/.claude-plugin/plugin.json684 Baacea0604983upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/.zcode-plugin/plugin.json548 B718f98e16f02upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/images/btc.jpeg11 KB6857936049e4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/images/qris.jpeg212 KB165a39dee873upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/pwa/manifest.json466 B94ab902304ecupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/pwa/sw.js868 Bd7abeb4fdae7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/babylonjs/index.html4.5 KBb384131b29cbupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/babylonjs/package.json610 B814930dfc3ceupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/babylonjs/vite.config.js329 B40e6e7471ccaupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/threejs/index.html5.6 KB86a116bf193eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/threejs/package.json514 B70de33d4f1b1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/assets/templates/threejs/vite.config.js344 B8839bfbb5c05upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/2d-drawing-textures.md16 KBc20d468b4eb2upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/animation-system.md7.0 KBb481c142e2a5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/asset-pipeline.md13 KB8ce2ab0dcb0cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/audio-ui-systems.md19 KBe5179461da77upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/babylonjs-complete.md24 KB2851ac5fc493upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/debugging.md5.7 KBfc228eb632c9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/design-system.md6.6 KB69e39db8beeaupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/external-libraries.md12 KB739fcbb078b7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/fps-game-template.md30 KBd0c86f8b7a6eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/game-architecture.md14 KB072b49a6a812upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/input-controls.md17 KBf63762317846upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/multiplayer-networking.md4.8 KB080feaa3b1bcupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/performance-optimization.md15 KBabfbbc40b5f6upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/physics-collision.md16 KB3ddcd64f9c13upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/platformer-template.md11 KB20675a9db75dupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/procedural-generation.md18 KB3476c4e21ae0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/testing-deployment.md15 KBaf0c71f5271eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/third-person-template.md11 KBdf4025c819f0upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/threejs-complete.md22 KBe772d3d741beupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/vfx-particles.md8.2 KB2bfe2668c2c6upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/voxel-game-template.md40 KBb0e78483a897upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/references/webxr-vr.md3.8 KB977ba0217c81upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/scripts/scaffold-babylonjs.js7.4 KBe0a8d77f49ccupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/scripts/scaffold-threejs.js8.4 KB4c71fabffdb1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
plugins/bufatechno-webgamedev/skills/bufatechno-webgamedev/scripts/sync-plugin.js1.9 KBe841bbfb77d1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
screenshoot-example/1.png931 KB8e05c23b1d17upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
screenshoot-example/2.png866 KB7ea5551d9167upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/scaffold.test.js3.3 KB10a0ceebd41bupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
test/skill.test.js6.3 KBda7287304164upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/bufatechno-bufatechno-webgamedev.md