threedog 0.7.0 → 1.0.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 (593) hide show
  1. package/CHANGELOG.md +411 -1
  2. package/README.md +8 -11
  3. package/core/{Animator.js → assets/Animator.js} +30 -18
  4. package/core/{Assets.js → assets/Assets.js} +131 -56
  5. package/core/{Baked.js → assets/Baked.js} +4 -4
  6. package/core/assets/assetEntry.js +302 -0
  7. package/core/{assetHot.js → assets/assetHot.js} +9 -7
  8. package/core/{assetLoad.js → assets/assetLoad.js} +55 -16
  9. package/core/assets/assetLod.js +113 -0
  10. package/core/{assetManifest.js → assets/assetManifest.js} +19 -11
  11. package/core/{assetReport.js → assets/assetReport.js} +7 -14
  12. package/core/{namedModel.js → assets/namedModel.js} +17 -13
  13. package/core/{Audio.js → audio/Audio.js} +47 -25
  14. package/core/{audioRules.js → audio/audioRules.js} +8 -5
  15. package/core/{audioVoice.js → audio/audioVoice.js} +17 -30
  16. package/core/{Events.js → base/Events.js} +3 -3
  17. package/core/{I18n.js → base/I18n.js} +15 -12
  18. package/core/{Random.js → base/Random.js} +7 -4
  19. package/core/{Vars.js → base/Vars.js} +14 -4
  20. package/core/{easing.js → base/easing.js} +1 -1
  21. package/core/{errorCodes.js → base/errorCodes.js} +151 -125
  22. package/core/{errorHints.js → base/errorHints.js} +17 -10
  23. package/core/{errors.js → base/errors.js} +12 -10
  24. package/core/{events.generated.js → base/events.generated.js} +11 -0
  25. package/core/base/follows.js +26 -0
  26. package/core/base/math.js +66 -0
  27. package/core/{params.js → base/params.js} +5 -6
  28. package/core/base/saveValues.js +81 -0
  29. package/core/base/sections.js +97 -0
  30. package/core/base/spelling.js +32 -0
  31. package/core/base/util.js +32 -0
  32. package/core/{validate.js → base/validate.js} +34 -34
  33. package/core/{Engine.js → engine/Engine.js} +137 -91
  34. package/core/{Loading.js → engine/Loading.js} +34 -5
  35. package/core/{copies.js → engine/copies.js} +4 -4
  36. package/core/{headlessLoad.js → engine/headlessLoad.js} +32 -15
  37. package/core/{lifecycle.js → engine/lifecycle.js} +41 -34
  38. package/core/{loop.js → engine/loop.js} +88 -49
  39. package/core/engine/moduleSlots.js +176 -0
  40. package/core/{moduleTypes.js → engine/moduleTypes.js} +26 -14
  41. package/core/engine/modules.js +503 -0
  42. package/core/{page.js → engine/page.js} +59 -29
  43. package/core/{plugins.js → engine/plugins.js} +21 -12
  44. package/core/{services.js → engine/services.js} +50 -40
  45. package/core/{startup.js → engine/startup.js} +66 -54
  46. package/core/{Input.js → input/Input.js} +67 -39
  47. package/core/{inputContext.js → input/inputContext.js} +14 -5
  48. package/core/input/inputKeyboard.js +39 -0
  49. package/core/{inputPad.js → input/inputPad.js} +24 -3
  50. package/core/{inputPointer.js → input/inputPointer.js} +11 -3
  51. package/core/input/inputSeat.js +66 -0
  52. package/core/{inputTouch.js → input/inputTouch.js} +24 -7
  53. package/core/{Budget.js → inspect/Budget.js} +21 -20
  54. package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +43 -18
  55. package/core/{Describe.js → inspect/Describe.js} +34 -26
  56. package/core/{Inspect.js → inspect/Inspect.js} +39 -10
  57. package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +7 -8
  58. package/core/{InspectPerf.js → inspect/InspectPerf.js} +19 -13
  59. package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
  60. package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +3 -2
  61. package/core/{UrlState.js → inspect/UrlState.js} +60 -24
  62. package/core/{catalog.js → inspect/catalog.js} +15 -8
  63. package/core/{checks.js → inspect/checks.js} +7 -5
  64. package/core/{debugView.js → inspect/debugView.js} +4 -4
  65. package/core/{describeRender.js → inspect/describeRender.js} +24 -22
  66. package/core/{describeText.js → inspect/describeText.js} +17 -8
  67. package/core/inspect/geometryWatch.js +38 -0
  68. package/core/{lightWatch.js → inspect/lightWatch.js} +8 -8
  69. package/core/inspect/metadata.generated.js +4140 -0
  70. package/core/{pictureWriters.js → inspect/pictureWriters.js} +130 -47
  71. package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
  72. package/core/inspect/toolDoor.js +21 -0
  73. package/core/inspect/valueHistory.js +35 -0
  74. package/core/{Ops.js → ops/Ops.js} +44 -14
  75. package/core/{control.js → ops/control.js} +57 -31
  76. package/core/ops/holds.js +140 -0
  77. package/core/{opsAtomic.js → ops/opsAtomic.js} +18 -5
  78. package/core/{opsCheck.js → ops/opsCheck.js} +11 -10
  79. package/core/{opsFail.js → ops/opsFail.js} +5 -7
  80. package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
  81. package/core/{opsRun.js → ops/opsRun.js} +9 -6
  82. package/core/{owned.js → ops/owned.js} +33 -19
  83. package/core/{sharedPoint.js → ops/sharedPoint.js} +13 -16
  84. package/core/{stackFrames.js → ops/stackFrames.js} +2 -2
  85. package/core/{stacks.js → ops/stacks.js} +34 -15
  86. package/core/{wrap.js → ops/wrap.js} +8 -6
  87. package/core/{SaveStore.js → saves/SaveStore.js} +53 -27
  88. package/core/{Saves.js → saves/Saves.js} +171 -54
  89. package/core/saves/saveApply.js +312 -0
  90. package/core/{saveFiles.js → saves/saveFiles.js} +45 -38
  91. package/core/{saveVersions.js → saves/saveVersions.js} +24 -23
  92. package/core/saves/session.js +231 -0
  93. package/core/saves/stateReplace.js +184 -0
  94. package/core/{Rays.js → scene/Rays.js} +44 -30
  95. package/core/{Views.js → scene/Views.js} +16 -8
  96. package/core/{adaptive.js → scene/adaptive.js} +19 -9
  97. package/core/{canvasBox.js → scene/canvasBox.js} +4 -3
  98. package/core/scene/compositeGround.js +72 -0
  99. package/core/scene/floor.js +17 -0
  100. package/core/{gameLights.js → scene/gameLights.js} +17 -7
  101. package/core/{grayMap.js → scene/grayMap.js} +8 -2
  102. package/core/{grid.js → scene/grid.js} +6 -4
  103. package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
  104. package/core/scene/ground.contract.js +14 -0
  105. package/core/scene/ground.js +139 -0
  106. package/core/{movement.js → scene/movement.js} +3 -3
  107. package/core/{pictureSlots.js → scene/pictureSlots.js} +2 -2
  108. package/core/scene/pixel.js +154 -0
  109. package/core/scene/pixelRatio.js +167 -0
  110. package/core/{sceneDelta.js → scene/sceneDelta.js} +5 -5
  111. package/core/{sceneMethods.js → scene/sceneMethods.js} +43 -15
  112. package/core/scene/stepPoses.js +60 -0
  113. package/core/{targeting.js → scene/targeting.js} +4 -5
  114. package/core/{thingExplain.js → scene/thingExplain.js} +7 -6
  115. package/core/{thingOps.js → scene/thingOps.js} +25 -16
  116. package/core/{things.js → scene/things.js} +18 -5
  117. package/core/{threePatches.js → scene/threePatches.js} +1 -1
  118. package/core/{tier.js → scene/tier.js} +10 -0
  119. package/core/scene/view.js +161 -0
  120. package/core/{Batching.js → stream/Batching.js} +85 -28
  121. package/core/{Stream.js → stream/Stream.js} +80 -38
  122. package/core/{batchGroups.js → stream/batchGroups.js} +11 -9
  123. package/core/{chunkStream.js → stream/chunkStream.js} +40 -0
  124. package/core/{scatter.js → stream/scatter.js} +7 -4
  125. package/core/{streamSources.js → stream/streamSources.js} +14 -8
  126. package/core/{Commits.js → threads/Commits.js} +17 -11
  127. package/core/{Jobs.js → threads/Jobs.js} +25 -13
  128. package/core/{Threads.js → threads/Threads.js} +21 -18
  129. package/core/{threadPure.js → threads/threadPure.js} +7 -5
  130. package/core/{threadServe.js → threads/threadServe.js} +3 -3
  131. package/core/{Clock.js → time/Clock.js} +20 -11
  132. package/core/{dayTime.js → time/dayTime.js} +5 -1
  133. package/core/{skip.js → time/skip.js} +28 -21
  134. package/core/{time.js → time/time.js} +32 -20
  135. package/core/{uiClock.js → time/uiClock.js} +4 -4
  136. package/docs/AI.md +92 -72
  137. package/docs/API.md +33 -28
  138. package/docs/CODEMAP.md +121 -200
  139. package/docs/COMMANDS.md +77 -70
  140. package/docs/CONVENTIONS.md +167 -24
  141. package/docs/MIGRATING-0.8.md +171 -0
  142. package/docs/MIGRATING-1.0.md +101 -0
  143. package/docs/THREE.md +140 -38
  144. package/docs/api/assets.md +12 -13
  145. package/docs/api/audio.md +6 -5
  146. package/docs/api/budget.md +4 -4
  147. package/docs/api/calendar.md +10 -11
  148. package/docs/api/cameraRig.md +32 -29
  149. package/docs/api/characters.md +35 -24
  150. package/docs/api/clock.md +1 -1
  151. package/docs/api/collider3d.md +9 -0
  152. package/docs/api/collision.md +12 -9
  153. package/docs/api/content.md +18 -17
  154. package/docs/api/dialogue.md +5 -4
  155. package/docs/api/engine.md +58 -54
  156. package/docs/api/events.md +17 -6
  157. package/docs/api/flow.md +1 -1
  158. package/docs/api/grids.md +1 -1
  159. package/docs/api/ground.md +6 -7
  160. package/docs/api/hud.md +2 -2
  161. package/docs/api/i18n.md +6 -6
  162. package/docs/api/input.md +9 -8
  163. package/docs/api/interactions.md +5 -5
  164. package/docs/api/inventory.md +10 -10
  165. package/docs/api/jobs.md +5 -5
  166. package/docs/api/level.md +10 -9
  167. package/docs/api/lightPool.md +1 -6
  168. package/docs/api/music.md +3 -3
  169. package/docs/api/nav.md +14 -12
  170. package/docs/api/openWorld.md +1 -1
  171. package/docs/api/particles.md +10 -7
  172. package/docs/api/photo.md +4 -2
  173. package/docs/api/pickups.md +3 -3
  174. package/docs/api/post.md +21 -5
  175. package/docs/api/quests.md +7 -5
  176. package/docs/api/rays.md +7 -7
  177. package/docs/api/rigid.md +29 -19
  178. package/docs/api/saves.md +13 -11
  179. package/docs/api/settings.md +9 -8
  180. package/docs/api/sky.md +8 -7
  181. package/docs/api/stream.md +8 -9
  182. package/docs/api/swarm.md +34 -0
  183. package/docs/api/terrain.md +6 -8
  184. package/docs/api/terrainDraw.md +2 -2
  185. package/docs/api/timeline.md +4 -4
  186. package/docs/api/tools.md +27 -22
  187. package/docs/api/triggers.md +2 -0
  188. package/docs/api/vars.md +1 -1
  189. package/docs/api/vegetation.md +4 -3
  190. package/docs/api/vegetationDraw.md +2 -2
  191. package/docs/api/water.md +7 -3
  192. package/docs/api/weather.md +27 -12
  193. package/docs/api/weatherDraw.md +4 -4
  194. package/docs/api/world.md +6 -6
  195. package/docs/recipes/01-new-game.md +28 -43
  196. package/docs/recipes/02-npc.md +21 -23
  197. package/docs/recipes/03-items-pickups.md +37 -53
  198. package/docs/recipes/04-quests.md +5 -4
  199. package/docs/recipes/05-props-bake.md +34 -44
  200. package/docs/recipes/06-clock-events.md +31 -22
  201. package/docs/recipes/07-flow-scenes-pause.md +30 -32
  202. package/docs/recipes/08-weather-sky.md +91 -37
  203. package/docs/recipes/09-materials-lights-models.md +25 -39
  204. package/docs/recipes/10-blender-level.md +22 -11
  205. package/docs/recipes/11-vehicles.md +44 -24
  206. package/docs/recipes/12-navmesh.md +60 -15
  207. package/docs/recipes/13-animation.md +70 -22
  208. package/docs/recipes/14-custom-module.md +33 -20
  209. package/docs/recipes/15-perf.md +51 -28
  210. package/docs/recipes/16-dev-bridge.md +39 -58
  211. package/docs/recipes/18-world.md +49 -28
  212. package/docs/recipes/19-shooting-picking.md +7 -4
  213. package/docs/recipes/20-content-actions-save.md +55 -40
  214. package/docs/recipes/21-camera.md +47 -25
  215. package/docs/recipes/22-shop-gold.md +21 -16
  216. package/docs/recipes/23-ops.md +28 -24
  217. package/docs/recipes/26-ui-parts.md +25 -14
  218. package/docs/recipes/27-net.md +3 -5
  219. package/docs/recipes/28-terrain.md +119 -23
  220. package/docs/recipes/29-grid.md +3 -3
  221. package/docs/recipes/30-templates.md +63 -30
  222. package/docs/recipes/31-audio.md +7 -7
  223. package/docs/recipes/32-action-game.md +21 -11
  224. package/docs/recipes/33-stream-sources.md +6 -3
  225. package/docs/recipes/34-environment-lighting.md +72 -25
  226. package/docs/recipes/35-picture-from-reference.md +20 -23
  227. package/docs/recipes/36-ground-plants.md +106 -0
  228. package/docs/recipes/40-scene.md +18 -21
  229. package/docs/recipes/43-shader-patches-surfaces.md +27 -48
  230. package/docs/recipes/44-water-weather-hooks.md +56 -50
  231. package/docs/recipes/45-cascaded-shadows.md +41 -20
  232. package/docs/recipes/46-blender-art-route.md +9 -10
  233. package/docs/recipes/49-game-module-contract.md +7 -6
  234. package/docs/recipes/50-own-renderer.md +3 -2
  235. package/docs/recipes/51-capability-catalog.md +14 -8
  236. package/docs/recipes/52-around-the-picture.md +56 -100
  237. package/docs/recipes/53-ground-up-close.md +61 -24
  238. package/docs/recipes/55-mods-time-wrap.md +17 -20
  239. package/docs/recipes/56-webgpu-tsl.md +28 -15
  240. package/docs/recipes/57-control.md +39 -12
  241. package/docs/recipes/58-input.md +15 -2
  242. package/docs/recipes/59-depth-post-effects.md +1 -1
  243. package/docs/recipes/60-judge-the-picture.md +30 -25
  244. package/docs/recipes/62-picture-code.md +129 -39
  245. package/docs/recipes/63-third-person-start.md +19 -5
  246. package/docs/recipes/64-particles.md +54 -5
  247. package/docs/recipes/65-swarm.md +140 -0
  248. package/docs/recipes/66-common-tasks.md +313 -0
  249. package/examples/action/.threedog/content-index.json +1 -1
  250. package/examples/action/GAMEMAP.md +5 -5
  251. package/examples/perf-island/.threedog/content-index.json +1 -0
  252. package/examples/{sheepisland → perf-island}/GAMEMAP.md +15 -14
  253. package/examples/{sheepisland → perf-island}/assets.js +1 -1
  254. package/examples/{sheepisland → perf-island}/main.js +8 -8
  255. package/examples/{sheepisland → perf-island}/models.js +1 -1
  256. package/examples/{sheepisland → perf-island}/params.js +1 -1
  257. package/examples/{sheepisland → perf-island}/picture/index.js +1 -1
  258. package/examples/{sheepisland → perf-island}/picture/palette.js +2 -2
  259. package/examples/{sheepisland → perf-island}/views.js +1 -1
  260. package/examples/plain-picture/GAMEMAP.md +4 -1
  261. package/examples/rc2d/GAMEMAP.md +4 -3
  262. package/examples/rc2d/main.js +1 -3
  263. package/examples/rc2d/rc2d.js +1 -1
  264. package/examples/styletest/.threedog/content-index.json +1 -1
  265. package/examples/styletest/GAMEMAP.md +6 -5
  266. package/examples/techniques/contact-shadows/contactShadows.js +1 -1
  267. package/examples/techniques/contact-shadows/main.js +1 -1
  268. package/examples/techniques/interior-light/main.js +1 -1
  269. package/examples/techniques/modular-building/README.md +7 -6
  270. package/examples/techniques/outlines-and-rim/picture/post.js +1 -1
  271. package/examples/techniques/procedural-animation/README.md +1 -1
  272. package/examples/webgpu-tsl/GAMEMAP.md +2 -1
  273. package/examples/world/.threedog/content-index.json +1 -1
  274. package/examples/world/GAMEMAP.md +9 -7
  275. package/examples/world/main.js +3 -3
  276. package/examples/world/picture/sky.js +1 -1
  277. package/index.d.ts +16 -12
  278. package/index.js +53 -32
  279. package/llms.txt +11 -14
  280. package/modules/ambience/Ambience.js +16 -11
  281. package/modules/calendar/Calendar.js +19 -19
  282. package/modules/calendar/index.js +18 -16
  283. package/modules/calendar/schedule.js +11 -6
  284. package/modules/calendar/seasons.js +7 -7
  285. package/modules/camera/FirstPersonCamera.js +5 -5
  286. package/modules/camera/FixedCamera.js +43 -30
  287. package/modules/camera/FollowCamera.js +24 -15
  288. package/modules/camera/RtsCamera.js +12 -11
  289. package/modules/camera/common.js +72 -37
  290. package/modules/camera/contract.js +1 -0
  291. package/modules/camera/pixelSnap.js +62 -0
  292. package/modules/characters/Character.js +166 -70
  293. package/modules/characters/NPC.js +84 -44
  294. package/modules/characters/assetModel.js +16 -12
  295. package/modules/characters/astar.js +48 -27
  296. package/modules/characters/behaviors.js +4 -5
  297. package/modules/characters/character.contract.js +21 -0
  298. package/modules/characters/contract.js +17 -3
  299. package/modules/characters/index.js +240 -226
  300. package/modules/characters/moveHelpers.js +88 -12
  301. package/modules/characters/mover.contract.js +14 -0
  302. package/modules/characters/movers/common.js +22 -18
  303. package/modules/characters/movers/manual.js +1 -1
  304. package/modules/characters/movers/rapier.js +18 -10
  305. package/modules/characters/movers/simple.js +26 -13
  306. package/modules/characters/movers/support.js +24 -13
  307. package/modules/characters/npcAvoid.js +19 -16
  308. package/modules/characters/npcSim.js +88 -32
  309. package/modules/characters/npcView.js +19 -11
  310. package/modules/characters/pathAsync.js +81 -29
  311. package/modules/characters/pathJob.js +38 -21
  312. package/modules/characters/pathWorker.js +1 -1
  313. package/modules/characters/player.js +120 -0
  314. package/modules/characters/playerStrings.js +2 -2
  315. package/modules/characters/proceduralRig.js +2 -2
  316. package/modules/characters/seat.js +56 -0
  317. package/modules/characters/useModel.js +3 -3
  318. package/modules/characters/vehicle.contract.js +8 -5
  319. package/modules/characters/walkTo.js +40 -33
  320. package/modules/collision/Collision.js +69 -45
  321. package/modules/collision/contract.js +15 -0
  322. package/modules/collision/grid.js +6 -1
  323. package/modules/content/explain.js +2 -3
  324. package/modules/content/fields.js +24 -3
  325. package/modules/content/ids.js +5 -3
  326. package/modules/content/index.js +132 -114
  327. package/modules/content/loader.js +117 -140
  328. package/modules/content/markers.js +25 -0
  329. package/modules/content/models.js +54 -17
  330. package/modules/content/packs.js +5 -4
  331. package/modules/content/parts.js +2 -2
  332. package/modules/content/places.js +36 -0
  333. package/modules/content/props.js +22 -17
  334. package/modules/content/rules.js +47 -61
  335. package/modules/content/stages.js +7 -7
  336. package/modules/content/templates.js +80 -49
  337. package/modules/content/words.js +47 -0
  338. package/modules/debug/DebugPanel.js +14 -45
  339. package/modules/flow/contract.js +2 -1
  340. package/modules/flow/index.js +30 -16
  341. package/modules/gameplay/Container.js +17 -13
  342. package/modules/gameplay/Containers.js +23 -6
  343. package/modules/gameplay/Dialogue.js +93 -34
  344. package/modules/gameplay/Interactions.js +93 -51
  345. package/modules/gameplay/Inventory.js +64 -22
  346. package/modules/gameplay/Quests.js +146 -30
  347. package/modules/gameplay/boxOps.js +8 -1
  348. package/modules/gameplay/dialogueBubbles.js +16 -12
  349. package/modules/gameplay/inventoryOps.js +11 -8
  350. package/modules/gameplay/pickups.js +63 -37
  351. package/modules/gameplay/questLog.js +4 -2
  352. package/modules/gameplay/questSave.js +9 -4
  353. package/modules/gameplay/quests.contract.js +1 -1
  354. package/modules/grid/Grid.js +2 -2
  355. package/modules/grid/Layer.js +12 -8
  356. package/modules/grid/index.js +28 -23
  357. package/modules/grid/ops.js +43 -46
  358. package/modules/grid/preview.js +7 -7
  359. package/modules/grid/tiles.js +6 -6
  360. package/modules/hlod/index.js +42 -57
  361. package/modules/hud/index.js +22 -14
  362. package/modules/hud/parts.js +8 -8
  363. package/modules/level/contract.js +16 -0
  364. package/modules/level/heightfield.js +29 -31
  365. package/modules/level/index.js +113 -161
  366. package/modules/level/load.js +196 -0
  367. package/modules/level/meshes.js +65 -0
  368. package/modules/level/nodes.js +40 -23
  369. package/modules/lights/index.js +33 -183
  370. package/modules/lights/slots.js +93 -0
  371. package/modules/lights/sources.js +90 -0
  372. package/modules/music/Music.js +34 -28
  373. package/modules/music/rules.js +1 -1
  374. package/modules/nav/contract.js +16 -0
  375. package/modules/nav/index.js +180 -49
  376. package/modules/nav/navPath.js +45 -10
  377. package/modules/net/Client.js +7 -7
  378. package/modules/net/Host.js +7 -7
  379. package/modules/net/Net.js +1 -1
  380. package/modules/net/index.js +6 -5
  381. package/modules/net/sync.js +2 -2
  382. package/modules/net/transports.js +2 -2
  383. package/modules/particles/Particles.js +95 -29
  384. package/modules/particles/effect.js +86 -32
  385. package/modules/particles/shaders.js +19 -1
  386. package/modules/photo/Photo.js +23 -23
  387. package/modules/rigid/RigidBodies.js +255 -89
  388. package/modules/rigid/Vehicles.js +17 -8
  389. package/modules/rigid/collider3d.contract.js +26 -0
  390. package/modules/rigid/ragdoll.js +298 -0
  391. package/modules/rigid/ragdollBones.js +209 -0
  392. package/modules/rigid/refresh.js +10 -0
  393. package/modules/rigid/sync.js +51 -20
  394. package/modules/settings/Settings.js +177 -61
  395. package/modules/settings/apply.js +20 -13
  396. package/modules/settings/sections.js +19 -14
  397. package/modules/settings/strings.js +2 -2
  398. package/modules/settings/view.js +3 -3
  399. package/modules/sky/Sky.js +29 -22
  400. package/modules/sky/clouds.js +7 -7
  401. package/modules/sky/dome.js +33 -20
  402. package/modules/sky/domeLayers.js +9 -9
  403. package/modules/sky/environment.js +6 -6
  404. package/modules/sky/frame.js +19 -10
  405. package/modules/sky/season.js +7 -1
  406. package/modules/sky/shader.js +24 -25
  407. package/modules/sky/skyModule.js +17 -28
  408. package/modules/sky/tint.js +1 -1
  409. package/modules/swarm/Swarm.js +356 -0
  410. package/modules/swarm/draw.js +68 -0
  411. package/modules/swarm/grid.js +63 -0
  412. package/modules/terrain/ChunkManager.js +71 -59
  413. package/modules/terrain/chunkQueries.js +7 -24
  414. package/modules/terrain/chunkWorker.js +1 -1
  415. package/modules/terrain/draw.js +14 -11
  416. package/modules/terrain/index.js +42 -42
  417. package/modules/terrain/terrainColorMap.js +6 -3
  418. package/modules/terrain/terrainDefaults.js +2 -1
  419. package/modules/terrain/terrainEdit.js +45 -29
  420. package/modules/terrain/terrainGen.js +19 -12
  421. package/modules/terrain/terrainIsland.js +2 -2
  422. package/modules/terrain/terrainMesh.js +7 -6
  423. package/modules/terrain/terrainShape.js +8 -10
  424. package/modules/terrain/terrainShapeMain.js +3 -3
  425. package/modules/timeline/Timeline.js +83 -43
  426. package/modules/timeline/Tween.js +25 -19
  427. package/modules/timeline/shots.js +24 -17
  428. package/modules/triggers/index.js +95 -28
  429. package/modules/vegetation/Vegetation.js +34 -26
  430. package/modules/vegetation/densityMap.js +4 -7
  431. package/modules/vegetation/draw.js +39 -18
  432. package/modules/vegetation/groundChunks.js +21 -38
  433. package/modules/vegetation/index.js +37 -12
  434. package/modules/vegetation/modelGeometry.js +3 -6
  435. package/modules/vegetation/nearFade.js +1 -1
  436. package/modules/water/Water.js +20 -16
  437. package/modules/water/surface.js +3 -3
  438. package/modules/weather/Weather.js +52 -40
  439. package/modules/weather/particles.js +8 -8
  440. package/modules/weather/weatherDraw.js +28 -23
  441. package/modules/world/World.js +28 -15
  442. package/modules/world/explain.js +1 -1
  443. package/modules/world/index.js +30 -17
  444. package/modules/world/persist.js +90 -27
  445. package/modules/world/pos.js +5 -5
  446. package/modules/world/records.js +37 -11
  447. package/modules/world/sim.js +78 -27
  448. package/modules/world/simFar.js +2 -2
  449. package/modules/world/state.js +43 -11
  450. package/modules/world/thingSource.js +20 -5
  451. package/modules/world/views.js +27 -14
  452. package/package.json +48 -7
  453. package/presets.js +1 -3
  454. package/render/PostFX.js +83 -53
  455. package/render/backend.js +31 -33
  456. package/render/cascades.js +17 -12
  457. package/render/cascades.tsl.js +5 -8
  458. package/render/daylight.js +20 -3
  459. package/render/detail.js +8 -7
  460. package/render/effects.js +28 -25
  461. package/render/fuse.js +3 -3
  462. package/render/fx/cloudShadow.tsl.js +3 -3
  463. package/render/fx/detail.tsl.js +1 -1
  464. package/render/fx/index.js +5 -10
  465. package/render/fx/library.tsl.js +11 -0
  466. package/render/fx/lighting.tsl.js +2 -1
  467. package/render/fx/nodeErrors.tsl.js +2 -2
  468. package/render/fx/objectOrigin.tsl.js +1 -2
  469. package/render/fx/particles.tsl.js +8 -6
  470. package/render/fx/patchNodes.tsl.js +5 -15
  471. package/render/fx/postWebGPU.tsl.js +30 -26
  472. package/render/fx/sky.tsl.js +15 -17
  473. package/render/fx/uniforms.tsl.js +4 -4
  474. package/render/fx/wind.tsl.js +1 -1
  475. package/render/fxNumbers.js +3 -0
  476. package/render/layers.js +2 -2
  477. package/render/lighting.js +5 -3
  478. package/render/lightmap.js +41 -21
  479. package/render/lights.js +6 -6
  480. package/render/lit.js +24 -0
  481. package/render/materials.js +8 -7
  482. package/render/mergeCommon.js +22 -0
  483. package/render/modeling.js +2 -2
  484. package/render/occlusion.js +62 -15
  485. package/render/ownFrame.js +4 -4
  486. package/render/patches.js +15 -15
  487. package/render/postWebGL.js +15 -12
  488. package/render/probes.js +41 -19
  489. package/render/recordSweep.js +117 -0
  490. package/render/shaderErrors.js +10 -9
  491. package/render/shadowCache.tsl.js +107 -0
  492. package/render/shadowTypes.js +9 -0
  493. package/{core → render}/shadows.js +59 -13
  494. package/render/slots.js +7 -7
  495. package/render/terms.js +22 -24
  496. package/render/uniformDecl.js +1 -1
  497. package/types/core.d.ts +336 -202
  498. package/types/gameplay.d.ts +254 -130
  499. package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +22 -7
  500. package/types/generated/core/{audioVoice.d.ts → audio/audioVoice.d.ts} +2 -2
  501. package/types/generated/core/{Events.d.ts → base/Events.d.ts} +4 -4
  502. package/types/generated/core/{I18n.d.ts → base/I18n.d.ts} +8 -16
  503. package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
  504. package/types/generated/core/{page.d.ts → engine/page.d.ts} +8 -9
  505. package/types/generated/core/{Input.d.ts → input/Input.d.ts} +28 -10
  506. package/types/generated/core/input/inputSeat.d.ts +26 -0
  507. package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
  508. package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +17 -3
  509. package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +6 -4
  510. package/types/generated/core/{control.d.ts → ops/control.d.ts} +14 -10
  511. package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +62 -18
  512. package/types/generated/core/{session.d.ts → saves/session.d.ts} +3 -2
  513. package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
  514. package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +2 -2
  515. package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
  516. package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +22 -18
  517. package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
  518. package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
  519. package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
  520. package/types/generated/modules/calendar/Calendar.d.ts +10 -11
  521. package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
  522. package/types/generated/modules/grid/Grid.d.ts +1 -0
  523. package/types/generated/modules/grid/Layer.d.ts +1 -1
  524. package/types/generated/modules/grid/index.d.ts +3 -3
  525. package/types/generated/modules/music/Music.d.ts +7 -5
  526. package/types/generated/modules/particles/Particles.d.ts +5 -4
  527. package/types/generated/modules/sky/Sky.d.ts +21 -10
  528. package/types/generated/modules/swarm/Swarm.d.ts +80 -0
  529. package/types/generated/modules/timeline/Timeline.d.ts +7 -5
  530. package/types/generated/modules/water/Water.d.ts +1 -0
  531. package/types/generated/modules/weather/Weather.d.ts +14 -16
  532. package/types/generated/modules/weather/weatherDraw.d.ts +3 -3
  533. package/types/generated/modules/world/World.d.ts +11 -7
  534. package/types/generated/render/PostFX.d.ts +21 -23
  535. package/types/generated/render/materials.d.ts +1 -0
  536. package/types/generated/render/occlusion.d.ts +9 -0
  537. package/types/generated/render/patches.d.ts +1 -0
  538. package/types/generated/ui/Focus.d.ts +1 -0
  539. package/types/generated/ui/UI.d.ts +1 -0
  540. package/types/nav.d.ts +47 -15
  541. package/types/physics.d.ts +150 -73
  542. package/types/pixel.d.ts +75 -0
  543. package/types/tsl.d.ts +37 -4
  544. package/types/world.d.ts +48 -75
  545. package/ui/Focus.js +10 -9
  546. package/ui/Parts.js +13 -5
  547. package/ui/UI.js +7 -7
  548. package/ui/defaults.js +3 -2
  549. package/ui/theme.js +7 -5
  550. package/core/assetEntry.js +0 -109
  551. package/core/engineCamera.js +0 -32
  552. package/core/ground.js +0 -104
  553. package/core/holds.js +0 -134
  554. package/core/math.js +0 -48
  555. package/core/moduleSlots.js +0 -100
  556. package/core/modules.js +0 -314
  557. package/core/saveApply.js +0 -210
  558. package/core/saveValues.js +0 -46
  559. package/core/session.js +0 -174
  560. package/core/shadowTypes.js +0 -16
  561. package/core/util.js +0 -17
  562. package/core/view.js +0 -43
  563. package/docs/MIGRATING-0.3.md +0 -248
  564. package/docs/MIGRATING-0.4.md +0 -320
  565. package/docs/MIGRATING-0.5.md +0 -68
  566. package/docs/MIGRATING-0.6.md +0 -126
  567. package/docs/PERF.md +0 -245
  568. package/docs/recipes/36-sky-ground-plants.md +0 -158
  569. package/docs/recipes/37-terrain-hooks.md +0 -115
  570. package/docs/recipes/38-environment-hooks.md +0 -67
  571. package/docs/recipes/42-terrain-shape.md +0 -64
  572. package/docs/recipes/47-island-snow-backdrop.md +0 -43
  573. package/docs/recipes/54-three-idioms.md +0 -88
  574. package/examples/plain-picture/FINDINGS.md +0 -53
  575. package/examples/sheepisland/.threedog/content-index.json +0 -1
  576. package/modules/camera/projection.js +0 -21
  577. /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
  578. /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
  579. /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
  580. /package/core/{actor.js → ops/actor.js} +0 -0
  581. /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
  582. /package/core/{saveIds.js → saves/saveIds.js} +0 -0
  583. /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
  584. /package/core/{cells.js → stream/cells.js} +0 -0
  585. /package/core/{streamCells.js → stream/streamCells.js} +0 -0
  586. /package/core/{pureWorker.js → threads/pureWorker.js} +0 -0
  587. /package/examples/{sheepisland → perf-island}/content/index.js +0 -0
  588. /package/examples/{sheepisland → perf-island}/content/props.js +0 -0
  589. /package/examples/{sheepisland → perf-island}/content/templates.js +0 -0
  590. /package/examples/{sheepisland → perf-island}/content/vegetation.js +0 -0
  591. /package/examples/{sheepisland → perf-island}/picture/lights.js +0 -0
  592. /package/examples/{sheepisland → perf-island}/picture/materials.js +0 -0
  593. /package/examples/{sheepisland → perf-island}/picture/sky.js +0 -0
