evomeme-dev 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +247 -0
  2. package/bin/evomeme +28 -0
  3. package/dist/canvas-public/app.js +5857 -0
  4. package/dist/canvas-public/cycle-detect.js +166 -0
  5. package/dist/canvas-public/index.html +395 -0
  6. package/dist/canvas-public/sequence-sheet.js +59 -0
  7. package/dist/canvas-public/smart-split.js +185 -0
  8. package/dist/canvas-public/styles.css +2276 -0
  9. package/dist/canvas-public/vendor/painterro.min.js +3 -0
  10. package/dist/index.js +25586 -0
  11. package/package.json +69 -0
  12. package/skills/evomeme-cloud-fs/SKILL.md +176 -0
  13. package/skills/evomeme-cloud-fs/agents/openai.yaml +7 -0
  14. package/skills/evomeme-cover/SKILL.md +132 -0
  15. package/skills/evomeme-cover/agents/openai.yaml +7 -0
  16. package/skills/evomeme-game-maker/SKILL.md +214 -0
  17. package/skills/evomeme-game-maker/agents/openai.yaml +4 -0
  18. package/skills/evomeme-login/SKILL.md +92 -0
  19. package/skills/evomeme-login/agents/openai.yaml +7 -0
  20. package/skills/evomeme-native-bridge-sdk/SKILL.md +286 -0
  21. package/skills/evomeme-native-bridge-sdk/agents/openai.yaml +7 -0
  22. package/skills/evomeme-tos-upload/SKILL.md +46 -0
  23. package/skills/evomeme-tos-upload/agents/openai.yaml +4 -0
  24. package/skills/game-art/SKILL.md +121 -0
  25. package/skills/game-art/agents/openai.yaml +7 -0
  26. package/skills/game-asset-image-generator/SKILL.md +104 -0
  27. package/skills/game-asset-image-generator/agents/openai.yaml +7 -0
  28. package/skills/game-asset-image-generator/references/background.md +32 -0
  29. package/skills/game-asset-image-generator/references/static-game-assets.md +38 -0
  30. package/skills/game-audio/SKILL.md +82 -0
  31. package/skills/game-audio/agents/openai.yaml +4 -0
  32. package/skills/game-audio/references/bgm-cdn.md +127 -0
  33. package/skills/game-audio/references/sfx-cdn.md +77 -0
  34. package/skills/game-demo/SKILL.md +103 -0
  35. package/skills/game-demo/agents/openai.yaml +7 -0
  36. package/skills/game-maker/SKILL.md +111 -0
  37. package/skills/game-maker/agents/openai.yaml +4 -0
  38. package/skills/game-test/SKILL.md +58 -0
  39. package/skills/game-test/agents/openai.yaml +7 -0
  40. package/skills/game-test/references/checklists/playtest-qa.md +12 -0
  41. package/skills/game-ui/SKILL.md +169 -0
  42. package/skills/game-ui/agents/openai.yaml +4 -0
  43. package/skills/game-ui/references/checklists/game-ui-quality.md +14 -0
  44. package/skills/game-ui/references/checklists/hud-readability.md +12 -0
  45. package/skills/game-ui/references/checklists/mobile-input.md +12 -0
  46. package/skills/game-ui/references/checklists/responsive-ui-fit.md +12 -0
  47. package/skills/game-ui/references/ui-patterns.md +140 -0
  48. package/skills/game-ui/references/ui-prompt-templates.md +63 -0
  49. package/skills/phaser-2d-game/SKILL.md +127 -0
  50. package/skills/phaser-2d-game/agents/openai.yaml +7 -0
  51. package/skills/phaser-2d-game/references/engine-performance.md +64 -0
  52. package/skills/phaser-2d-game/references/engine-physics.md +139 -0
  53. package/skills/phaser-2d-game/references/engine-runtime.md +129 -0
  54. package/skills/phaser-2d-game/references/engine-spritesheets.md +99 -0
  55. package/skills/phaser-2d-game/references/engine-tilemaps.md +80 -0
  56. package/skills/phaser-2d-game/references/file-structure.md +94 -0
  57. package/skills/phaser-2d-graphics-builder/SKILL.md +68 -0
  58. package/skills/phaser-2d-graphics-builder/agents/openai.yaml +7 -0
  59. package/skills/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-1.jpeg +0 -0
  60. package/skills/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-2.jpeg +0 -0
  61. package/skills/phaser-2d-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
  62. package/skills/phaser-2d-graphics-builder/references/checklists/compose-quality.md +10 -0
  63. package/skills/phaser-2d-graphics-builder/references/checklists/performance-safe-visual-detail.md +9 -0
  64. package/skills/phaser-2d-graphics-builder/references/checklists/premium-game-quality-gate.md +15 -0
  65. package/skills/phaser-2d-graphics-builder/references/checklists/sprite-quality.md +10 -0
  66. package/skills/phaser-2d-graphics-builder/references/checklists/technical-art-quality.md +9 -0
  67. package/skills/phaser-2d-graphics-builder/references/checklists/visual-scorecard.md +9 -0
  68. package/skills/phaser-2d-graphics-builder/references/compose-recipes.md +71 -0
  69. package/skills/phaser-2d-graphics-builder/references/graphics-prompt-templates.md +33 -0
  70. package/skills/phaser-2d-graphics-builder/references/implementation-blueprint.md +82 -0
  71. package/skills/phaser-2d-graphics-builder/references/sprite-recipes.md +90 -0
  72. package/skills/phaser-2d-graphics-builder/references/technical-art.md +67 -0
  73. package/skills/phaser-2d-graphics-builder/references/vfx-recipes.md +67 -0
  74. package/skills/phaser-2d-graphics-builder/references/visual-scorecard.md +129 -0
  75. package/skills/threejs-3d-game/SKILL.md +113 -0
  76. package/skills/threejs-3d-game/agents/openai.yaml +7 -0
  77. package/skills/threejs-3d-game/references/engine-asset-pipeline.md +116 -0
  78. package/skills/threejs-3d-game/references/engine-audio.md +70 -0
  79. package/skills/threejs-3d-game/references/engine-input-camera.md +84 -0
  80. package/skills/threejs-3d-game/references/engine-performance.md +96 -0
  81. package/skills/threejs-3d-game/references/engine-physics.md +142 -0
  82. package/skills/threejs-3d-game/references/engine-runtime.md +199 -0
  83. package/skills/threejs-3d-game/references/file-structure.md +353 -0
  84. package/skills/threejs-aaa-graphics-builder/SKILL.md +62 -0
  85. package/skills/threejs-aaa-graphics-builder/agents/openai.yaml +7 -0
  86. package/skills/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-1.jpg +0 -0
  87. package/skills/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-2.jpg +0 -0
  88. package/skills/threejs-aaa-graphics-builder/assets/scorecard-anchors/scene-3.jpg +0 -0
  89. package/skills/threejs-aaa-graphics-builder/references/checklists/aaa-game-quality-gate.md +23 -0
  90. package/skills/threejs-aaa-graphics-builder/references/checklists/aaa-visual-scorecard.md +19 -0
  91. package/skills/threejs-aaa-graphics-builder/references/checklists/material-lighting-quality.md +14 -0
  92. package/skills/threejs-aaa-graphics-builder/references/checklists/performance-safe-visual-detail.md +14 -0
  93. package/skills/threejs-aaa-graphics-builder/references/checklists/procedural-model-quality.md +15 -0
  94. package/skills/threejs-aaa-graphics-builder/references/checklists/technical-art-quality.md +17 -0
  95. package/skills/threejs-aaa-graphics-builder/references/graphics-prompt-templates.md +236 -0
  96. package/skills/threejs-aaa-graphics-builder/references/implementation-blueprint.md +161 -0
  97. package/skills/threejs-aaa-graphics-builder/references/model-recipes.md +146 -0
  98. package/skills/threejs-aaa-graphics-builder/references/render-recipes.md +90 -0
  99. package/skills/threejs-aaa-graphics-builder/references/shader-cookbook.md +292 -0
  100. package/skills/threejs-aaa-graphics-builder/references/technical-art.md +167 -0
  101. package/skills/threejs-aaa-graphics-builder/references/visual-scorecard.md +147 -0
