threedog 1.1.0 → 1.3.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 (370) hide show
  1. package/CHANGELOG.md +893 -798
  2. package/README.md +1 -1
  3. package/core/assets/Animator.js +41 -3
  4. package/core/assets/Assets.js +100 -24
  5. package/core/assets/assetEntry.js +73 -20
  6. package/core/assets/assetHot.js +68 -16
  7. package/core/assets/assetLoad.js +6 -6
  8. package/core/assets/assetLod.js +9 -2
  9. package/core/assets/assetManifest.js +12 -2
  10. package/core/assets/assetPart.js +54 -0
  11. package/core/assets/ik.js +271 -0
  12. package/core/assets/modelNeeds.js +37 -0
  13. package/core/assets/namedModel.js +102 -29
  14. package/core/assets/nodeVisibility.js +15 -0
  15. package/core/audio/Audio.js +36 -4
  16. package/core/audio/audioReverb.js +99 -0
  17. package/core/audio/audioRules.js +1 -1
  18. package/core/audio/audioVoice.js +1 -1
  19. package/core/base/Events.js +14 -4
  20. package/core/base/Random.js +1 -1
  21. package/core/base/Vars.js +1 -1
  22. package/core/base/docRef.js +51 -0
  23. package/core/base/errorCodes.js +187 -126
  24. package/core/base/errorHints.js +9 -7
  25. package/core/base/errors.js +25 -10
  26. package/core/base/events.generated.js +2 -0
  27. package/core/base/freeParts.js +76 -0
  28. package/core/base/math.js +28 -0
  29. package/core/base/sections.js +5 -5
  30. package/core/base/validate.js +31 -3
  31. package/core/engine/Engine.js +17 -7
  32. package/core/engine/Loading.js +5 -3
  33. package/core/engine/copies.js +1 -1
  34. package/core/engine/headlessLoad.js +4 -1
  35. package/core/engine/lifecycle.js +32 -16
  36. package/core/engine/loop.js +71 -27
  37. package/core/engine/moduleSlots.js +2 -2
  38. package/core/engine/moduleTypes.js +3 -3
  39. package/core/engine/modules.js +65 -39
  40. package/core/engine/page.js +6 -3
  41. package/core/engine/services.js +6 -5
  42. package/core/engine/startup.js +8 -7
  43. package/core/input/Input.js +28 -14
  44. package/core/input/inputContext.js +28 -16
  45. package/core/input/inputKeyboard.js +31 -3
  46. package/core/input/inputPad.js +4 -0
  47. package/core/input/inputPointer.js +2 -1
  48. package/core/input/inputSeat.js +1 -1
  49. package/core/inspect/Budget.js +109 -19
  50. package/core/inspect/DebugOverrides.js +28 -4
  51. package/core/inspect/Describe.js +17 -9
  52. package/core/inspect/Inspect.js +4 -2
  53. package/core/inspect/InspectMaterials.js +3 -1
  54. package/core/inspect/InspectPerf.js +19 -9
  55. package/core/inspect/InspectScene.js +32 -7
  56. package/core/inspect/MaterialInfo.js +19 -2
  57. package/core/inspect/UrlState.js +50 -28
  58. package/core/inspect/catalog.js +28 -9
  59. package/core/inspect/debugView.js +2 -1
  60. package/core/inspect/describeRender.js +25 -13
  61. package/core/inspect/describeText.js +14 -6
  62. package/core/inspect/lightWatch.js +1 -1
  63. package/core/inspect/metadata.generated.js +35 -17
  64. package/core/inspect/pictureChecks.js +148 -0
  65. package/core/inspect/pictureMenu.js +84 -0
  66. package/core/inspect/pictureWriters.js +26 -6
  67. package/core/inspect/textureBytes.js +12 -2
  68. package/core/inspect/toolDoor.js +2 -4
  69. package/core/ops/Ops.js +11 -4
  70. package/core/ops/holds.js +27 -10
  71. package/core/ops/opsAtomic.js +15 -7
  72. package/core/ops/opsGuard.js +2 -2
  73. package/core/ops/opsRun.js +8 -7
  74. package/core/ops/sharedPoint.js +72 -21
  75. package/core/ops/stacks.js +56 -16
  76. package/core/saves/SaveStore.js +9 -3
  77. package/core/saves/Saves.js +32 -23
  78. package/core/saves/saveApply.js +96 -44
  79. package/core/saves/saveIds.js +1 -1
  80. package/core/saves/saveVersions.js +7 -5
  81. package/core/saves/session.js +17 -8
  82. package/core/saves/stateReplace.js +34 -15
  83. package/core/scene/Rays.js +52 -10
  84. package/core/scene/Views.js +36 -15
  85. package/core/scene/adaptive.js +144 -21
  86. package/core/scene/drawOnly.js +17 -0
  87. package/core/scene/gameLights.js +47 -4
  88. package/core/scene/sceneMethods.js +13 -11
  89. package/core/scene/stepPoses.js +11 -3
  90. package/core/scene/targeting.js +5 -3
  91. package/core/scene/thingOps.js +1 -1
  92. package/core/scene/tier.js +15 -0
  93. package/core/stream/Batching.js +30 -7
  94. package/core/stream/Stream.js +26 -7
  95. package/core/stream/batchGroups.js +2 -2
  96. package/core/stream/chunkStream.js +7 -5
  97. package/core/stream/prepare.js +77 -0
  98. package/core/time/skip.js +3 -1
  99. package/core/time/time.js +4 -2
  100. package/docs/AI.md +82 -83
  101. package/docs/API.md +16 -16
  102. package/docs/CODEMAP.md +17 -11
  103. package/docs/COMMANDS.md +139 -142
  104. package/docs/CONVENTIONS.md +37 -49
  105. package/docs/MIGRATING-0.8.md +2 -2
  106. package/docs/MIGRATING-1.0.md +2 -2
  107. package/docs/THREE.md +30 -35
  108. package/docs/api/assets.md +3 -1
  109. package/docs/api/audio.md +4 -2
  110. package/docs/api/budget.md +5 -0
  111. package/docs/api/characters.md +10 -8
  112. package/docs/api/collision.md +6 -4
  113. package/docs/api/engine.md +16 -16
  114. package/docs/api/events.md +3 -2
  115. package/docs/api/ground.md +6 -5
  116. package/docs/api/hud.md +4 -2
  117. package/docs/api/input.md +5 -5
  118. package/docs/api/particles.md +2 -1
  119. package/docs/api/photo.md +3 -0
  120. package/docs/api/post.md +7 -4
  121. package/docs/api/quests.md +2 -2
  122. package/docs/api/rays.md +1 -2
  123. package/docs/api/saves.md +7 -7
  124. package/docs/api/settings.md +2 -2
  125. package/docs/api/tools.md +3 -1
  126. package/docs/api/vars.md +1 -1
  127. package/docs/api/vegetation.md +4 -2
  128. package/docs/api/world.md +1 -1
  129. package/docs/recipes/01-new-game.md +16 -17
  130. package/docs/recipes/02-npc.md +22 -18
  131. package/docs/recipes/03-items-pickups.md +37 -35
  132. package/docs/recipes/04-quests.md +15 -10
  133. package/docs/recipes/05-props-bake.md +101 -95
  134. package/docs/recipes/06-clock-events.md +28 -28
  135. package/docs/recipes/07-flow-scenes-pause.md +29 -26
  136. package/docs/recipes/08-weather-sky.md +52 -64
  137. package/docs/recipes/09-materials-lights-models.md +26 -17
  138. package/docs/recipes/10-blender-level.md +15 -10
  139. package/docs/recipes/11-vehicles.md +12 -7
  140. package/docs/recipes/12-navmesh.md +44 -26
  141. package/docs/recipes/13-animation.md +56 -45
  142. package/docs/recipes/14-custom-module.md +21 -18
  143. package/docs/recipes/15-perf.md +61 -55
  144. package/docs/recipes/16-dev-bridge.md +24 -33
  145. package/docs/recipes/18-world.md +36 -42
  146. package/docs/recipes/19-shooting-picking.md +20 -15
  147. package/docs/recipes/20-content-actions-save.md +48 -56
  148. package/docs/recipes/21-camera.md +45 -54
  149. package/docs/recipes/22-shop-gold.md +12 -7
  150. package/docs/recipes/23-ops.md +25 -23
  151. package/docs/recipes/26-ui-parts.md +67 -47
  152. package/docs/recipes/27-net.md +12 -7
  153. package/docs/recipes/28-terrain.md +24 -21
  154. package/docs/recipes/29-grid.md +32 -27
  155. package/docs/recipes/30-templates.md +21 -20
  156. package/docs/recipes/31-audio.md +39 -22
  157. package/docs/recipes/32-action-game.md +19 -14
  158. package/docs/recipes/33-stream-sources.md +15 -11
  159. package/docs/recipes/34-environment-lighting.md +126 -70
  160. package/docs/recipes/35-picture-from-reference.md +8 -8
  161. package/docs/recipes/36-ground-plants.md +27 -21
  162. package/docs/recipes/40-scene.md +19 -28
  163. package/docs/recipes/43-shader-patches-surfaces.md +15 -12
  164. package/docs/recipes/44-water-weather-hooks.md +34 -31
  165. package/docs/recipes/45-cascaded-shadows.md +35 -26
  166. package/docs/recipes/46-blender-art-route.md +7 -2
  167. package/docs/recipes/49-game-module-contract.md +13 -8
  168. package/docs/recipes/50-own-renderer.md +6 -2
  169. package/docs/recipes/51-capability-catalog.md +15 -8
  170. package/docs/recipes/52-around-the-picture.md +34 -32
  171. package/docs/recipes/53-ground-up-close.md +6 -1
  172. package/docs/recipes/55-mods-time-wrap.md +27 -19
  173. package/docs/recipes/56-webgpu-tsl.md +75 -43
  174. package/docs/recipes/57-control.md +18 -13
  175. package/docs/recipes/58-input.md +26 -16
  176. package/docs/recipes/59-depth-post-effects.md +8 -3
  177. package/docs/recipes/60-judge-the-picture.md +10 -9
  178. package/docs/recipes/61-deploy.md +5 -0
  179. package/docs/recipes/62-picture-code.md +72 -79
  180. package/docs/recipes/63-third-person-start.md +48 -45
  181. package/docs/recipes/64-particles.md +22 -10
  182. package/docs/recipes/65-swarm.md +18 -13
  183. package/docs/recipes/66-common-tasks.md +38 -35
  184. package/examples/action/.threedog/content-index.json +1 -1
  185. package/examples/action/GAMEMAP.md +2 -3
  186. package/examples/action/main.js +3 -3
  187. package/examples/action/picture/lights.js +3 -1
  188. package/examples/perf-island/.threedog/content-index.json +1 -1
  189. package/examples/perf-island/GAMEMAP.md +3 -3
  190. package/examples/perf-island/picture/lights.js +2 -1
  191. package/examples/plain-picture/GAMEMAP.md +1 -1
  192. package/examples/rc2d/GAMEMAP.md +1 -1
  193. package/examples/styletest/.threedog/content-index.json +1 -1
  194. package/examples/styletest/GAMEMAP.md +2 -2
  195. package/examples/styletest/main.js +1 -1
  196. package/examples/techniques/interior-light/README.md +3 -3
  197. package/examples/techniques/interior-light/interiorLight.js +2 -4
  198. package/examples/techniques/interior-light/picture/lights.js +2 -1
  199. package/examples/techniques/modular-building/picture/lights.js +3 -1
  200. package/examples/techniques/outlines-and-rim/picture/lights.js +3 -1
  201. package/examples/techniques/procedural-animation/README.md +1 -1
  202. package/examples/techniques/procedural-animation/main.js +1 -1
  203. package/examples/webgpu-tsl/GAMEMAP.md +1 -1
  204. package/examples/world/.threedog/content-index.json +1 -1
  205. package/examples/world/GAMEMAP.md +2 -3
  206. package/examples/world/art/humanoid.js +1 -1
  207. package/examples/world/main.js +6 -3
  208. package/index.d.ts +2 -2
  209. package/llms.txt +101 -0
  210. package/modules/ambience/Ambience.js +21 -5
  211. package/modules/calendar/index.js +9 -5
  212. package/modules/calendar/schedule.js +23 -8
  213. package/modules/camera/FirstPersonCamera.js +3 -1
  214. package/modules/camera/FollowCamera.js +10 -5
  215. package/modules/camera/RtsCamera.js +4 -3
  216. package/modules/camera/common.js +70 -8
  217. package/modules/camera/contract.js +1 -1
  218. package/modules/characters/Character.js +16 -10
  219. package/modules/characters/NPC.js +31 -19
  220. package/modules/characters/assetModel.js +14 -9
  221. package/modules/characters/astar.js +6 -1
  222. package/modules/characters/contract.js +2 -2
  223. package/modules/characters/index.js +34 -22
  224. package/modules/characters/movers/manual.js +1 -1
  225. package/modules/characters/movers/rapier.js +17 -2
  226. package/modules/characters/movers/simple.js +1 -1
  227. package/modules/characters/movers/support.js +16 -7
  228. package/modules/characters/npcAvoid.js +2 -2
  229. package/modules/characters/npcSim.js +3 -2
  230. package/modules/characters/pathAsync.js +24 -8
  231. package/modules/characters/pathJob.js +1 -1
  232. package/modules/characters/player.js +10 -9
  233. package/modules/characters/playerStrings.js +5 -5
  234. package/modules/characters/proceduralRig.js +5 -5
  235. package/modules/characters/useModel.js +6 -0
  236. package/modules/characters/walkTo.js +1 -1
  237. package/modules/collision/Collision.js +29 -18
  238. package/modules/collision/grid.js +22 -4
  239. package/modules/content/index.js +3 -1
  240. package/modules/content/loader.js +1 -1
  241. package/modules/content/models.js +82 -33
  242. package/modules/content/props.js +2 -1
  243. package/modules/content/rules.js +11 -5
  244. package/modules/content/templates.js +3 -3
  245. package/modules/content/words.js +2 -2
  246. package/modules/debug/DebugPanel.js +9 -9
  247. package/modules/flow/index.js +9 -6
  248. package/modules/gameplay/Dialogue.js +34 -20
  249. package/modules/gameplay/Interactions.js +19 -15
  250. package/modules/gameplay/Inventory.js +9 -4
  251. package/modules/gameplay/Quests.js +12 -10
  252. package/modules/gameplay/pickups.js +23 -11
  253. package/modules/grid/index.js +1 -1
  254. package/modules/grid/preview.js +2 -2
  255. package/modules/grid/tiles.js +1 -1
  256. package/modules/hlod/index.js +4 -1
  257. package/modules/hud/index.js +47 -10
  258. package/modules/hud/parts.js +28 -9
  259. package/modules/level/geometry.js +8 -3
  260. package/modules/level/index.js +10 -5
  261. package/modules/level/load.js +4 -2
  262. package/modules/lights/sources.js +1 -1
  263. package/modules/music/Music.js +22 -4
  264. package/modules/nav/index.js +20 -10
  265. package/modules/particles/Particles.js +31 -14
  266. package/modules/particles/effect.js +20 -5
  267. package/modules/particles/lit.js +72 -0
  268. package/modules/photo/Photo.js +72 -28
  269. package/modules/photo/pathTrace.js +106 -0
  270. package/modules/rigid/RigidBodies.js +23 -14
  271. package/modules/rigid/Vehicles.js +3 -13
  272. package/modules/rigid/sync.js +2 -1
  273. package/modules/settings/Settings.js +52 -20
  274. package/modules/settings/apply.js +23 -9
  275. package/modules/settings/sections.js +39 -6
  276. package/modules/settings/strings.js +2 -0
  277. package/modules/settings/view.js +19 -3
  278. package/modules/sky/dome.js +15 -3
  279. package/modules/sky/environment.js +28 -12
  280. package/modules/sky/fog.js +1 -1
  281. package/modules/sky/frame.js +6 -1
  282. package/modules/sky/shader.js +4 -3
  283. package/modules/sky/skyModule.js +8 -4
  284. package/modules/swarm/Swarm.js +1 -1
  285. package/modules/terrain/ChunkManager.js +61 -15
  286. package/modules/terrain/chunkJob.js +2 -2
  287. package/modules/terrain/index.js +20 -5
  288. package/modules/terrain/terrainEdit.js +8 -4
  289. package/modules/terrain/terrainTexture.js +4 -2
  290. package/modules/timeline/Timeline.js +4 -3
  291. package/modules/timeline/Tween.js +3 -0
  292. package/modules/timeline/letterbox.js +1 -0
  293. package/modules/triggers/index.js +36 -17
  294. package/modules/vegetation/Vegetation.js +81 -19
  295. package/modules/vegetation/densityMap.js +13 -8
  296. package/modules/vegetation/draw.js +147 -24
  297. package/modules/vegetation/groundChunks.js +20 -5
  298. package/modules/vegetation/index.js +3 -3
  299. package/modules/vegetation/modelGeometry.js +9 -4
  300. package/modules/water/Water.js +11 -8
  301. package/modules/weather/Weather.js +7 -2
  302. package/modules/weather/shaders.js +25 -5
  303. package/modules/weather/weatherDraw.js +20 -6
  304. package/modules/world/World.js +2 -1
  305. package/modules/world/index.js +2 -2
  306. package/modules/world/persist.js +6 -2
  307. package/modules/world/views.js +15 -2
  308. package/package.json +5 -1
  309. package/presets.js +5 -5
  310. package/render/PostFX.js +102 -42
  311. package/render/backend.js +142 -16
  312. package/render/bindingLimits.js +59 -0
  313. package/render/cascades.js +3 -1
  314. package/render/cascades.tsl.js +2 -0
  315. package/render/daylight.js +7 -1
  316. package/render/detail.js +7 -4
  317. package/render/effects.js +27 -8
  318. package/render/fogLook.js +24 -0
  319. package/render/fuse.js +5 -2
  320. package/render/fx/compareLevel.tsl.js +23 -0
  321. package/render/fx/detail.tsl.js +9 -7
  322. package/render/fx/index.js +9 -2
  323. package/render/fx/library.tsl.js +1 -0
  324. package/render/fx/lightShaft.tsl.js +114 -0
  325. package/render/fx/noise.tsl.js +25 -8
  326. package/render/fx/objectOrigin.tsl.js +39 -10
  327. package/render/fx/particles.tsl.js +23 -6
  328. package/render/fx/patchNodes.tsl.js +17 -12
  329. package/render/fx/pcss.tsl.js +51 -0
  330. package/render/fx/postWebGPU.tsl.js +104 -29
  331. package/render/fx/sky.tsl.js +3 -9
  332. package/render/fxNumbers.js +10 -4
  333. package/render/impostor.tsl.js +107 -0
  334. package/render/lighting.js +33 -1
  335. package/render/lightmap.js +42 -28
  336. package/render/lights.js +19 -3
  337. package/render/materials.js +6 -4
  338. package/render/mergeCommon.js +4 -1
  339. package/render/occlusion.js +14 -4
  340. package/render/patches.js +79 -41
  341. package/render/postRuns.js +32 -0
  342. package/render/postWebGL.js +97 -10
  343. package/render/probes.js +10 -14
  344. package/render/shaderErrors.js +44 -7
  345. package/render/shadowCache.tsl.js +33 -5
  346. package/render/shadows.js +42 -16
  347. package/render/slots.js +8 -5
  348. package/render/vertexInputs.js +52 -0
  349. package/types/core.d.ts +115 -47
  350. package/types/gameplay.d.ts +56 -23
  351. package/types/generated/core/audio/Audio.d.ts +27 -1
  352. package/types/generated/core/base/Random.d.ts +1 -1
  353. package/types/generated/core/input/Input.d.ts +6 -8
  354. package/types/generated/core/input/inputSeat.d.ts +1 -1
  355. package/types/generated/core/inspect/Budget.d.ts +26 -0
  356. package/types/generated/core/inspect/DebugOverrides.d.ts +0 -2
  357. package/types/generated/core/saves/Saves.d.ts +10 -7
  358. package/types/generated/core/saves/session.d.ts +8 -2
  359. package/types/generated/core/scene/Rays.d.ts +1 -3
  360. package/types/generated/core/scene/Views.d.ts +17 -3
  361. package/types/generated/modules/particles/Particles.d.ts +1 -1
  362. package/types/generated/modules/world/World.d.ts +2 -1
  363. package/types/generated/render/PostFX.d.ts +35 -9
  364. package/types/physics.d.ts +796 -764
  365. package/types/pixel.d.ts +1 -1
  366. package/types/tsl.d.ts +62 -1
  367. package/types/world.d.ts +12 -3
  368. package/ui/Focus.js +7 -5
  369. package/ui/Parts.js +1 -1
  370. package/ui/touchPart.js +6 -3
