@jgengine/shell 0.19.0 → 0.22.0

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 (215) hide show
  1. package/CHANGELOG.md +364 -0
  2. package/dist/GameHost.d.ts +12 -1
  3. package/dist/GameHost.js +14 -1
  4. package/dist/GamePlayerShell.js +113 -15
  5. package/dist/Shell3dPresentation.d.ts +2 -2
  6. package/dist/Shell3dPresentation.js +49 -7
  7. package/dist/ShellChrome.d.ts +2 -1
  8. package/dist/ShellChrome.js +22 -6
  9. package/dist/ShellHudPresentation.d.ts +11 -1
  10. package/dist/ShellHudPresentation.js +20 -6
  11. package/dist/audio/audioEngine.d.ts +16 -0
  12. package/dist/audio/audioEngine.js +178 -89
  13. package/dist/audio/audioWire.js +2 -2
  14. package/dist/audio/synthEngine.d.ts +7 -1
  15. package/dist/audio/synthEngine.js +103 -38
  16. package/dist/camera/GameCameraRig.js +2 -1
  17. package/dist/camera/GameFirstPersonCamera.d.ts +2 -2
  18. package/dist/camera/GameFirstPersonCamera.js +17 -13
  19. package/dist/camera/cameraRigs.js +8 -2
  20. package/dist/camera/chaseHeading.d.ts +9 -0
  21. package/dist/camera/chaseHeading.js +10 -0
  22. package/dist/camera/customMuzzle.d.ts +14 -0
  23. package/dist/camera/customMuzzle.js +68 -0
  24. package/dist/camera/index.d.ts +1 -0
  25. package/dist/camera/index.js +1 -0
  26. package/dist/camera/rigResolve.d.ts +3 -0
  27. package/dist/camera/rigResolve.js +11 -0
  28. package/dist/combat/ProjectileModels.d.ts +31 -0
  29. package/dist/combat/ProjectileModels.js +70 -0
  30. package/dist/commandSink.d.ts +1 -2
  31. package/dist/commandSink.js +3 -2
  32. package/dist/defineGame.d.ts +12 -5
  33. package/dist/defineGame.js +25 -10
  34. package/dist/devtools/DevtoolsOverlay.d.ts +2 -69
  35. package/dist/devtools/DevtoolsOverlay.js +14 -168
  36. package/dist/devtools/DevtoolsRuntime.d.ts +7 -0
  37. package/dist/devtools/DevtoolsRuntime.js +61 -0
  38. package/dist/devtools/agentBridge.js +1 -1
  39. package/dist/devtools/devtoolsReports.d.ts +68 -0
  40. package/dist/devtools/devtoolsReports.js +100 -0
  41. package/dist/devtools/latencyInstrumentation.d.ts +3 -0
  42. package/dist/devtools/latencyInstrumentation.js +11 -0
  43. package/dist/devtools/playtestProbe.d.ts +4 -0
  44. package/dist/devtools/playtestProbe.js +22 -0
  45. package/dist/drivers/FrameDriver.js +25 -21
  46. package/dist/drivers/HudOnlyDriver.d.ts +6 -1
  47. package/dist/drivers/HudOnlyDriver.js +32 -14
  48. package/dist/environment/EnvironmentScene.js +19 -15
  49. package/dist/environment/terrainGroundColor.d.ts +5 -4
  50. package/dist/environment/terrainGroundColor.js +19 -8
  51. package/dist/inputSink.d.ts +6 -6
  52. package/dist/inputSink.js +60 -21
  53. package/dist/lazyShell3dPresentation.d.ts +9 -0
  54. package/dist/lazyShell3dPresentation.js +24 -0
  55. package/dist/materialOverride.d.ts +42 -0
  56. package/dist/materialOverride.js +95 -36
  57. package/dist/multiplayer.d.ts +33 -3
  58. package/dist/multiplayer.js +105 -22
  59. package/dist/pointer/pointerService.d.ts +2 -0
  60. package/dist/pointer/pointerService.js +12 -2
  61. package/dist/postfx/PostProcessing.d.ts +10 -0
  62. package/dist/postfx/PostProcessing.js +9 -41
  63. package/dist/postfx/gradeShader.d.ts +1 -1
  64. package/dist/postfx/gradeShader.js +30 -2
  65. package/dist/postfx/shadowPrepass.d.ts +3 -0
  66. package/dist/postfx/shadowPrepass.js +18 -0
  67. package/dist/presentationRecovery.d.ts +75 -0
  68. package/dist/presentationRecovery.js +204 -0
  69. package/dist/presentationRecovery3d.d.ts +4 -0
  70. package/dist/presentationRecovery3d.js +32 -0
  71. package/dist/presentationResolve.d.ts +8 -1
  72. package/dist/presentationResolve.js +5 -2
  73. package/dist/render/CascadedShadows.d.ts +7 -2
  74. package/dist/render/CascadedShadows.js +98 -20
  75. package/dist/render/EnvironmentLighting.js +74 -35
  76. package/dist/render/HairCards.d.ts +7 -0
  77. package/dist/render/HairCards.js +23 -0
  78. package/dist/render/SceneModels.js +51 -77
  79. package/dist/render/authoredSurfaceMaterial.d.ts +43 -0
  80. package/dist/render/authoredSurfaceMaterial.js +108 -0
  81. package/dist/render/materialAppearanceSignals.d.ts +23 -0
  82. package/dist/render/materialAppearanceSignals.js +58 -0
  83. package/dist/render/materialAsset.d.ts +98 -0
  84. package/dist/render/materialAsset.js +454 -0
  85. package/dist/render/measureBounds.js +16 -3
  86. package/dist/render/measureCollisionMesh.js +8 -1
  87. package/dist/render/modelAssets.d.ts +8 -0
  88. package/dist/render/modelAssets.js +43 -0
  89. package/dist/render/modelBindPose.d.ts +5 -0
  90. package/dist/render/modelBindPose.js +35 -0
  91. package/dist/render/modelLoad.d.ts +3 -0
  92. package/dist/render/modelLoad.js +9 -0
  93. package/dist/render/modelNodeVisibility.d.ts +6 -0
  94. package/dist/render/modelNodeVisibility.js +18 -0
  95. package/dist/render/modelRender.d.ts +18 -1
  96. package/dist/render/modelRender.js +81 -3
  97. package/dist/render/projectedOverdraw.d.ts +35 -0
  98. package/dist/render/projectedOverdraw.js +204 -0
  99. package/dist/render/resolveModel.d.ts +12 -2
  100. package/dist/render/resolveModel.js +21 -4
  101. package/dist/render/rigNode.d.ts +26 -0
  102. package/dist/render/rigNode.js +32 -0
  103. package/dist/render/spriteRender.d.ts +4 -0
  104. package/dist/render/spriteRender.js +5 -0
  105. package/dist/render/staticShapeInstances.d.ts +34 -0
  106. package/dist/render/staticShapeInstances.js +78 -0
  107. package/dist/render/useFootIk.js +76 -11
  108. package/dist/render/useModelAnimation.d.ts +28 -2
  109. package/dist/render/useModelAnimation.js +194 -69
  110. package/dist/render/useModelInstance.d.ts +25 -0
  111. package/dist/render/useModelInstance.js +43 -0
  112. package/dist/scatter/scatterModels.d.ts +3 -2
  113. package/dist/scatter/scatterModels.js +15 -7
  114. package/dist/scene/AuthoredScene.d.ts +14 -6
  115. package/dist/scene/AuthoredScene.js +30 -9
  116. package/dist/scene/GeneratedAssetRenderer.js +11 -42
  117. package/dist/scene/GrassFieldRenderer.js +20 -2
  118. package/dist/settings/SettingsMenu.js +11 -18
  119. package/dist/settings/SettingsRuntime.d.ts +5 -0
  120. package/dist/settings/SettingsRuntime.js +29 -2
  121. package/dist/shellControlSuspension.d.ts +18 -0
  122. package/dist/shellControlSuspension.js +28 -0
  123. package/dist/shellInputPublication.d.ts +28 -0
  124. package/dist/shellInputPublication.js +49 -0
  125. package/dist/shellPointerInput.d.ts +18 -0
  126. package/dist/shellPointerInput.js +49 -0
  127. package/dist/structures/BuildingKitBatch.d.ts +3 -1
  128. package/dist/structures/BuildingKitBatch.js +34 -59
  129. package/dist/structures/BuildingRenderBudget.d.ts +23 -0
  130. package/dist/structures/BuildingRenderBudget.js +54 -0
  131. package/dist/structures/GeneratedBuilding.js +13 -8
  132. package/dist/structures/buildingKitMaterials.d.ts +20 -0
  133. package/dist/structures/buildingKitMaterials.js +70 -0
  134. package/dist/structures/buildingSpatialBatch.d.ts +11 -0
  135. package/dist/structures/buildingSpatialBatch.js +45 -0
  136. package/dist/terrain/CarvedTerrain.d.ts +2 -1
  137. package/dist/terrain/CarvedTerrain.js +2 -2
  138. package/dist/terrain/GrassField.d.ts +3 -1
  139. package/dist/terrain/GrassField.js +61 -6
  140. package/dist/terrain/grassGeometry.d.ts +13 -0
  141. package/dist/terrain/grassGeometry.js +57 -1
  142. package/dist/terrain/grassMaterial.js +2 -2
  143. package/dist/terrain/index.d.ts +1 -0
  144. package/dist/terrain/index.js +1 -0
  145. package/dist/terrain/terrainDetailMaterial.d.ts +3 -3
  146. package/dist/terrain/terrainDetailMaterial.js +7 -7
  147. package/dist/terrain/terrainMath.d.ts +2 -0
  148. package/dist/terrain/terrainMath.js +2 -0
  149. package/dist/terrain/terrainPaintColor.d.ts +11 -0
  150. package/dist/terrain/terrainPaintColor.js +47 -0
  151. package/dist/touch/TouchControlsOverlay.js +4 -4
  152. package/dist/useShellMultiplayerSync.js +4 -0
  153. package/dist/vfx/ParticleField.d.ts +23 -20
  154. package/dist/vfx/ParticleField.js +168 -50
  155. package/dist/visibility/CullingProvider.js +2 -62
  156. package/dist/visibility/cullingDriver.d.ts +9 -0
  157. package/dist/visibility/cullingDriver.js +68 -0
  158. package/dist/weather/AuthoredWeatherLayer.d.ts +16 -0
  159. package/dist/weather/AuthoredWeatherLayer.js +31 -0
  160. package/dist/weather/DustField.d.ts +2 -1
  161. package/dist/weather/DustField.js +17 -3
  162. package/dist/weather/FireSpreadLayer.d.ts +4 -2
  163. package/dist/weather/FireSpreadLayer.js +5 -11
  164. package/dist/weather/LightningStrike.d.ts +4 -1
  165. package/dist/weather/LightningStrike.js +13 -17
  166. package/dist/weather/RainField.d.ts +2 -1
  167. package/dist/weather/RainField.js +17 -3
  168. package/dist/weather/RainImpactField.d.ts +16 -0
  169. package/dist/weather/RainImpactField.js +89 -0
  170. package/dist/weather/SnowField.d.ts +2 -1
  171. package/dist/weather/SnowField.js +17 -3
  172. package/dist/weather/WeatherLayer.d.ts +11 -2
  173. package/dist/weather/WeatherLayer.js +30 -6
  174. package/dist/weather/index.d.ts +2 -0
  175. package/dist/weather/index.js +2 -0
  176. package/dist/weather/weatherMath.d.ts +2 -0
  177. package/dist/weather/weatherMath.js +8 -0
  178. package/dist/weather/weatherShelter.d.ts +18 -0
  179. package/dist/weather/weatherShelter.js +75 -0
  180. package/dist/weather/weatherUniforms.d.ts +40 -1
  181. package/dist/weather/weatherUniforms.js +29 -9
  182. package/dist/world/AuthoredFlocks.d.ts +22 -0
  183. package/dist/world/AuthoredFlocks.js +87 -0
  184. package/dist/world/StaticObjectModels.d.ts +8 -0
  185. package/dist/world/StaticObjectModels.js +75 -0
  186. package/dist/world/WorldHud.d.ts +14 -6
  187. package/dist/world/WorldHud.js +25 -12
  188. package/dist/world/WorldParticles.d.ts +10 -23
  189. package/dist/world/WorldParticles.js +209 -61
  190. package/dist/world/WorldScene.d.ts +3 -1
  191. package/dist/world/WorldScene.js +41 -26
  192. package/dist/world/staticObjectBatches.d.ts +35 -0
  193. package/dist/world/staticObjectBatches.js +163 -0
  194. package/dist/world/worldBarSamples.d.ts +37 -33
  195. package/dist/world/worldBarSamples.js +117 -75
  196. package/package.json +4 -4
  197. package/skills/ce-handoff/SKILL.md +1 -1
  198. package/skills/game-design/SKILL.md +2 -0
  199. package/skills/jgengine/SKILL.md +23 -2
  200. package/skills/jgengine/api.md +28 -17
  201. package/skills/jgengine/recipes/minimal-game.md +7 -2
  202. package/skills/jgengine-ui/SKILL.md +3 -1
  203. package/skills/jgengine-ui/api.md +219 -70
  204. package/skills/jgengine-ui/capabilities.md +119 -1
  205. package/skills/jgengine-ui/reference-primitives.md +93 -3
  206. package/skills/jgengine-ui/reference.md +2 -0
  207. package/skills/jgengine-world/SKILL.md +12 -3
  208. package/skills/jgengine-world/api.md +201 -58
  209. package/skills/jgengine-world/capabilities.md +116 -3
  210. package/skills/jgengine-world/recipes/character-animation.md +31 -8
  211. package/skills/jgengine-world/recipes/controls.md +4 -0
  212. package/skills/jgengine-world/recipes/npc-senses.md +12 -0
  213. package/skills/jgengine-world/recipes/vehicle-feel.md +3 -1
  214. package/skills/jgengine-world/reference.md +167 -5
  215. package/skills/jgengine-world/visibility.md +28 -1