@@ -0,0 +1,67 @@
1
+ # VFX Recipes (Phaser 2D)
2
+
3
+ Event-driven visual effects that clarify game state. Load only after sprites and compose are readable. Core rule still applies: FX never substitutes for authored art.
4
+
5
+ Cross-link: hand-feel timing principles in `../game-designer/references/game-feel.md`; UI motion in `../game-art/references/animation-specs.md`. This file is **in-world / camera FX** for Phaser.
6
+
7
+ ## Principles
8
+
9
+ 1. **One trigger → one readable beat.** Prefer a single strong burst over layered noise.
10
+ 2. **Severity scale.** Pickup < hit < kill < fail/clear. Strongest events must still leave the next decision visible.
11
+ 3. **Pool everything.** No allocating emitters per bullet in `update`.
12
+ 4. **Sync with audio when present.** Same frame as SFX when `game-audio` is wired.
13
+ 5. **No ambient filler** to hide empty Far layers.
14
+
15
+ ## Recipe Table
16
+
17
+ | Event | Primary FX | Duration | Notes |
18
+ | --- | --- | --- | --- |
19
+ | Light confirm (UI-adjacent in world) | Small scale pop + brief spark | 100–200ms | Keep off HUD DOM |
20
+ | Pickup / coin | Radial burst (8–16 particles) + optional arc to HUD anchor | 200–350ms | High contrast; don’t blanket Play |
21
+ | Hit (player) | White/red flash on sprite + tiny camera shake | 80–120ms | Invuln blink separate from flash |
22
+ | Hit (enemy) | Impact ring or directional sparks + hitstop 1–2 frames | 100–180ms | Direction from attack vector |
23
+ | Block / parry | Sharp spark + short freeze | 80–150ms | Distinct from hurt |
24
+ | Dash / boost | Motion streaks or afterimage (2–3 ghosts) | During dash | Cap ghosts; fade quick |
25
+ | Death / explode | Larger burst + brief screen flash ≤30% alpha | 300–500ms | Then remove clutter |
26
+ | Spawn | Poof / ring expand | 200–300ms | Telegraph if hostile |
27
+ | Charge telegraph | Pulse outline / growing warning glyph | Wind-up length | Must be readable before damage |
28
+ | Zone warning | Edge vignette or floor decal pulse | While zone active | Center Play stays clear |
29
+ | Combo / milestone | Short celebratory burst + optional zoom punch | 250–400ms | Don’t stack with death FX |
30
+ | Fail / soft lock | Gray flash or desat pulse | 200ms | Not seizure-level strobe |
31
+
32
+ ## Implementation Notes (Phaser)
33
+
34
+ - Prefer `this.add.particles` with preconfigured `ParticleEmitter` reused via pools, or a small `VfxSystem.burst(kind, x, y, dir?)` API.
35
+ - Sprite flash: tween `setTintFill` / short `setAlpha` blink; clear tint on complete.
36
+ - Afterimages: spawn faded copies at depth just below hero; auto-destroy.
37
+ - Screen flash: camera-fixed Rectangle or Image at Screen FX depth; fade out; ignore input blocking.
38
+ - Respect `technical-art.md` emitter and particle caps; on spam (machine-gun hits), coalesce to rate-limited bursts.
39
+
40
+ ## Anti-Patterns
41
+
42
+ - Permanent floating dust as “atmosphere” when Far art is missing.
43
+ - Full-screen rainbow particles on every tap.
44
+ - Shake so strong platforms/hazards can’t be aimed at.
45
+ - Additive glow soup that blows out silhouette edges.
46
+ - FX that spawn without a gameplay event (pure decoration loops).
47
+
48
+ ## Severity Ladder (default)
49
+
50
+ ```text
51
+ 0 none
52
+ 1 sprite-only (tint/scale)
53
+ 2 local particles
54
+ 3 local particles + camera punch
55
+ 4 screen flash + particles + punch
56
+ ```
57
+
58
+ Map events to ≤ one ladder step above the previous severity so players learn intensity.
59
+
60
+ ## Checklist
61
+
62
+ Before scoring VFX/motion ≥ 2:
63
+
64
+ - [ ] Every FX kind maps to a gameplay event
65
+ - [ ] Caps documented in technical art brief
66
+ - [ ] Mobile screenshot shows FX without hiding hazards
67
+ - [ ] No ambient-only particle layer required for “premium”
@@ -0,0 +1,129 @@
1
+ # Visual Scorecard (Phaser 2D)
2
+
3
+ Score active-play screenshots, not idle title screens or isolated asset sheets. Prefer **mobile portrait** screenshots; add desktop when the project targets it.
4
+
5
+ Scores are self-assessed against the anchors below, so they drift optimistic. For premium/showcase claims: cite Measured Evidence where possible, run the Fresh-Eyes Review, and compare against packaged anchors before finalizing.
6
+
7
+ ## Calibration Anchors
8
+
9
+ Reference screenshots for score calibration are packaged in `phaser-2d-graphics-builder/assets/scorecard-anchors/`:
10
+
11
+ - `scene-1.jpeg` — score ~1: geometric/simple hero and props on a flat sparse stage, utility HUD.
12
+ - `scene-2.jpeg` — score ~2: authored sprites and scene art, readable state HUD, intentional composition; still short of dense active-play showcase.
13
+ - `scene-3.jpg` — score ~2.5–3: dense layered authored world in active play, varied character family, readable state feedback, cohesive HUD.
14
+
15
+ Before scoring World/environment, Hero/player, Sprite fidelity, Compose, or VFX, **view the anchors** and compare: if your screenshot reads closer to `scene-1.jpeg` than `scene-3.jpg` for that surface, the category is at most a 1–2 regardless of how much code was written.
16
+
17
+ Do not score against title screens, collages, or marketing montages.
18
+
19
+ ## Scoring Scale
20
+
21
+ - 0: Placeholder. Flat colors, missing art, unreadable state, debug UI, or no evidence.
22
+ - 1: Basic styled. Playable and themed, but obvious prototype assets, flat composition, or generic UI.
23
+ - 2: Premium stylized. Authored silhouettes, layered world, readable state, cohesive UI/world, measured performance.
24
+ - 3: Showcase. Strong art direction, memorable hero and world, dense authored detail, excellent readability, polished VFX, diagnostics.
25
+
26
+ ## Categories
27
+
28
+ 1. Art direction.
29
+ - 0: No clear theme.
30
+ - 1: Theme is mostly a palette swap.
31
+ - 2: Theme affects sprites, world layers, UI, and feedback.
32
+ - 3: Distinct identity on every production surface.
33
+ 2. Hero/player.
34
+ - 0: Colored rectangle / emoji / default shape.
35
+ - 1: Basic sprite with glow or simple tint.
36
+ - 2: Authored silhouette, clear facing, state cues (hurt/boost).
37
+ - 3: Memorable sprite language with expressive feedback.
38
+ 3. Obstacles/enemies.
39
+ - 0: Same box as everything else.
40
+ - 1: Recolored repeated silhouette.
41
+ - 2: At least three readable variants with telegraphs.
42
+ - 3: Varied family with anticipation and gameplay clarity.
43
+ 4. Rewards/interactables.
44
+ - 0: Plain circle/token.
45
+ - 1: Repeated icon with simple pulse.
46
+ - 2: Two authored forms with idle/collect states.
47
+ - 3: Desirable, animated, clearly valued in motion.
48
+ 5. World/environment.
49
+ - 0: Flat fill or empty stage.
50
+ - 1: Single background image, sparse props.
51
+ - 2: Layered Play/Near/Mid/Far matching `scene-profiles` profile.
52
+ - 3: Dense authored world that still preserves play readability.
53
+ 6. Sprite fidelity / atlas.
54
+ - 0: Procedural shapes only.
55
+ - 1: Mixed placeholder + one real image.
56
+ - 2: Key surfaces from MCP/user art; consistent PPI and facing; sheets measured before load.
57
+ - 3: Cohesive atlas/mip strategy, clean cutouts, no stretched mush.
58
+ 7. Compose (camera / parallax / tint).
59
+ - 0: No depth; camera fights the player.
60
+ - 1: Parallax or tint used as the whole style.
61
+ - 2: Intentional camera, parallax ratios, depth sort, readable overlays.
62
+ - 3: Cinematic but disciplined compose; never hides the next decision.
63
+ 8. VFX/motion.
64
+ - 0: None or random ambient particles.
65
+ - 1: Generic particles/trails.
66
+ - 2: Event-driven FX for hit, pickup, fail, combo, spawn, dash.
67
+ - 3: High-impact FX that clarify state and stay within budget.
68
+ 9. UI/HUD.
69
+ - 0: Debug text or missing UI.
70
+ - 1: Generic stat cards over the canvas.
71
+ - 2: Genre HUD via DOM overlay; colors echo world signals.
72
+ - 3: Cohesive hierarchy and polished transitions without covering Play.
73
+ 10. Performance evidence.
74
+ - 0: No notes after visual changes.
75
+ - 1: Informal "seems fine".
76
+ - 2: Texture/display/particle budget notes + mobile screenshot.
77
+ - 3: Before/after or budget-aware notes, pooling, atlas strategy.
78
+
79
+ ## Thresholds
80
+
81
+ Premium:
82
+
83
+ - Every category at least 2.
84
+ - Average at least 2.3.
85
+ - Mobile active-play screenshot when portrait mobile is in scope.
86
+ - Technical-art / budget notes after graphics changes.
87
+
88
+ Showcase:
89
+
90
+ - At least six categories score 3.
91
+ - No category below 2.
92
+ - Average at least 2.7.
93
+ - Performance evidence includes before/after or budget-aware notes.
94
+
95
+ ## Automatic Failures
96
+
97
+ Any of these prevents a premium/showcase claim:
98
+
99
+ - Active screenshot is placeholder-dominant (SVG/rect/emoji as hero or main threats).
100
+ - Main world is a flat fill with no authored Far/Mid layers when the profile requires them.
101
+ - Hero is mostly a shape plus glow/particles.
102
+ - Obstacles or rewards are one repeated silhouette recolored.
103
+ - Ambient particles or full-screen flash are the primary “art”.
104
+ - Compose (shake/vignette/parallax) hides the next gameplay decision.
105
+ - Dense formal HUD drawn in Canvas instead of DOM without an explicit project requirement.
106
+ - No asset sourcing ledger for premium hero/background surfaces.
107
+ - Claimed premium while required references were skipped.
108
+
109
+ ## Fresh-Eyes Review
110
+
111
+ Before finalizing premium/showcase:
112
+
113
+ 1. Look only at the latest active-play screenshot for 10 seconds.
114
+ 2. Name the weakest two categories without reading the scorecard you just filled.
115
+ 3. If either is below 2, lower scores and keep working—or report blockers.
116
+ 4. Confirm Automatic Failures are absent.
117
+
118
+ ## Measured Evidence
119
+
120
+ Prefer citing:
121
+
122
+ - `public/config.json` keys bound for hero/bg/parallax.
123
+ - Screenshot paths (mobile/desktop).
124
+ - Texture sizes / atlas notes / particle max counts from the technical art brief.
125
+ - Phaser Scale mode confirmation (no CSS canvas scale).
126
+
127
+ ## Output
128
+
129
+ When claiming premium/showcase, paste a filled table: category, score 0–3, one-line evidence, measured evidence if any. Include average and list Automatic Failures remaining (or “none”).
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: threejs-3d-game
3
+ description: 用 Three.js、React Three Fiber、TypeScript 与 Vite 实现 3D 浏览器游戏。在需要 R3F Canvas、模拟系统、DOM HUD 覆盖层、事件总线桥接或 3D 项目文件结构时使用。
4
+ ---
5
+
6
+ # Three.js 3D 游戏实现
7
+
8
+ ## 概述
9
+
10
+ 本技能用于 3D 浏览器游戏的具体实现阶段。
11
+
12
+ 技术栈:**Three.js + React + R3F + TypeScript + Vite + pnpm**。R3F `<Canvas>` 负责 3D / WebGL 世界;React DOM(`src/ui`)负责 HUD、菜单与叙事面板。跨层通信走事件总线、统一输入动作与可序列化模拟状态。
13
+
14
+ ## 架构原则
15
+
16
+ 1. **R3F 与 DOM 分离**
17
+ - `<Canvas>` / `game/three` 拥有场景、网格、灯光、`AnimationMixer`、摄像机编排。
18
+ - `src/ui` 拥有正式 HUD、菜单、设置、背包、任务与叙事面板。
19
+ - 禁止用 R3F `<Html>` 替代正式 HUD。
20
+
21
+ 2. **模拟优先于渲染**
22
+ - 规则、数值、胜负、存档放在 `game/simulation`,无 Three / React 依赖。(与 2D 技能的 System 对位:规则真相层)
23
+ - `useFrame` 只编排:读输入/模拟 → 同步 `Object3D` → mixer/相机;不写核心规则。
24
+
25
+ 3. **纯 Three 模块可单测**
26
+ - `game/three/*` 禁止 import React;场景构建与数学助手可独立验证。
27
+
28
+ 4. **资产键稳定**
29
+ - 全部游戏代码通过 `manifest` / `public/config.json` 引用资产,不在业务代码中硬编码 glTF / 贴图路径。
30
+
31
+ ## 实现指导
32
+
33
+ - 通过 `gameBus`(mitt)让 React UI 发 `command:*`,游戏运行时发 `game:*` / `player:*` 等事实事件。
34
+ - 输入物理映射集中在 `game/input`,UI 与 Canvas 只消费统一语义动作。
35
+ - 内容数据(关卡、遭遇、道具)放在 `game/content`,与渲染生命周期解耦。
36
+ - 音频集中在 `game/audio`,由总线事件驱动;禁止在 HUD 里 `new Audio()` 播局内音效(细节见 `references/engine-audio.md`)。
37
+ - Canvas / gl / DPR 默认与 R3F 加载边界见 `references/engine-runtime.md`。
38
+
39
+ ## 覆盖的 3D 游戏类型
40
+
41
+ - 第三人称 / 俯视探索与轻量动作
42
+ - 无尽跑酷、障碍躲避
43
+ - 载具、弹珠、刚体小品
44
+ - 轻量射击或遭遇战
45
+ - 需要立体空间表现的休闲玩法
46
+
47
+ ## 摄像机与表现
48
+
49
+ - 早期确定摄像机模型:跟随、轨道、锁定、过肩。
50
+ - 摄像机逻辑与游戏规则分离;震动 / FOV 变化服务于可读性。
51
+ - 资源在 StrictMode 重挂载 / 卸载时必须 dispose(几何、材质、mixer、总线订阅)。
52
+ - 细节见 `references/engine-input-camera.md`。
53
+
54
+ ## 引擎参考(按需加载)
55
+
56
+ 写/改 3D 运行时代码时,在 `file-structure.md` 之外按任务加载,勿一次性预读全部:
57
+
58
+ | 任务 | 加载 |
59
+ | --- | --- |
60
+ | 帧循环、Canvas/gl 默认、dispose、白屏/双循环、R3F 政策、诊断钩子 | `references/engine-runtime.md` |
61
+ | 输入意图、触控粘滞、镜头跟随 / FOV | `references/engine-input-camera.md` |
62
+ | 物理选型、Rapier/固定步、碰撞代理 | `references/engine-physics.md` |
63
+ | GLB/FBX 导入、AnimationMixer、根运动、导入性能 | `references/engine-asset-pipeline.md` |
64
+ | 卡顿、池化、InstancedMesh、DPR、LOD、热路径分配 | `references/engine-performance.md` |
65
+ | AudioContext 解锁、总线播音、静音、重开清理 | `references/engine-audio.md` |
66
+
67
+ 目录与分层以本技能 `file-structure.md` 为准;**不要**按无关的 `core/entities/systems` 脚手架另建目录。
68
+
69
+ ## UI 集成
70
+
71
+ - HUD、指令菜单、设置与叙事界面用 React DOM,叠在 Canvas 之上(`App` 组合)。
72
+ - `GameCanvas.tsx` 是 WebGL ↔ React DOM 边界。
73
+ - 业务 UI 放 `src/ui`;共享无业务原语放 `src/components`。
74
+
75
+ ## 脚手架与配置
76
+
77
+ 新项目入口:`index.html`、`src/main.tsx`、`public/config.json`。包管理器为 **pnpm**。构建产物落到 `dist/`,需包含 `dist/index.html` 和 `dist/config.json`。
78
+
79
+ 目录布局、分层职责、config schema 与部署路径以 `references/file-structure.md` 为唯一规范来源。
80
+
81
+ ## 常见反模式
82
+
83
+ - 在 `useFrame` 或 `Hud.tsx` 里写战斗/胜负规则
84
+ - 用 R3F `<Html>` 堆正式菜单与设置
85
+ - `game/three` 里 import React hooks / 组件
86
+ - HUD 直接拿 `Object3D` 引用每帧改 `position`
87
+ - 多处硬编码同一 glTF / 贴图路径
88
+ - 额外 `new WebGLRenderer` 或第二套 rAF 与 R3F 抢循环
89
+ - 不 cap DPR、热路径狂建网格/音源
90
+ - HUD 里 `new Audio()` 播局内音效
91
+ - 用 CRA / Next.js / npm-only 脚手架替换本规范(除非用户明确要求)
92
+
93
+ ## References
94
+
95
+ **引擎(本技能)**
96
+ - 文件结构与分层:`references/file-structure.md`
97
+ - 运行时 / Canvas / R3F 政策:`references/engine-runtime.md`
98
+ - 输入与摄像机:`references/engine-input-camera.md`
99
+ - 物理与碰撞:`references/engine-physics.md`
100
+ - 资产加载与动画:`references/engine-asset-pipeline.md`
101
+ - 性能:`references/engine-performance.md`
102
+ - 音频运行时:`references/engine-audio.md`
103
+
104
+ **跨技能(玩法 / 验收,非引擎实现细节)**
105
+ - 玩法工作流:`../game-designer/references/gameplay-workflows.md`
106
+ - 手感调优:`../game-designer/references/game-feel.md`
107
+ - 关卡设计:`../game-designer/references/game-design-level-design.md`
108
+ - 物理选型(设计侧对照):`../game-designer/references/physics-engine-selection.md`
109
+ - 新游戏完成定义:`../game-designer/references/checklists/new-game-definition-of-done.md`
110
+ - 美术风格指南:`../game-art/references/art-styles.md`
111
+ - UI 风格规范:`../game-ui/references/ui-styles.md`
112
+ - 音频资产生成:`../game-audio/SKILL.md`
113
+ - QA / 性能画像:`../game-test/SKILL.md`
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Three.js 3D Game"
3
+ short_description: "搭建结构清晰的三维浏览器游戏,分离玩法模拟、场景渲染与界面"
4
+ default_prompt: "请使用 $threejs-3d-game 根据我的需求实现这个三维浏览器游戏,并保持玩法模拟、三维场景和界面边界清晰。"
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,116 @@
1
+ # 引擎:资产加载与动画管线
2
+
3
+ 关注 **运行时如何安全接入 GLB/FBX**。
4
+
5
+ 加载/绑定网格、AnimationMixer、根运动、碰撞代理、导入后性能时加载本文件。路径与 config 契约仍以 `file-structure.md` 为准。
6
+
7
+ ## 输出与加载偏好
8
+
9
+ | 用途 | 格式 |
10
+ | --- | --- |
11
+ | Three 运行时 | 优先 GLB(PBR) |
12
+ | 动画交换 | FBX 按需,再谨慎导入或离线转 GLB |
13
+ | 打印 / AR | STL/3MF、USDZ —— 非本游戏运行时默认 |
14
+
15
+ - 用 `GLTFLoader`(`three/addons/loaders/GLTFLoader.js`)。
16
+ - 运行时 URL:`./` 相对路径或外部 `http(s)`;禁止站点根绝对路径 `/...`(见部署规则)。
17
+ - 加载放在资产层 / `game/three` 助手,**不要**在实体每帧 update 里 `load`。
18
+ - 业务代码通过 `manifest` / `config` 键引用,不硬编码 URL。
19
+
20
+ ```ts
21
+ import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
22
+
23
+ const loader = new GLTFLoader();
24
+ const gltf = await loader.loadAsync(urlFromManifest);
25
+ wrapper.add(gltf.scene);
26
+ ```
27
+
28
+ ## 包装实体
29
+
30
+ 导入场景包进游戏实体时显式处理:
31
+
32
+ - 统一 scale、pivot、朝向(可外层 `Group`)
33
+ - 包围盒 / 逻辑 bounds
34
+ - **与视觉分离的 collision proxy**
35
+ - 加载失败占位或错误态
36
+ - 记录:文件大小、三角面、材质数、贴图尺寸、clip 名
37
+
38
+ ## AnimationMixer
39
+
40
+ ```ts
41
+ const mixer = new THREE.AnimationMixer(gltf.scene);
42
+ const action = mixer.clipAction(gltf.animations[0]);
43
+ action.play();
44
+
45
+ // useFrame / 模拟后:秒
46
+ mixer.update(deltaSeconds);
47
+ ```
48
+
49
+ - 玩法状态映射到 clip:idle / walk-run / jump / attack / hurt / fall / turn 等。
50
+ - 街机默认:**原地动画 + 代码位移**;若保留根运动,必须有意为之。
51
+ - 重启时 stop actions、dispose mixer,避免叠播。
52
+
53
+ ## 根运动与导入动画注意(引擎侧)
54
+
55
+ 上游绑定/重定向的坑若存在,在引擎侧固定修法:
56
+
57
+ 1. 需要原地动画时优先在**导入后**处理,不要依赖不可控的上游 `animate_in_place` 行为。
58
+ 2. 原地化时只改顶层根骨位置轨(常见名 `Root.position`),且只钉死水平 XZ,**保留 Y**(跳跃起伏)。
59
+ 3. 不要广谱删 Hip/Pelvis 或 twist 轨:部分绑定把肢体蒙在 twist 上,删轨会塌肢体。
60
+
61
+ ```ts
62
+ for (const clip of clips) {
63
+ for (const tr of clip.tracks) {
64
+ if (tr.name !== 'Root.position') continue;
65
+ const v = tr.values;
66
+ const x0 = v[0];
67
+ const z0 = v[2];
68
+ for (let i = 0; i < v.length; i += 3) {
69
+ v[i] = x0;
70
+ v[i + 2] = z0;
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ 批处理重定向若得到 `NlaTrack` / `NlaTrack.001`:按**请求顺序**用下标映射到预设名,加载后 `clip.name = 'walk'` 再按名选取。
77
+
78
+ 加载后打日志:`gltf.animations.map(c => \`${c.name} ${c.tracks.length} tracks\`)`。人型健康 clip 应驱动大量骨骼;只有极少 track 通常是上游绑定坏了,先修绑定。
79
+
80
+ ### FBX 摄入(人型重定向常见)
81
+
82
+ - `FBXLoader` 依赖 `fflate`;bundler 一般自动带上。
83
+ - 同一 take 可能出现两条不同 `|` 深度路径的 clip:**保留更浅**的那条。
84
+ - 用关键词选 clip(walk / idle / attack),不要盲目 `animations[0]` 除非管线保证单 take。
85
+ - FBX 常是 Phong,比 GLB PBR 暗;最终美术对齐可离线转 GLB。
86
+ - 除「单根骨水平钉死」外,避免再在 loader 侧「修正」动画(易越修越坏)。
87
+
88
+ ## 性能纪律
89
+
90
+ - 浏览器/移动:控面数、贴图尺寸;英雄件高质量 + 实例化/程序化配角。
91
+ - Clone 时尽量共享 geometry/material。
92
+ - 离场 / 换关 dispose 已加载资源。
93
+ - 导入前后记 renderer diagnostics:calls、triangles、geometries、textures、materials、文件体积。
94
+ - 运行时卡顿、池化、DPR、LOD 见 `engine-performance.md`。
95
+
96
+ ## 导入体检清单
97
+
98
+ - [ ] 文件大小与三角面可接受
99
+ - [ ] 网格 / 材质 / 贴图数量与尺寸
100
+ - [ ] 当前灯光下 PBR 观感
101
+ - [ ] 米制尺度与 pivot / bounds
102
+ - [ ] 碰撞代理独立且调试可见
103
+ - [ ] clip 名、时长、根运动策略明确
104
+ - [ ] 失败有占位;成功路径进 manifest/config
105
+ - [ ] 卸载与重开无泄漏
106
+
107
+ ## 常见修复
108
+
109
+ | 问题 | 处理 |
110
+ | --- | --- |
111
+ | 过大/过小 | 外层 Group 归一化 bounds |
112
+ | 朝向错 | wrapper 旋转,或生成侧对齐选项 |
113
+ | 动画滑步/飘走 | 保留导出根运动后按上式只钉 XZ |
114
+ | 太贵 | 降面、缩贴图、少唯一重模 |
115
+ | 材质过暗/过亮 | 色域、tone mapping、环境光、曝光 |
116
+ | 碰撞怪 | 视觉 mesh 不参与物理,另建 proxy |
@@ -0,0 +1,70 @@
1
+ # 引擎:音频运行时
2
+
3
+ 音频运行时落在 `game/audio` + `gameBus`。资产生成与选曲走 `../game-audio`;本文件只管**运行时接线与生命周期**。
4
+
5
+ 改局内 BGM/SFX 播放、解锁、静音、重开清理时加载。
6
+
7
+ ## 所有权
8
+
9
+ | 事项 | 落点 |
10
+ | --- | --- |
11
+ | 播放 / decode / dispose | `game/audio`(`audioManager` 等) |
12
+ | 玩法事实 → 声音 | `audioHooks` 订阅 `gameBus`(`game:*` / `player:*` / `game:feedback`) |
13
+ | 静音 / 音量偏好 | HUD 发 `command:audio-prefs` → `audioPrefs` 应用 |
14
+ | URL / 开关 | `public/config.json` 或 `game/assets` manifest |
15
+
16
+ 禁止:
17
+
18
+ - HUD / `useFrame` 里 `new Audio()` 播局内音效
19
+ - 每帧新建音源或脚步循环
20
+ - 在多个组件复制播放逻辑
21
+
22
+ ## 用户手势解锁
23
+
24
+ 浏览器要求在**用户手势**后 resume `AudioContext`(或等价解锁):
25
+
26
+ - 首次「开始 / 继续 / 点按 Canvas」路径调用 `audioManager.unlock()`(或 `context.resume()`)
27
+ - 解锁失败要可见(日志 / 诊断),勿静默
28
+ - 移动端必须实机或模拟手势验一次
29
+
30
+ ## 事件驱动钩子(最小集)
31
+
32
+ 按状态发声,不随机装饰:
33
+
34
+ | 事件类 | 示例 |
35
+ | --- | --- |
36
+ | UI | 点击、暂停、重试 |
37
+ | 进度 | 拾取、得分、里程碑 / combo |
38
+ | 压力 | 受伤、失败、危险接近 |
39
+ | 能力 | 冲刺 / 加速 / 开火 |
40
+ | 氛围 | BGM 或环境 loop(可关) |
41
+
42
+ `game:feedback` / `player:movement` 等 payload 用普通数据;`game/audio` 映射到具体 clip,不把 URL 写进 UI。
43
+
44
+ ## 生命周期
45
+
46
+ - **暂停 / 隐藏页**:停或压低局内 BGM;`visibilitychange` 勿叠出第二个 loop
47
+ - **失败 / 结算 / 重开**:停局内 loop 与短效;摘掉仅本局订阅;归还池化音源(若有)
48
+ - **换关**:卸本关独有 buffer;公共 UI 音可留
49
+ - **静音 / 音量**:偏好必须作用到所有分组(BGM / SFX / UI)
50
+
51
+ ## 与 config
52
+
53
+ BGM/SFX 的 `http(s)` URL、默认音量、是否开音乐进扁平 `config.json`;代码经 `getSetting` / manifest 键读取,禁止散落硬编码路径。
54
+
55
+ ## 故障检查
56
+
57
+ - 文件 URL、MIME、CORS
58
+ - decode/load reject 是否可见
59
+ - 是否从未 unlock 就 play
60
+ - SFX 是否每帧触发
61
+ - 暂停/重开后是否双 BGM
62
+ - mute 是否漏某一组
63
+
64
+ ## 引擎反模式
65
+
66
+ - UI 按钮直接 `new Audio(url).play()`
67
+ - 未 unlock 就依赖自动播放
68
+ - 重开残留 BGM / 监听叠加
69
+ - 业务代码硬编码音频 URL
70
+ - 把生成管线细节写进 `game/audio`(生成属 `game-audio` skill)
@@ -0,0 +1,84 @@
1
+ # 引擎:输入与摄像机
2
+
3
+ 输入与相机落在 `game/input` + `game/three`。不含 UI 视觉设计、不含 juice 数值配方(手感见 `game-designer/references/game-feel.md`)。
4
+
5
+ 改控制、触控粘滞、镜头跟随、FOV、指针锁定时加载本文件。
6
+
7
+ ## 输入:意图与所有权
8
+
9
+ 1. **采集**(键鼠 / 指针 / 触控 / 手柄)与 **模拟** 分离。
10
+ 2. 物理设备 → 语义动作(如 `move`、`dash`、`confirm`)集中在 `game/input`。
11
+ 3. `GameCanvas` / DOM HUD 只读统一输入面,禁止在 `useFrame` 里散落硬编码键位。
12
+ 4. UI 按钮通过同一套动作或 `command:*` 进入运行时,不在按钮里复制一套规则。
13
+
14
+ ### 粘滞与取消
15
+
16
+ - 必须处理 `pointerup` / `pointercancel` / `blur` / `visibilitychange`,避免摇杆或冲刺键粘住。
17
+ - 指针控件使用 `setPointerCapture`;测试环境可能无真实 pointerId,需容错。
18
+ - 键位用 `event.code`(布局无关),不要只靠 `key`。
19
+ - CSS `touch-action` 有意设置且范围可控;避免整页滚动偷走手势。
20
+ - 失败 / 暂停 / 重开后恢复焦点与重启控件可用。
21
+
22
+ ### 移动合成(桌面 + 摇杆)
23
+
24
+ 键向量与摇杆向量相加后长度 > 1 则归一化(脚手架模式):
25
+
26
+ ```ts
27
+ target.copy(keyVector).add(pointerVector);
28
+ if (target.lengthSq() > 1) target.normalize();
29
+ ```
30
+
31
+ 移动端在范围内时:虚拟摇杆在 DOM(`src/ui`),经 `game/input` 写入同一 `move` 意图;不要在 Canvas 内再绑一套冲突监听。
32
+
33
+ ### 输入故障检查
34
+
35
+ - 焦点是否在可接收键盘的页面上
36
+ - 监听是否挂在正确元素
37
+ - `touch-action` / viewport meta / 安全区
38
+ - DPR 导致触控热区过小
39
+ - 旋转后 resize 是否更新
40
+ - 加了移动控件后桌面键鼠是否仍可用
41
+ - UI 是否发出意图,而非直接改模拟根状态
42
+
43
+ ## 摄像机:模型与职责
44
+
45
+ 早期选定一种主模型并写进实现(逻辑在 `game/three`,规则仍在 simulation):
46
+
47
+ | 模型 | 适用 |
48
+ | --- | --- |
49
+ | 跟随 + 固定偏移 | 跑酷、俯视动作、街机 |
50
+ | 轨道 / 观察 | 展示、慢节奏探索 |
51
+ | 锁定目标 | 战术、锁定战 |
52
+ | 过肩 | 轻量第三人称 |
53
+
54
+ 规则:
55
+
56
+ - 相机与游戏规则分离:相机读「跟随目标位姿 / 事件脉冲」,不改写胜负状态。
57
+ - 震动 / FOV kick 只服务可读性,不得挡住下一决策区。
58
+ - 可读性:下一决策可见、玩家足够居中、威胁不被 HUD/相机裁切藏住。
59
+ - 无障碍:避免过度震动、闪烁、不可控运动;尊重 `setReducedMotion` 类钩子。
60
+
61
+ ### 跟随滞后(指数平滑)
62
+
63
+ 脚手架常用形式(`lag` 为时间常数,秒;可来自 `config.json` 的 `camera_follow_lag`):
64
+
65
+ ```ts
66
+ const desired = target.clone().add(offset);
67
+ const factor = 1 - Math.exp(-delta / Math.max(0.001, lag));
68
+ camera.position.lerp(desired, factor);
69
+ camera.lookAt(lookTarget);
70
+ ```
71
+
72
+ 可调轴(改引擎参数,不改规则):跟随滞后、look-ahead、高度、距离、FOV、近远平面、碰撞/遮挡时的拉近策略。
73
+
74
+ ### 相机与控制一起验
75
+
76
+ 改速度或加速度后,必须复测:
77
+
78
+ - 高速是否穿模或镜头丢目标
79
+ - 转向是否与 look-ahead 打架
80
+ - 暂停/菜单打开时是否应冻结或解锁指针
81
+
82
+ ## 与 config 的约定
83
+
84
+ 镜头滞后、FOV、是否震屏等可调项进扁平 `public/config.json`(见 `file-structure.md`),禁止在多个相机文件里复制魔法数。