@@ -4,6 +4,10 @@
4
4
  // Naming rule for a NEW code: `<area>-<problem>` in lowercase with hyphens (save-version, unknown-name): the area first so the codes sort
5
5
  // and grep by subsystem. Codes already published keep their names even where they do not follow it (renaming would break the tools and tests that match them).
6
6
  // One code per kind of misuse per module: the message names the exact call, the value it got and the accepted values; the fix says what to change.
7
+ // The engine used something other than what the game gave (design.md 2.4) and the game can go on: a warnOnce(coded(code, text)), never silent, with a code
8
+ // named by what happened: `<area>-clamped` kept to a documented range, `<area>-fallback` another way or value used because the asked one cannot run here,
9
+ // `<area>-ignored` not applied at all, `<area>-replaced` the engine works on its own copy or name in its place. The text names the value, what was used
10
+ // instead and the option to change; describe().warnings lists them.
7
11
 
8
12
  /**
9
13
  * Errors the engine raises by name (the message ends with "[code]"): code -> { fix, docs }. Codes are stable: tools and tests may match on them.
@@ -12,53 +16,56 @@
12
16
  */
13
17
  export const ERROR_CODES = {
14
18
  'save-part-threw': {
15
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
19
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
16
20
  fix: 'A save part\'s save() threw or returned what a save cannot hold, so nothing was written and the previous save is kept. Fix the save() named in the message ' +
17
21
  '(it must return plain data; NaN and Infinity at any depth count, and the message gives the path).' },
18
22
  'save-load-threw': {
19
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
23
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
20
24
  fix: 'A save part\'s load() threw, so the game was rolled back to how it was before the load. Fix the load() named in the ' +
21
25
  'message.' },
22
26
  'save-refused': {
23
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
27
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
24
28
  fix: 'The save is unreadable, from a newer build, or a migrate step is missing; nothing changed. Add the migrate step, or run ' +
25
29
  'the newer build.' },
26
30
  'save-version': {
27
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
28
- fix: 'saves.register(key, { version, migrate }): version is a whole number >= 1; migrate keys are older versions, each a ' +
31
+ docs: ['recipes/20-content-actions-save.md §"Save format"', 'api/saves.md'],
32
+ fix: 'saves.define(key, { version, migrate }): version is a whole number >= 1; migrate keys are older versions, each a ' +
29
33
  'function data => newData.' },
30
34
  'save-import': {
31
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
35
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
32
36
  fix: 'Import only text or files made by saves.export / exportFile; attachments must be data: URLs. Nothing was fetched or ' +
33
37
  'changed.' },
34
38
  'save-key-taken': {
35
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
36
- fix: 'One owner per save key: pick another key, or call remove() on the handle of the first saves.register before registering again.' },
39
+ docs: ['recipes/20-content-actions-save.md §"Save format"', 'api/saves.md'],
40
+ fix: 'One owner per save key: pick another key, or call remove() on the handle of the first saves.define before defining it again.' },
37
41
  'save-busy': {
38
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
42
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
39
43
  fix: 'Wait for the load to end (await it) before collecting. engine.saves.save waits by itself.' },