@@ -3,16 +3,18 @@
3
3
 
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
+ // 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.
6
7
 
7
8
  /**
8
9
  * Errors the engine raises by name (the message ends with "[code]"): code -> { fix, docs }. Codes are stable: tools and tests may match on them.
9
- * @type {Record<string, { fix: string, docs: string[] }>}
10
+ * brief: a hint that stays one line on the console, because its message already says where the rest is; err.fix and errorInfo still give it.
11
+ * @type {Record<string, { fix: string, docs: string[], brief?: boolean }>}
10
12
  */
11
13
  export const ERROR_CODES = {
12
14
  'save-part-threw': {
13
15
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
14
- fix: 'A save part\'s save() threw, so nothing was written and the previous save is kept. Fix the save() named in the message ' +
15
- '(it must return plain data).' },
16
+ 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
+ '(it must return plain data; NaN and Infinity at any depth count, and the message gives the path).' },
16
18
  'save-load-threw': {
17
19
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
18
20
  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 ' +
@@ -29,18 +31,25 @@ export const ERROR_CODES = {
29
31
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
30
32
  fix: 'Import only text or files made by saves.export / exportFile; attachments must be data: URLs. Nothing was fetched or ' +
31
33
  'changed.' },
34
+ '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.' },
37
+ 'save-busy': {
38
+ docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
39
+ fix: 'Wait for the load to end (await it) before collecting. engine.saves.save waits by itself.' },
40
+ 'save-nested': {
41
+ docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
42
+ 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
+ '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.' },
32
44
  'save-autosave': {
33
45
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
34
46
  fix: 'saves.autosave(minutes) takes a positive number of minutes of play.' },