@@ -44,14 +44,43 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
44
44
 
45
45
  - `ActionTooltip` (function) · `import { ActionTooltip } from "@jgengine/react"`
46
46
 
47
+ ## animation-motion-params — read resolved player movement into reusable animation graph parameters
48
+
49
+ - `readModelAnimationParams` (function) · `import { readModelAnimationParams } from "@jgengine/shell/render/useModelAnimation"`
50
+
51
+ ## authored-flocks — render authored habitat agents through caller-selected animated species models with velocity orientation and bounded model lifetime
52
+
53
+ - `AuthoredFlocks` (function) · `import { AuthoredFlocks } from "@jgengine/shell/world/AuthoredFlocks"`
54
+
47
55
  ## authored-solids — collision for studio-authored world content such as city volumes
48
56
 
49
57
  - `AuthoredSolids` (function) · `import { AuthoredSolids } from "@jgengine/shell/scene"`
50
58
 
59
+ ## authored-surface-material — mount an owned PBR surface material on a mesh
60
+
61
+ - `AuthoredSurfaceMaterial` (function) · `import { AuthoredSurfaceMaterial } from "@jgengine/shell/render/authoredSurfaceMaterial"`
62
+ - `useAuthoredSurfaceMaterial` (function) · `import { useAuthoredSurfaceMaterial } from "@jgengine/shell/render/authoredSurfaceMaterial"`
63
+
64
+ ## authored-weather-rendering — Render authored weather from shared gameplay samples, simulation time and shelter volumes.
65
+
66
+ - `AuthoredWeatherLayer` (function) · `import { AuthoredWeatherLayer } from "@jgengine/shell/weather"`
67
+
51
68
  ## auto-scroll — pin a log/chat/console panel to its newest line as entries arrive — no hand-rolled scrollTop effects
52
69
 
53
70
  - `useAutoScroll` (function) · `import { useAutoScroll } from "@jgengine/react"`
54
71
 
72
+ ## bounded-spatial-audio — play positional or flat cues with listener orientation, voice budgets, and per-source cleanup
73
+
74
+ - `createAudioEngine` (function) · `import { createAudioEngine } from "@jgengine/shell/audio/audioEngine"`
75
+
76
+ ## browser-suspension — observe blur, hidden-page and pointer-lock loss while the game owns pause and input policy
77
+
78
+ - `useBrowserSuspension` (function) · `import { useBrowserSuspension } from "@jgengine/react"`
79
+
80
+ ## browser-suspension-observer — observe browser interruptions outside React with caller-owned pause policy and event sources
81
+
82
+ - `observeBrowserSuspension` (function) · `import { observeBrowserSuspension } from "@jgengine/react"`
83
+
55
84
  ## camera-shake-meter — HUD readout for a core camera-shake controller — a trauma meter plus current impact-kind label, reskinnable and kind-labelled
56
85
 
57
86
  - `CameraShakeMeter` (function) · `import { CameraShakeMeter } from "@jgengine/react"`
@@ -76,6 +105,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
76
105
 
77
106
  - `StatList` (function) · `import { StatList } from "@jgengine/react"`
78
107
 
108
+ ## chase-heading — keep camera-relative input heading independent of body facing while retaining vehicle and seat camera follow
109
+
110
+ - `resolveChaseHeading` (function) · `import { resolveChaseHeading } from "@jgengine/shell/camera/chaseHeading"`
111
+
79
112
  ## clock-format — format a signed time gap like a race split (+/- m:ss.ff)
80
113
 
81
114
  - `formatDelta` (function) · `import { formatDelta } from "@jgengine/core/ui"`
@@ -125,6 +158,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
125
158
 
126
159
  - `useTarget` (function) · `import { useTarget } from "@jgengine/react"`
127
160
 
161
+ ## custom-viewmodel-muzzle — align tracer origins with a custom viewmodel's live muzzle without changing authoritative shots
162
+
163
+ - `registerFirstPersonMuzzle` (function) · `import { registerFirstPersonMuzzle } from "@jgengine/shell/camera"`
164
+
128
165
  ## cutscene-letterbox — reskinnable cinematic letterbox + skip overlay for a cutscene — animated bars, caption/dialogue slot, progress line, Skip button
129
166
 
130
167
  - `CutsceneLetterbox` (function) · `import { CutsceneLetterbox } from "@jgengine/react"`
@@ -149,6 +186,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
149
186
 