40
44
  'save-nested': {
41
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
45
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
42
46
  fix: "Something waits behind a state replacement that has not ended; with no sign of life for loading.timeoutMs it fails with this code. If a save part's load() or a module's afterLoad awaits it, it waits for itself: pass the turn they are given to " +
43
47
  'level.load / content.load ({ turn }). A new saves.apply / load / save or session.newGame / load / quit starts after the running one: do not await it there, or ask from a save:loaded or session:start listener.' },
44
48
  'save-autosave': {
45
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
49
+ docs: ['recipes/20-content-actions-save.md §2', 'api/saves.md'],
46
50
  fix: 'saves.autosave(minutes) takes a positive number of minutes of play.' },
47
51
  'session-early': {
48
- docs: ['recipes/20-content-actions-save.md', 'api/engine.md'],
52
+ docs: ['recipes/20-content-actions-save.md §4', 'api/engine.md'],
49
53
  fix: 'engine.session needs the new-game state that start() captures: call it from a button or after `await engine.start()`.' },
54
+ 'session-start-missed': {
55
+ docs: ['recipes/20-content-actions-save.md §4', 'api/engine.md'],
56
+ fix: "The first playthrough began inside engine.start() (?play, or newGame / load during start), so a session:start listener added after `await engine.start()` missed it. Add the listener before start(), or read the state after it: engine.session.playing, engine.events.recent('session:start')." },
50
57
  'clock-interval': {
51
58
  docs: ['recipes/06-clock-events.md', 'api/clock.md'],
52
59
  fix: 'clock.after / every take a finite number of calendar seconds (every needs > 0). For every fixed step use engine.onFixed.' },
53
60
  'threads-option': {
54
- docs: ['recipes/15-perf.md', 'api/engine.md'],
61
+ docs: ['recipes/15-perf.md §4', 'api/engine.md'],
55
62
  fix: 'createEngine({ threads }) takes \'auto\', a worker count (0 = none) or false.' },
56
63
  'threads-transfer': {
57
- docs: ['recipes/15-perf.md', 'api/engine.md'],
64
+ docs: ['recipes/15-perf.md §4', 'api/engine.md'],
58
65
  fix: 'The worker died after the task moved its buffers away (transfer), so the task cannot rerun on the main thread. Resend ' +
59
66
  'it, or send it without transfer.' },
60
67
  'pure-function': {
61
- docs: ['recipes/18-world.md', 'recipes/15-perf.md'],
68
+ docs: ['recipes/18-world.md', 'recipes/15-perf.md §4'],
62
69
  fix: 'A worker function sees only its parameters and worker-safe globals (Math, JSON, Number...): no closure variables, ' +
63
70
  'engine, window or document. Pass values in, or store them on the record.' },