35
47
  'session-early': {
36
48
  docs: ['recipes/20-content-actions-save.md', 'api/engine.md'],
37
49
  fix: 'engine.session needs the new-game state that start() captures: call it from a button or after `await engine.start()`.' },
38
- 'session-handle': {
39
- docs: ['api/engine.md'],
40
- fix: 'session.track(handle) takes something with remove(), such as the result of events.on / onFixed / clock.after.' },
41
50
  'clock-interval': {
42
51
  docs: ['recipes/06-clock-events.md', 'api/clock.md'],
43
- fix: 'clock.after / every take a finite number of game seconds (every needs > 0). For every fixed step use engine.onFixed.' },
52
+ fix: 'clock.after / every take a finite number of calendar seconds (every needs > 0). For every fixed step use engine.onFixed.' },
44
53
  'threads-option': {
45
54
  docs: ['recipes/15-perf.md', 'api/engine.md'],
46
55
  fix: 'createEngine({ threads }) takes \'auto\', a worker count (0 = none) or false.' },
@@ -66,11 +75,13 @@ export const ERROR_CODES = {
66
75
  'is both a condition and a measure. Keep each name in one place.' },
67
76
  'engine-disposed': {
68
77
  docs: ['api/engine.md'],
69
- fix: 'engine.dispose() ran while start() was still loading, so start() stopped. Create a new engine instead of starting a ' +
70
- 'disposed one.' },
78
+ fix: 'engine.dispose() ran, so start() stopped or refused to run. Create a new engine instead of starting a disposed one.' },
71
79
  'skip-amount': {
72
80
  docs: ['recipes/06-clock-events.md', 'api/engine.md'],
73
- fix: 'engine.skip takes { to: \'06:00\' } (needs the sky module) or { seconds: 600 } (game seconds, > 0).' },
81
+ fix: 'engine.skip takes { to: \'06:00\' } (needs the calendar module) or { seconds: 600 } (calendar seconds, > 0).' },
82
+ 'skip-busy': {
83
+ docs: ['recipes/06-clock-events.md', 'api/engine.md'],
84
+ fix: 'Await the skip that is running (engine.skip returns its Promise), then call engine.skip again.' },
74
85
  'stream-timeout': {
75
86
  docs: ['recipes/18-world.md', 'api/stream.md'],
76
87
  fix: 'The teleport destination did not finish loading in time (terrain, colliders, nearby models). Read describe().loading or ' +
@@ -78,29 +89,26 @@ export const ERROR_CODES = {
78
89
  'stream-removed': {
79
90
  docs: ['recipes/18-world.md', 'api/stream.md'],
80
91
  fix: 'A stream source was removed (remove(), its until, or engine.dispose) before it was ready, so its whenReady rejects. Await ' +
81
- 'whenReady only on a source you keep.' },
92
+ '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.' },
82
93
  'stream-option': {
83
94
  docs: ['recipes/18-world.md', 'api/stream.md'],
84
- fix: 'stream.source(position, { detail }) takes \'full\' or \'simple\'.' },
95
+ fix: 'stream.source(position, { detail }) takes \'full\' or \'simple\'; stream.radius takes a finite number of meters or null.' },
85
96
  'op-misuse': {
86
97
  docs: ['recipes/23-ops.md', 'api/engine.md'],
87
98
  fix: 'Ops are defined with ops.define(name, { can, run }) and run with ops.run(name, args); args are plain data and can() only ' +
88
99
  'reads. The message says which rule was broken.' },