150
187
  - `DEFAULT_WALK_CODES` (const) · `import { DEFAULT_WALK_CODES } from "@jgengine/shell/shellMovement"`
151
188
 
189
+ ## dialog-behavior — controlled dialog focus and keyboard behavior without owning markup or screen state
190
+
191
+ - `useDialogBehavior` (function) · `import { useDialogBehavior } from "@jgengine/react"`
192
+
152
193
  ## dialogue-view — drop-in branching conversation UI — speaker + portrait slot, current line, clickable response choices that advance a DialogueRun
153
194
 
154
195
  - `DialogueView` (function) · `import { DialogueView } from "@jgengine/react"`
@@ -165,6 +206,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
165
206
 
166
207
  - `useDomEvent` (function) · `import { useDomEvent } from "@jgengine/react"`
167
208
 
209
+ ## drag-layer — composable pointer-owned drag, drop targets and cancellation for custom cards and inventory UI
210
+
211
+ - `useDragLayer` (function) · `import { useDragLayer } from "@jgengine/react"`
212
+
168
213
  ## entity-frames — overlay that renders caller-composed frames over on-screen entities
169
214
 
170
215
  - `EntityFrames` (function) · `import { EntityFrames } from "@jgengine/react"`
@@ -294,6 +339,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
294
339
 
295
340
  - `createI18n` (function) · `import { createI18n } from "@jgengine/core/ui"`
296
341
 
342
+ ## imported-rig-node — resolve original imported bone and slot names with ambiguity diagnostics
343
+
344
+ - `resolveRigNode` (function) · `import { resolveRigNode } from "@jgengine/shell/render/rigNode"`
345
+
297
346
  ## interaction-prompt-host — screen-anchored "press E to…" callout rendering a prompt registry's active interactable — keybind cap+label, gauge hold bar, or plain label, theme- and per-prompt-accent skinnable
298
347
 
299
348
  - `InteractionPrompt` (function) · `import { InteractionPrompt } from "@jgengine/react"`
@@ -326,6 +375,37 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
326
375
 
327
376
  - `MapLegend` (function) · `import { MapLegend } from "@jgengine/react"`
328
377
 
378
+ ## material-appearance-signals — update one owned material from wetness and local card exposure without global lighting edits
379
+
380
+ - `applyMaterialAppearanceSignals` (function) · `import { applyMaterialAppearanceSignals } from "@jgengine/shell/render/materialAppearanceSignals"`
381
+ - `captureMaterialAppearanceBaseline` (function) · `import { captureMaterialAppearanceBaseline } from "@jgengine/shell/render/materialAppearanceSignals"`
382
+ - `restoreMaterialAppearanceBaseline` (function) · `import { restoreMaterialAppearanceBaseline } from "@jgengine/shell/render/materialAppearanceSignals"`
383
+ - `setHairCardLightExposure` (function) · `import { setHairCardLightExposure } from "@jgengine/shell/render/materialAsset"`
384
+
385
+ ## material-assets — render authored physical surfaces, woven detail and approximate hair-card appearance
386
+
387
+ - `MaterialAssetSurface` (function) · `import { MaterialAssetSurface } from "@jgengine/shell/render/materialAsset"`
388
+ - `applyMaterialAsset` (function) · `import { applyMaterialAsset } from "@jgengine/shell/render/materialAsset"`
389
+ - `applyMaterialAssignments` (function) · `import { applyMaterialAssignments } from "@jgengine/shell/render/materialAsset"`
390
+ - `materialAssetSurface` (function) · `import { materialAssetSurface } from "@jgengine/shell/render/materialAsset"`
391
+ - `useMaterialAssetMaterial` (function) · `import { useMaterialAssetMaterial } from "@jgengine/shell/render/materialAsset"`
392
+
393
+ ## material-resource-metrics — inspect loaded texture byte bounds and physical, coverage and transmission participation
394
+
395
+ - `materialResourceMetrics` (function) · `import { materialResourceMetrics } from "@jgengine/shell/render/materialAsset"`
396
+
397
+ ## material-slot-selection — preflight native model assignments without allocating or changing imported resources
398
+
399
+ - `validateMaterialAssignmentTargets` (function) · `import { validateMaterialAssignmentTargets } from "@jgengine/shell/render/materialAsset"`
400
+
401
+ ## material-slots — discover exact imported mesh and material selectors with UV and tangent prerequisites
402
+
403
+ - `inspectModelMaterialSlots` (function) · `import { inspectModelMaterialSlots } from "@jgengine/shell/render/materialAsset"`
404
+
405
+ ## material-texture-metadata — configure owned map views with semantic color space, packed channels, UV transforms and sampling
406
+
407
+ - `configureMaterialTexture` (function) · `import { configureMaterialTexture } from "@jgengine/shell/render/materialAsset"`
408
+
329
409
  ## menu-router — screen stack for a game front-end — push/back/replace/reset with optional Escape-to-back
330
410
 
331
411
  - `useMenuRouter` (function) · `import { useMenuRouter } from "@jgengine/react/menuRouter"`
@@ -358,14 +438,28 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
358
438
 
359
439
  - `createModalStack` (function) · `import { createModalStack } from "@jgengine/core/ui"`
360
440
 
441
+ ## model-animation-diagnostics — inspect imported clip mappings, layer masks and root-track compatibility
442
+
443
+ - `diagnoseModelAnimation` (function) · `import { diagnoseModelAnimation } from "@jgengine/shell/render/useModelAnimation"`
444
+
361
445
  ## model-fallbacks — models the loader replaced with a placeholder, for capture and smoke assertions
362
446
 
363
447
  - `modelLoadFallbacks` (function) · `import { modelLoadFallbacks } from "@jgengine/shell/render/modelLoad"`
364
448
 
449
+ ## model-instance — clone a loaded model for independent styling and animation
450
+
451
+ - `cloneModelScene` (function) · `import { cloneModelScene } from "@jgengine/shell/render/modelRender"`
452
+ - `disposeModelScene` (function) · `import { disposeModelScene } from "@jgengine/shell/render/modelRender"`
453
+ - `useModelInstance` (function) · `import { useModelInstance } from "@jgengine/shell/render/useModelInstance"`
454
+
365
455
  ## model-load-idle — how long the shared GLB loader has been idle, for capture settle waits
366
456
 
367
457
  - `modelLoadIdleMs` (function) · `import { modelLoadIdleMs } from "@jgengine/shell/render/modelLoad"`
368
458
 
459
+ ## multiplayer-p2p — bootstrap a playable authoritative world for browser peer co-op
460
+
461
+ - `resolvePeerShellMultiplayer` (function) · `import { resolvePeerShellMultiplayer } from "@jgengine/shell/multiplayer"`
462
+
369
463
  ## nameplates — billboarded name + HP bar over nearby entities
370
464
 
371
465
  - `WorldNameplates` (function) · `import { WorldNameplates } from "@jgengine/shell/world/WorldHud"`
@@ -435,7 +529,7 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
435
529
 
436
530
  - `togglePanel` (function) · `import { togglePanel } from "@jgengine/core/ui"`
437
531
 
438
- ## particle-field — render a core particle system as a soft-point GPU cloud with per-particle size, color, and alpha
532
+ ## particle-field — render a core particle pool as soft points, velocity streaks, connected ribbons, flakes, flames, smoke sprites, or ground ripples
439
533
 
440
534
  - `ParticleField` (function) · `import { ParticleField } from "@jgengine/shell/vfx/ParticleField"`
441
535
 
@@ -459,6 +553,14 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
459
553
 
460
554
  - `Popover` (function) · `import { Popover } from "@jgengine/react"`
461
555
 
556
+ ## projected-overdraw — sample actual mesh/camera fragment overlap with native coverage and explicit depth/blending/transmission limits
557
+
558
+ - `measureProjectedOverdraw` (function) · `import { measureProjectedOverdraw } from "@jgengine/shell/render/projectedOverdraw"`
559
+
560
+ ## projectile-models — render authoritative projectile flights with caller models or opt-in shaft/head geometry, velocity orientation, bounded instances, and settlement cleanup
561
+
562
+ - `ProjectileModels` (function) · `import { ProjectileModels } from "@jgengine/shell/combat/ProjectileModels"`
563
+
462
564
  ## quest-tracker — compact quest/objective HUD tracker — titles + labelled objective progress from describeTrackedQuest views
463
565
 
464
566
  - `QuestTracker` (function) · `import { QuestTracker } from "@jgengine/react"`
@@ -479,6 +581,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
479
581
 
480
582
  - `useRafLoop` (function) · `import { useRafLoop } from "@jgengine/react"`
481
583
 
584
+ ## rain-ground-ripples — Render bounded rain impacts on exposed terrain using the shared precipitation clock.
585
+
586
+ - `RainImpactField` (function) · `import { RainImpactField } from "@jgengine/shell/weather"`
587
+
482
588
  ## resolve-game-look — expand a look preset into concrete lighting/backdrop/post knobs
483
589
 
484
590
  - `resolveGameLook` (function) · `import { resolveGameLook } from "@jgengine/core/ui"`
@@ -499,6 +605,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
499
605
 
500
606
  - `ScreenEffectsOverlay` (function) · `import { ScreenEffectsOverlay } from "@jgengine/shell/postfx/ScreenEffectsOverlay"`