64
71
  'asset-name-clash': {
@@ -66,97 +73,101 @@ export const ERROR_CODES = {
66
73
  fix: 'One name was registered as two asset types (models / textures / sounds). Give each its own name, e.g. grass and ' +
67
74
  'grass_tex.' },
68
75
  'audio-synth-gone': {
69
- docs: ['recipes/31-audio.md', 'api/audio.md'],
76
+ docs: ['recipes/31-audio.md §1', 'api/audio.md'],
70
77
  fix: 'A synthesized sound is an asset: register the function in assets.manifest({ sounds: { ding: fn } }); audio.sounds entries only say ' +
71
78
  'how it plays (src: the sound name, volume, variants, bus).' },
72
79
  'audio-name-clash': {
73
- docs: ['recipes/31-audio.md', 'api/audio.md'],
80
+ docs: ['recipes/31-audio.md §8', 'api/audio.md'],
74
81
  fix: 'One audio name is defined twice: a sound / footstep in both createEngine({ audio }) and a content pack, or a rule key that ' +
75
82
  'is both a condition and a measure. Keep each name in one place.' },
76
83
  'engine-disposed': {
77
84
  docs: ['api/engine.md'],
78
85
  fix: 'engine.dispose() ran, so start() stopped or refused to run. Create a new engine instead of starting a disposed one.' },
79
86
  'skip-amount': {
80
- docs: ['recipes/06-clock-events.md', 'api/engine.md'],
87
+ docs: ['recipes/06-clock-events.md §2', 'api/engine.md'],
81
88
  fix: 'engine.skip takes { to: \'06:00\' } (needs the calendar module) or { seconds: 600 } (calendar seconds, > 0).' },
82
89
  'skip-busy': {
83
- docs: ['recipes/06-clock-events.md', 'api/engine.md'],
90
+ docs: ['recipes/06-clock-events.md §2', 'api/engine.md'],
84
91
  fix: 'Await the skip that is running (engine.skip returns its Promise), then call engine.skip again.' },
85
92
  'stream-timeout': {
86
93
  docs: ['recipes/18-world.md', 'api/stream.md'],
87
94
  fix: 'The teleport destination did not finish loading in time (terrain, colliders, nearby models). Read describe().loading or ' +
88
95
  '`threedog loading`; raise { timeout } or check the place exists.' },
89
96
  'stream-removed': {
90
- docs: ['recipes/18-world.md', 'api/stream.md'],
97
+ docs: ['recipes/18-world.md §6', 'api/stream.md'],
91
98
  fix: 'A stream source was removed (remove(), its until, or engine.dispose) before it was ready, so its whenReady rejects. Await ' +
92
99
  'whenReady only on a source you keep. stream.teleport also rejects with it when a new game or a load replaced the state during the trip: start the trip again from the new state if it is still wanted.' },
93
100
  'stream-option': {
94
- docs: ['recipes/18-world.md', 'api/stream.md'],
101
+ docs: ['recipes/33-stream-sources.md', 'api/stream.md'],
95
102
  fix: 'stream.source(position, { detail }) takes \'full\' or \'simple\'; stream.radius takes a finite number of meters or null.' },
96
103
  'op-misuse': {
97
- docs: ['recipes/23-ops.md', 'api/engine.md'],
104
+ docs: ['recipes/23-ops.md §1', 'api/engine.md'],
98
105
  fix: 'Ops are defined with ops.define(name, { can, run }) and run with ops.run(name, args); args are plain data and can() only ' +
99
106
  'reads. The message says which rule was broken.' },
100
107
  'halt-owner': {
101
- docs: ['recipes/23-ops.md', 'api/engine.md'],
108
+ docs: ['recipes/23-ops.md §11', 'api/engine.md'],
102
109
  fix: 'const h = engine.haltLoop(owner); ... h.remove() ends that owner\'s halt; the loop restarts only when every owner has removed theirs.' },
103
110
  'mod-owner': {
104
- docs: ['recipes/55-mods-time-wrap.md', 'api/engine.md'],
111
+ docs: ['recipes/55-mods-time-wrap.md §"The rules in full"', 'api/engine.md'],
105
112
  fix: "engine.mod(point, { owner, set | add | mul | clamp, layer?, for?, clock?, id? }): owner is a non-empty string, exactly one of set / add / mul / clamp for a number (set for a value point); in a module ctx.mod(point, { mul }) names the module itself. haltLoop / freeze / takeCamera / debug.view name their owner the same way. Only that owner ends it, with the handle's remove()." },
106
113
  'shared-conflict': {
107
- docs: ['recipes/55-mods-time-wrap.md'],
114
+ docs: ['recipes/55-mods-time-wrap.md §"The rules in full"'],
108
115
  fix: "Two owners set one shared value on the same layer, so nothing says which one decides (every build throws; the first value stays). Copy one fix from the message: contribute instead (mul / add), decide on another layer ({ layer }), or take it over on purpose (manual, or a set on the system layer)." },
109
116
  'shared-taken': {
110
- docs: ['recipes/55-mods-time-wrap.md', 'recipes/14-custom-module.md'],
117
+ docs: ['recipes/55-mods-time-wrap.md §"Replacing a module"', 'recipes/14-custom-module.md §2'],
111
118
  fix: "Two modules provide the same exclusive slot (provides: ['inventory']; terrain and level both hold 'ground'). Install only one, or swap: engine.use(mine(), { replaces: 'inventory' }) unloads the holder and its changes. Terrain and level together: give both { part: true } and add compositeGround({ parts })." },
112
119
  'shared-settings': {
113
- docs: ['recipes/55-mods-time-wrap.md'],
120
+ docs: ['recipes/55-mods-time-wrap.md §"Picture points follow"'],
114
121
  fix: "The settings layer only restricts what the scene chose: clamp or mul on a number, set: false on a value point. It cannot switch something on or raise it; leave the setting out to allow the scene's value." },
115
122
  'shared-value': {
116
- docs: ['recipes/55-mods-time-wrap.md'],
123
+ docs: ['recipes/55-mods-time-wrap.md §"The rules in full"'],
117
124
  fix: 'A number shared value got a value it cannot combine: set / add / mul take a finite number; clamp takes { min?, max? } with each given bound a finite number and min <= max. The same check runs on engine.mod and on handle.change, so a NaN never reaches the value.' },
118
125
  'shared-layer': {
119
- docs: ['recipes/55-mods-time-wrap.md'],
126
+ docs: ['recipes/55-mods-time-wrap.md §"The rules in full"'],
120
127
  fix: "layer is one of engine < game < effect < system < settings < debug (default game); most code never passes it." },
121
128
  'views-define': {
122
- docs: ['recipes/46-blender-art-route.md', 'api/engine.md'],
129
+ docs: ['recipes/46-blender-art-route.md §"The same shot"', 'api/engine.md'],
123
130
  fix: "engine.views.define(name, { position: [x, y, z], target?: [x, y, z], fov? }): position and target are 3-number arrays." },
124
131
  'ops-guard': {
125
- docs: ['recipes/23-ops.md'],
132
+ docs: ['recipes/23-ops.md §5'],
126
133
  fix: 'Gameplay state (world, containers, vars, quests) was changed outside a fixed step and outside an op. Do it inside ' +
127
134
  'engine.ops.run(...) or an onFixed / module fixed hook.' },
128
135
  'quest-step': {
129
- docs: ['recipes/04-quests.md', 'api/quests.md'],
136
+ docs: ['recipes/04-quests.md §1', 'api/quests.md'],
130
137
  fix: "A quest step is wrong. In a definition: each step has done (a function) or all: [parts] with at least one part not optional, and step ids are unique. In a save: a step id the definition no longer has restarts the quest from its first step; keep step ids stable, or add a migrate step to the quests save part." },
131
138
  'save-write': {
132
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
139
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
133
140
  fix: 'The browser refused to store the save (storage full, private mode, blocked IndexedDB); the previous save is kept. Free ' +
134
141
  'space or export the save as a file.' },
135
142
  'save-bad-record': {
136
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
143
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
137
144
  fix: "A core field of saved data is malformed (a position that is not three finite numbers, a record without kind, a swarm without its columns); the load was refused and rolled back. The save was edited by hand or damaged: fix the field the message names, or load another save." },
138
145
  'save-value': {
139
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
140
- fix: 'A saved number was not finite or out of range (a negative clock, a count beyond any stack); it was clamped or dropped and the ' +
146
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
147
+ fix: 'A saved number was not finite or out of range (a negative clock, a count beyond any stack), or a saved shared value broke a rule engine.mod checks; it was clamped or dropped and the ' +
141
148
  'rest of the part loaded. The save was edited by hand or damaged; save again to write the fixed values.' },
142
149
  'save-stale': {
143
- docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
150
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
144
151
  fix: 'Another tab or window of this game saved into this slot after this one last loaded or saved it, so it was not overwritten ' +
145
152
  '(that would lose the newer progress). Load the slot to continue from it, save into another slot, or close the other tab.' },
146
153
  'budget-over': {
147
- docs: ['recipes/15-perf.md', 'api/budget.md'],
154
+ docs: ['recipes/15-perf.md §2', 'api/budget.md'],
148
155
  fix: 'A performance budget set with createEngine({ budget }) was exceeded; the message names the biggest costs. Measure with ' +
149
156
  'describe().perf or npm run perf.' },
157
+ 'budget-option': {
158
+ docs: ['recipes/15-perf.md §2', 'api/budget.md'],
159
+ fix: 'A budget limit was set that this renderer cannot measure (gpuMemoryMB is counted by three only on WebGPURenderer), so it is not checked. ' +
160
+ 'Use createEngine({ renderer: "webgpu" }) to check it, or watch engine.counts() (geometries, textures) instead.' },
150
161
  'webgpu-records-unread': {
151
162
  docs: ['recipes/56-webgpu-tsl.md'],
152
163
  fix: 'three.js changed the private list of draw records the WebGPU sweep reads (usually a three upgrade), so the sweep is off and the game runs on. ' +
153
164
  'Until the engine is updated, send the event yourself when a mesh is gone for good: mesh.dispatchEvent({ type: \'dispose\' }).' },
154
165
  'geometry-undisposed': {
155
- docs: ['recipes/56-webgpu-tsl.md'],
166
+ docs: ['recipes/56-webgpu-tsl.md §"Dropping a mesh"'],
156
167
  fix: 'Meshes are leaving the scene with their geometry never disposed, so the renderer keeps counting it. Call mesh.geometry.dispose() when a mesh is gone for good, ' +
157
168
  'or engine.remove(mesh). Geometry parked for reuse is fine; this warns only about a steady climb.' },
158
169
  'jobs-slow': {
159
- docs: ['recipes/15-perf.md', 'api/jobs.md'],
170
+ docs: ['recipes/15-perf.md §4', 'api/jobs.md'],
160
171
  fix: 'A job step ran too long or a job queued too many steps. Yield more often inside the generator (engine.jobs.add(function* ' +
161
172
  '() { ...; yield; })).' },
162
173
  'jobs-endless': {
@@ -164,29 +175,29 @@ export const ERROR_CODES = {
164
175
  fix: 'A job with apply reached its due tick and engine.jobs.maxSteps steps were not enough to finish it, so its promise rejected and apply did not run. ' +
165
176
  'A generator that loops forever needs an end; one that is only long needs a later lag or a higher engine.jobs.maxSteps.' },
166
177
  'threads-crash': {
167
- docs: ['recipes/15-perf.md', 'api/engine.md'],
178
+ docs: ['recipes/15-perf.md §4', 'api/engine.md'],
168
179
  fix: 'A worker failed or went silent past the lane timeout (the reason is printed with it); the lane now runs on the main thread with the same ' +
169
180
  'results, only slower. Fix the worker file or its imports; a lane whose tasks really take longer passes a bigger lane({ timeout }).' },
170
181
  'input-bound-twice': {
171
- docs: ['recipes/58-input.md', 'api/input.md'],
182
+ docs: ['recipes/58-input.md §4', 'api/input.md'],
172
183
  fix: "Two different owners bound the same action (createEngine({ bindings }) of the game and a module, or two modules). One owner binds an action: keep one of the two, or bind another action name. The same owner binding again just replaces its keys." },
173
184
  'input-action-context': {
174
- docs: ['recipes/58-input.md', 'api/input.md'],
185
+ docs: ['recipes/58-input.md §4', 'api/input.md'],
175
186
  fix: 'Two owners declared one action in different input contexts. An action belongs to one context: rename one of them, or declare both in ' +
176
187
  'the same context (then they share the action).' },
177
188
  'input-seat': {
178
- docs: ['recipes/58-input.md', 'api/input.md'],
189
+ docs: ['recipes/58-input.md §"Local players on one"', 'api/input.md'],
179
190
  fix: 'A seat owns its pad and keys alone. Give each seat its own pad index and keys, or remove() the seat that holds them; one seat drives one player.' },
180
191
  'input-unbound': {
181
- docs: ['recipes/58-input.md', 'api/input.md'],
192
+ docs: ['recipes/58-input.md §4', 'api/input.md'],
182
193
  fix: "An action a module needs is read but no key is bound, so it never fires. Modules bind no keys: bind it with " +
183
194
  "engine.input.bind('action', ['KeyX']), createEngine({ bindings }) or a presets.bindings.* map." },
184
195
  'interaction-no-key': {
185
- docs: ['recipes/63-third-person-start.md', 'recipes/58-input.md', 'api/interactions.md'],
196
+ docs: ['recipes/63-third-person-start.md §4', 'recipes/58-input.md §4', 'api/interactions.md'],
186
197
  fix: 'Interactions were added but their action has no key, so no key press reaches them; the game keeps running. Bind it in createEngine({ bindings }) or with ' +
187
198
  'engine.input.bind; any key works, and bind it to [] if the game reaches them another way (a click, a touch, its own button): that ends this warning.' },
188
199
  'signal-overwritten': {
189
- docs: ['recipes/62-picture-code.md'],
200
+ docs: ['recipes/62-picture-code.md §2'],
190
201
  fix: 'This signal has one writer that rewrites it every frame, so a direct write lasts at most a frame. The message names the entry that changes it.' },
191
202
  'asset-cache': {
192
203
  docs: ['recipes/05-props-bake.md', 'api/assets.md'],
@@ -197,25 +208,25 @@ export const ERROR_CODES = {
197
208
  fix: 'The browser dropped the WebGL context (GPU reset, too many tabs); gameplay waits until it is restored. Nothing to fix ' +
198
209
  'unless it repeats: then lower quality or texture sizes.' },
199
210
  'module-params': {
200
- docs: ['recipes/51-capability-catalog.md'],
211
+ docs: ['recipes/51-capability-catalog.md §3'],
201
212
  fix: "A module option or call argument does not fit (unknown key, wrong type, out of range or not one of the allowed values). The message names it and what it should be; engine.catalog(name).params lists every option with its default." },
202
213
  'module-dispose': {
203
- docs: ['recipes/14-custom-module.md'],
214
+ docs: ['recipes/14-custom-module.md §2'],
204
215
  fix: 'A module\'s dispose(e) threw; the other modules and core were still cleaned up. Fix that module\'s dispose.' },
205
216
  'module-order': {
206
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
217
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
207
218
  fix: 'A module\'s before / after contradicts the stage order (stages always run in order; before / after only order modules inside one ' +
208
219
  'stage). Give both modules the same stage, or remove the before / after.' },
209
220
  'module-critical': {
210
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
221
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
211
222
  fix: 'A module declared critical: true failed in init(), or a provider it requires failed, so start() stopped instead of starting a broken game. The message names the module ' +
212
223
  'and the reason: fix that init(), or drop critical if the game can run without it.' },
213
224
  'module-contract': {
214
- docs: ['recipes/14-custom-module.md', 'recipes/49-game-module-contract.md'],
225
+ docs: ['recipes/14-custom-module.md §2', 'recipes/49-game-module-contract.md §"The five contracts"'],
215
226
  fix: "A module provides (or another module requires) a capability the engine has a contract for, and its API lacks methods or fields that contract lists. Add them, or accept the risk " +
216
227
  "if your game calls none of them: the module still runs. The behavior half of the contract is checked by runContract from @threedog/tools/contract." },
217
228
  'module-not-ready': {
218
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
229
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
219
230
  fix: 'start() waited longer than engine.loading.timeoutMs for modules whose isReady(e) stays false. Fix what that module waits for, ' +
220
231
  'or raise engine.loading.timeoutMs if the load is only slow. engine.loading.view().waiting names the current item.' },
221
232
  'step-during-load': {
@@ -225,24 +236,24 @@ export const ERROR_CODES = {
225
236
  docs: ['api/engine.md'],
226
237
  fix: 'engine.step(seconds) takes a finite number >= 0 in real seconds: 0 advances nothing, 0.5 is half a second, 1 / 60 is one fixed step.' },
227
238
  'player-control': {
228
- docs: ['recipes/01-new-game.md', 'api/characters.md'],
229
- fix: "createPlayer() has no default feel: give control. Usually createPlayer({ ...presets.player.thirdPerson, spawn }); else control: 'camera' | " +
239
+ docs: ['recipes/01-new-game.md §3', 'api/characters.md'],
240
+ fix: "addPlayer() has no default feel: give control. Usually addPlayer({ ...presets.player.thirdPerson, spawn }); else control: 'camera' | " +
230
241
  "(player, input, dt) => ({ x, z }) (null stands still), plus cameraFollow as wanted (run / jump keys: presets.bindings.walk). The game moving the player itself " +
231
242
  "takes control: engine.control.take(player, { owner, layer: 'script', step })." },
232
243
  'control-conflict': {
233
- docs: ['recipes/57-control.md'],
244
+ docs: ['recipes/57-control.md §"Who takes what"'],
234
245
  fix: "Two owners want the same character on the same control layer, so nothing says which one steers, and the first keeps it (every build). " +
235
246
  "End the old one first (its handle.remove()), or take another layer: base < script < cutscene (higher pauses lower)." },
236
247
  'control-net': {
237
- docs: ['recipes/57-control.md', 'recipes/27-net.md'],
248
+ docs: ['recipes/57-control.md §"Who takes what"', 'recipes/27-net.md §4'],
238
249
  fix: "That character is driven by another machine (net holds its control for good). Change it where it is driven: run an op the host runs " +
239
250
  "(engine.ops.run), or steer the character that is yours (engine.player)." },
240
251
  'control-bypass': {
241
- docs: ['recipes/57-control.md'],
252
+ docs: ['recipes/57-control.md §"Moved by script"'],
242
253
  fix: "character.move() was called on a character someone controls, from outside that owner. Take control and move through it: " +
243
254
  "const h = engine.control.take(ch, { owner, layer: 'script', step }) (or h.move(x, z, run, dt)), then h.remove() to hand it back." },
244
255
  'control-layer': {
245
- docs: ['recipes/57-control.md'],
256
+ docs: ['recipes/57-control.md §"Who takes what"'],
246
257
  fix: "engine.control.take(character, { owner, layer?, step? }): a character (or its id), a non-empty owner name, layer 'base' | 'script' | 'cutscene' (physics and net are the engine's own), step a function (dt, ch) => ({ x, z, run }) or left out." },
247
258
  'interaction-setup': {
248
259
  docs: ['recipes/02-npc.md', 'api/interactions.md'],
@@ -252,50 +263,50 @@ export const ERROR_CODES = {
252
263
  docs: ['recipes/21-camera.md', 'api/openWorld.md'],
253
264
  fix: "openWorld() installs no camera on its own: pass camera: 'follow' | 'firstPerson' | 'rts' | 'fixed' | a camera module | false." },
254
265
  'lightpool-dusk': {
255
- docs: ['api/lightPool.md', 'recipes/09-materials-lights-models.md'],
266
+ docs: ['api/lightPool.md', 'recipes/09-materials-lights-models.md §"Night glow: emissive"'],
256
267
  fix: 'A lightPool source has a wrong dusk value, or follows daylight while nothing tells day from night: install sky() or calendar(), or register the daylight measure.' },
257
268
  'engine-terms': {
258
- docs: ['recipes/52-around-the-picture.md'],
269
+ docs: ['recipes/52-around-the-picture.md §"Surfaces: ground, plants"'],
259
270
  fix: 'engine.shaderTerms was given a spec it cannot draw: a term is { glsl, tsl, uniforms?, pars?, slot? } with the form this renderer needs, or false for none.' },
260
271
  'engine-two-copies': {
261
272
  docs: ['THREE.md'],
262
273
  fix: "vite.config.js: resolve: { dedupe: ['threedog', 'three'] }. Two copies of threedog are loaded (the message names both paths); each hooks THREE.Mesh.prototype for shadows, so keep one: `npm ls threedog`, and packs / tools list threedog as a peerDependency." },
263
274
  'debug-override': {
264
- docs: ['recipes/40-scene.md'],
275
+ docs: ['recipes/40-scene.md §9'],
265
276
  fix: "engine.debug.override(owner, target, patch): owner names who sets it (engine.debug.clear(owner) removes all of them), target is a thing id or Object3D, " +
266
277
  "patch is { visible?, material?: 'flat' | 'wire', apply? }; a three.js value: override(owner, object, key, value). Overrides change only what the screen shows and are never saved." },
267
278
  'plugin-shape': {
268
- docs: ['THREE.md', 'recipes/40-scene.md'],
279
+ docs: ['THREE.md', 'recipes/40-scene.md §1'],
269
280
  fix: 'A file in the plugins folder is plugged by what it exports: an Object3D, a three.js Pass, a post effect { name, create | node | fuse }, ' +
270
281
  'a module { name, type, install }, or an array of these (default export, else every named export). ' +
271
282
  'A function is never a plugin (on either renderer): export what a factory returns (export default makeIt({ ... })), a node pass as { name, node }; threedog lib pull writes that line for library code. plugins.json names only files that exist.' },
272
283
  'thing-id': {
273
- docs: ['recipes/40-scene.md'],
284
+ docs: ['recipes/40-scene.md §4'],
274
285
  fix: "Ids given to engine.add(obj, { id }) are non-empty strings without '#', unique across engine.add objects and world records. " +
275
286
  'engine.thing(id) takes such an id, a world record id, an object name or an Object3D; the message suggests the closest id.' },
276
287
  'thing-owned': {
277
- docs: ['recipes/40-scene.md', 'recipes/18-world.md'],
288
+ docs: ['recipes/40-scene.md §4b', 'recipes/18-world.md §4b'],
278
289
  fix: "Two systems manage one object: a world model is placed by world every frame. Change the record (ops.run('thing.set', { id, " +
279
290
  "position }), world.set / world.move) instead of the model, and never engine.add a model world built." },
280
291
  'thing-unsaved': {
281
- docs: ['recipes/40-scene.md'],
292
+ docs: ['recipes/40-scene.md §3'],
282
293
  fix: 'An object you expect to keep cannot be saved: it has no stable id or was added during play. Give it an id at setup ' +
283
294
  "(engine.add(obj, { id })), or make it a template and create it inside an op with engine.content.spawn(name, at)." },
284
295
  'thing-orphan': {
285
- docs: ['recipes/40-scene.md'],
296
+ docs: ['recipes/40-scene.md §4c'],
286
297
  fix: "The 'scene' save part names an id no engine.add object has: the code that added it changed its id or no longer runs. " +
287
298
  'The data is kept in the save; restore the id, or ignore it if the object was deleted on purpose.' },
288
299
  'engine-misuse': {
289
300
  docs: ['api/engine.md'],
290
301
  fix: 'An engine call got an argument it cannot use; the message names the call and the accepted forms.' },
291
302
  'pixel-conflict': {
292
- docs: ['recipes/62-picture-code.md', 'api/engine.md'],
303
+ docs: ['recipes/62-picture-code.md §4b', 'api/engine.md'],
293
304
  fix: 'pixelSize decides the render resolution, and a camera\'s pixelSnap its view height, while they are on; something else asked for it too. The message names both: keep one, or turn it off first (engine.setPixelSize(null), or drop pixelSnap).' },
294
305
  'many-lights': {
295
- docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
306
+ docs: ['recipes/09-materials-lights-models.md §1b', 'api/lightPool.md'],
296
307
  fix: "Too many real-time lights are in the scene (the message has the count). Use engine.use(lightPool({ point: 8 })) and register torches / lamps with engine.lightPool.add(...), so a fixed small set of real lights follows the nearest sources." },
297
308
  'light-recompile': {
298
- docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
309
+ docs: ['recipes/09-materials-lights-models.md §1b', 'api/lightPool.md'],
299
310
  fix: 'The number of lights changed during play, so three.js compiled new shader programs (a long frame). Keep the light ' +
300
311
  'count fixed: engine.use(lightPool({ point: 8 })) before engine.start() and register torches / lamps with ' +
301
312
  'engine.lightPool.add(...), or create your own lights before start and fade them with intensity instead of adding, ' +
@@ -311,26 +322,26 @@ export const ERROR_CODES = {
311
322
  docs: ['recipes/15-perf.md'],
312
323
  fix: "createEngine({ batching }) takes false or an object with the keys named in the message." },
313
324
  'debug-view': {
314
- docs: ['recipes/16-dev-bridge.md', 'api/engine.md'],
325
+ docs: ['recipes/15-perf.md §1', 'api/engine.md'],
315
326
  fix: 'engine.debug.defineView(name, { what, apply }): the name must be new (not a built-in view mode) and apply(scene) returns ' +
316
327
  'what to restore. Pick another name or fix the definition.' },
317
328
  'probes-option': {
318
- docs: ['recipes/34-environment-lighting.md', 'api/engine.md'],
329
+ docs: ['recipes/34-environment-lighting.md §"Light probes (baked indirect light)"', 'api/engine.md'],
319
330
  fix: 'engine.bakeProbes / loadProbes got a wrong option: bounds must be a Box3 or { min, max }, spacing a positive number of meters ' +
320
331
  '(raise it when the grid has too many probes). On a device that cannot render to float textures, bake elsewhere and ship the file.' },
321
332
  'probes-check': {
322
- docs: ['recipes/34-environment-lighting.md'],
333
+ docs: ['recipes/34-environment-lighting.md §"Light probes (baked indirect light)"'],
323
334
  fix: 'A probe grid is live and something around it will look wrong: lit objects reach outside it (widen bounds or light them another way) ' +
324
335
  'or other light adds to what the bake saw (lower it where the probes take over). The details are in describe().render.probes.' },
325
336
  'probes-data': {
326
- docs: ['recipes/34-environment-lighting.md', 'api/engine.md'],
337
+ docs: ['recipes/34-environment-lighting.md §"Light probes (baked indirect light)"', 'api/engine.md'],
327
338
  fix: 'engine.loadProbes(json) was given data that is not a probe file (or a damaged one), so nothing was added. Pass what ' +
328
339
  'handle.toJSON() returned, or bake again with engine.bakeProbes.' },
329
340
  'lightmap-data': {
330
- docs: ['recipes/34-environment-lighting.md', 'api/engine.md'],
341
+ docs: ['recipes/34-environment-lighting.md §"Lightmaps (baked light on what never moves)"', 'api/engine.md'],
331
342
  fix: 'engine.loadLightmap(file) was given something that is not a file from `threedog bake light`, or a damaged one, so nothing was changed. Bake it again.' },
332
343
  'lightmap-check': {
333
- docs: ['recipes/34-environment-lighting.md'],
344
+ docs: ['recipes/34-environment-lighting.md §"Lightmaps (baked light on what never moves)"'],
334
345
  fix: 'A lightmap is on and something around it will look wrong: a baked mesh moved or is missing, a baked material is shared with an unbaked mesh, ' +
335
346
  'or ambient light adds to what the bake saw. The details are in describe().render.lightmap.' },
336
347
  'grid-data': {
@@ -345,7 +356,7 @@ export const ERROR_CODES = {
345
356
  docs: ['api/input.md'],
346
357
  fix: 'input.push(name, { owner }) needs a non-empty owner string (who pushed the context), so pop / describe can tell owners apart.' },
347
358
  'owned-misuse': {
348
- docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
359
+ docs: ['recipes/52-around-the-picture.md §"Who writes it"', 'THREE.md'],
349
360
  fix: 'defineOwned / engine.autoView.manual(key) was called wrongly: a module definition misses id / part / read / levels.manual, or ' +
350
361
  'manual() named a key the part does not write. Use a key listed in the message.' },
351
362
  'shadow-cascades': {
@@ -353,13 +364,16 @@ export const ERROR_CODES = {
353
364
  fix: 'engine.shadows (cascades, box, budget, include, enabled) was called wrongly: the message names what to change. ' +
354
365
  'An engine draws one set of cascades, and a light takes a box or cascades, not both.' },
355
366
  'wrap-misuse': {
356
- docs: ['recipes/55-mods-time-wrap.md'],
367
+ docs: ['recipes/55-mods-time-wrap.md §"Wrapping a module"'],
357
368
  fix: "engine.wrap(target, method, fn): target is an object, fn a function, and method the name of a method that exists on it (the message lists the public ones). A name with a leading _ is the object's inside: it can be wrapped, a dev warning says so once, and an engine update may change it without notice." },
358
369
  'ambience-rule': {
359
370
  docs: ['api/ambience.md', 'api/audio.md'],
360
371
  fix: 'An ambience rule names no sound: give sound: a name registered in audio.sounds.' },
361
- 'camera-option': {
372
+ 'camera-clamped': {
362
373
  docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
374
+ fix: 'A camera value the game asked for is outside the range of the rig, so the rig kept it inside, as documented. Widen the range the message names: followCamera({ minDistance, maxDistance, minPitch, maxPitch }), or set it on engine.cameraRig.' },
375
+ 'camera-option': {
376
+ docs: ['recipes/21-camera.md §6', 'api/cameraRig.md'],
363
377
  fix: 'A camera option is wrong: projection is \'perspective\' or \'orthographic\' (orthographic needs size > 0 and an EngineCamera or a real OrthographicCamera), engine.camera takes a THREE.PerspectiveCamera or THREE.OrthographicCamera, ' +
364
378
  'ground / shots use the values the message lists.' },
365
379
  'character-option': {
@@ -369,7 +383,7 @@ export const ERROR_CODES = {
369
383
  docs: ['api/collision.md'],
370
384
  fix: 'A collision call got a wrong argument, e.g. collision.addBlocked needs fn(x, z) => boolean.' },
371
385
  'content-id': {
372
- docs: ['recipes/20-content-actions-save.md', 'api/content.md'],
386
+ docs: ['recipes/20-content-actions-save.md §"Save format"', 'api/content.md'],
373
387
  fix: 'A content id is invalid (contains # or /) or defined twice across content files, or a rename table is malformed. Ids are ' +
374
388
  'unique per kind across files; saves match on them, so rename through the rename table.' },
375
389
  'content-misuse': {
@@ -377,7 +391,7 @@ export const ERROR_CODES = {
377
391
  fix: 'content.load / content files hold something the loader cannot use (an unknown key, a rule needing a module that is not ' +
378
392
  'installed, a malformed field table). Install the module named in the message or fix the entry it points at.' },
379
393
  'content-pack': {
380
- docs: ['recipes/20-content-actions-save.md', 'api/content.md'],
394
+ docs: ['recipes/20-content-actions-save.md §1b', 'api/content.md'],
381
395
  fix: 'A content pack is not a plain object, carries code where data is expected, or defines a key another pack already has. ' +
382
396
  'Give each pack its own ids.' },
383
397
  'content-template': {
@@ -390,6 +404,12 @@ export const ERROR_CODES = {
390
404
  'grids-misuse': {
391
405
  docs: ['recipes/29-grid.md', 'api/grids.md'],
392
406
  fix: "grids(): a grid or item name is unknown or defined twice, a mapping lacks toCell / center, or a layer / preview material is not a three.js material or has nothing to draw on. Use a listed name, or the form in the message." },
407
+ 'content-layer-ignored': {
408
+ docs: ['recipes/05-props-bake.md'],
409
+ fix: 'collide.layer works on an upright prop only (a tilted one is held by collider3d, which has no layers): stand the model up, or drop the layer; until then it stops every mover.' },
410
+ 'level-layer-ignored': {
411
+ docs: ['recipes/10-blender-level.md §1', 'api/level.md'],
412
+ fix: 'The custom property layer on a col_ mesh must be one non-empty text (the name a character lists in passes). Fix it in Blender; until then the wall stops every mover.' },
393
413
  'level-node': {
394
414
  docs: ['recipes/10-blender-level.md', 'api/level.md'],
395
415
  fix: 'A level node points at content that is not defined, clashes with another record, or is used before the level loaded. Define ' +
@@ -404,14 +424,24 @@ export const ERROR_CODES = {
404
424
  docs: ['recipes/27-net.md', 'api/net.md'],
405
425
  fix: 'net() needs role \'host\' or \'client\' and a transport; reconnect() is for clients only.' },
406
426
  'rigid-misuse': {
407
- docs: ['recipes/11-vehicles.md', 'api/rigid.md'],
408
- fix: "The message says which: an id already used by another body or vehicle (give each its own id); joints lost when newGame / a load rebuilt the physics world (re-create them in a rigid:rebuilt listener, recipe 11 section 3 \"Joints\"); rigid.ragdoll() got something it cannot drive (a skinned character out of its vehicle, with the bones named when they cannot be read); or a moving body left the terrain colliders and froze (raise rigid({ terrainRing }) if it must keep moving there, recipe 11 section 3)." },
427
+ docs: ['recipes/11-vehicles.md §3', 'api/rigid.md'],
428
+ fix: "The message says which: an id already used by another body or vehicle (give each its own id); a mesh that another body or a character already owns (one object, one physics owner: remove the first, or give the second its own object); joints lost when newGame / a load rebuilt the physics world (re-create them in a rigid:rebuilt listener, recipe 11 section 3 \"Joints\"); rigid.ragdoll() got something it cannot drive (a skinned character out of its vehicle, with the bones named when they cannot be read); or a moving body left the terrain colliders and froze (raise rigid({ terrainRing }) if it must keep moving there, recipe 11 section 3)." },
409
429
  'settings-row': {
410
430
  docs: ['api/settings.md'],
411
- fix: 'settings.set() names a key no row owns, so nothing would apply it. Use a listed key, add the tab that has the row (settings({ sections })) or define the row: settings.define(key, default, apply).' },
431
+ fix: 'A settings row nobody owns or nobody draws. settings.set() with a key no row owns: use a listed key, add the tab that has the row (settings({ sections })) or define it: settings.define(key, default, apply). A defined row the menu cannot draw, in a missing tab, or drawn twice: give it min/max or options, a tab that exists, or menu: false when your own tab draws it.' },
412
432
  'settings-tab': {
413
433
  docs: ['api/settings.md'],
414
- fix: 'settings({ tabs }) names a built-in tab that does not exist. Use a listed built-in name, or define your own section.' },
434
+ fix: 'settings({ sections }) contains a built-in section that does not exist. Use a listed name, or register one with engine.settings.addSection(id, { title, render }).' },
435
+ 'time-owner-conflict': {
436
+ docs: ['recipes/06-clock-events.md §"The time table (the single source; other docs link here)"', 'api/calendar.md'],
437
+ fix: 'calendar() and sky({ time }) both set the time of day. calendar owns time while it is installed: move the starting time to calendar({ time }) and remove sky({ time }).' },
438
+ 'save-provider-changed': {
439
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
440
+ fix: 'The module of a save part was unloaded or replaced while an earlier part of the same load was still loading, so the data read for it has nobody to take it. The load failed and rolled back (the data stays in the save). Do not unload or replace modules while a load is in flight; retry the load.' },
441
+ 'rollback-incomplete': {
442
+ docs: ['recipes/20-content-actions-save.md §"Save failures and versions"', 'api/saves.md'],
443
+ fix: 'A rollback could not restore one save part: its save() gave nothing before and it has no new-game state to go back to, so it keeps what the failed load or op wrote. ' +
444
+ 'Make that part\'s save() return restorable data (or give it a new-game state), then reload the page before retrying.' },
415
445
  'clock-time': {
416
446
  docs: ['recipes/06-clock-events.md', 'api/calendar.md'],
417
447
  fix: "A clock time (?time= in the URL, calendar({ time }), sky({ time }), a schedule's at, calendar.at / between, skip({ to })) is 'HH:MM' such as '18:30' or a fraction of the day 0-1 such as 0.75; words like 'night' are not times." },
@@ -424,7 +454,7 @@ export const ERROR_CODES = {
424
454
  fix: 'A sky or clouds option has a wrong value (day length, days and seasons are calendar() options). Own GLSL goes through ' +
425
455
  'engine.sky.clouds() and engine.sky.layer(), not an option key. The message lists the accepted values.' },
426
456
  'terrain-chunk-failed': {
427
- docs: ['recipes/28-terrain.md', 'api/terrain.md'],
457
+ docs: ['recipes/28-terrain.md §7', 'api/terrain.md'],
428
458
  fix: 'A terrain chunk failed on every try and stays empty (no ground, no collision there). Usually the height / groundType / placement rule ' +
429
459
  'throws at that spot: fix what it reads, then engine.terrain.retry() sends the failed chunks again (terrain:chunkFailed names each one).' },
430
460
  'terrain-option': {
@@ -432,9 +462,13 @@ export const ERROR_CODES = {
432
462
  fix: 'A terrain option or terrain edit is wrong (shape mask missing, a brush number not a number, an unknown paint). Use the form ' +
433
463
  'in the message.' },
434
464
  'vegetation-option': {
435
- docs: ['api/vegetation.md', 'recipes/36-ground-plants.md'],
465
+ docs: ['api/vegetation.md', 'recipes/36-ground-plants.md §"Plants and wind"'],
436
466
  fix: 'A vegetation option is wrong: positions entries, densityMap form, fade range or a model with several materials. Fix the ' +
437
467
  'entry the message points at.' },
468
+ 'vegetation-ignored': {
469
+ docs: ['api/vegetation.md', 'recipes/36-ground-plants.md §"Plants and wind"'],
470
+ fix: 'A model given to vegetation.define has an attribute (uv, color ...) on only some meshes; one instanced geometry keeps only what every mesh has, so its ' +
471
+ 'material draws without it. Give every mesh the attribute (a plain uv / white color on the parts that need none), or define the parts as separate species.' },
438
472
  'water-option': {
439
473
  docs: ['api/water.md', 'recipes/44-water-weather-hooks.md'],
440
474
  fix: 'A water option is wrong; own GLSL goes through engine.water.shader({ wave, surface }) and must define the function the message names.' },
@@ -445,25 +479,34 @@ export const ERROR_CODES = {
445
479
  docs: ['recipes/18-world.md', 'api/world.md'],
446
480
  fix: 'A world option is wrong (an anchor shape, a simulate channel that is not a time channel). Use the form in the message.' },
447
481
  'material-option': {
448
- docs: ['recipes/09-materials-lights-models.md', 'recipes/43-shader-patches-surfaces.md'],
482
+ docs: ['recipes/09-materials-lights-models.md §1', 'recipes/43-shader-patches-surfaces.md §"Ready-made effects: `detail`"'],
449
483
  fix: 'A material / surface / detail / lighting spec is wrong: an unknown type, texture slot or setting, or GLSL that does not define ' +
450
484
  'the function the slot expects. The message names the key and the accepted values.' },
451
485
  'post-effect': {
452
- docs: ['api/post.md', 'recipes/52-around-the-picture.md'],
486
+ docs: ['api/post.md', 'recipes/52-around-the-picture.md §"Post effect chain"'],
453
487
  fix: 'A post effect is malformed or clashes: engine.post.add takes a three.js Pass, a node function (WebGPU) or { name, create | node | fuse }, ' +
454
488
  'with a unique name and a known slot. Change an existing effect with its handle (engine.post.get(name).set(params), .enabled); add one with engine.post.add (the one way).' },
489
+ 'post-effect-failed': {
490
+ docs: ['recipes/52-around-the-picture.md §"Post effect chain"'],
491
+ fix: "The device could not build the shader of a post effect's own pass (a driver compiler error, or a device limit), so the engine holds that effect off and " +
492
+ 'the frame draws without it. The message ends with what the device said. Same picture on other devices: nothing to do. ' +
493
+ 'To run it here: change the option the error points at, then remove the effect and add it again.' },
455
494
  'own-frame': {
456
- docs: ['THREE.md', 'recipes/52-around-the-picture.md'],
495
+ docs: ['THREE.md', 'recipes/52-around-the-picture.md §"Post effect chain"'],
457
496
  fix: 'The game draws the canvas itself (its own composer.render() / renderer.render outside engine.onRender), so the engine yielded ' +
458
497
  'the frame. Intended: nothing to do. To get the engine frame back delete your render call; to add a pass to it use engine.post.add(pass).' },
459
498
  'shader-patch': {
460
- docs: ['recipes/43-shader-patches-surfaces.md'],
499
+ docs: ['recipes/43-shader-patches-surfaces.md §"Patch a slot"'],
461
500
  fix: 'A shader patch is malformed: glsl goes with a slot name (a string per slot), raw anchors use vertex / fragment, and the ' +
462
501
  'material must provide what the patch needs. The message lists the slot names.' },
463
502
  'renderer-backend': {
464
503
  docs: ['recipes/50-own-renderer.md'],
465
504
  fix: "The WebGPU route could not start as asked: WebGPU is unavailable with fallback: 'error', a NodeMaterial met fallback: 'webgl' " +
466
505
  "(WebGLRenderer cannot draw TSL; use fallback: 'webgl2'), a WebGL-only material is in the scene, or threedog/tsl is not imported. The message names which." },
506
+ 'photo-path-trace': {
507
+ docs: ['recipes/26-ui-parts.md §"Photo mode: the picture"', 'api/photo.md'],
508
+ fix: "photo.trace() could not trace: the game's import is missing (npm i -D three-gpu-pathtracer three-mesh-bvh, then photo({ pathTracer: () => import('three-gpu-pathtracer/webgpu') }), or 'three-gpu-pathtracer' on WebGL), " +
509
+ 'the page runs the WebGL2 fallback, no sample arrived in time, a traced photo is still accumulating, or the engine was disposed. The message names which.' },
467
510
  'ui-misuse': {
468
511
  docs: ['recipes/26-ui-parts.md', 'api/hud.md'],
469
512
  fix: 'A UI part, theme or toast call is wrong (an unknown part or verb, a value of the wrong type, the engine not passed first). ' +
@@ -482,45 +525,51 @@ export const ERROR_CODES = {
482
525
  docs: ['recipes/12-navmesh.md', 'api/nav.md'],
483
526
  fix: 'The navmesh could not be built from this geometry; paths fall back. The message has the builder\'s reason (usually too few ' +
484
527
  'walkable triangles or wrong cell sizes).' },
528
+ 'fog-fallback': {
529
+ docs: ['recipes/56-webgpu-tsl.md §"Sky and fog hooks"', 'recipes/34-environment-lighting.md §"Fog: plain three.js, signals, your own math"'],
530
+ fix: "On WebGPU the engine reads the color of scene.fogNode = fog(color, factor) only when color is a THREE.Color, color(..) or uniform(Color) (new THREE.Color(0xaabbcc), color(0xaabbcc)). With a computed color the sky dome's fog band, the water's grazing reflection and the horizon check cannot follow your fog. Give fog() a color(..) or uniform(Color), or set scene.fog too." },
531
+ 'nav-fallback': {
532
+ docs: ['recipes/12-navmesh.md §5', 'api/nav.md'],
533
+ fix: 'nav() builds its mesh from the ground of a level. With none (procedural terrain, or a level still loading) paths use collision A*: they work but ignore nav links, crowds and floor changes. Load a level for a navmesh, or ignore this if A* is what you want.' },
485
534
  'nav-link': {
486
- docs: ['recipes/12-navmesh.md', 'api/nav.md'],
535
+ docs: ['recipes/12-navmesh.md §6', 'api/nav.md'],
487
536
  fix: 'A nav link needs both ends within its radius of the mesh (which stops about the agent radius short of every edge) and within maxClimb of its height, and the places ' +
488
537
  'where they meet the mesh in the same tile or neighbouring tiles (a tile is tileSize x cellSize meters). Move the end onto walkable ground, raise radius, split a long link in two, or raise tileSize.' },
489
538
  'nav-height': {
490
- docs: ['recipes/12-navmesh.md', 'api/nav.md'],
539
+ docs: ['recipes/12-navmesh.md §5', 'api/nav.md'],
491
540
  fix: 'A height given to a path or a stop is more than a body height from every walkable surface at that spot, so the nearest surface was used. Leave y out to mean the ground, or give the height of the floor you mean.' },
492
541
  'grid-overlap': {
493
- docs: ['recipes/29-grid.md', 'api/grids.md'],
542
+ docs: ['recipes/29-grid.md §2', 'api/grids.md'],
494
543
  fix: 'Two grid items claim the same cell; the second is skipped. Move one, or remove the other first.' },
495
544
  'grid-orphan': {
496
- docs: ['recipes/29-grid.md', 'api/grids.md'],
545
+ docs: ['recipes/29-grid.md §2', 'api/grids.md'],
497
546
  fix: 'A placed record names an item the content no longer defines, so it has no size and takes no cells; the record is kept. Define the item again, or remove the record with grid.remove.' },
498
547
  'module-requires': {
499
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
548
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
500
549
  fix: "A module requires a capability ('world', 'inventory') no installed module provides yet. Install the engine's part of that name first (engine.use(world(), mine())), or your own module with provides: ['<name>'] (a typo is suggested in the message)." },
501
550
  'module-provides': {
502
- docs: ['recipes/14-custom-module.md'],
551
+ docs: ['recipes/14-custom-module.md §2'],
503
552
  fix: "provides is a list of exclusive slot names (provides: ['inventory']); a slot name must not be a shared value's name." },
504
553
  'module-replaces': {
505
- docs: ['recipes/14-custom-module.md'],
554
+ docs: ['recipes/14-custom-module.md §2'],
506
555
  fix: "engine.use(mine(), { replaces: 'slot' }): an installed module must hold the slot, a module in the same call must provide it, and no other module may require the old one by its module name (require the slot). The world holds every record, so it is never replaced under modules that use it or after start(): install your world before the modules that need it." },
507
556
  'module-cycle': {
508
- docs: ['recipes/14-custom-module.md'],
557
+ docs: ['recipes/14-custom-module.md §2'],
509
558
  fix: 'before / after constraints of two or more modules point at each other. Remove one of them or give a module a different stage.' },
510
559
  'module-type': {
511
- docs: ['recipes/14-custom-module.md'],
560
+ docs: ['recipes/14-custom-module.md §"Type: what the module"'],
512
561
  fix: "A module's type names what it owns: 'rules' (game logic, the default), 'world' | 'picture' | 'actor' | 'ui' | 'net' | 'tool' (core/engine/moduleTypes.js). This one is not a type: a typo?" },
513
562
  'module-type-rule': {
514
- docs: ['recipes/14-custom-module.md'],
563
+ docs: ['recipes/14-custom-module.md §"Type: what the module"'],
515
564
  fix: 'A warning, the call went through: a module did something its type does not usually own (a picture module defining an op or writing world records, a ui module binding keys or registering a save part). Move that part into a module of the right type, or change the type, as the message says, or leave it if the game means it.' },
516
565
  'module-stage': {
517
- docs: ['recipes/14-custom-module.md'],
566
+ docs: ['recipes/14-custom-module.md §2'],
518
567
  fix: 'Modules sort by stage (+ before / after), not by number. Use one of the listed stage names.' },
519
568
  'module-name': {
520
569
  docs: ['recipes/14-custom-module.md'],
521
- fix: 'The module name becomes engine.<name>; it must not be an existing engine property or another module name.' },
570
+ fix: 'The module name becomes engine.<name>; it must not be an existing engine property, another module name or a capability another module provides (requires and engine.<name> would reach different modules).' },
522
571
  'module-handle': {
523
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
572
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
524
573
  fix: "ctx.track(handle) (the ctx install / init receive) and engine.session.track(handle) take something with remove(), such as the result of events.on / onFixed / clock.after; ctx.borrow(obj, values) takes two objects, and one property has one holder at a time: end the first borrow, or use a shared point (engine.mod) when several parties want the value. A handle tracked after its module was unloaded (an async init resuming after replaces / unload) is removed at once: check what the init does after its await." },
525
574
  'module-called': {
526
575
  docs: ['recipes/01-new-game.md', 'api/engine.md'],
@@ -538,11 +587,11 @@ export const ERROR_CODES = {
538
587
  docs: ['api/hud.md', 'recipes/26-ui-parts.md'],
539
588
  fix: "A hud element option is wrong: anchor is one of the listed corners / edges, a counter value is a number or text, and hud.bump needs a counter that shows a number. Fix the option the message names." },
540
589
  'describe-threw': {
541
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
590
+ docs: ['recipes/14-custom-module.md §2', 'api/engine.md'],
542
591
  fix: "A module's describe(e, ctx) hook threw; describe() put { error, code } under that module's name and kept the rest. Fix the " +
543
592
  'hook named in the message (it must return plain data or nothing).' },
544
593
  'world-plain': {
545
- docs: ['recipes/18-world.md', 'api/world.md'],
594
+ docs: ['recipes/18-world.md §9', 'api/world.md'],
546
595
  fix: "A saved record holds a three.js object, function or class instance. World data must be JSON-like (it is saved and may go to a worker): write { x, y, z } for a vector. A model: world.present('crate', { build: rec => mesh }), then world.view(id) gets it. Nothing to save: world.add(rec, { save: false }) may hold anything." },
547
596
  'pickup-misuse': {
548
597
  docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
@@ -566,13 +615,13 @@ export const ERROR_CODES = {
566
615
  docs: ['recipes/16-dev-bridge.md'],
567
616
  fix: 'applyState got a value it cannot use: the message names the key and the accepted forms. Nothing was applied.' },
568
617
  'content-place': {
569
- docs: ['recipes/20-content-actions-save.md', 'api/content.md'],
618
+ docs: ['recipes/20-content-actions-save.md §1b', 'api/content.md'],
570
619
  fix: 'content.load references a place that has no coordinates, or needs world() for props / pickups. Give the place in content.load({ places }) or add the marker to the level.' },
571
620
  'container': {
572
- docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
621
+ docs: ['recipes/03-items-pickups.md §"Chests / corpses"', 'api/inventory.md'],
573
622
  fix: 'Container id / capacity / count was invalid, or a container used in transfer was never created. Create it first with inventory.container(id, { capacity }).' },
574
623
  'npc-behavior': {
575
- docs: ['recipes/02-npc.md', 'api/characters.md'],
624
+ docs: ['recipes/02-npc.md §"Changing behavior / custom"', 'api/characters.md'],
576
625
  fix: 'The schedule / behavior name is unknown. Register it with engine.npcs.behavior(name, { near, far }) before npcs.add, or use a listed built-in.' },
577
626
  'unknown-option': {
578
627
  docs: ['api/engine.md', 'CONVENTIONS.md'],
@@ -584,21 +633,21 @@ export const ERROR_CODES = {
584
633
  docs: ['api/events.md'],
585
634
  fix: "This event name is one letter or so from an engine event, and nothing emits it. Use the suggested name; if this really is a new event of your own, ignore the warning." },
586
635
  'owned-prop': {
587
- docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
636
+ docs: ['recipes/52-around-the-picture.md §"Who writes it"', 'THREE.md'],
588
637
  fix: 'The engine wrote this value on its own (sky, camera, fog distance ...); your direct write took it over, so the engine no longer changes it. Intended: say so with the manual() call in the message. Not intended: give it back with manual(key, false) and adjust it with set(...).' },
589
638
  'picture-held': {
590
- docs: ['recipes/62-picture-code.md'],
591
- fix: 'A picture value is held by a part (provides) and other code wrote it, so one of the two never reaches the screen. Delete the stray write; or swap the holder with engine.use(mine(), { replaces: slot }); or, when both need a say, make it a shared value the holder reads (recipes/62-picture-code.md "Picture parts").' },
639
+ docs: ['recipes/62-picture-code.md §3f'],
640
+ fix: 'A picture value is held by a part (provides) and other code wrote it, so one of the two never reaches the screen. Delete the stray write; or swap the holder with engine.use(mine(), { replaces: slot }); or, when both need a say, make it a shared value the holder reads (recipes/62-picture-code.md §3f).' },
592
641
  'picture-leftover': {
593
- docs: ['recipes/62-picture-code.md'],
594
- fix: "A picture part was removed and what it added stayed. In its install, hand each thing to ctx.track({ remove() { ... } }) (or undo it in dispose), so it goes with the part (recipes/62-picture-code.md \"Picture parts\")." },
642
+ docs: ['recipes/62-picture-code.md §3f'],
643
+ fix: "A picture part was removed and what it added stayed. In its install, hand each thing to ctx.track({ remove() { ... } }) (or undo it in dispose), so it goes with the part (recipes/62-picture-code.md §3f)." },
595
644
  'module-unuse': {
596
- docs: ['recipes/14-custom-module.md'],
645
+ docs: ['recipes/14-custom-module.md §2'],
597
646
  fix: "engine.unuse(name): the module must be installed, and no other module may still require it or a slot only it provides. Unload the dependent first, or swap the provider with engine.use(mine(), { replaces: 'slot' })." },
598
647
  'picture-conflict': {
599
648
  brief: true,
600
- docs: ['recipes/62-picture-code.md'],
601
- fix: 'Two places write this value, so one write never shows. Pick the one that owns the value and delete the other, or turn the second into a signal the owner reads (recipes/62-picture-code.md "Wiring picture/ parts"). Both lines are in the message.' },
649
+ docs: ['recipes/62-picture-code.md §3e'],
650
+ fix: 'Two places write this value, so one write never shows. Pick the one that owns the value and delete the other, or turn the second into a signal the owner reads (recipes/62-picture-code.md §3c). Both lines are in the message.' },
602
651
  'camera-kind': {
603
652
  docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
604
653
  fix: 'setCamera() got an unknown camera kind. Use one of the listed kinds; for a camera of your own, take it with engine.takeCamera(owner) and place engine.camera yourself (recipes/21-camera.md).' },
@@ -612,16 +661,19 @@ export const ERROR_CODES = {
612
661
  docs: ['api/jobs.md'],
613
662
  fix: "commits.request() needs fallback: () => result. Async results apply at fixed steps; when a result is late, the fallback computes it on the main thread, so the outcome never depends on machine speed." },
614
663
  'asset-critical': {
615
- docs: ['recipes/05-props-bake.md', 'api/assets.md'],
664
+ docs: ['recipes/05-props-bake.md §3', 'api/assets.md'],
616
665
  fix: 'An asset marked critical: true in the manifest (or an engine.loading.track step) failed, so start() stopped instead of starting a broken game. The line names the file, HTTP status and manifest. Fix the path or the file; if the game can run without it, drop critical so it falls back. engine.loading.list({ phase: "failed" }) or threedog loading shows every failure.' },
617
666
  'asset-missing-ref': {
618
667
  docs: ['recipes/05-props-bake.md', 'api/assets.md'],
619
668
  fix: 'The model file loaded, but a file it references (texture image or .bin) is missing, usually after moving the .gltf without its folder or a case mismatch in the referenced name. Export as .glb (everything in one file) or copy the referenced files next to it.' },
669
+ 'asset-needs': {
670
+ docs: ['recipes/05-props-bake.md §2f', 'api/assets.md'],
671
+ fix: 'A model file lacks a node or animation clip its manifest entry declares in needs: { nodes, clips }, usually a re-export that dropped or renamed it. The line names each missing part and the closest name in the file. Restore it in the model (Blender: keep the name, check the action is not unused and has a fake user or is in an NLA track), or change needs. `threedog assets check` reads the same declaration from the glb without running the game.' },
620
672
  'asset-not-loaded': {
621
673
  docs: ['api/assets.md', 'recipes/05-props-bake.md'],
622
674
  fix: 'assets.modelNow only hands out a model something already loaded; it never starts a load. A code-built model loads too (built, or read from the bake cache). Write `modelNow(name) ?? await model(name)`, or mark it preload: true and await assets.preload() before the code that must not wait.' },
623
675
  'asset-lod': {
624
- docs: ['recipes/15-perf.md', 'api/assets.md'],
676
+ docs: ['recipes/15-perf.md §4a', 'api/assets.md'],
625
677
  fix: 'assets.lod and a prop\'s lod need level files from `threedog assets optimize --lod` (skipped models say why in its report), distances as rising meters, and levels made from the same version of the model. A LOD object is never batched, so for many copies of a light model drop lod and let engine.batching draw them.',
626
678
  },
627
679
  'asset-fallback-cycle': {
@@ -634,10 +686,10 @@ export const ERROR_CODES = {
634
686
  docs: ['api/audio.md'],
635
687
  fix: 'No AudioContext in this browser / test environment. Guard calls with typeof AudioContext, or skip audio in headless tests.' },
636
688
  'indexeddb': {
637
- docs: ['api/saves.md', 'recipes/20-content-actions-save.md'],
689
+ docs: ['api/saves.md', 'recipes/20-content-actions-save.md §"Save failures and versions"'],
638
690
  fix: 'Saves use IndexedDB, which is blocked in private windows and some embedded browsers. Test in a normal window, or export / import the save as a file.' },
639
691
  'gameplay-frozen': {
640
- docs: ['recipes/16-dev-bridge.md', 'recipes/14-custom-module.md'],
692
+ docs: ['recipes/16-dev-bridge.md §8', 'recipes/14-custom-module.md §2'],
641
693
  fix: 'In dev / tests a gameplay error freezes the game on purpose, so half-applied state is not mistaken for normal. Read the error printed with it (engine.error has where + message), fix it, reload.' },
642
694
  'canvas-released': {
643
695
  docs: ['api/engine.md'],
@@ -648,16 +700,25 @@ export const ERROR_CODES = {
648
700
  'tsl-misuse': {
649
701
  docs: ['recipes/43-shader-patches-surfaces.md'],
650
702
  fix: "A threedog/tsl function cannot work here; the message says why. Usually: pass the engine, draw with the engine renderer, on a Mesh or InstancedMesh." },
703
+ 'vertex-inputs': {
704
+ docs: ['recipes/56-webgpu-tsl.md §"The engine\'s shader"'],
705
+ fix: "One program needs more vertex inputs than the device has (16 on most; WebGPU also 8 vertex buffers). The message counts what stacked up: geometry attributes the " +
706
+ "material reads, the instance matrix (4) and color (1), last frame's matrix for temporalAA's velocity buffer (4), engine patches, your own attribute nodes. " +
707
+ 'Drop what is not read, pack per-instance values into one vec4, or move them to a storage buffer (instancedArray from three/tsl); temporalAA off frees 4.' },
708
+ 'texture-bindings': {
709
+ docs: ['recipes/56-webgpu-tsl.md §"The engine\'s shader"'],
710
+ fix: "One shader stage binds more sampled textures or samplers than the device allows (16 each on most). The message names the material and counts them, with the shadow maps " +
711
+ "and environment / cube maps among them. Use fewer texture layers, pack maps into one texture's channels, or cast shadows from fewer lights." },
651
712
  'webgpu-needs-tsl': {
652
- docs: ['recipes/56-webgpu-tsl.md'],
713
+ docs: ['recipes/56-webgpu-tsl.md §"Turning it on"'],
653
714
  fix: "On WebGPURenderer the engine draws with node materials. Either threedog/tsl is not loaded (add import 'threedog/tsl' at the top of the entry), " +
654
715
  'or a part is written only as GLSL text: give it a tsl form too (a patch: tsl next to glsl; sky / fog hooks: { glsl, tsl }; a weather glsl spec: ' +
655
716
  'create(engine) returning your own node-material object). The message names the part.' },
656
717
  'swarm-full': {
657
- docs: ['recipes/65-swarm.md'],
718
+ docs: ['recipes/65-swarm.md §"Time, saves, limits"'],
658
719
  fix: 'The swarm holds capacity objects and spawn returned -1, so that object does not exist. Raise capacity in engine.swarm({ capacity }), or remove objects sooner; describe().swarm.<name>.dropped counts the refused spawns.' },
659
720
  'swarm-handle': {
660
- docs: ['recipes/65-swarm.md'],
721
+ docs: ['recipes/65-swarm.md §"The id rule"'],
661
722
  fix: 'free takes a handle, not a row: rows move when objects are removed. Inside onStep or near pass d.id[i]; to remove the object onStep is on, return false.' },
662
723
  'swarm-step': {
663
724
  docs: ['recipes/65-swarm.md'],
@@ -666,12 +727,12 @@ export const ERROR_CODES = {
666
727
  docs: ['recipes/65-swarm.md'],
667
728
  fix: 'spawn() was given a name that is no column. Columns are x, y, z, the names in engine.swarm({ fields }), and with { color: true } r, g, b and the spawn key color.' },
668
729
  'swarm-name': {
669
- docs: ['recipes/65-swarm.md'],
730
+ docs: ['recipes/65-swarm.md §"Time, saves, limits"'],
670
731
  fix: 'Swarm names are unique: they are the keys in describe() and in saves. Pick another name, or dispose() the old swarm first.' },
671
732
  'swarm-disposed': {
672
733
  docs: ['recipes/65-swarm.md'],
673
734
  fix: 'This swarm was disposed. Make a new one with engine.swarm(options), or keep it and call clear() to empty it.' },
674
735
  'module-disabled': {
675
- docs: ['recipes/14-custom-module.md'],
736
+ docs: ['recipes/14-custom-module.md §2'],
676
737
  fix: 'A picture or ui module (particles, sky, music, a panel...) threw and was switched off; the game keeps running without it. The error printed with it is the real cause.' },
677
738
  };