89
- 'renamed-field': {
90
- docs: ['MIGRATING-0.4.md'],
91
- fix: 'A name removed in 0.4 was read (engine.elapsed); the message names the new form (engine.time.now(\'real\') or engine.time.now(\'ambient\')). Checked in dev only.' },
92
- 'pause-owner': {
100
+ 'halt-owner': {
93
101
  docs: ['recipes/23-ops.md', 'api/engine.md'],
94
- fix: 'const p = engine.pause(owner); ... p.remove() ends that owner pause; the loop resumes only when every owner has removed theirs.' },
102
+ fix: 'const h = engine.haltLoop(owner); ... h.remove() ends that owner\'s halt; the loop restarts only when every owner has removed theirs.' },
95
103
  'mod-owner': {
96
104
  docs: ['recipes/55-mods-time-wrap.md', 'api/engine.md'],
97
- 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. pause / freeze / takeCamera / debug.view name their owner the same way. Only that owner ends it, with the handle's remove()." },
105
+ 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()." },
98
106
  'shared-conflict': {
99
107
  docs: ['recipes/55-mods-time-wrap.md'],
100
- fix: "Two owners set one shared value on the same layer, so nothing says which one decides (dev builds throw; release builds let the later write win and warn once). 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)." },
108
+ 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)." },
101
109
  'shared-taken': {
102
110
  docs: ['recipes/55-mods-time-wrap.md', 'recipes/14-custom-module.md'],
103
- fix: "Two modules provide the same exclusive slot (provides: ['inventory']). Install only one, or swap: engine.use(mine(), { replaces: 'inventory' }) unloads the holder and its changes." },
111
+ 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 })." },
104
112
  'shared-settings': {
105
113
  docs: ['recipes/55-mods-time-wrap.md'],
106
114
  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." },
@@ -109,7 +117,7 @@ export const ERROR_CODES = {
109
117
  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.' },
110
118
  'shared-layer': {
111
119
  docs: ['recipes/55-mods-time-wrap.md'],
112
- fix: 'layer is one of engine < style < game < effect < system < settings < debug (default game); most code never passes it.' },
120
+ fix: "layer is one of engine < game < effect < system < settings < debug (default game); most code never passes it." },
113
121
  'views-define': {
114
122
  docs: ['recipes/46-blender-art-route.md', 'api/engine.md'],
115
123
  fix: "engine.views.define(name, { position: [x, y, z], target?: [x, y, z], fov? }): position and target are 3-number arrays." },
@@ -119,16 +127,14 @@ export const ERROR_CODES = {
119
127
  'engine.ops.run(...) or an onFixed / module fixed hook.' },
120
128
  'quest-step': {
121
129
  docs: ['recipes/04-quests.md', 'api/quests.md'],
122
- fix: 'A saved quest step or part id no longer exists in the quest definition. Keep step ids stable (steps: [{ id, text, done ' +
123
- '}]) or add a migrate step to the quests save part.' },
130
+ 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." },
124
131
  'save-write': {
125
132
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
126
133
  fix: 'The browser refused to store the save (storage full, private mode, blocked IndexedDB); the previous save is kept. Free ' +
127
134
  'space or export the save as a file.' },
128
135
  'save-bad-record': {
129
136
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
130
- fix: 'A core field of a saved record is malformed (a position that is not three finite numbers, a record without kind); the ' +
131
- 'load was refused and rolled back. The save was edited by hand or damaged: fix the field the message names, or load another save.' },
137
+ 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." },
132
138
  'save-value': {
133
139
  docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
134
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 ' +
@@ -141,30 +147,47 @@ export const ERROR_CODES = {
141
147
  docs: ['recipes/15-perf.md', 'api/budget.md'],
142
148
  fix: 'A performance budget set with createEngine({ budget }) was exceeded; the message names the biggest costs. Measure with ' +
143
149
  'describe().perf or npm run perf.' },
150
+ 'webgpu-records-unread': {
151
+ docs: ['recipes/56-webgpu-tsl.md'],
152
+ 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
+ 'Until the engine is updated, send the event yourself when a mesh is gone for good: mesh.dispatchEvent({ type: \'dispose\' }).' },
154
+ 'geometry-undisposed': {
155
+ docs: ['recipes/56-webgpu-tsl.md'],
156
+ 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
+ 'or engine.remove(mesh). Geometry parked for reuse is fine; this warns only about a steady climb.' },
144
158
  'jobs-slow': {
145
159
  docs: ['recipes/15-perf.md', 'api/jobs.md'],
146
160
  fix: 'A job step ran too long or a job queued too many steps. Yield more often inside the generator (engine.jobs.add(function* ' +
147
161
  '() { ...; yield; })).' },
162
+ 'jobs-endless': {
163
+ docs: ['api/jobs.md'],
164
+ 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
+ 'A generator that loops forever needs an end; one that is only long needs a later lag or a higher engine.jobs.maxSteps.' },
148
166
  'threads-crash': {
149
167
  docs: ['recipes/15-perf.md', 'api/engine.md'],
150
168
  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 ' +
151
169
  'results, only slower. Fix the worker file or its imports; a lane whose tasks really take longer passes a bigger lane({ timeout }).' },
152
170
  'input-bound-twice': {
153
171
  docs: ['recipes/58-input.md', 'api/input.md'],
154
- fix: 'Two different owners bound the same action (a module given keys in its options and createEngine({ bindings }) of the game, or two ' +
155
- '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.' },
172
+ 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." },
156
173
  'input-action-context': {
157
174
  docs: ['recipes/58-input.md', 'api/input.md'],
158
175
  fix: 'Two owners declared one action in different input contexts. An action belongs to one context: rename one of them, or declare both in ' +
159
176
  'the same context (then they share the action).' },
177
+ 'input-seat': {
178
+ docs: ['recipes/58-input.md', 'api/input.md'],
179
+ 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.' },
160
180
  'input-unbound': {
161
181
  docs: ['recipes/58-input.md', 'api/input.md'],
162
182
  fix: "An action a module needs is read but no key is bound, so it never fires. Modules bind no keys: bind it with " +
163
183
  "engine.input.bind('action', ['KeyX']), createEngine({ bindings }) or a presets.bindings.* map." },
164
184
  'interaction-no-key': {
165
185
  docs: ['recipes/63-third-person-start.md', 'recipes/58-input.md', 'api/interactions.md'],
166
- fix: 'Interactions were added but their action has no key, so a player can never use them. Bind it in createEngine({ bindings }) or with ' +
167
- 'engine.input.bind; any key works, and bind it to [] if the game really reaches them another way (a click on the prompt).' },
186
+ 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
+ '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
+ 'signal-overwritten': {
189
+ docs: ['recipes/62-picture-code.md'],
190
+ 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.' },
168
191
  'asset-cache': {
169
192
  docs: ['recipes/05-props-bake.md', 'api/assets.md'],
170
193
  fix: 'The dev model cache could not be used, so code-generated models are built from code. Run the game through its vite ' +
@@ -175,8 +198,7 @@ export const ERROR_CODES = {
175
198
  'unless it repeats: then lower quality or texture sizes.' },
176
199
  'module-params': {
177
200
  docs: ['recipes/51-capability-catalog.md'],
178
- fix: 'A module option does not fit the module params schema (unknown key, wrong type, out of range or not one of the allowed values). ' +
179
- 'The message names the option and what it should be; engine.catalog(name).params lists every option with its default.' },
201
+ 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." },
180
202
  'module-dispose': {
181
203
  docs: ['recipes/14-custom-module.md'],
182
204
  fix: 'A module\'s dispose(e) threw; the other modules and core were still cleaned up. Fix that module\'s dispose.' },
@@ -186,15 +208,22 @@ export const ERROR_CODES = {
186
208
  'stage). Give both modules the same stage, or remove the before / after.' },
187
209
  'module-critical': {
188
210
  docs: ['recipes/14-custom-module.md', 'api/engine.md'],
189
- fix: 'A module declared critical: true failed in init(), so start() stopped instead of starting a broken game. The message names the module ' +
190
- 'and the reason: fix its init(), or drop critical if the game can run without it.' },
211
+ 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
+ 'and the reason: fix that init(), or drop critical if the game can run without it.' },
213
+ 'module-contract': {
214
+ docs: ['recipes/14-custom-module.md', 'recipes/49-game-module-contract.md'],
215
+ 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
+ "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." },
191
217
  'module-not-ready': {
192
218
  docs: ['recipes/14-custom-module.md', 'api/engine.md'],
193
219
  fix: 'start() waited longer than engine.loading.timeoutMs for modules whose isReady(e) stays false. Fix what that module waits for, ' +
194
220
  'or raise engine.loading.timeoutMs if the load is only slow. engine.loading.view().waiting names the current item.' },
221
+ 'step-during-load': {
222
+ docs: ['api/engine.md'],
223
+ fix: 'engine.step() ran during a load nobody awaited. Await engine.start(), or the session.newGame / load / quit that is running, then step.' },
195
224
  'step-seconds': {
196
225
  docs: ['api/engine.md'],
197
- fix: 'engine.step(seconds) takes a finite number >= 0 in game seconds: 0 advances nothing, 0.5 is half a second, 1 / 60 is one fixed step.' },
226
+ 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.' },
198
227
  'player-control': {
199
228
  docs: ['recipes/01-new-game.md', 'api/characters.md'],
200
229
  fix: "createPlayer() has no default feel: give control. Usually createPlayer({ ...presets.player.thirdPerson, spawn }); else control: 'camera' | " +
@@ -202,8 +231,8 @@ export const ERROR_CODES = {
202
231
  "takes control: engine.control.take(player, { owner, layer: 'script', step })." },
203
232
  'control-conflict': {
204
233
  docs: ['recipes/57-control.md'],
205
- fix: "Two owners want the same character on the same control layer, so nothing says which one steers (dev builds throw; release builds let " +
206
- "the later one take it). End the old one first (its handle.remove()), or take another layer: base < script < cutscene (higher pauses lower)." },
234
+ 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
+ "End the old one first (its handle.remove()), or take another layer: base < script < cutscene (higher pauses lower)." },
207
236
  'control-net': {
208
237
  docs: ['recipes/57-control.md', 'recipes/27-net.md'],
209
238
  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 " +
@@ -214,8 +243,7 @@ export const ERROR_CODES = {
214
243
  "const h = engine.control.take(ch, { owner, layer: 'script', step }) (or h.move(x, z, run, dt)), then h.remove() to hand it back." },
215
244
  'control-layer': {
216
245
  docs: ['recipes/57-control.md'],
217
- fix: "engine.control.take(character, { owner, layer?, step? }): a character (or its id), a non-empty owner name, layer 'base' | 'script' | " +
218
- "'cutscene' (net is the network's), step a function (dt, ch) => ({ x, z, run }) or left out." },
246
+ 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." },
219
247
  'interaction-setup': {
220
248
  docs: ['recipes/02-npc.md', 'api/interactions.md'],
221
249
  fix: 'interactions() has no default pick: use interactions({ ...presets.interactions.nearest }) or interactions({ pick }); the game binds ' +
@@ -228,11 +256,10 @@ export const ERROR_CODES = {
228
256
  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.' },
229
257
  'engine-terms': {
230
258
  docs: ['recipes/52-around-the-picture.md'],
231
- fix: 'engine.terms 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.' },
259
+ 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.' },
232
260
  'engine-two-copies': {
233
261
  docs: ['THREE.md'],
234
- fix: "vite.config.js: resolve: { dedupe: ['threedog', 'three'] }. Two copies of threedog are loaded (the message names both paths); " +
235
- 'each hooks THREE.Mesh.prototype for shadows, so keep one: `npm ls threedog`, and packs / tools list threedog as a peerDependency.' },
262
+ 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." },
236
263
  'debug-override': {
237
264
  docs: ['recipes/40-scene.md'],
238
265
  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, " +
@@ -240,7 +267,7 @@ export const ERROR_CODES = {
240
267
  'plugin-shape': {
241
268
  docs: ['THREE.md', 'recipes/40-scene.md'],
242
269
  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 }, ' +
243
- 'a Material, a ShaderPatch { slot, glsl }, a module { name, type, install }, or an array of these (default export, else every named export). ' +
270
+ 'a module { name, type, install }, or an array of these (default export, else every named export). ' +
244
271
  '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.' },
245
272
  'thing-id': {
246
273
  docs: ['recipes/40-scene.md'],
@@ -261,30 +288,28 @@ export const ERROR_CODES = {
261
288
  'engine-misuse': {
262
289
  docs: ['api/engine.md'],
263
290
  fix: 'An engine call got an argument it cannot use; the message names the call and the accepted forms.' },
291
+ 'pixel-conflict': {
292
+ docs: ['recipes/62-picture-code.md', 'api/engine.md'],
293
+ 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).' },
264
294
  'many-lights': {
265
295
  docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
266
- fix: 'More than 8 real-time lights are in the scene. Use engine.use(lightPool({ point: 8 })) and register torches / lamps with ' +
267
- 'engine.lightPool.add(...) so a fixed small set of real lights follows the nearest sources.' },
296
+ 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." },
268
297
  'light-recompile': {
269
298
  docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
270
299
  fix: 'The number of lights changed during play, so three.js compiled new shader programs (a long frame). Keep the light ' +
271
300
  'count fixed: engine.use(lightPool({ point: 8 })) before engine.start() and register torches / lamps with ' +
272
301
  'engine.lightPool.add(...), or create your own lights before start and fade them with intensity instead of adding, ' +
273
302
  'removing or hiding them.' },
274
- // ---- W4 (one failure shape): every engine throw carries a code. One code per kind of misuse per module; the message names the exact
275
- // call and the accepted values, the fix says where to look and what to change. Hint-table classes that matched engine messages moved here too
276
- // (the engine tags its own errors now; errorHints.js keeps patterns only for three.js / browser messages).
277
303
  'preset-option': {
278
304
  docs: ['api/openWorld.md', 'api/engine.md'],
279
305
  fix: 'An openWorld() / preset option has a wrong value or a part name it does not know. The message lists the accepted values; ' +
280
306
  'use one of them, or leave the key out for the default.' },
281
307
  'asset-misuse': {
282
308
  docs: ['api/assets.md', 'recipes/05-props-bake.md'],
283
- fix: 'An engine.assets call got a model it does not know or an object that is not an assets.model() copy. Register the model ' +
284
- '(manifest or assets.define) and pass its name, or the object assets.model() returned.' },
309
+ fix: "An engine.assets call got a model it does not know, an object that is not an assets.model() copy, or setParams on a model with no params schema. Register the model (engine.assets.manifest) and pass its name, or the object assets.model() returned." },
285
310
  'batching-option': {
286
311
  docs: ['recipes/15-perf.md'],
287
- fix: 'engine.batch / batching got an option it does not have. Use the options named in the message.' },
312
+ fix: "createEngine({ batching }) takes false or an object with the keys named in the message." },
288
313
  'debug-view': {
289
314
  docs: ['recipes/16-dev-bridge.md', 'api/engine.md'],
290
315
  fix: 'engine.debug.defineView(name, { what, apply }): the name must be new (not a built-in view mode) and apply(scene) returns ' +
@@ -320,31 +345,26 @@ export const ERROR_CODES = {
320
345
  docs: ['api/input.md'],
321
346
  fix: 'input.push(name, { owner }) needs a non-empty owner string (who pushed the context), so pop / describe can tell owners apart.' },
322
347
  'owned-misuse': {
323
- docs: ['recipes/52-around-the-picture.md', 'recipes/54-three-idioms.md'],
324
- fix: 'defineOwned / engine.view.manual(key) was called wrongly: a module definition misses id / part / read / levels.manual, or ' +
348
+ docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
349
+ fix: 'defineOwned / engine.autoView.manual(key) was called wrongly: a module definition misses id / part / read / levels.manual, or ' +
325
350
  'manual() named a key the part does not write. Use a key listed in the message.' },
326
351
  'shadow-cascades': {
327
352
  docs: ['recipes/45-cascaded-shadows.md'],
328
353
  fix: 'engine.shadows (cascades, box, budget, include, enabled) was called wrongly: the message names what to change. ' +
329
354
  'An engine draws one set of cascades, and a light takes a box or cascades, not both.' },
330
- 'shadow-type': {
331
- docs: ['recipes/45-cascaded-shadows.md'],
332
- fix: 'Unknown shadow type: use one of the names listed in the message.' },
333
355
  'wrap-misuse': {
334
356
  docs: ['recipes/55-mods-time-wrap.md'],
335
- fix: 'engine.wrap(target, method, fn): target must be an object, fn a function, and method a public method that exists on it ' +
336
- '(the message lists them). Wrap a public method, not a private _one.' },
357
+ 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." },
337
358
  'ambience-rule': {
338
359
  docs: ['api/ambience.md', 'api/audio.md'],
339
360
  fix: 'An ambience rule names no sound: give sound: a name registered in audio.sounds.' },
340
361
  'camera-option': {
341
362
  docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
342
- fix: 'A camera option is wrong: projection is \'perspective\' or \'orthographic\' (orthographic needs size > 0 and engine.camera), ' +
363
+ 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, ' +
343
364
  'ground / shots use the values the message lists.' },
344
365
  'character-option': {
345
- docs: ['api/characters.md', 'recipes/13-animation.md'],
346
- fix: 'A character / NPC option or model name is wrong. The message names the option and the accepted forms; an unknown model lists ' +
347
- 'the registered ones.' },
366
+ docs: ['api/characters.md', 'recipes/13-animation.md', 'recipes/02-npc.md'],
367
+ fix: "A character / NPC option or model name is wrong: the message names the option and the accepted forms, and an unknown model lists the registered ones. An NPC's interact is { op: 'name', args?, ... } or null; characters.support(object, { carry, id }) takes an Object3D with meshes, a listed carry mode and a unique id." },
348
368
  'collision-misuse': {
349
369
  docs: ['api/collision.md'],
350
370
  fix: 'A collision call got a wrong argument, e.g. collision.addBlocked needs fn(x, z) => boolean.' },
@@ -366,11 +386,10 @@ export const ERROR_CODES = {
366
386
  'field, a module it needs not installed). The message names the template and the field to fix.' },
367
387
  'inventory-misuse': {
368
388
  docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
369
- fix: 'An inventory call or option got a wrong value (an item id with #, pauseGame not boolean, a pickup radius not > 0). Use the ' +
370
- 'form in the message.' },
389
+ fix: "inventory.define(id): an item id may not contain '#', which marks entry keys (sword#3). Pick an id without it." },
371
390
  'grids-misuse': {
372
391
  docs: ['recipes/29-grid.md', 'api/grids.md'],
373
- fix: 'grids(): a grid or item name is unknown or defined twice. Define it once with grids.define / grids.item, and use a listed name.' },
392
+ 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." },
374
393
  'level-node': {
375
394
  docs: ['recipes/10-blender-level.md', 'api/level.md'],
376
395
  fix: 'A level node points at content that is not defined, clashes with another record, or is used before the level loaded. Define ' +
@@ -386,7 +405,10 @@ export const ERROR_CODES = {
386
405
  fix: 'net() needs role \'host\' or \'client\' and a transport; reconnect() is for clients only.' },
387
406
  'rigid-misuse': {
388
407
  docs: ['recipes/11-vehicles.md', 'api/rigid.md'],
389
- fix: 'Two cases, the message says which: an id already used by another body or vehicle (give each its own id), or joints lost when newGame / a load rebuilt the physics world (re-create them in a rigid:rebuilt listener, recipe 11 section 3 "Joints").' },
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)." },
409
+ 'settings-row': {
410
+ 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).' },
390
412
  'settings-tab': {
391
413
  docs: ['api/settings.md'],
392
414
  fix: 'settings({ tabs }) names a built-in tab that does not exist. Use a listed built-in name, or define your own section.' },
@@ -398,19 +420,19 @@ export const ERROR_CODES = {
398
420
  fix: 'A calendar option, season name or scenario season is wrong (day length not > 0, a season list entry without name / days, a season the ' +
399
421
  'calendar does not have). Day, time, seasons and hours per day are calendar({...}) options; sky({ time }) is only the fixed time drawn without a calendar.' },
400
422
  'sky-option': {
401
- docs: ['recipes/08-weather-sky.md', 'recipes/36-sky-ground-plants.md', 'api/sky.md'],
402
- fix: 'A sky / fog / clouds / shadow option has a wrong value or is not an option (day length, days and seasons are calendar() options). Own GLSL goes through ' +
423
+ docs: ['recipes/08-weather-sky.md', 'api/sky.md'],
424
+ fix: 'A sky or clouds option has a wrong value (day length, days and seasons are calendar() options). Own GLSL goes through ' +
403
425
  'engine.sky.clouds() and engine.sky.layer(), not an option key. The message lists the accepted values.' },
404
426
  'terrain-chunk-failed': {
405
427
  docs: ['recipes/28-terrain.md', 'api/terrain.md'],
406
428
  fix: 'A terrain chunk failed on every try and stays empty (no ground, no collision there). Usually the height / groundType / placement rule ' +
407
429
  'throws at that spot: fix what it reads, then engine.terrain.retry() sends the failed chunks again (terrain:chunkFailed names each one).' },
408
430
  'terrain-option': {
409
- docs: ['recipes/28-terrain.md', 'recipes/42-terrain-shape.md', 'api/terrain.md'],
431
+ docs: ['recipes/28-terrain.md', 'api/terrain.md'],
410
432
  fix: 'A terrain option or terrain edit is wrong (shape mask missing, a brush number not a number, an unknown paint). Use the form ' +
411
433
  'in the message.' },
412
434
  'vegetation-option': {
413
- docs: ['api/vegetation.md', 'recipes/36-sky-ground-plants.md'],
435
+ docs: ['api/vegetation.md', 'recipes/36-ground-plants.md'],
414
436
  fix: 'A vegetation option is wrong: positions entries, densityMap form, fade range or a model with several materials. Fix the ' +
415
437
  'entry the message points at.' },
416
438
  'water-option': {
@@ -418,7 +440,7 @@ export const ERROR_CODES = {
418
440
  fix: 'A water option is wrong; own GLSL goes through engine.water.shader({ wave, surface }) and must define the function the message names.' },
419
441
  'weather-option': {
420
442
  docs: ['api/weather.md', 'recipes/44-water-weather-hooks.md'],
421
- fix: 'A weather type, field, pool or particle definition is wrong. The message lists the defined types and the accepted forms.' },
443
+ fix: "A weather type, field, pool, particle definition or weather.set argument is wrong. The message lists the defined types and the accepted forms." },
422
444
  'world-option': {
423
445
  docs: ['recipes/18-world.md', 'api/world.md'],
424
446
  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,13 +469,8 @@ export const ERROR_CODES = {
447
469
  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). ' +
448
470
  'The message lists the defined parts and the accepted forms.' },
449
471
  'module-needs': {
450
- docs: ['recipes/14-custom-module.md', 'api/engine.md'],
451
- fix: 'A call needs a module that is not installed or not ready yet (e.g. pickups need interactions(), timeline say needs dialogue(), ' +
452
- 'rigid bodies need engine.start() first). Install the module named in the message, or call after engine:ready.' },
453
- 'load-failed': {
454
- docs: ['api/assets.md', 'recipes/05-props-bake.md'],
455
- fix: 'A file the engine loads on the side (a particle texture, a generated vegetation model, an ambience sound, a level) failed; ' +
456
- 'the engine fell back (round dot, no model, silence). Check the path named in the message.' },
472
+ docs: ['recipes/14-custom-module.md', 'recipes/18-world.md', 'api/engine.md'],
473
+ fix: "A call needs a module that is not installed or not ready yet (the data of NPCs, props and pickups lives in world(), pickups need interactions(), timeline say needs dialogue(), rigid bodies need engine.start() first). Install the module named in the message before the one that needs it (openWorld() already includes world()), or call after engine:ready." },
457
474
  'tween-property': {
458
475
  docs: ['api/timeline.md'],
459
476
  fix: 'A tween names a property path that does not exist or is not a number / color / vector. Check the path (a.b.c) against the object.' },
@@ -465,13 +482,19 @@ export const ERROR_CODES = {
465
482
  docs: ['recipes/12-navmesh.md', 'api/nav.md'],
466
483
  fix: 'The navmesh could not be built from this geometry; paths fall back. The message has the builder\'s reason (usually too few ' +
467
484
  'walkable triangles or wrong cell sizes).' },
485
+ 'nav-link': {
486
+ docs: ['recipes/12-navmesh.md', 'api/nav.md'],
487
+ 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
+ '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
+ 'nav-height': {
490
+ docs: ['recipes/12-navmesh.md', 'api/nav.md'],
491
+ 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.' },
468
492
  'grid-overlap': {
469
493
  docs: ['recipes/29-grid.md', 'api/grids.md'],
470
494
  fix: 'Two grid items claim the same cell; the second is skipped. Move one, or remove the other first.' },
471
495
  'grid-orphan': {
472
496
  docs: ['recipes/29-grid.md', 'api/grids.md'],
473
497
  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.' },
474
- // ---- classes that were patterns in errorHints.js: the engine raises these messages itself, now tagged with the code ----
475
498
  'module-requires': {
476
499
  docs: ['recipes/14-custom-module.md', 'api/engine.md'],
477
500
  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)." },
@@ -480,16 +503,16 @@ export const ERROR_CODES = {
480
503
  fix: "provides is a list of exclusive slot names (provides: ['inventory']); a slot name must not be a shared value's name." },
481
504
  'module-replaces': {
482
505
  docs: ['recipes/14-custom-module.md'],
483
- 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)." },
506
+ 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." },
484
507
  'module-cycle': {
485
508
  docs: ['recipes/14-custom-module.md'],
486
509
  fix: 'before / after constraints of two or more modules point at each other. Remove one of them or give a module a different stage.' },
487
510
  'module-type': {
488
511
  docs: ['recipes/14-custom-module.md'],
489
- fix: "Every module says what it may own: add type: 'rules' (game logic; the usual one for a game module), or 'world' | 'picture' | 'actor' | 'ui' | 'net' | 'tool' (core/moduleTypes.js)." },
512
+ 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?" },
490
513
  'module-type-rule': {
491
514
  docs: ['recipes/14-custom-module.md'],
492
- fix: 'A module did something its type does not 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.' },
515
+ 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.' },
493
516
  'module-stage': {
494
517
  docs: ['recipes/14-custom-module.md'],
495
518
  fix: 'Modules sort by stage (+ before / after), not by number. Use one of the listed stage names.' },
@@ -497,59 +520,36 @@ export const ERROR_CODES = {
497
520
  docs: ['recipes/14-custom-module.md'],
498
521
  fix: 'The module name becomes engine.<name>; it must not be an existing engine property or another module name.' },
499
522
  'module-handle': {
500
- docs: ['recipes/14-custom-module.md'],
501
- fix: 'ctx.track(handle) (the ctx install / init receive) takes something with remove(), such as the result of events.on / onFixed / clock.after. ' +
502
- '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.' },
523
+ docs: ['recipes/14-custom-module.md', 'api/engine.md'],
524
+ 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." },
503
525
  'module-called': {
504
526
  docs: ['recipes/01-new-game.md', 'api/engine.md'],
505
527
  fix: 'engine.use() takes the module object: write engine.use(sky()), not engine.use(sky).' },
506
528
  'describe-name': {
507
529
  docs: ['recipes/16-dev-bridge.md', 'api/engine.md'],
508
530
  fix: 'describe.add names share one namespace with the standard fields and module names. Pick a unique name.' },
509
- // (registered after the fact: these were raised before they had an entry, so err.fix was null; tests/errorCodeScan.mjs now fails on that)
510
- 'options-object': {
511
- docs: ['CONVENTIONS.md', 'api/engine.md'],
512
- fix: 'A position is one argument: a Vector3, [x, y, z] or { x, z } (a horizontal position needs finite x and z). The old (x, z) ' +
513
- 'number form and a 2-element [x, z] array do not work; pass { x, z }.' },
514
531
  'input-keys': {
515
532
  docs: ['recipes/01-new-game.md', 'api/input.md'],
516
- fix: 'The engine binds no gameplay key on its own and modules take no keys option: bind the action the module declares, ' +
517
- "createEngine({ bindings: { ...presets.bindings.<name> } }) or engine.input.bind('<action>', ['KeyX']); [] = deliberately no key." },
518
- 'bad-arg': {
519
- docs: ['api/characters.md', 'recipes/32-action-game.md'],
520
- fix: 'characters.support(object, opts): object is a three.js Object3D with meshes to stand on, carry is one of the listed modes and ' +
521
- 'each support id is unique. Fix the argument the message names.' },
522
- 'npc-option': {
523
- docs: ['recipes/02-npc.md', 'api/characters.md'],
524
- fix: "An NPC's interact option is { op: 'name', args?, ... } (an op the player runs on it) or null for none. Fix the value the " +
525
- 'message shows.' },
533
+ fix: "Keys are names like 'KeyE', 'Space', 'PadA', 'Mouse0'. The engine binds no gameplay key on its own and modules take no keys option: bind the action the module declares, createEngine({ bindings: { ...presets.bindings.<name> } }) or engine.input.bind('<action>', ['KeyX']); [] = deliberately no key." },
526
534
  'interaction-option': {
527
535
  docs: ['api/interactions.md', 'recipes/03-items-pickups.md'],
528
- fix: 'interactions.add(): hold is seconds the key stays down (a number >= 0), radius is meters > 0 (Infinity = from ' +
529
- 'anywhere), and a once item needs its own stable id or mesh.name. Fix the option the message names.' },
536
+ fix: "interactions.add(): hold is seconds the key stays down (a number >= 0), radius is meters > 0 (Infinity = from anywhere), counter is a HUD counter name, and a once item needs its own stable id or mesh.name. Fix the option the message names." },
530
537
  'hud-option': {
531
538
  docs: ['api/hud.md', 'recipes/26-ui-parts.md'],
532
- fix: 'A hud element option is wrong: anchor is one of the listed corners / edges, a counter value is a number or text. Fix ' +
533
- 'the option the message names.' },
539
+ 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." },
534
540
  'describe-threw': {
535
541
  docs: ['recipes/14-custom-module.md', 'api/engine.md'],
536
542
  fix: "A module's describe(e, ctx) hook threw; describe() put { error, code } under that module's name and kept the rest. Fix the " +
537
543
  'hook named in the message (it must return plain data or nothing).' },
538
- 'world-missing': {
539
- docs: ['recipes/18-world.md', 'api/world.md'],
540
- fix: 'The feature stores its data in engine.world, but the world() module is not installed or comes after it. engine.use(world(), ...) first; the openWorld() preset already includes it.' },
541
544
  'world-plain': {
542
545
  docs: ['recipes/18-world.md', 'api/world.md'],
543
- fix: 'A 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). Keep the model in world.present(), the logic in world.simulate().' },
544
- 'pickup-prop-id': {
545
- docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
546
- fix: 'A pickup / prop id collides with other data. Use distinct ids; stable ids are what saves match on.' },
546
+ 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
547
  'pickup-misuse': {
548
548
  docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
549
- fix: 'pickups.spawn() got a wrong value: give must be an item id (needs inventory()) or a function (e, { actor }) => result; radius a positive number.' },
549
+ fix: "pickups.spawn() got a wrong value (give is an item id, which needs inventory(), or a function (e, { actor }) => result; radius is a positive number), or engine.pickups.material got something that is not a three.js material." },
550
550
  'world-id': {
551
- docs: ['recipes/18-world.md', 'api/world.md'],
552
- fix: 'Two records share one id. Omit id to auto-number, give each its own id, or use world.set(id, patch) to update an existing record.' },
551
+ docs: ['recipes/18-world.md', 'api/world.md', 'recipes/03-items-pickups.md'],
552
+ fix: "Two things claim one id: every world record (props, pickups, NPCs, template instances) shares one id space. Omit id to auto-number, give each its own id, or use world.set(id, patch) to update the existing record." },
553
553
  'world-record': {
554
554
  docs: ['recipes/18-world.md', 'api/world.md'],
555
555
  fix: 'The id was never added, was removed, or is misspelled. world.query({ kind }) lists what exists.' },
@@ -561,10 +561,10 @@ export const ERROR_CODES = {
561
561
  fix: 'present(kind, { build }) must return a three.js object (or use show: rec => false to hide). Errors inside build also land here.' },
562
562
  'bad-position': {
563
563
  docs: ['CONVENTIONS.md', 'api/world.md'],
564
- fix: 'A position was NaN or the wrong shape: a Vector3 used like an array (v[0]), a missing field, or a division by zero upstream. Use [x, y, z], { x, z } or the Vector3 itself.' },
565
- 'state-at': {
566
- docs: ['recipes/07-flow-scenes-pause.md'],
567
- fix: 'at names a place of content.load({ places }) or a level marker: install content(), or use pos=x,z.' },
564
+ fix: "A position was NaN, out of range or the wrong shape: a Vector3 used like an array (v[0]), a missing field, a division by zero upstream, or the old (x, z) number form. A position is one argument: a Vector3, [x, y, z] or { x, z }; a 2-element [x, z] array does not work." },
565
+ 'state-value': {
566
+ docs: ['recipes/16-dev-bridge.md'],
567
+ fix: 'applyState got a value it cannot use: the message names the key and the accepted forms. Nothing was applied.' },
568
568
  'content-place': {
569
569
  docs: ['recipes/20-content-actions-save.md', 'api/content.md'],
570
570
  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.' },
@@ -582,9 +582,9 @@ export const ERROR_CODES = {
582
582
  fix: 'A name (action, item, asset, weather, text key, ...) was never registered or has a typo. The message lists the registered names.' },
583
583
  'event-typo': {
584
584
  docs: ['api/events.md'],
585
- fix: 'The event name is probably a typo of an engine event (the engine emits no event you did not subscribe to under this name).' },
585
+ 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
586
  'owned-prop': {
587
- docs: ['recipes/52-around-the-picture.md', 'recipes/54-three-idioms.md'],
587
+ docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
588
588
  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
589
  'picture-held': {
590
590
  docs: ['recipes/62-picture-code.md'],
@@ -596,20 +596,21 @@ export const ERROR_CODES = {
596
596
  docs: ['recipes/14-custom-module.md'],
597
597
  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
598
  'picture-conflict': {
599
+ brief: true,
599
600
  docs: ['recipes/62-picture-code.md'],
600
- fix: 'Two places change this picture value inside one frame, so the earlier 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.' },
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.' },
601
602
  'camera-kind': {
602
603
  docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
603
604
  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).' },
604
605
  'camera-none': {
605
606
  docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
606
- fix: 'setCamera() switches between camera kinds once a camera module is installed. Install one first: engine.use(fixedCamera({ position, lookAt })) (or followCamera / firstPersonCamera / rtsCamera); openWorld installs followCamera.' },
607
+ fix: 'setCamera() switches between camera kinds once a camera module is installed. Install one first: engine.use(fixedCamera({ position, lookAt })) (or followCamera / firstPersonCamera / rtsCamera), or name one: openWorld({ camera: \'follow\' }).' },
607
608
  'movement': {
608
609
  docs: ['api/characters.md', 'api/engine.md'],
609
- fix: 'A movement parameter was zero, negative or not a number (a typo in a name gives undefined).' },
610
+ fix: "createEngine({ movement }): every movement value is a number > 0. A typo in a name gives undefined; the message names the key." },
610
611
  'commit-fallback': {
611
612
  docs: ['api/jobs.md'],
612
- fix: 'Async results apply at fixed steps; the fallback is the deterministic main-thread computation used when the result is late.' },
613
+ 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." },
613
614
  'asset-critical': {
614
615
  docs: ['recipes/05-props-bake.md', 'api/assets.md'],
615
616
  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.' },
@@ -619,9 +620,16 @@ export const ERROR_CODES = {
619
620
  'asset-not-loaded': {
620
621
  docs: ['api/assets.md', 'recipes/05-props-bake.md'],
621
622
  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
+ 'asset-lod': {
624
+ docs: ['recipes/15-perf.md', 'api/assets.md'],
625
+ 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
+ },
627
+ 'asset-fallback-cycle': {
628
+ docs: ['api/assets.md'],
629
+ fix: 'Entries name each other as fallback (A falls back to B, B back to A), so a failed load would wait on itself forever. The line lists the chain. Give one of them no fallback, or point it at a file that loads.' },
622
630
  'asset-load': {
623
631
  docs: ['api/assets.md', 'recipes/05-props-bake.md'],
624
- fix: 'The file was not found (404) or is not valid. Check the path (files under public/ are served from /), the extension, and the case of the name. A registered file that is not critical now shows its fallback; engine.loading.get(name) has the details.' },
632
+ fix: "Read the reason in the message first. \"called before the backend is initialized\" means the load ran before engine.start() finished: await engine.start() first, or register the file in a manifest. Otherwise the file was not found (404) or is not valid. Check the path (files under public/ are served from /), the extension, and the case of the name. A file that is not critical falls back (a registered fallback, a stand-in texture, silence) and the game runs on; engine.loading.get(name) has the details." },
625
633
  'audio-unsupported': {
626
634
  docs: ['api/audio.md'],
627
635
  fix: 'No AudioContext in this browser / test environment. Guard calls with typeof AudioContext, or skip audio in headless tests.' },
@@ -639,12 +647,30 @@ export const ERROR_CODES = {
639
647
  fix: 'engine.dispose() takes nothing or { keepContext: true }.' },
640
648
  'tsl-misuse': {
641
649
  docs: ['recipes/43-shader-patches-surfaces.md'],
642
- fix: 'A threedog/tsl function cannot work here (the message says why): draw it with the engine renderer, on a Mesh or InstancedMesh.' },
650
+ 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." },
643
651
  'webgpu-needs-tsl': {
644
652
  docs: ['recipes/56-webgpu-tsl.md'],
645
653
  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), " +
646
654
  '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: ' +
647
655
  'create(engine) returning your own node-material object). The message names the part.' },
656
+ 'swarm-full': {
657
+ docs: ['recipes/65-swarm.md'],
658
+ 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
+ 'swarm-handle': {
660
+ docs: ['recipes/65-swarm.md'],
661
+ 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
+ 'swarm-step': {
663
+ docs: ['recipes/65-swarm.md'],
664
+ fix: "swarm.onStep(fn) sets the one function that runs every fixed step: pass a function, once at setup, not from onFixed. Do several jobs in one function, or h.remove() the old one first." },
665
+ 'swarm-field': {
666
+ docs: ['recipes/65-swarm.md'],
667
+ 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
+ 'swarm-name': {
669
+ docs: ['recipes/65-swarm.md'],
670
+ fix: 'Swarm names are unique: they are the keys in describe() and in saves. Pick another name, or dispose() the old swarm first.' },
671
+ 'swarm-disposed': {
672
+ docs: ['recipes/65-swarm.md'],
673
+ fix: 'This swarm was disposed. Make a new one with engine.swarm(options), or keep it and call clear() to empty it.' },
648
674
  'module-disabled': {
649
675
  docs: ['recipes/14-custom-module.md'],
650
676
  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.' },