501
607
 
608
+ ## scroll-rail — reachable horizontal controls with visible overflow navigation and keyboard focus reveal
609
+
610
+ - `ScrollRail` (function) · `import { ScrollRail } from "@jgengine/react"`
611
+
502
612
  ## selection-collection — accessible portrait-strip / group-chip renderer over a selection model
503
613
 
504
614
  - `SelectionCollectionChrome` (function) · `import { SelectionCollectionChrome } from "@jgengine/react"`
@@ -544,6 +654,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
544
654
 
545
655
  - `StartScreen` (function) · `import { StartScreen } from "@jgengine/react"`
546
656
 
657
+ ## static-shape-instances — render authored primitive transforms as static material-compatible instance batches
658
+
659
+ - `StaticShapeInstances` (function) · `import { StaticShapeInstances } from "@jgengine/shell/render/staticShapeInstances"`
660
+
547
661
  ## status-effect-bar — timeline HUD row of active statuses — icon + radial countdown ring + stack badge, driven off the status model, HudTheme-skinned
548
662
 
549
663
  - `StatusEffectBar` (function) · `import { StatusEffectBar } from "@jgengine/react"`
@@ -556,6 +670,10 @@ Reach for these before hand-rolling. Each row is *the thing you need* → *the p
556
670
 
557
671
  - `TalentTree` (function) · `import { TalentTree } from "@jgengine/react"`
558
672
 
673
+ ## terrain-paint-color — sample authored terrain surfaces and blended layers for shared ground rendering
674
+
675
+ - `createTerrainPaintColorSampler` (function) · `import { createTerrainPaintColorSampler } from "@jgengine/shell/terrain"`
676
+
559
677
  ## territory-overlay — show footprint ownership, claim cost, and affordability
560
678
 
561
679
  - `TerritoryOverlay` (function) · `import { TerritoryOverlay } from "@jgengine/shell/TerritoryOverlay"`
@@ -2,6 +2,26 @@
2
2
 
3
3
  On-demand detail behind [reference.md](reference.md) §6. Search [capabilities.md](capabilities.md) by intent first; open this file when you need how a shipped block composes.
4
4
 
5
+ ## Browser interruptions
6
+
7
+ `useBrowserSuspension(onSuspend, { blur, hidden, pointerLockLost })` from
8
+ `@jgengine/react/browserLifecycle` observes all three triggers by default and
9
+ calls the latest callback with `"blur"`, `"hidden"`, or `"pointer-lock-lost"`.
10
+ Pointer lock acquisition and visible-page events do not notify. Mounting while
11
+ unlocked or hidden does not notify either. The game owns its pause guards,
12
+ modal handling, input reset and multiplayer policy; this hook never changes
13
+ simulation state. `observeBrowserSuspension` offers the same behavior outside
14
+ React and returns listener cleanup; its optional sources support iframe windows
15
+ and isolated tests.
16
+
17
+ **Voice transmission state.** `useVoice` (`@jgengine/react/voice`) reads its mode, mute, status and transmission from the push-to-talk controller. Initial `mode: "openMic"` enables transmission on the first render; granted audio tracks adopt the current mode and mute state before publication, including changes made while capture is pending. Transport readiness preserves explicitly enabled hold/toggle sessions. Use `setMode` and `setMuted` for policy changes; microphone permission and transport stay caller-owned.
18
+
19
+ **Microphone lifetime.** `requestMic()` returns `false` for requests retired by unmount, a later request, or channel/transport replacement. Their returned tracks stop without publication or stale error updates. Successful replacement stops the previous capture; a current permission denial leaves an already accepted capture available. Accepted capture survives transport replacement and joins the replacement channel with its current stream id. Retained callbacks from a retired channel/transport cannot start capture; a grant without live audio is rejected. Current publication errors return `false` and populate `micError` while retaining accepted capture for retry; retired publication results cannot update the current owner.
20
+
21
+ **Keyboard ownership.** The shell leaves prevented key events and focused text, dialog, grid, gridcell, and toolbar controls to the HUD, clearing held gameplay input at that boundary. Custom keyboard widgets call `preventDefault()` for the keys they handle. Opening a window does not pause simulation or change pointer lock; keep those policies in the game and use `suspendPlayControls(ctx)` when the window should suspend player controls.
22
+
23
+ **Push-to-talk ownership.** `PushToTalkButton` (`@jgengine/react/voice`) owns one primary pointer or focused Enter/Space activation. Matching release, cancellation, capture loss, browser suspension and button unmount release its hold; mouse departure and keyboard focus loss also retire their activation. Secondary pointers, auxiliary buttons and key repeats cannot change it. Compose a caller-owned `VoiceState`; toggle/open-mic policy and holds started elsewhere remain caller-owned.
24
+
5
25
  ## 6. Game UI primitives
6
26
 
7
27
  Prefer small headless or lightly styled primitives over a giant universal design system. Useful concepts include:
@@ -25,6 +45,8 @@ Prefer small headless or lightly styled primitives over a giant universal design
25
45
 
26
46
  A primitive should expose game-oriented choices such as shape, material, urgency, placement, hierarchy, entry motion, icon treatment, compactness, and diegetic-versus-overlay presentation.
27
47
 
48
+ **Atomic bar fills.** An explicit `fill` prop wins over a bar skin and semantic palette colors. Without it, `HudSkin.bar.fill` wins over the normal or low-health palette token. `hudThemeVars` resets an inherited bar skin when the nested theme has none; `hudSkinVars` alone applies only the supplied skin fields and preserves inheritance for the rest.
49
+
28
50
  **Portable minimap adoption.** Existing React games pass `MarkerView[]`, a
29
51
  `MarkerSource`, or their existing `MarkerSet` to `Minimap`/`Compass`/`WorldMap`.
30
52
  Use `createMarkerSource` (`@jgengine/core/world/markers`) to cache a projection
@@ -32,7 +54,9 @@ from an external ECS/store snapshot; it needs no `GameProvider`, Three.js, or
32
54
  React Three Fiber. Follow [the portable minimap recipe](recipes/portable-minimap.md)
33
55
  instead of mirroring external entities into `createMarkerSet`.
34
56
 
35
- **Minimap** is already shipped, not hand-rolled: `Minimap` / `WorldMap` / `Compass` from `@jgengine/react/map` render a framed SVG minimap over a `MarkerSet` (`createMarkerSet`, `@jgengine/core/world/markers`) and optional `FogField`, projecting via `@jgengine/core/world/minimap` (`projectToMinimap`, `headingToBearing`, edge-clamp). A game feeds flat props (`markers`, `center: [x,z]`, `worldRadius`, `size`, `facingYaw`, `rotate`) and repopulates the marker set each HUD tick from live entities — no custom canvas painter. `MinimapPanel` (same module) composes zone-label + clock header slots and a `Compass` strip around a `Minimap` — pass `zoneLabel`/`clock` nodes (e.g. from `useGameClock().calendar`) and `showCompass`/`compassProps`; omit either header slot and it collapses, `showCompass={false}` drops the strip. **Baked terrain background**: to draw the authored terrain under the markers, pass `background={document.minimap?.background}` and `mapBounds={document.minimap?.bounds}` to `Minimap`/`WorldMap` (or `MinimapPanel`, which forwards both through) — the editor's `bake_minimap` action stores a top-down terrain PNG + world bounds on `EditorDocument.minimap` (see `jgengine-editor`), and runtime reads that stored PNG with no re-rasterization. Both are undefined until baked, so an unbaked game renders the plain map unchanged. Rolling a **custom** minimap around your own course/route content (not the full `Minimap` panel)? `MinimapChrome` is the headless chrome layer other games were re-drawing by hand: nest it inside your own `<svg>` for the ring `frame`, and pass `markers: MinimapChromeMarker[]` (`{ id, position, heading?, color?, radius?, glyph? }`) for edge-clamped dots that draw as a rotated arrow whenever a marker carries a `heading` (the compass-arrow / player-blip layer) — never hand-roll `clampToMinimapEdge` + a `<polygon>` again. **Nameplates**: `WorldNameplates` (`@jgengine/shell/world/WorldHud`) billboards a name + optional 78×6px HP bar over every nearby non-local entity — turn it on declaratively via `defineGame({ nameplates: { roles, maxDistance } })` (mirrors `worldHealthBars`) rather than mounting it by hand; skin every part via `className`/`data-*` slots (`nameplateClassName`, `nameClassName`, `barClassName`, `fillClassName`) or swap the whole markup with `renderNameplate`. When the game does **not** run the JGengine entity store — it owns enemies in its own array/ECS/store — reach for the data-first **entity-frame** seam instead of `WorldNameplates`: `EntityFrames` (`@jgengine/react/entityFrames`, `entity-frames` capability) takes a caller-owned `{ id, worldPosition, ... }[]` plus a `project` (world→screen) and a `renderFrame` that composes the shipped `HealthBar` + a name (reskinned via `barTokens`/`HudTheme`); it owns only the reusable behavior — projection offset, off-screen/behind-camera culling, and nearest-on-top stacking (`layoutEntityFrames` is the pure, unit-tested core). An R3F game gets the projector for free from `WorldEntityFrames` / `useWorldProjection` (`@jgengine/shell/world/WorldEntityFrames`), which samples the live camera and composes the react primitive — overhead nameplates/health bars from your own array in a few lines, no store mirroring. Follow [the overhead entity-frames recipe](recipes/overhead-entity-frames.md). **Selection rings**: `WorldObjectHighlights` (`@jgengine/shell/world/WorldHud`) draws a ground ring over every `ctx.scene.object.selection`-ed placed object — the object-layer counterpart to `WorldEntityBars`/`WorldNameplates`; mount it once in the game's scene (`color`/`radius`/`y` props, `radius` otherwise derived from the object's catalog `halfExtents`) instead of hand-rolling a selection highlight through `WorldOverlay` against external state. **Playing cards** are already shipped, not hand-rolled: `CardFace` / `StackedPile` / `CardStack` (with `Suit`, `Rank`, `PlayingCard`) from `@jgengine/react/cards` render a French-deck face (rank + suit pips, patterned back when `faceDown`) and an overlapping fan. `StackedPile` composes the existing drag system (`useDragLayer`/`DraggableCard`/`DropZone`) — pass a `layer` for drag and `dropId` for a drop target; `CardStack` binds a fan to a headless `CardPileState` zone (`@jgengine/core/cards/cardPile`). Never draw cards on a canvas or reinvent pointer handling. **Swing timer**: `swingTimerState(player, target, prevPeriod, prevTimer)` (`@jgengine/core/ui/swingTimer`) is the pure, parameter-in/next-state-out core for a melee swing bar (recovers period on the reset edge; hidden unless auto-attacking a live non-object target) — thread the returned `nextPeriod`/`nextTimer` back via refs, render a thin `Meter`.
57
+ **Fullscreen map gestures.** `FullscreenMap` owns one primary pan or drawing pointer. Cancellation, touch capture loss, closing, tool changes and unmount discard unfinished gestures and route drafts. Mouse release outside the viewport also retires ownership; auxiliary buttons do not finish a primary drag. Custom overlay controls, including shadow DOM controls, keep their native input. Compose `onWorldClick` for navigation or `onStrokeComplete` with a caller-owned annotation layer; the game keeps route policy, composition and skin.
58
+
59
+ **Minimap** is already shipped, not hand-rolled: `Minimap` / `WorldMap` / `Compass` from `@jgengine/react/map` render a framed SVG minimap over a `MarkerSet` (`createMarkerSet`, `@jgengine/core/world/markers`) and optional `FogField`, projecting via `@jgengine/core/world/minimap` (`projectToMinimap`, `headingToBearing`, edge-clamp). A game feeds flat props (`markers`, `center: [x,z]`, `worldRadius`, `size`, `facingYaw`, `rotate`) and repopulates the marker set each HUD tick from live entities — no custom canvas painter. `MinimapPanel` (same module) composes zone-label + clock header slots and a `Compass` strip around a `Minimap` — pass `zoneLabel`/`clock` nodes (e.g. from `useGameClock().calendar`) and `showCompass`/`compassProps`; omit either header slot and it collapses, `showCompass={false}` drops the strip. **Baked terrain background**: to draw the authored terrain under the markers, pass `background={document.minimap?.background}` and `mapBounds={document.minimap?.bounds}` to `Minimap`/`WorldMap` (or `MinimapPanel`, which forwards both through) — the editor's `bake_minimap` action stores a top-down terrain PNG + world bounds on `EditorDocument.minimap` (see `jgengine-editor`), and runtime reads that stored PNG with no re-rasterization. Both are undefined until baked, so an unbaked game renders the plain map unchanged. Rolling a **custom** minimap around your own course/route content (not the full `Minimap` panel)? `MinimapChrome` is the headless chrome layer other games were re-drawing by hand: nest it inside your own `<svg>` for the ring `frame`, and pass `markers: MinimapChromeMarker[]` (`{ id, position, heading?, color?, radius?, glyph? }`) for edge-clamped dots that draw as a rotated arrow whenever a marker carries a `heading` (the compass-arrow / player-blip layer) — never hand-roll `clampToMinimapEdge` + a `<polygon>` again. **Nameplates**: `WorldNameplates` (`@jgengine/shell/world/WorldHud`) billboards a name + optional 78×6px HP bar over every nearby non-local entity — turn it on declaratively via `defineGame({ nameplates: { roles, maxDistance } })` (mirrors `worldHealthBars`) rather than mounting it by hand; skin every part via `className`/`data-*` slots (`nameplateClassName`, `nameClassName`, `barClassName`, `fillClassName`) or swap the whole markup with `renderNameplate`. Bars and nameplates respect blocking object, wall, and terrain geometry from the actual render camera by default; use `occlude: false` only for an intentional reveal mechanic. They filter hidden/depleted-health entities and renderer membership, use camera distance, and sample at most 64 nearby candidates with visibility rays per refresh (bars 80ms, plates 120ms); retained bar anchors reproject every frame without additional queries or rays. Both declarative configs and direct components expose `maxSamples` (capped at 256) and `tickMs`. Nameplates retain human names but suppress id-equal, lowercase machine names and names containing `_`, `:`, or `/`; supply `nameplates.resolveName(entity)` for authored catalog or player labels, returning `null` to omit a plate. When the game does **not** run the JGengine entity store — it owns enemies in its own array/ECS/store — reach for the data-first **entity-frame** seam instead of `WorldNameplates`: `EntityFrames` (`@jgengine/react/entityFrames`, `entity-frames` capability) takes a caller-owned `{ id, worldPosition, ... }[]` plus a `project` (world→screen) and a `renderFrame` that composes the shipped `HealthBar` + a name (reskinned via `barTokens`/`HudTheme`); it owns only the reusable behavior — projection offset, off-screen/behind-camera culling, and nearest-on-top stacking (`layoutEntityFrames` is the pure, unit-tested core). An R3F game gets the projector for free from `WorldEntityFrames` / `useWorldProjection` (`@jgengine/shell/world/WorldEntityFrames`), which samples the live camera and composes the react primitive — overhead nameplates/health bars from your own array in a few lines, no store mirroring. Follow [the overhead entity-frames recipe](recipes/overhead-entity-frames.md). **Selection rings**: `WorldObjectHighlights` (`@jgengine/shell/world/WorldHud`) draws a ground ring over every `ctx.scene.object.selection`-ed placed object — the object-layer counterpart to `WorldEntityBars`/`WorldNameplates`; mount it once in the game's scene (`color`/`radius`/`y` props, `radius` otherwise derived from the object's catalog `halfExtents`) instead of hand-rolling a selection highlight through `WorldOverlay` against external state. **Playing cards** are already shipped, not hand-rolled: `CardFace` / `StackedPile` / `CardStack` (with `Suit`, `Rank`, `PlayingCard`) from `@jgengine/react/cards` render a French-deck face (rank + suit pips, patterned back when `faceDown`) and an overlapping fan. `StackedPile` composes the existing drag system (`useDragLayer`/`DraggableCard`/`DropZone`) — pass a `layer` for drag and `dropId` for a drop target; `CardStack` binds a fan to a headless `CardPileState` zone (`@jgengine/core/cards/cardPile`). Never draw cards on a canvas or reinvent pointer handling. **Swing timer**: `swingTimerState(player, target, prevPeriod, prevTimer)` (`@jgengine/core/ui/swingTimer`) is the pure, parameter-in/next-state-out core for a melee swing bar (recovers period on the reset edge; hidden unless auto-attacking a live non-object target) — thread the returned `nextPeriod`/`nextTimer` back via refs, render a thin `Meter`.
36
60
 
37
61
  **HUD widgets split into three reusable layers** — data, renderer, chrome — so a second presentation drops in without a forked widget. **Chrome**: `HudFrame` (`@jgengine/react/hudFrame`, `hud-frame` capability) is the single framed-panel primitive — `<HudFrame variation="glass"|"plate"|"retro"|"themed" shape="rounded"|"circle"|"square" title aside padding width style>` renders a `data-hud-frame` div with an optional small-caps `title`/`aside` header; `glass` is byte-identical to the built-in widgets' dark-glass panel, `plate` a heavier opaque plate, `retro` a hard black-outlined frame, `themed` driven by the `--jg-frame-*` `HudTheme` tokens (the token-skinning path SKILL.md promotes). Need only the CSS on your own element? spread `hudFrameStyle(variation, shape)`. Reach for it instead of hand-rolling a bordered panel `<div>` per widget. **Renderer**: `MinimapTrack` (`@jgengine/react/map`, `minimap-track-hud` capability) is a structurally-different second minimap — a horizontal linear progress rail (vs the radial `Minimap`) with colored zone `spans` and gate/exit/player `pips` placed by 0..1 fraction, driven by core `trackFraction([x,z], { from, to })` (`@jgengine/core/world/minimapTrack`, `minimap-track` capability — the 1D analogue of `projectToMinimap`). It reads no store; the caller supplies fractions. Use it for corridor/route progress; use the radial `Minimap` for open worlds — both share `HudFrame` chrome. **Data**: `useLiveMarkers(rebuild, { intervalMs?, deps? })` (`@jgengine/react/hooks`, `live-markers` capability) returns a self-ticking `MarkerSet` that each HUD tick clears and re-runs your `rebuild(markers, ctx)` against the live scene — replaces the hand-rolled `useState` ticker + `useEffect` + `createMarkerSet` + `markers.clear()` + rescan boilerplate; feed the returned set straight into `Minimap`/`MinimapPanel`.
38
62
 
@@ -42,8 +66,12 @@ instead of mirroring external entities into `createMarkerSet`.
42
66
 
43
67
  **Inventory grid** is already shipped, not hand-rolled: `<InventoryGrid inventoryId columns>` (`@jgengine/react`, backed by the `useInventoryGrid` hook) is a drop-in NxN grid bound to a live inventory — it renders the bound inventory's slots and wires drag-to-move / swap / stack / split through the built-in `inventory.move` / `inventory.split` commands, so a bag is one element plus a reskin, never a re-derived slot matrix over raw divs. It is distinct from the atomic `EquipmentSlots` / `WeaponSlots`, which are single-slot targets for paperdoll and equip layouts — reach for `InventoryGrid` for the bag/backpack surface and the atomic slots for the worn/equipped layout. Reskin via `className`/`data-*` slots and HudTheme tokens; the mechanics stay caller-agnostic.
44
68
 
69
+ **Drag ownership.** `useDragLayer` (`@jgengine/react/dragLayer`) owns one primary pointer until release or cancellation. Compose `DraggableCard`, `DropZone`, and `DragGhost`; registered zones resolve from the pointer position even under touch capture. Releasing outside finishes with a null target; cancellation, Escape, blur, lost capture, and source or owner unmount release listeners without invoking drop policy. A removed zone cannot receive a stale drop. The layer releases ownership before calling `onDrop`; games retain their move, discard, rotation, and stack rules. Cards own the touch gesture, while inventory keyboard move and split controls remain available.
70
+
45
71
  **Toggleable game windows** are already shipped, not hand-rolled open/close state: `usePanels(defs)` + `<PanelHost>` + `<Window>` (`@jgengine/react`) over the headless `@jgengine/core/ui/panelModel` are THE way to build openable windows — bag (`B`), character (`C`), spellbook, quest log — with keybind toggles, drag-to-move, close buttons, ESC-to-close, and z-stack ordering all handled. Declare each window in `defs` (id, keybind, title), mount one `<PanelHost>`, and render each panel's body inside a `<Window>`; the game owns the body content and skin, the model owns focus/stacking/keybind wiring. Never re-derive window toggling from local `useState` booleans and hand-rolled keydown listeners.
46
72
 
73
+ Window title-bar movement belongs to one primary pointer. Release, cancellation, capture loss, blur, and window unmount retire that gesture's listeners; another pointer cannot move it. Controlled positions and panel z-order remain caller-owned.
74
+
47
75
  **Character sheet / paperdoll** is already shipped, not hand-rolled: `<CharacterSheet>` / `<Paperdoll>` / `<StatList>` (`@jgengine/react`) compose the paperdoll equip layout (worn `EquipmentSlots` arranged around a portrait) and the derived-stat readout into one window body. `Paperdoll` is the equip-slot arrangement, `StatList` the derived-stat rows, `CharacterSheet` the batteries-included default that pairs them — the game composes and reskins them (slot layout, stat labels/terminology, skin) rather than re-deriving a paperdoll from raw divs and manual stat math.
48
76
 
49
77
  **Toast/announcer stacks**: two supported sources, pick the one that matches where the message comes from. An engine event already bound onto `ctx.game.feed` (kill feed, loot log, quest update) renders with `@jgengine/react`'s `ToastStack({ action })` directly. A game-raised one-off message with its own lifetime (boss-intro banner, objective callout) belongs in a `createToastQueue` (`@jgengine/core/game/toasts`, `toast-feed` capability — see `jgengine-gameplay`) rendered from `queue.list()`; don't reimplement the append-cap-plus-TTL-prune loop as a local `Toast`/`pushToast` pair.
@@ -62,6 +90,8 @@ The post chain itself is never hand-wired render passes. Set `defineGame({ postP
62
90
  - `ao: { radius, intensity, distanceFalloff, blend }` — ground-truth ambient occlusion; heavier than the rest, omit or `false` on low-end targets.
63
91
  - `stylize: { outline, bands, pixelSize }` — art style without touching materials. `outline: { color, thickness, opacity, depthThreshold, normalThreshold, fadeDistance }` traces ink lines from depth and normal edges (one extra normal/depth scene render, shadow maps reused); `bands` quantizes brightness into cel bands keeping hue; `pixelSize` snaps the frame to retro blocks. Mix freely: outline alone is a clean comic ink, `bands: 3` plus outline is cartoon, `pixelSize` plus `bands` is retro. Mark custom overlay effects with `POSTFX_OVERLAY_USERDATA` so they are not outlined; transparent, alpha-cut, points, lines and sprites are skipped automatically.
64
92
 
93
+ AO and depth-of-field prepasses reuse the beauty pass's shadow maps; they do not redraw shadow casters. Prepass failure restores shadow update policy and marked overlay visibility. The composer resizes passes through `setSize`, and graph cleanup calls each pass's `dispose` once; avoid reading a pass's internal targets or materials.
94
+
65
95
  **Orbit camera occlusion:** the third-person orbit rig takes `camera: { collision: { enabled, padding?, minTargetDistance? } }` — a spring-arm that raycasts target→camera each frame and pulls the boom in past walls/terrain so the camera never clips inside geometry. Off by default (unchanged chase feel); enable it for any world with interiors or dense structures.
66
96
 
67
97
  Lighting is `defineGame({ lighting })` (`LightingConfig`): ambient / hemisphere / directional, replacing the shell's default lights when set. A `DirectionalLightingConfig` with `castShadow` takes `shadowMapSize`, `shadowCameraSize`, `shadowBias`, `shadowNormalBias` for crisp contact shadows. Sky-lit worlds (a `sky()` world feature) get a high-res sun whose shadow camera follows the view each frame, so grounded shadows stay sharp under the player anywhere in a large world.
@@ -70,10 +100,50 @@ Lighting is `defineGame({ lighting })` (`LightingConfig`): ambient / hemisphere
70
100
 
71
101
  Three composable-chrome seams for FPS/TPS polish — a placement hook plus a good default, never a forced look:
72
102
 
73
- - **Custom viewmodel.** `defineGame({ viewmodel })` supplies a component rendered inside the shell's camera-locked, muzzle-tracked anchor in place of the built-in three-mesh gun — read when the active rig is first-person. It receives `ViewmodelProps` (`@jgengine/shell/camera`): `{ cuesRef }`, a live `MutableRefObject<EntityRenderCues>` for the followed entity — read `cuesRef.current` inside your own `useFrame` to drive bob/recoil/reload poses; never store it as render state (it updates every frame). `camera.firstPerson.viewmodel: false` renders no viewmodel at all regardless of `defineGame`'s `viewmodel` field — the explicit opt-out always wins. `readFirstPersonMuzzle(target: THREE.Vector3)` (also `@jgengine/shell/camera`) writes the live muzzle world position into `target` and returns `false` when no viewmodel is mounted — the seam for muzzle-flash lights, tracer origins, or shell casings.
103
+ - **Custom viewmodel.** `defineGame({ viewmodel })` supplies a component rendered inside the shell's camera-locked, muzzle-tracked anchor in place of the built-in three-mesh gun — read when the active rig is first-person. It receives `ViewmodelProps` (`@jgengine/shell/camera`): `{ cuesRef }`, a live `MutableRefObject<EntityRenderCues>` for the followed entity — read `cuesRef.current` inside your own `useFrame` to drive bob/recoil/reload poses; never store it as render state (it updates every frame). `camera.firstPerson.viewmodel: false` renders no viewmodel at all regardless of `defineGame`'s `viewmodel` field — the explicit opt-out always wins. `readFirstPersonMuzzle(target: THREE.Vector3, camera?: THREE.Camera)` (also `@jgengine/shell/camera`) writes the live presentation muzzle world position into `target`; pass the active Three.js camera to isolate canvases. It returns `false` without changing `target` when no muzzle is available — the seam for muzzle-flash lights, tracer origins, or shell casings.
74
104
  - **Weapon pose.** `camera.weapon: (entityId) => { handling, presentation } | null` hands the rigs the held weapon's `createWeaponHandling` frame and a `WeaponPresentationTuning` (`@jgengine/core/combat/weaponPresentation`). First person poses the viewmodel anchor from it (hip and ADS offsets, viewmodel FOV, `adsZoom`, sway from look speed, bob from `cuesRef`, recoil kick) and adds the recoil to the look; `shoulder` takes its ADS blend from `adsProgress` and adds the same recoil. A custom `viewmodel` rides the posed anchor. `bun run drive weapon-handling` (and `weapon-handling-shoulder`) is the dev demo.
75
- - **`WorldOverlay` receives `{ ctx }`.** `defineGame({ WorldOverlay })` components take `WorldOverlayProps` (`@jgengine/core/game/playableGame`) — `ctx: GameContext` handed directly, no extra hook or module-global workaround needed to reach engine state from canvas-layer VFX.
105
+ - **`WorldOverlay` receives `{ ctx }`.** `defineGame({ WorldOverlay })` components take `WorldOverlayProps` (`@jgengine/core/game/playableGame`) — `ctx: GameContext` handed directly, no extra hook or module-global workaround needed to reach engine state from canvas-layer VFX. Shared bars/nameplates mounted there inherit the renderer's visibility context; both omit the local account and its currently possessed body. Occlusion still uses the render camera and the authored overlay anchor, with `occlude: false` as an explicit through-wall reveal. Custom geometry retains the overlay's camera-transparent policy.
76
106
  - **Render cues for any custom rig.** `useEntityRenderCues(instanceId, tuning?)` (`@jgengine/shell/render/useEntityRenderCues`) returns the same `cuesRef` the viewmodel gets, for a custom `renderEntity` component: velocity-driven `bobPhase`, `firing`/`recoil` from `ctx.game.playEntityAnimation(instanceId, "fire")`, `reloading` from `"reload"`/`"reloadEnd"`, `hit` from `combat.hitReaction`, `dead` from `entity.died` — no diffing the parent group's position, no game-side module map for attack timing. `RenderCueTuning` (`@jgengine/core/combat/renderCues`) overrides the bob rate / recoil decay / pulse durations; see `jgengine-combat`'s `combat/renderCues` for the underlying pure math.
107
+ A custom `WorldOverlay` rig can keep `camera.firstPerson.viewmodel: false` and
108
+ register its own live muzzle for the shell's tracer presentation:
109
+
110
+ ```tsx
111
+ import { useEffect, useRef } from "react";
112
+ import { useThree } from "@react-three/fiber";
113
+ import type { Object3D } from "three";
114
+ import { registerFirstPersonMuzzle } from "@jgengine/shell/camera";
115
+
116
+ function CustomRig() {
117
+ const camera = useThree((state) => state.camera);
118
+ const muzzle = useRef<Object3D>(null);
119
+ useEffect(() => registerFirstPersonMuzzle(camera, (target) => {
120
+ const tip = muzzle.current;
121
+ if (tip === null) return false;
122
+ tip.getWorldPosition(target);
123
+ return true;
124
+ }), [camera]);
125
+ return <group>{/* game-owned animated weapon geometry */}<object3D ref={muzzle} /></group>;
126
+ }
127
+ ```
128
+
129
+ Place the marker at the game's actual barrel tip and move it with the custom
130
+ rig's recoil, aim, bob, reload, and equipment poses. Returning the registration's
131
+ cleanup from the effect releases only that owner, including StrictMode remounts.
132
+ The newest available custom reader wins over that camera's tracked stock muzzle;
133
+ return `false` when unequipped or unavailable. A failed/invalid read preserves
134
+ the caller's fallback origin. Registrations are limited to 64 per camera per
135
+ priority; legacy one-argument reads consider the newest 64 globally per priority.
136
+ Callbacks run on demand over a snapshot of at most 64 readers per priority.
137
+ Disposed readers are skipped before their callback starts; newly registered
138
+ readers join the next read. Callbacks must write finite world coordinates and should not throw.
139
+
140
+ This is presentation only: projectile prediction, collision, authority, and
141
+ `projectile.settled.origin` remain simulation-owned. Scrap Signal's
142
+ `FerralonViewmodel` is the concrete adopter: its `flash` marker already shares
143
+ `muzzleOffsetZ(gun.family)` with the actual barrel geometry. Its game-side
144
+ registration waits for the coordinator's verified published SDK release; no
145
+ source aliases or native verification of unpublished APIs are implied.
146
+
77
147
  `@jgengine/shell/terrain`'s `ProceduralGround`/`CarvedTerrain`/`GrassField` are the game-facing terrain surface; the height-field math underneath (`arenaField`, `flatField`, `fractalNoise`, `resolveGroundStep`, `valueNoise`, `withNormal`, re-exported from `@jgengine/core/world/terrain`) and `GamePlayerShell`'s physics helpers (`applyMotionImpulses`, `nearbyObstacles`, `resolvePhysicsTuning`, `hasEnvironmentTerrain`, sourced from `core/runtime/motionIntents` / `core/movement`) are internal building blocks the shell composes for you — reach for `defineGame({ movement, world })` and the ground primitives above instead of calling these directly.
78
148
 
79
149
  ## 15. Compact implementation API appendix
@@ -87,3 +157,23 @@ The shipped building blocks — inventory grids, toggleable windows, character s
87
157
  ## 2D sprite presentation
88
158
 
89
159
  Core owns renderer-independent atlas data and animation state. Convert Aseprite or TexturePacker JSON with `fromAseprite` / `fromTexturePacker` from `@jgengine/core/assets/spriteAtlas`, then drive a clip with `createSpriteClipPlayer` from `@jgengine/core/render/sprite2d`. Persist `snapshot()` and restore it on load; use `retune({ speed })` for runtime playback changes. Use `sortingOrder(layers, layer, offset)` when a game maps named presentation layers to renderer order.
160
+
161
+ The shell's `EntitySprite` changes atlas UVs without uploading the image again. Configuration changes request a frame; frozen shell posters keep their demand rendering behavior.
162
+
163
+ ## Model instances
164
+
165
+ Custom R3F model components use `useModelInstance` (`@jgengine/shell/render/useModelInstance`) inside Canvas and Suspense. Pass the model's URL, placement, shadows and animation; render its returned `scene` with `position` and uniform `scale`. The imported `content` stays inside that placement frame, so imported pivots/transforms and root animation survive normalization. The hook shares the diagnostic loader and bind-pose placement used by `EntityModel`, and releases cloned materials and bone textures on replacement/unmount. It works without a game provider. Placement retuning uses the initially configured bind frame even after root animation has moved the content. Geometry/textures retained by the loader remain shared; resources introduced or replaced by `configure` stay caller-owned.
166
+
167
+ Use the optional `configure(content)` callback for initial caller-owned styling or deformation; memoize it, since a changed callback rebuilds the clone. Live mood colors or custom motion can update `content` in caller effects without replacing it. Texture loading, material-map application and extra geometry remain caller-owned; `EntityModel` supplies those for ordinary model configurations. Each clone owns its pose, bone textures and cloned materials, with one skeleton/material per shared source skeleton/material. Geometry and image textures stay in the loader cache. Apply material overrides with `clone: false` to an instance that already owns its materials. Attachments own their separate cleanup.
168
+
169
+ For non-hook consumers, `cloneModelScene` and `disposeModelScene` (`@jgengine/shell/render/modelRender`) provide the same resource ownership. `cloneMaterials: false` borrows source materials; do not mutate them.
170
+
171
+ `useModelInstance` already mounts `useModelAnimation`; do not mount a second driver on that instance. Other custom scene owners use `useModelAnimation` (`@jgengine/shell/render/useModelAnimation`) instead of creating a mixer in game code. It releases mixer bindings on replacement/unmount and skips updates for paused or completed single clips. Configuration and animation events request a frame without continuously waking a frozen poster.
172
+
173
+ `EntityModel` starts resolved part, attachment and material-map requests alongside the root model through the existing loader cache. Loaded maps apply before their next draw, without eagerly uploading an unconfigured color texture. Keep per-part error boundaries; a failed texture or attachment still reports its own fallback.
174
+
175
+ Cascaded lighting patches streamed meshes on attachment and material replacement instead of scanning the scene each frame. Replacing or unmounting a cascaded light releases its lights, targets, shadow maps and shader bindings while retaining authored material hooks. Authored cascade counts and map sizes keep priority over graphics-profile defaults.
176
+
177
+ **Scrolling controls.** `ScrollRail` (`@jgengine/react/scrollRail`) wraps caller-owned items with native horizontal scrolling, overflow-only 44px navigation buttons, and automatic focus reveal. Supply `label` for navigation names, prevent items from shrinking, and keep selection and keyboard semantics in the caller. Shared settings rows use it; short sidebar settings remain vertically scrollable. Touch movement sits below the HUD so the floating joystick capture zone cannot intercept an interactive panel; touch action clusters keep their higher layer.
178
+
179
+ **Controlled dialogs.** `useDialogBehavior({ open, onClose?, initialFocus?, focusKey? })` (`@jgengine/react/dialogBehavior`) returns a ref for the game's own dialog element. It owns initial focus, Tab cycling, Escape close requests, and return focus; it does not create modal state or markup. Set `role="dialog"`, `aria-modal`, an accessible name, and `tabIndex={-1}` on the root. Use `initialFocus: "root"` to focus the dialog itself. Omit `onClose` to disable Escape, or leave `open` true when the game rejects a close. `focusKey` refocuses changed content while keeping the original return target. Replacing an open root preserves its dialog order and original return target; a portalled child whose opener was removed returns to the replacement parent root. Nested dialogs may render through portals; only the most recently opened dialog handles keys. `ModalHost` uses the same behavior for its stack, so game-owned screens need no mirrored `ModalStack`.
@@ -261,6 +261,8 @@ Only show entries the game supports, and disable (don't delete) verbs that are t
261
261
 
262
262
  **Settings menu (themed, four layouts, no forced chrome).** The engine builds the whole menu for free — Sound (master + per-bus volume), Graphics (Low/Medium/High/Ultra tier, render scale, frame-rate limit (V-Sync or 30/60/120/144 cap), texture filtering, shadows, per-stage post toggles, UI scale, FPS counter), Gameplay (FOV slider, default 40–120), Controls (per-action key rebinding, inline click-to-rebind, persisted) — from the game's `audio.buses` and `input` map. What it does **not** do is bolt a fixed gear onto every game: **there is no auto trigger.** You place the entry yourself so it lives *inline with your game's own UI*, never a stray corner overlay. Drop `<SettingsTrigger className=…>` (from `@jgengine/react`) anywhere in your HUD or menu — headless button, `className` for skin/placement, optional `children` to replace the default gear glyph, renders nothing when there's nothing to show. Or call `useSettings().open()` from your own control. Tune the menu via `defineGame({ settings })` (`GameSettingsConfig` from `@jgengine/core/settings/settingsModel`):
263
263
 
264
+ HUD-only games (`presentation: "hud"` or a camera with rig `"none"`) use the same shell-owned settings store, audio volumes, key rebinding, actions, and menu. Pass `settings` directly to the public `defineGame` from `@jgengine/shell/gameKit`; both HUD and 3D presentations receive that configuration. Declare custom rows in `settings.extra` and read them with `useSetting`; saved player values override configured defaults, and no additional settings provider or runtime is needed. HUD-only menus omit the camera FOV slider. Select option buttons expose their selected state through `aria-pressed` in a labelled group. The shell leaves Tab navigation and Space activation to focused HUD controls and dialogs.
265
+
264
266
  - `variant: "panel" | "sheet" | "sidebar" | "fullscreen"` — the layout + skin (default `panel`; `sheet` is the mobile bottom-sheet). All four are fixed-size (no shrink-to-content jitter) and read the game's `--jg-*` theme tokens, falling back to a neutral dark skin.
265
267
  - `actions: SettingsActionDef[]` — game-state actions (Restart, Quit to menu, …). They become the **first "Game" tab, shown before anything else** — the home for buttons that used to float over the HUD. Each: `{ id, label, kind?: "default"|"danger", description?, run(ctx) }`; the menu closes right after `run`.
266
268
  - `hideBindings: string[]` — input actions to drop from the rebindable Controls list. A game-state key like `restart` belongs in `actions`, not the rebind grid — hide it here so it stops showing up as a "rebindable" control.
@@ -19,7 +19,7 @@ For a *connected* walkthrough that wires several primitives into a running loop,
19
19
  - [recipes/vehicle-feel.md](recipes/vehicle-feel.md) — feel target → handling metrics → physical knobs for a ground vehicle, plus the camera, sound and rumble hooks that hang off its telemetry.
20
20
  - [recipes/flight-feel.md](recipes/flight-feel.md) — an aircraft as physical numbers: surfaces, inertia and engine, with the symptom → knob table for how it flies.
21
21
  - [recipes/controls.md](recipes/controls.md) — actions → layered contexts that rebind live → keyboard, touch and gamepad on the same actions → per-axis feel.
22
- - [recipes/character-animation.md](recipes/character-animation.md) — clips → graph → rig → ground: data-driven state machines, triggers and clip events, root motion, foot IK that keeps feet on slopes, and instanced crowds.
22
+ - [recipes/character-animation.md](recipes/character-animation.md) — clips → graph → rig → ground: modular instance visibility, data-driven state machines, triggers and clip events, root motion, foot IK that keeps feet on slopes, and instanced crowds.
23
23
 
24
24
  ## Canonical workflows
25
25
 
@@ -31,15 +31,19 @@ A world is the place you play in: substrate + laws, via `world()` from `@jgengin
31
31
 
32
32
  1. Load the scene document through the shared authored-scene feature.
33
33
  2. Render objects, paths, terrain, foliage, and markers generically.
34
- 3. Query the same ids/layers for spawns, routes, plots, and interaction.
34
+ 3. Query the same ids/layers for spawns, routes, plots, and interaction. The shell batches compatible static catalog props above eight placements per 24 m cell, preserving chosen models, material groups, shadows, measured colliders and object ids for picking. Interactive/custom props, per-object visual/style overrides, and animated, rigged, composed, transparent or mirrored models keep individual renderers. Runtime compatibility changes return a placement to its individual renderer. Visibility compacts each batch to the current visible placements.
35
35
  4. Collision for generated and studio content comes from its data through `ctx.world.solids`; never hand-place invisible blockers for it (see reference.md, World solids).
36
36
  5. Keep derived caches rebuildable; the document remains authoritative.
37
37
 
38
+ For existing `environment()` consumers, `defineGame` overlays only defined editor sky fields on the legacy sky, retaining settings the editor cannot represent; an explicit `backdrop.sky` remains authoritative.
39
+
40
+ For environment-driven surface appearance, sample only selected targets through `material/appearanceSignals`; wetness already includes shelter. Capture the assigned material's dry baseline, apply explicit wet endpoints, and restore it on unbinding. Keep wind in geometry/simulation consumers and local card backlighting separate from scene exposure. See [reference.md](reference.md#environment-fields-weather-hooks--realm-composition).
41
+
38
42
  ### Movement and interaction
39
43
 
40
44
  Choose input intent, controller/motor, collision/navigation, and camera as separate seams. Commands express game intent; world systems resolve motion. Interaction targets come from bounded spatial/sensor queries, not full-world scans.
41
45
 
42
- Walk feel is data, not code. `movement.feel` sets `groundAcceleration`, `airAcceleration` and `groundFriction` (response rates, 1/s) plus `runMultiplier`, `crouchMultiplier`, jump forgiveness (`jumpBufferMs`, `coyoteMs`) and jump shape (`jumpCutFactor`, `apexGravityScale`, `fallGravityScale`, `landingRecoveryMs`), and `physics` sets `gravity` and `jumpVelocity`. A floaty platformer and a weighty shooter differ only in these numbers; pin them with `measureMovement` (`movement/movementProbe`) in a test.
46
+ Walk feel is data, not code. `movement.feel` sets `groundAcceleration`, `airAcceleration` and `groundFriction` (response rates, 1/s) plus `runMultiplier`, `crouchMultiplier`, jump forgiveness (`jumpBufferMs`, `coyoteMs`) and jump shape (`jumpCutFactor`, `apexGravityScale`, `fallGravityScale`, `landingRecoveryMs`), and `physics` sets `gravity` and `jumpVelocity`. The heightfield and capsule paths share these feel controls; voxel jumping retains its press-frame policy. Crouch follows supported catalog poses, and capsule standing requires headroom. Pin numeric movement behavior with `measureMovement` (`movement/movementProbe`) in a test.
43
47
 
44
48
  ### Stateful placed objects
45
49
 
@@ -49,8 +53,12 @@ Per-instance state belongs on the placement, not in a game-owned map keyed by `i
49
53
 
50
54
  Compose perception, selection, planning/behavior, movement, and lifecycle independently. Inject randomness and scheduling. Use spatial indexes, interest tiers, or bounded candidate sets for scale.
51
55
 
56
+ For chase-to-reach and cooldown effects, attach `pursue({ aggroRadius, reach, leashRange, speed, attack })` as behavior data. The host schedules acquisition and solid-aware movement; `behaviorControl` exposes pause/reset and optional threat. Pursuit progress survives GameContext save/replication without a game-local home/cooldown map. For allies or neutral players, configure `defineGame({ pursuit: { eligible(ctx, selfId, candidateId) { /* bounded caller policy */ } } })`; the predicate receives the current world and constrains nearest, held, explicit and forced targets. Bind the receiving world's policy data before advancing after a cold restore. Omission keeps the all-player default; see the reference for faction composition. Use a decision graph and navigation actions when a route or richer perception policy is required.
57
+
52
58
  NPC decisions are a `decisionGraph` behavior: the graph and its blackboard are data, actions are registered by name, and perception or game systems write facts into `behaviorControl(ctx).blackboard(id)` rather than actions querying the world. Set `thinkInterval` so crowds think a few times a second, not every frame, and release movement or claims in `onAbort`.
53
59
 
60
+ For a bounded local detour over movement collision geometry, use `planSolidRoute` (`nav/solidRoute`) with an indexed `solidObstaclesNear` or `sourceObstaclesNear` query. Handle `no-path` and `budget` separately; retain caller movement, goals, terrain and retry policy. See [reference.md](reference.md#local-collision-routes) for limits.
61
+
54
62
  Route on a polygon nav mesh through one `createNavMeshQuery(mesh)` per mesh; price terrain and gate doors with `areaCosts` via `retune`, and keep `maxNodes` bounded so a long request returns a `partial` route instead of stalling a frame.
55
63
 
56
64
  ### Fallback-seam diagnostics
@@ -64,6 +72,7 @@ Render seams fall back to placeholders when content is unauthored: default green
64
72
  - Do not duplicate editor coordinates in runtime state.
65
73
  - Public APIs accept semantic policies and caller data, not renderer mechanics or internal tuning rolls.
66
74
  - Generated environments still need deterministic data assertions; authored environments need scene-document assertions.
75
+ - Bound SFX through `PlayableGame.audio.maxVoices` and game-owned `SoundDef.priority`/`maxVoices`; choose reject or deterministic stealing with `voiceOverflow`. See the spatial audio reference for custom hosts and cleanup.
67
76
  - Audio files and licensing belong to `jgengine-assets`; spatial playback policy belongs here.
68
77
 
69
78