threedog 0.7.0 → 0.8.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 (544) hide show
  1. package/CHANGELOG.md +196 -1
  2. package/README.md +6 -9
  3. package/core/{Animator.js → assets/Animator.js} +28 -18
  4. package/core/{Assets.js → assets/Assets.js} +98 -54
  5. package/core/{Baked.js → assets/Baked.js} +4 -4
  6. package/core/assets/assetEntry.js +237 -0
  7. package/core/{assetHot.js → assets/assetHot.js} +7 -6
  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} +6 -12
  12. package/core/{namedModel.js → assets/namedModel.js} +17 -13
  13. package/core/{Audio.js → audio/Audio.js} +26 -23
  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} +10 -10
  18. package/core/{Random.js → base/Random.js} +5 -4
  19. package/core/{easing.js → base/easing.js} +1 -1
  20. package/core/{errorCodes.js → base/errorCodes.js} +98 -110
  21. package/core/{errorHints.js → base/errorHints.js} +5 -9
  22. package/core/{errors.js → base/errors.js} +6 -6
  23. package/core/{events.generated.js → base/events.generated.js} +1 -0
  24. package/core/{math.js → base/math.js} +15 -4
  25. package/core/{params.js → base/params.js} +3 -4
  26. package/core/base/util.js +32 -0
  27. package/core/{validate.js → base/validate.js} +28 -7
  28. package/core/{Engine.js → engine/Engine.js} +80 -77
  29. package/core/{Loading.js → engine/Loading.js} +4 -2
  30. package/core/{copies.js → engine/copies.js} +4 -4
  31. package/core/{headlessLoad.js → engine/headlessLoad.js} +4 -4
  32. package/core/{lifecycle.js → engine/lifecycle.js} +14 -12
  33. package/core/{loop.js → engine/loop.js} +68 -47
  34. package/core/{moduleSlots.js → engine/moduleSlots.js} +6 -6
  35. package/core/{moduleTypes.js → engine/moduleTypes.js} +13 -14
  36. package/core/{modules.js → engine/modules.js} +14 -11
  37. package/core/{page.js → engine/page.js} +36 -23
  38. package/core/{plugins.js → engine/plugins.js} +6 -9
  39. package/core/{services.js → engine/services.js} +47 -40
  40. package/core/{startup.js → engine/startup.js} +26 -24
  41. package/core/{Input.js → input/Input.js} +30 -22
  42. package/core/{inputContext.js → input/inputContext.js} +14 -5
  43. package/core/{inputPad.js → input/inputPad.js} +1 -1
  44. package/core/{inputPointer.js → input/inputPointer.js} +8 -2
  45. package/core/{inputTouch.js → input/inputTouch.js} +1 -1
  46. package/core/{Budget.js → inspect/Budget.js} +21 -20
  47. package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +30 -16
  48. package/core/{Describe.js → inspect/Describe.js} +26 -22
  49. package/core/{Inspect.js → inspect/Inspect.js} +9 -7
  50. package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +7 -8
  51. package/core/{InspectPerf.js → inspect/InspectPerf.js} +19 -13
  52. package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
  53. package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +3 -2
  54. package/core/{UrlState.js → inspect/UrlState.js} +52 -20
  55. package/core/{catalog.js → inspect/catalog.js} +3 -3
  56. package/core/{checks.js → inspect/checks.js} +7 -5
  57. package/core/{debugView.js → inspect/debugView.js} +4 -4
  58. package/core/{describeRender.js → inspect/describeRender.js} +21 -20
  59. package/core/{describeText.js → inspect/describeText.js} +11 -6
  60. package/core/inspect/geometryWatch.js +38 -0
  61. package/core/{lightWatch.js → inspect/lightWatch.js} +8 -8
  62. package/core/{pictureWriters.js → inspect/pictureWriters.js} +15 -16
  63. package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
  64. package/core/{Ops.js → ops/Ops.js} +16 -11
  65. package/core/{control.js → ops/control.js} +13 -12
  66. package/core/ops/holds.js +139 -0
  67. package/core/{opsAtomic.js → ops/opsAtomic.js} +2 -1
  68. package/core/{opsCheck.js → ops/opsCheck.js} +4 -5
  69. package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
  70. package/core/{opsRun.js → ops/opsRun.js} +7 -4
  71. package/core/{owned.js → ops/owned.js} +14 -17
  72. package/core/{sharedPoint.js → ops/sharedPoint.js} +8 -8
  73. package/core/{stackFrames.js → ops/stackFrames.js} +2 -2
  74. package/core/{stacks.js → ops/stacks.js} +12 -14
  75. package/core/{wrap.js → ops/wrap.js} +8 -6
  76. package/core/{SaveStore.js → saves/SaveStore.js} +1 -1
  77. package/core/{Saves.js → saves/Saves.js} +58 -36
  78. package/core/{saveApply.js → saves/saveApply.js} +13 -9
  79. package/core/{saveFiles.js → saves/saveFiles.js} +17 -15
  80. package/core/{saveValues.js → saves/saveValues.js} +20 -3
  81. package/core/{saveVersions.js → saves/saveVersions.js} +4 -17
  82. package/core/{session.js → saves/session.js} +31 -17
  83. package/core/{Rays.js → scene/Rays.js} +23 -25
  84. package/core/{Views.js → scene/Views.js} +14 -6
  85. package/core/{adaptive.js → scene/adaptive.js} +15 -8
  86. package/core/{canvasBox.js → scene/canvasBox.js} +2 -3
  87. package/core/{engineCamera.js → scene/engineCamera.js} +1 -1
  88. package/core/{gameLights.js → scene/gameLights.js} +17 -7
  89. package/core/{grayMap.js → scene/grayMap.js} +8 -2
  90. package/core/{grid.js → scene/grid.js} +4 -4
  91. package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
  92. package/core/{ground.js → scene/ground.js} +9 -9
  93. package/core/{movement.js → scene/movement.js} +3 -3
  94. package/core/{pictureSlots.js → scene/pictureSlots.js} +2 -2
  95. package/core/{sceneDelta.js → scene/sceneDelta.js} +2 -2
  96. package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -13
  97. package/core/scene/stepPoses.js +55 -0
  98. package/core/{targeting.js → scene/targeting.js} +4 -5
  99. package/core/{thingExplain.js → scene/thingExplain.js} +6 -5
  100. package/core/{thingOps.js → scene/thingOps.js} +4 -3
  101. package/core/{things.js → scene/things.js} +18 -5
  102. package/core/{threePatches.js → scene/threePatches.js} +1 -1
  103. package/core/{view.js → scene/view.js} +17 -16
  104. package/core/{Batching.js → stream/Batching.js} +85 -27
  105. package/core/{Stream.js → stream/Stream.js} +60 -30
  106. package/core/{batchGroups.js → stream/batchGroups.js} +10 -9
  107. package/core/{chunkStream.js → stream/chunkStream.js} +40 -0
  108. package/core/{scatter.js → stream/scatter.js} +2 -2
  109. package/core/{streamSources.js → stream/streamSources.js} +12 -7
  110. package/core/{Commits.js → threads/Commits.js} +6 -5
  111. package/core/{Jobs.js → threads/Jobs.js} +12 -10
  112. package/core/{Threads.js → threads/Threads.js} +16 -16
  113. package/core/{threadPure.js → threads/threadPure.js} +7 -5
  114. package/core/{threadServe.js → threads/threadServe.js} +3 -3
  115. package/core/{Clock.js → time/Clock.js} +17 -10
  116. package/core/{dayTime.js → time/dayTime.js} +5 -1
  117. package/core/{skip.js → time/skip.js} +18 -17
  118. package/core/{time.js → time/time.js} +18 -12
  119. package/core/{uiClock.js → time/uiClock.js} +4 -4
  120. package/docs/AI.md +22 -19
  121. package/docs/API.md +24 -23
  122. package/docs/CODEMAP.md +76 -183
  123. package/docs/COMMANDS.md +66 -58
  124. package/docs/CONVENTIONS.md +54 -14
  125. package/docs/MIGRATING-0.8.md +169 -0
  126. package/docs/THREE.md +78 -29
  127. package/docs/api/assets.md +12 -13
  128. package/docs/api/audio.md +6 -5
  129. package/docs/api/budget.md +4 -4
  130. package/docs/api/calendar.md +10 -11
  131. package/docs/api/cameraRig.md +29 -29
  132. package/docs/api/characters.md +23 -18
  133. package/docs/api/clock.md +1 -1
  134. package/docs/api/collision.md +12 -9
  135. package/docs/api/content.md +6 -6
  136. package/docs/api/dialogue.md +3 -3
  137. package/docs/api/engine.md +45 -43
  138. package/docs/api/events.md +3 -2
  139. package/docs/api/flow.md +1 -1
  140. package/docs/api/grids.md +1 -1
  141. package/docs/api/ground.md +4 -5
  142. package/docs/api/hud.md +2 -2
  143. package/docs/api/i18n.md +6 -6
  144. package/docs/api/input.md +7 -7
  145. package/docs/api/interactions.md +4 -4
  146. package/docs/api/inventory.md +9 -9
  147. package/docs/api/jobs.md +5 -5
  148. package/docs/api/level.md +7 -7
  149. package/docs/api/lightPool.md +1 -6
  150. package/docs/api/music.md +3 -3
  151. package/docs/api/nav.md +10 -10
  152. package/docs/api/openWorld.md +1 -1
  153. package/docs/api/particles.md +2 -2
  154. package/docs/api/photo.md +4 -2
  155. package/docs/api/pickups.md +2 -2
  156. package/docs/api/post.md +20 -3
  157. package/docs/api/quests.md +3 -3
  158. package/docs/api/rays.md +5 -7
  159. package/docs/api/rigid.md +27 -18
  160. package/docs/api/saves.md +8 -7
  161. package/docs/api/settings.md +9 -8
  162. package/docs/api/sky.md +8 -7
  163. package/docs/api/stream.md +7 -7
  164. package/docs/api/swarm.md +34 -0
  165. package/docs/api/terrain.md +7 -8
  166. package/docs/api/terrainDraw.md +1 -1
  167. package/docs/api/timeline.md +2 -2
  168. package/docs/api/tools.md +25 -22
  169. package/docs/api/vars.md +1 -1
  170. package/docs/api/vegetation.md +4 -3
  171. package/docs/api/vegetationDraw.md +1 -1
  172. package/docs/api/water.md +1 -1
  173. package/docs/api/weather.md +9 -9
  174. package/docs/api/weatherDraw.md +3 -3
  175. package/docs/api/world.md +5 -5
  176. package/docs/recipes/01-new-game.md +25 -40
  177. package/docs/recipes/02-npc.md +19 -20
  178. package/docs/recipes/03-items-pickups.md +27 -43
  179. package/docs/recipes/04-quests.md +3 -4
  180. package/docs/recipes/05-props-bake.md +29 -39
  181. package/docs/recipes/06-clock-events.md +27 -18
  182. package/docs/recipes/07-flow-scenes-pause.md +12 -17
  183. package/docs/recipes/08-weather-sky.md +88 -34
  184. package/docs/recipes/09-materials-lights-models.md +22 -36
  185. package/docs/recipes/10-blender-level.md +6 -7
  186. package/docs/recipes/11-vehicles.md +30 -22
  187. package/docs/recipes/12-navmesh.md +9 -8
  188. package/docs/recipes/13-animation.md +39 -17
  189. package/docs/recipes/14-custom-module.md +14 -13
  190. package/docs/recipes/15-perf.md +49 -26
  191. package/docs/recipes/16-dev-bridge.md +32 -52
  192. package/docs/recipes/18-world.md +36 -23
  193. package/docs/recipes/19-shooting-picking.md +4 -2
  194. package/docs/recipes/20-content-actions-save.md +30 -35
  195. package/docs/recipes/21-camera.md +33 -5
  196. package/docs/recipes/22-shop-gold.md +0 -4
  197. package/docs/recipes/23-ops.md +10 -10
  198. package/docs/recipes/26-ui-parts.md +22 -12
  199. package/docs/recipes/27-net.md +0 -2
  200. package/docs/recipes/28-terrain.md +117 -21
  201. package/docs/recipes/29-grid.md +2 -2
  202. package/docs/recipes/30-templates.md +55 -19
  203. package/docs/recipes/31-audio.md +5 -5
  204. package/docs/recipes/32-action-game.md +15 -6
  205. package/docs/recipes/33-stream-sources.md +2 -2
  206. package/docs/recipes/34-environment-lighting.md +67 -19
  207. package/docs/recipes/35-picture-from-reference.md +10 -17
  208. package/docs/recipes/36-ground-plants.md +105 -0
  209. package/docs/recipes/40-scene.md +7 -11
  210. package/docs/recipes/43-shader-patches-surfaces.md +20 -41
  211. package/docs/recipes/44-water-weather-hooks.md +48 -43
  212. package/docs/recipes/45-cascaded-shadows.md +39 -17
  213. package/docs/recipes/46-blender-art-route.md +7 -8
  214. package/docs/recipes/49-game-module-contract.md +5 -5
  215. package/docs/recipes/50-own-renderer.md +2 -2
  216. package/docs/recipes/52-around-the-picture.md +54 -98
  217. package/docs/recipes/53-ground-up-close.md +61 -24
  218. package/docs/recipes/55-mods-time-wrap.md +12 -16
  219. package/docs/recipes/56-webgpu-tsl.md +16 -14
  220. package/docs/recipes/57-control.md +9 -2
  221. package/docs/recipes/58-input.md +2 -2
  222. package/docs/recipes/59-depth-post-effects.md +1 -1
  223. package/docs/recipes/60-judge-the-picture.md +29 -24
  224. package/docs/recipes/62-picture-code.md +49 -17
  225. package/docs/recipes/63-third-person-start.md +17 -4
  226. package/docs/recipes/64-particles.md +1 -1
  227. package/docs/recipes/65-swarm.md +140 -0
  228. package/examples/action/.threedog/content-index.json +1 -1
  229. package/examples/action/GAMEMAP.md +2 -2
  230. package/examples/{sheepisland → perf-island}/.threedog/content-index.json +1 -1
  231. package/examples/{sheepisland → perf-island}/GAMEMAP.md +12 -11
  232. package/examples/{sheepisland → perf-island}/assets.js +1 -1
  233. package/examples/{sheepisland → perf-island}/main.js +8 -8
  234. package/examples/{sheepisland → perf-island}/models.js +1 -1
  235. package/examples/{sheepisland → perf-island}/params.js +1 -1
  236. package/examples/{sheepisland → perf-island}/picture/index.js +1 -1
  237. package/examples/{sheepisland → perf-island}/picture/palette.js +2 -2
  238. package/examples/{sheepisland → perf-island}/views.js +1 -1
  239. package/examples/plain-picture/GAMEMAP.md +1 -0
  240. package/examples/rc2d/GAMEMAP.md +3 -2
  241. package/examples/rc2d/main.js +1 -3
  242. package/examples/styletest/.threedog/content-index.json +1 -1
  243. package/examples/styletest/GAMEMAP.md +3 -2
  244. package/examples/techniques/contact-shadows/contactShadows.js +1 -1
  245. package/examples/techniques/contact-shadows/main.js +1 -1
  246. package/examples/techniques/interior-light/main.js +1 -1
  247. package/examples/techniques/modular-building/README.md +7 -6
  248. package/examples/techniques/outlines-and-rim/picture/post.js +1 -1
  249. package/examples/techniques/procedural-animation/README.md +1 -1
  250. package/examples/webgpu-tsl/GAMEMAP.md +1 -0
  251. package/examples/world/.threedog/content-index.json +1 -1
  252. package/examples/world/GAMEMAP.md +4 -3
  253. package/examples/world/picture/sky.js +1 -1
  254. package/index.d.ts +8 -7
  255. package/index.js +31 -31
  256. package/llms.txt +9 -13
  257. package/modules/ambience/Ambience.js +11 -8
  258. package/modules/calendar/Calendar.js +19 -19
  259. package/modules/calendar/index.js +13 -13
  260. package/modules/calendar/schedule.js +11 -6
  261. package/modules/calendar/seasons.js +7 -7
  262. package/modules/camera/FirstPersonCamera.js +2 -2
  263. package/modules/camera/FixedCamera.js +14 -15
  264. package/modules/camera/FollowCamera.js +4 -4
  265. package/modules/camera/RtsCamera.js +11 -11
  266. package/modules/camera/common.js +48 -24
  267. package/modules/camera/contract.js +1 -0
  268. package/modules/camera/projection.js +2 -2
  269. package/modules/characters/Character.js +33 -30
  270. package/modules/characters/NPC.js +27 -19
  271. package/modules/characters/assetModel.js +14 -10
  272. package/modules/characters/astar.js +7 -5
  273. package/modules/characters/behaviors.js +4 -5
  274. package/modules/characters/contract.js +2 -2
  275. package/modules/characters/index.js +168 -214
  276. package/modules/characters/moveHelpers.js +14 -3
  277. package/modules/characters/movers/common.js +16 -14
  278. package/modules/characters/movers/manual.js +1 -1
  279. package/modules/characters/movers/rapier.js +7 -6
  280. package/modules/characters/movers/simple.js +3 -3
  281. package/modules/characters/movers/support.js +8 -8
  282. package/modules/characters/npcAvoid.js +4 -4
  283. package/modules/characters/npcSim.js +23 -17
  284. package/modules/characters/npcView.js +6 -5
  285. package/modules/characters/pathAsync.js +12 -10
  286. package/modules/characters/pathWorker.js +1 -1
  287. package/modules/characters/player.js +108 -0
  288. package/modules/characters/playerStrings.js +2 -2
  289. package/modules/characters/proceduralRig.js +2 -2
  290. package/modules/characters/useModel.js +3 -3
  291. package/modules/characters/walkTo.js +11 -17
  292. package/modules/collision/Collision.js +26 -20
  293. package/modules/collision/contract.js +15 -0
  294. package/modules/content/explain.js +1 -2
  295. package/modules/content/fields.js +24 -3
  296. package/modules/content/ids.js +2 -2
  297. package/modules/content/index.js +61 -99
  298. package/modules/content/loader.js +14 -17
  299. package/modules/content/markers.js +25 -0
  300. package/modules/content/models.js +10 -7
  301. package/modules/content/packs.js +3 -3
  302. package/modules/content/parts.js +2 -2
  303. package/modules/content/places.js +35 -0
  304. package/modules/content/props.js +17 -14
  305. package/modules/content/rules.js +25 -21
  306. package/modules/content/stages.js +7 -7
  307. package/modules/content/templates.js +20 -20
  308. package/modules/content/words.js +34 -0
  309. package/modules/debug/DebugPanel.js +10 -43
  310. package/modules/flow/contract.js +1 -1
  311. package/modules/flow/index.js +11 -7
  312. package/modules/gameplay/Container.js +12 -11
  313. package/modules/gameplay/Containers.js +14 -5
  314. package/modules/gameplay/Dialogue.js +13 -11
  315. package/modules/gameplay/Interactions.js +37 -24
  316. package/modules/gameplay/Inventory.js +8 -9
  317. package/modules/gameplay/Quests.js +16 -9
  318. package/modules/gameplay/boxOps.js +1 -1
  319. package/modules/gameplay/dialogueBubbles.js +3 -4
  320. package/modules/gameplay/inventoryOps.js +0 -1
  321. package/modules/gameplay/pickups.js +22 -23
  322. package/modules/gameplay/questSave.js +3 -3
  323. package/modules/grid/Grid.js +1 -1
  324. package/modules/grid/Layer.js +4 -4
  325. package/modules/grid/index.js +7 -8
  326. package/modules/grid/preview.js +7 -7
  327. package/modules/grid/tiles.js +6 -6
  328. package/modules/hlod/index.js +37 -55
  329. package/modules/hud/index.js +17 -11
  330. package/modules/hud/parts.js +4 -4
  331. package/modules/level/contract.js +16 -0
  332. package/modules/level/heightfield.js +12 -10
  333. package/modules/level/index.js +47 -152
  334. package/modules/level/load.js +79 -0
  335. package/modules/level/meshes.js +65 -0
  336. package/modules/level/nodes.js +6 -7
  337. package/modules/lights/index.js +28 -181
  338. package/modules/lights/slots.js +93 -0
  339. package/modules/lights/sources.js +88 -0
  340. package/modules/music/Music.js +30 -26
  341. package/modules/music/rules.js +1 -1
  342. package/modules/nav/contract.js +14 -0
  343. package/modules/nav/index.js +11 -10
  344. package/modules/net/Client.js +7 -7
  345. package/modules/net/Host.js +7 -7
  346. package/modules/net/Net.js +1 -1
  347. package/modules/net/index.js +5 -4
  348. package/modules/net/sync.js +2 -2
  349. package/modules/net/transports.js +2 -2
  350. package/modules/particles/Particles.js +11 -8
  351. package/modules/particles/effect.js +7 -5
  352. package/modules/particles/shaders.js +2 -1
  353. package/modules/photo/Photo.js +15 -17
  354. package/modules/rigid/RigidBodies.js +66 -43
  355. package/modules/rigid/Vehicles.js +2 -3
  356. package/modules/rigid/ragdoll.js +287 -0
  357. package/modules/rigid/ragdollBones.js +159 -0
  358. package/modules/rigid/sync.js +6 -6
  359. package/modules/settings/Settings.js +108 -39
  360. package/modules/settings/apply.js +6 -6
  361. package/modules/settings/sections.js +16 -14
  362. package/modules/settings/view.js +3 -3
  363. package/modules/sky/Sky.js +29 -22
  364. package/modules/sky/clouds.js +7 -7
  365. package/modules/sky/dome.js +33 -20
  366. package/modules/sky/domeLayers.js +9 -9
  367. package/modules/sky/environment.js +6 -6
  368. package/modules/sky/frame.js +19 -10
  369. package/modules/sky/season.js +7 -1
  370. package/modules/sky/shader.js +24 -25
  371. package/modules/sky/skyModule.js +14 -27
  372. package/modules/sky/tint.js +1 -1
  373. package/modules/swarm/Swarm.js +346 -0
  374. package/modules/swarm/draw.js +68 -0
  375. package/modules/swarm/grid.js +63 -0
  376. package/modules/terrain/ChunkManager.js +70 -52
  377. package/modules/terrain/chunkQueries.js +7 -24
  378. package/modules/terrain/chunkWorker.js +1 -1
  379. package/modules/terrain/draw.js +14 -11
  380. package/modules/terrain/index.js +28 -34
  381. package/modules/terrain/terrainColorMap.js +6 -3
  382. package/modules/terrain/terrainDefaults.js +2 -1
  383. package/modules/terrain/terrainEdit.js +32 -27
  384. package/modules/terrain/terrainGen.js +17 -12
  385. package/modules/terrain/terrainIsland.js +2 -2
  386. package/modules/terrain/terrainMesh.js +7 -6
  387. package/modules/terrain/terrainShape.js +8 -10
  388. package/modules/terrain/terrainShapeMain.js +3 -3
  389. package/modules/timeline/Timeline.js +27 -19
  390. package/modules/timeline/Tween.js +6 -6
  391. package/modules/timeline/shots.js +5 -7
  392. package/modules/triggers/index.js +9 -9
  393. package/modules/vegetation/Vegetation.js +30 -23
  394. package/modules/vegetation/densityMap.js +4 -7
  395. package/modules/vegetation/draw.js +23 -18
  396. package/modules/vegetation/groundChunks.js +11 -31
  397. package/modules/vegetation/index.js +8 -6
  398. package/modules/vegetation/modelGeometry.js +3 -6
  399. package/modules/vegetation/nearFade.js +1 -1
  400. package/modules/water/Water.js +16 -16
  401. package/modules/water/surface.js +3 -3
  402. package/modules/weather/Weather.js +41 -30
  403. package/modules/weather/particles.js +8 -8
  404. package/modules/weather/weatherDraw.js +22 -18
  405. package/modules/world/World.js +8 -8
  406. package/modules/world/explain.js +1 -1
  407. package/modules/world/index.js +18 -12
  408. package/modules/world/persist.js +73 -25
  409. package/modules/world/pos.js +4 -4
  410. package/modules/world/records.js +28 -8
  411. package/modules/world/sim.js +4 -4
  412. package/modules/world/state.js +12 -5
  413. package/modules/world/thingSource.js +4 -2
  414. package/modules/world/views.js +11 -9
  415. package/package.json +42 -7
  416. package/presets.js +1 -3
  417. package/render/PostFX.js +39 -27
  418. package/render/backend.js +26 -32
  419. package/render/cascades.js +17 -12
  420. package/render/cascades.tsl.js +5 -8
  421. package/render/daylight.js +20 -3
  422. package/render/detail.js +8 -7
  423. package/render/effects.js +28 -25
  424. package/render/fuse.js +3 -3
  425. package/render/fx/cloudShadow.tsl.js +3 -3
  426. package/render/fx/detail.tsl.js +1 -1
  427. package/render/fx/index.js +5 -10
  428. package/render/fx/library.tsl.js +11 -0
  429. package/render/fx/lighting.tsl.js +2 -1
  430. package/render/fx/nodeErrors.tsl.js +2 -2
  431. package/render/fx/objectOrigin.tsl.js +1 -2
  432. package/render/fx/patchNodes.tsl.js +5 -15
  433. package/render/fx/postWebGPU.tsl.js +27 -23
  434. package/render/fx/sky.tsl.js +15 -17
  435. package/render/fx/uniforms.tsl.js +4 -4
  436. package/render/fx/wind.tsl.js +1 -1
  437. package/render/fxNumbers.js +3 -0
  438. package/render/layers.js +1 -1
  439. package/render/lighting.js +5 -3
  440. package/render/lightmap.js +20 -20
  441. package/render/lights.js +6 -6
  442. package/render/lit.js +24 -0
  443. package/render/materials.js +8 -7
  444. package/render/mergeCommon.js +22 -0
  445. package/render/modeling.js +2 -2
  446. package/render/occlusion.js +20 -4
  447. package/render/ownFrame.js +4 -4
  448. package/render/patches.js +13 -13
  449. package/render/postWebGL.js +12 -10
  450. package/render/probes.js +16 -19
  451. package/render/recordSweep.js +117 -0
  452. package/render/shaderErrors.js +10 -9
  453. package/render/shadowCache.tsl.js +107 -0
  454. package/render/shadowTypes.js +9 -0
  455. package/{core → render}/shadows.js +57 -11
  456. package/render/slots.js +7 -7
  457. package/render/terms.js +22 -24
  458. package/render/uniformDecl.js +1 -1
  459. package/types/core.d.ts +200 -153
  460. package/types/gameplay.d.ts +163 -91
  461. package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +22 -7
  462. package/types/generated/core/{audioVoice.d.ts → audio/audioVoice.d.ts} +2 -2
  463. package/types/generated/core/{Events.d.ts → base/Events.d.ts} +4 -4
  464. package/types/generated/core/{I18n.d.ts → base/I18n.d.ts} +7 -15
  465. package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
  466. package/types/generated/core/{page.d.ts → engine/page.d.ts} +8 -9
  467. package/types/generated/core/{Input.d.ts → input/Input.d.ts} +12 -8
  468. package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
  469. package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +2 -2
  470. package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +4 -3
  471. package/types/generated/core/{control.d.ts → ops/control.d.ts} +4 -10
  472. package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +37 -13
  473. package/types/generated/core/{session.d.ts → saves/session.d.ts} +2 -1
  474. package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
  475. package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +1 -1
  476. package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
  477. package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +18 -16
  478. package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
  479. package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
  480. package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
  481. package/types/generated/modules/calendar/Calendar.d.ts +10 -11
  482. package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
  483. package/types/generated/modules/grid/Layer.d.ts +1 -1
  484. package/types/generated/modules/grid/index.d.ts +3 -3
  485. package/types/generated/modules/music/Music.d.ts +7 -5
  486. package/types/generated/modules/particles/Particles.d.ts +1 -1
  487. package/types/generated/modules/sky/Sky.d.ts +21 -10
  488. package/types/generated/modules/swarm/Swarm.d.ts +80 -0
  489. package/types/generated/modules/timeline/Timeline.d.ts +2 -1
  490. package/types/generated/modules/water/Water.d.ts +1 -0
  491. package/types/generated/modules/weather/Weather.d.ts +16 -12
  492. package/types/generated/modules/weather/weatherDraw.d.ts +3 -3
  493. package/types/generated/modules/world/World.d.ts +5 -3
  494. package/types/generated/render/PostFX.d.ts +17 -11
  495. package/types/generated/render/materials.d.ts +1 -0
  496. package/types/generated/render/occlusion.d.ts +9 -0
  497. package/types/generated/render/patches.d.ts +1 -0
  498. package/types/generated/ui/Focus.d.ts +1 -0
  499. package/types/generated/ui/UI.d.ts +1 -0
  500. package/types/nav.d.ts +11 -11
  501. package/types/physics.d.ts +99 -70
  502. package/types/tsl.d.ts +37 -4
  503. package/types/world.d.ts +38 -71
  504. package/ui/Focus.js +10 -9
  505. package/ui/Parts.js +4 -3
  506. package/ui/UI.js +7 -7
  507. package/ui/defaults.js +3 -2
  508. package/ui/theme.js +5 -3
  509. package/core/assetEntry.js +0 -109
  510. package/core/holds.js +0 -134
  511. package/core/shadowTypes.js +0 -16
  512. package/core/util.js +0 -17
  513. package/docs/MIGRATING-0.3.md +0 -248
  514. package/docs/MIGRATING-0.4.md +0 -320
  515. package/docs/MIGRATING-0.5.md +0 -68
  516. package/docs/MIGRATING-0.6.md +0 -126
  517. package/docs/PERF.md +0 -245
  518. package/docs/recipes/36-sky-ground-plants.md +0 -158
  519. package/docs/recipes/37-terrain-hooks.md +0 -115
  520. package/docs/recipes/38-environment-hooks.md +0 -67
  521. package/docs/recipes/42-terrain-shape.md +0 -64
  522. package/docs/recipes/47-island-snow-backdrop.md +0 -43
  523. package/docs/recipes/54-three-idioms.md +0 -88
  524. package/examples/plain-picture/FINDINGS.md +0 -53
  525. /package/core/{Vars.js → base/Vars.js} +0 -0
  526. /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
  527. /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
  528. /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
  529. /package/core/{actor.js → ops/actor.js} +0 -0
  530. /package/core/{opsFail.js → ops/opsFail.js} +0 -0
  531. /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
  532. /package/core/{saveIds.js → saves/saveIds.js} +0 -0
  533. /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
  534. /package/core/{tier.js → scene/tier.js} +0 -0
  535. /package/core/{cells.js → stream/cells.js} +0 -0
  536. /package/core/{streamCells.js → stream/streamCells.js} +0 -0
  537. /package/core/{pureWorker.js → threads/pureWorker.js} +0 -0
  538. /package/examples/{sheepisland → perf-island}/content/index.js +0 -0
  539. /package/examples/{sheepisland → perf-island}/content/props.js +0 -0
  540. /package/examples/{sheepisland → perf-island}/content/templates.js +0 -0
  541. /package/examples/{sheepisland → perf-island}/content/vegetation.js +0 -0
  542. /package/examples/{sheepisland → perf-island}/picture/lights.js +0 -0
  543. /package/examples/{sheepisland → perf-island}/picture/materials.js +0 -0
  544. /package/examples/{sheepisland → perf-island}/picture/sky.js +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,201 @@
2
2
 
3
3
  What changed in each version and how a game upgrades.
4
4
 
5
+ ## 0.8.0 (2026-11-06)
6
+
7
+ npm never had 0.7.1: coming from 0.7.0, read this section and the 0.7.1 section below it, and follow `docs/MIGRATING-0.8.md`, which goes from 0.7.0 straight to 0.8.0.
8
+
9
+ - Decoded sounds no longer pile up: they are assets now, so `assets.release` takes a sound (name or path), `assets.trim()` and level changes free long ones, and long sounds over a memory budget go by themselves, the longest unused first. Playing sounds play on, a freed one loads again when played, effects under 10 s stay cached, `preload: true` keeps a track. A failed file by path now reads `Asset failed to load`, same code `asset-load`.
10
+ - Characters, vehicles and rigid bodies draw between fixed steps (`engine.stepBlend`), and the camera rigs follow that drawn place, so motion stays smooth on a screen faster than 60 Hz or when a frame runs no step or two. `root.position` and `mesh.position` stay the step's truth: gameplay reads what it read before, and the drawn pose is one step behind it, as swarms already were.
11
+ - `jumpBuffer: 0` means "this step only" instead of never jumping, a press now gets its whole `jumpBuffer` (one step more than before), and with `coyoteTime: 0` walking off an edge spends the ground jump instead of leaving a free air jump.
12
+ - `character.walkTo` no longer counts a long leg after a corner as being stuck: a path of several long legs used to replan at each one and ended `'stuck'` after `maxRepaths`.
13
+ - `session.load` asked while a new game is still running (right after a page opened with `?play`) waits and then loads; it used to join the new game, answer `true` and load nothing.
14
+ - `threedog types`: a name declared and never read is a hint in a game's code and an error in `packages/`. `shot <url>` on a built page keeps its fog, shadow, key and light facts and names what it could not read there (no three.js for the tools on a built page).
15
+ - `quests.define` refuses a quest without a `steps` list when it is defined; it used to throw on every check after `start`.
16
+ - The engine gives no help for this version's old names: a stale uniform name in shader text reads 0 with no warning, and an old `sky()` or `water()` option is an ordinary unknown option. See `docs/MIGRATING-0.8.md`.
17
+ - `saves.register({ movedFrom })` is removed; only the calendar used it. The time and day of a 0.2 save under the old `sky` part are no longer read. Every released sample save from 0.7.0 on still loads.
18
+ - `engine.sky.uniforms` is public, like `engine.water.uniforms`: the live handle for the uniforms given to `engine.sky.clouds()` and `engine.sky.layer()`, on both renderers (`engine.sky.dome.material.uniforms` only ever worked on WebGL).
19
+ - The field `calendar.daysPerSeason` is removed: nothing read it and writing it did nothing. The `calendar({ daysPerSeason })` option stays.
20
+ - `engine.THREE` is removed: `import { THREE } from 'threedog'`. Holding the whole of three.js on the engine kept every class in every game's bundle, and the package now has a `sideEffects` list: a bare `createEngine()` page went from 1561 KB to 1336 KB (470 KB to 397 KB gzipped). A dev page holds three.js under a private name for the engine's own tools (the picture check), a production build does not.
21
+ - The contract files are importable from an install: `import contract from 'threedog/modules/gameplay/inventory.contract.js'`, as `@threedog/tools/contract` says. They are plain data for checking a replacement.
22
+ - A model's clips moved from `model.userData.animations` to `model.animations`, three's own place. A game that cloned a model and then animated the clone crashed: three copies `userData` through JSON, which breaks the clips. A model with clips is now never batched, as the batching rule always said.
23
+ - `phase` on the engine has one more value, `'starting'`, while modules run their `init`; `'loading'` now starts after them.
24
+ - `uiFocus` is marked experimental: its shape may still change. `engine.input.push` is the stable route.
25
+
26
+ ## 0.8.0 (2026-11-05)
27
+
28
+ npm never had 0.7.1: coming from 0.7.0, read this section and the 0.7.1 section below it, and follow `docs/MIGRATING-0.8.md`, which goes from 0.7.0 straight to 0.8.0.
29
+
30
+ - 249 public names are now `@experimental`, so 1.0 does not freeze them: the ones no game, recipe, example or template uses, and the coordination features no test game has used (`engine.stacks`, `engine.wrap`, `engine.mod`, `time.channel`). None is removed; `docs/api-surface.txt` lists each one. They sit in: `adaptive`, `assets`, `audio`, `batching`, `budget`, `calendar`, `characters`, `checkOptions`, `collision`, `control`, `decoders`, `dialogue`, `error`, `firstPersonCamera`, `fixedCamera`, `flow`, `followCamera`, `ground`, `i18n`, `inRange`, `input`, `interactions`, `inventory`, `jobs`, `level`, `materialPatches`, `mod`, `music`, `nav`, `ops`, `page`, `particles`, `photo`, `pickups`, `player`, `post`, `quests`, `random`, `rays`, `rigid`, `rtsCamera`, `runState`, `saves`, `session`, `settings`, `sky`, `stacks`, `startup`, `stateApplied`, `stateRefused`, `stream`, `terrain`, `terrainMaterial`, `time`, `timeline`, `toggleOnKey`, `ui`, `uniforms`, `urlState`, `validate`, `vars`, `vegetation`, `water`, `weather`, `world`, `wrap`.
31
+ - NPCs and `character.walkTo` follow a path by one rule: an NPC skips points it has passed and no longer stands still for a step at each point, so it runs a few centimetres ahead of where it was mid-walk.
32
+ - `inventory.slotsUsed` is gone: read `inventory.of().slotsUsed`.
33
+ - `settings({ sections })` takes an entry `{ id: 'graphics', omit: [...] }` that leaves graphics rows out; an omitted row stays the game's value, and no preset or stored value moves it. A fixed pixel look omits `pixelRatio`, `antialias`, `adaptive` (recipe 62 section 4b).
34
+ - The WebGPU renderer no longer asks for `powerPreference` on Windows, where Chrome ignores it and warned on every page load.
35
+ - A damaged save is refused in more cases: an NPC `nav` that is not an object or a path that is not a list of points, a character speed that is not a sane number, a record with no `position`, content marks or an interactions part of the wrong shape, a physics body past ±1e7 (it hung the page for good). Each is `save-bad-record` at load (load false, game rolled back) instead of freezing the game. Found by the long fuzz runs.
36
+ - Docs: recipe 28 section 4b, a road laid on terrain: the road and the height function read the same data.
37
+ - A KTX2 model or texture asked for before `engine.start()` loads on WebGPU: the engine waits for the renderer's init itself, and `await engine.renderer.init()` is no longer needed.
38
+ - `engine.setCamera(kind, options)` before play (boot code, or with the title up) keeps its options when play starts.
39
+ - A moving physics body that freezes outside `rigid({ terrainRing })` warns once in dev, by name (`rigid-misuse`); recipe 11 explains the freeze.
40
+ - `hud.counter` with no label shows the value alone; it used to show the id.
41
+ - `inspect.perf()` on a halted page: `cpuMs` and `fps` are null and the text says they are not measured (they read 0). Its `lights` line says it counts point and spot lights.
42
+ - `input.holders` and `runState.blockedBy` count pushes and removes that wait for the next fixed step, so the status line of a halted page no longer names a closed window.
43
+ - Saves now hold the camera view: a new save part `cameraRig` (yaw, pitch), so Continue no longer loses a first-person view. Old saves load as before. `session.load` / `newGame` rebuild the installed rig on the same object, so a `const rig = engine.cameraRig` kept at boot stays the camera and a save part's `load()` that writes the rig keeps its write.
44
+ - Error codes merged before 1.0, one code per failure: `options-object` is now `bad-position`; `npc-option` is `character-option`; `pickup-prop-id` is `world-id`; `session-handle` is `module-handle`; `world-missing` is `module-needs`; `load-failed` is `asset-load`. `bad-arg` is gone: `input.bind` raises `input-keys`, `characters.support` raises `character-option`, `settings({ presets })` raises `module-params`.
45
+ - Some raises moved to the code that says what went wrong: `engine.stacks.define` of a known name raises `engine-misuse` (was `mod-owner`), `swarm.onStep` with no function raises `swarm-step`, `weather.set` with bad seconds raises `weather-option` (both were `module-params`), a damaged saved swarm raises `save-bad-record` (was `save-refused`).
46
+ - Four throws that protected nothing are now one dev warning: `engine.wrap` on a `_private` method works, `createEngine({ fallback })` without WebGPU starts, a vegetation `rule` beside `positions` plants the listed spots, `ui.theme.promptHeight` starts.
47
+ - Error text follows the current names: `shared-layer` no longer lists a `style` layer, `input-bound-twice` no longer mentions a module keys option, `rigid-misuse` covers the ragdoll cases, `quest-step` covers definitions, and other fixes that named the wrong call.
48
+ - Editor test fixes: the test pickup sat under the editor panel and could not be clicked (moved), the grid-item test model now turns with its record, and a drag where the outer turn ring would stand is checked to move the camera and write nothing (the turn handle shows the yaw ring only).
49
+ - Editor, first walked through by hand on a new game: opening it closes the title screen, Esc no longer opens the game's menu over the scene, the buttons stay in one place, a save says "Saved", a refusal is colored, a second Add lands beside the first, yes/no fields are lists (an unset `static` no longer looks like "no"), and a value the game cannot load (a `place` that does not exist) is taken back from the file at once instead of breaking the next start. `threedog content add` to a list written on one line opens it, one entry per line.
50
+ - `threePatches.off('lod-view-camera')` now works: LOD objects made after it keep three's own `update` and `clone`.
51
+ - `threedog how`: a sentence that only points at a recipe no longer ranks its row, and a text line joins the ranking only if it holds the typed word itself, so "webgpu", "node material" and "climb" reach their recipes again.
52
+ - A module's `type` is optional: without one it is `'rules'`. A module going against its type (a `ui` module binding keys, a `picture` module defining an op) now warns once in dev and the call goes through; it used to throw. An unknown type name still throws.
53
+ - `threedog state` and `threedog snap` (also `snap --play`) move no game time: they used to add a tick or two.
54
+ - Animators update in a core step right after the `onFrame` list, so an `anim.sync` / `go` / `set` from any `onFrame` shows the same frame.
55
+ - `engine.step()` during an unawaited `start()` or session change warns once in dev (`step-during-load`).
56
+ - `views.show` writes the fov through the engine's owner, so `autoView.manual('fov')` keeps the game's value, and `release()` gives the fov back.
57
+ - `assets.report` and `inspect.materials` share one texture slot table: `specularMap` is data in both, and a `lightMap` may be linear or sRGB in both.
58
+ - `createEngine({ audio: { music } })` key spelling is checked by `music()` when it installs, not in core.
59
+ - Removed: the error messages for names gone since 0.4 and earlier (`createEngine({ post })`, `createEngine({ style })`, `engine.elapsed`, a fourth `clock.after` argument): the first two are now plain unknown options. Error codes `renamed-field` and `shadow-type`, and `withHint` from `threedog/error-hints` (`hintText` stays).
60
+ - Removed before 1.0, nothing implemented it: the ground API's optional `ground.navGeometry`. The navmesh comes from `staticTrimeshes()`.
61
+ - `content.load` reads a pack's own `places` file; the `places` option goes on top, and `{ places: data.places }` is no longer needed.
62
+ - `weather()` no longer needs `sky()`: rain and snow fall without it, or under a game's own sky, which reads `weather.current.grey` and `weatherDraw.flash`.
63
+ - A low-tier device changes only defaults. `particles.define` `max`, `weather({ particles })`, a weather `count` and `sky.environment({ interval })` stand as the game gave them, as `colorResolution` already did.
64
+ - `sky.replace(false)` is in the type: it draws no sky. A skybox now reaches full brightness at the brightest row of the game's keyframes, not at ambient 1.2.
65
+ - `hlod` puts everything back when the module unloads. The shadows switch reaches near-only plants and plants on vegetation's own ground. `terrain({ viewFog })` keeps working under a replaced `terrain-draw`.
66
+ - `music.play`, `music.stinger`, `hud.counter`, `hud.bar`, `calendar.at`, `calendar.daily`, `calendar.between` and `vegetation.removeInstance` check their option keys.
67
+ - Removed, no reader anywhere: `settings.saved`.
68
+ - New in `threedog/tsl`: `noise`, `hash` (the engine's value noise, until now only in sky hooks) and `instanceOffset` (an offset through the instance's rotation and scale). `ctx.fx` in patches, sky hooks and post effect nodes now holds the same full list.
69
+ - `#include <threedog_uniforms>` declares every name on `engine.uniforms`, `uNight` and the sky values included. A shader that also declares one of them itself drops its own line.
70
+ - `engine.shadows.cache`: a batch now answers for its originals, so `{ static: cityRoot }` covers batched copies, and an InstancedMesh whose instances change, or that leaves the scene, redraws the kept map by itself.
71
+ - New: `adaptive.base`, the ratio this device or game starts at. A settings preset's `pixelRatio` is a share of it.
72
+ - Removed before 1.0, no game used them (`MIGRATING-0.8.md`): `adaptive.paused`, `settings.removeSection`.
73
+ - `hlod` hides a far original on the batch layer, the way `engine.batching` does. The `hlod-visible` patch and `userData.rayVisible` are gone: `mesh.visible` on a registered mesh is plain three.js again, and reads the game's value near and far. The full model of a far `assets.lod` waits on the same layer, so read `getCurrentLevel()` to see what is drawn.
74
+ - Occlusion culling keeps a game's `mesh.layers` write made while the mesh was hidden; showing it used to put the old mask back.
75
+ - Settings store only what the player changed, like `input.rebound()` for keys: one volume change no longer pins the render scale and every graphics value for later launches, and a preset is stored by name. A preset's `pixelRatio` is a share of the device's default ratio, so `medium` is no longer blurry on a 2x screen and `high` no longer renders 1.5x on a 1x one. `settings.values` is read only and `settings.get('pixelRatio')` is the real ratio. Stored files of version 1 are read: a value equal to the default lets go.
76
+ - `engine.setPixelRatio(p)` is now the top adaptive resolution climbs back to: it was undone within two minutes while the raw three.js call stayed. Adaptive may still lower it under load.
77
+ - New, off unless called, `@experimental`: `engine.rigid.ragdoll(character, { impulse, position, bones, limits, mass })` turns a skinned character limp and `rd.remove()` returns it to animation (recipe 11, section 3b). Reads common skeletons by itself, names what it cannot read; the mover, animator, capsule and camera yield and come back; the pose goes to the plain three.js bones in fixed steps; not saved. Partial or blended ragdoll is left out. `control.take` has a new layer, `physics`, between `cutscene` and `net`.
78
+ - Swarm: a handle kept in a field now stays good. Handles pass 2^24 after 16 births, and a Float32 column rounded them, so `row()` answered -1 as if the target had died. A game's own `fields` are `Float64Array` now (twice the memory per field); `x`, `y`, `z` and `r`, `g`, `b` stay `Float32Array`.
79
+ - `audio.buses.master` exists, as recipe 31 always said. A name that is no bus warns once with `[unknown-name]` and gives `master`, so `node.connect(audio.buses.wrong)` no longer throws and freezes gameplay in dev.
80
+ - Pure functions: a number such as `1e9` or `0xff` is no longer read as an outer variable named `e9` or `xff`, so `terrain({ height })` accepts them.
81
+ - `content.load`'s `unknown content` error now says `rules` must be listed in `content/index.js` too, and recipe 20 says the same.
82
+ - Docs: `n.fbm`, `noise` and `hash` run 0 to 1 (recipe 28); every `bloom` option with its default (52); pool lights and walls (09); `onBeforeCompile` on WebGPU and a node-material sky (54, 08); where the canvas is (01); `vegetation.define` order and keeping plants off a line (36); how `describe` nests a part (19). Recipes 02 and 04 no longer send a game to engine source or engine tests.
83
+ - Tools tell the truth, from four AI-built games. `check` reads `content/index.js`, what the page really loads: a kind listed there without `rules` is now an error instead of a green check and a dead page, and a file left out is a warning. A kind's `load` is optional: a game that imports its own file no longer writes an empty function. Valid TSL (`p.xy`, `.mul` on a `uniformArray` element) is a hint, not "engine API misused", and the worker check no longer reads `1e9` as a variable `e9`.
84
+ - `applyState({ fresh, play, pos })` keeps `pos` (a new run used to undo it while `state` printed Set). A view moves `engine.focus` to its target and waits for the world there, so `shot --view` no longer needs a `--pos` beside it. `threedog perf -w game` measures a game's page, as its usage line always said.
85
+ - `threedog test` says before the run, and again on a timeout, that a spec with `page.screenshot` left the GPU for software rendering; `software: false` keeps it on the GPU for a real picture. COMMANDS.md: a steering test holds the loop and advances with `engine.step`, so machine load cannot change its path.
86
+ - Picture check: edges are not read when the picture changes by itself between two identical renders (moving film grain read as "shadow stripes on 92%"); a line over a default budget says why the number exists and that nothing is cut at it. `threedog how` no longer prints a GLSL sample under a row in a WebGPU game. New games: CLAUDE.md names `threedog play`, STATUS.md no longer asks for three versions against "build it".
87
+
88
+ - Physics follows the `world` time channel: `engine.mod('time.world', { mul: 0.2 })` slows rigid bodies and vehicles with everything else, and a hit-stop at speed 0 holds them. To keep bodies at full speed, slow a channel of your own instead of `world`.
89
+ - The press that opens a window or dialogue from a fixed step no longer also acts on it. `h.fresh` counts input frames, ended by `input.endFrame()`, so it holds at any frame rate and no longer depends on who called `uiFocus` first.
90
+ - Renamed before 1.0 (`MIGRATING-0.8.md`): `engine.pause` is `engine.haltLoop` and `engine.paused` is `engine.halted`, because it stops rendering and an AI asked to pause a game reached for it and got a dead screen; a game freezes (`engine.freeze`, flow `'paused'`). The `pause` stack is `halt` and the error code `pause-owner` is `halt-owner`. `runState.state` is `'loading' | 'title-frozen' | 'halted' | 'frozen' | 'running'`: `'test-paused'` and `'paused'` go, and so does the `kind: 'test'` option.
91
+ - `engine.freeze(owner, { ambient: true })` is now a real still: skeletal animation, character animation and particles stop with `uTime`. A plain freeze, as behind a pause menu, keeps them moving as before. `engine.still` is true during one, for a game's own frame code.
92
+ - A page hold is a freeze (`MIGRATING-0.8.md`): a window in the background or a lost graphics device freezes gameplay by owner `'page'`, a full still. Cutscene tweens and camera moves used to run on over a stopped world, and `runState` said `running`. `page.held` is removed (`engine.frozen`, `runState.owners`), and `describe().page.held` goes with it. `step()` obeys it like any freeze; a page with the loop stopped has no hold, so tools still step a background window.
93
+ - Removed: error code `character-hook`. Nothing raises it: assigning `player.onStep` or `player.onLand` gets no warning; use the events `character:step` and `character:land`.
94
+ - Marked experimental, no promise at 1.0: `nav.crowd`. It hands out the raw Recast object, like `nav.navMesh`, `query` and `tileCache`.
95
+ - New, off unless called: `engine.shadows.cache(light, { static })` draws what does not move once and redraws only the rest, by copying a kept depth map into the light's shadow map on WebGPU (recipe 45). One plain map only, no cascades; other renderers draw everything, with a warning. Marked `@experimental`: no frame time has been measured yet.
96
+ - `threedog assets optimize --lod` writes lower-detail levels of each model (meshoptimizer simplification, geometry only) and reports triangles per level; skinned, morphing, animated and small models are skipped with the reason. `engine.assets.lod(name)` (experimental) or `lod: true` on a prop or template draws them as a plain `THREE.LOD`; off by default, and rays, collision and saves keep the full model. A LOD object is never batched.
97
+ - `threedog assets optimize` no longer needs the external `ktx` program: when it is not on PATH the textures are encoded by `ktx2-encoder` (npm, MIT, Basis Universal as WebAssembly), still by slot (normal / occlusion / roughness as linear UASTC, color as sRGB ETC1S). `ktx` on PATH stays the first choice; the output names the encoder and the encoding time. The "`ktx` is required" error is gone; with no encoder at all it says `npm i -D ktx2-encoder`. Field page `docs/testing/field/2026-11-05-ktx/`.
98
+ - Saves survive upgrades, now guarded: fixed sample saves from 0.7.0 and from 0.7.1 (`packages/engine/tests/save-compat/samples/`, every save part plus the stored settings) are loaded by a test on every run, and a save from a newer engine is checked to be refused with a message and no change. Nothing in the engine needed fixing. Every release now adds a sample and old ones are never edited (`docs/plans/release-checklist.md`).
99
+ - `engine.batching.tint` on a batch that had already drawn did nothing on real WebGPU: three built the batch's shader before the batch had any instance color, so the first tint never reached the GPU. The first tint now rebuilds the batch material once. Guard in bundles.mjs reads pixels on real WebGPU.
100
+ - `engine.batching` batches are no longer `DynamicDrawUsage`: on `WebGPURenderer` that refreshed every batch in full, every pass, every frame. City flight on a real GPU: frame median about 10.6 to 8.7 ms (one pair). Writes to a batch reach the screen as before.
101
+ - Three's `BundleGroup` works beside the engine, no new API: `engine.batching` leaves a mesh under a `BundleGroup` alone, `hlod.add` skips it with a warning, `describe().render.bundles` and the `inspect.scene()` reason `in-bundle` report it. It gained nothing on the city scene; recipe 05 says when it may pay.
102
+ - `engine.stream` unloads through `engine.jobs`, behind every build, so a row of blocks no longer leaves in one frame. An entry out of range can stay a few frames longer in the real-time loop; `engine.step` still finishes in the same frame.
103
+ - `engine.remove` counts the scene only when a part is held by neither `assets.shared` nor `batching.held`. Batching relists only the parents that changed.
104
+ - A damaged world save record whose `motion` is not an object (e.g. the number 25) is now refused at load as `save-bad-record` (load false, game rolled back) instead of throwing `Cannot create property 'vx' on number` in the fixed step and freezing the game; `motion: null` and game-own fields stay allowed.
105
+ - A hang the fuzz found: a position far past float precision (`applyState({ pos })` with z = -3.6e178, or any `placeAt` / ground call) froze the page for good, because the chunk loops (`cx = floor(x / size); ...; cx++`) stop advancing once `x / size` passes 2^53. Positions with |x| or |z| above 1e9 are now refused with the `bad-position` code and the position in the message (`xzOf`), so `applyState` reports `pos` as refused and the game goes on. Each fuzz case also has a time limit now (`FC_CASE_MS`; 60 s in the browser items, 30 s in the writer item): a case over it is a failure that prints its input, seed and path. Dev warning, once: a world record whose `jump` or `safe` is the wrong kind of value (a damaged or hand-edited save) is still repaired when the character writes its motion, but the warning `character motion: the world record's 'jump' is ...` now names the field.
106
+ - Fuzz tests (fast-check, fixed seed, short in the normal suite): the content writer now refuses values that are not data (NaN, Infinity, undefined, functions, bigints) by name instead of writing them as code, and writes a carriage return and -0 correctly; a damaged `scene` save part is refused as `save-bad-record` (load false, game rolled back, no frozen gameplay) instead of throwing a code error. Long run for a release: `FC_RUNS=300 threedog test Fuzz` (see `docs/plans/release-checklist.md`).
107
+ - Editor (dev server only): pickups get a height handle and can be added from the panel (items the game defines); a grid item turns in quarter turns and writes `rotation`; undo of a cleared field puts it back in front of the property that followed it (the content write takes an optional `spot`); an entry with computed values can be deleted and the delete undone; the turn handle's outer rings no longer tip the anchor. NPC facing is not content data, so NPCs get no turn handle, and schedules are still edited by hand.
108
+ - Dev warning, once: the game added its own light while the engine's placeholder lights (`engine.lights.sun`, `engine.lights.hemi`) are still in the scene, so the two add up. It names the fix, `createEngine({ lights: false })`; nothing is refused or changed, and there is no warning with `lights: false`, with the placeholders removed, or for a module's or pool's lights. New field page `docs/testing/field/2026-11-05-many-lights/` (frame time vs light count, lightPool, shadows, adding a light mid-play).
109
+ - Fewer freezes from hooks: a quest reward that throws (`content-place`, `ground-missing`) no longer leaves the quest half finished. `content.run` runs every effect of a list and rethrows the first error, the quest still finishes (`quest:done`, toast) and the failure is reported softly. A job that fails inside its commit tick no longer freezes the fixed step a second time; its promise rejects once. `ground-missing` (a prop, spawn or `snapToGround` beyond `terrain({ shape })`) and `swarm-disposed` (`spawn()` after `dispose()`, returns -1) are warnings now: the fallback was already safe.
110
+ - Surface names these changes touch, as the API lock lists them: `decoders`, `openWindows`, `uniforms.uCloud`, `uniforms.uCloudScale`, `uniforms.uCloudSpeed`, `uniforms.uCover`, `uniforms.uCurve`, `uniforms.uMoonPower`, `uniforms.uSunPower`, `sky.gradientCurve`, `sky.moonSize`, `sky.orbitSway`, `sky.orbitTilt`, `sky.starScale`. See `MIGRATING-0.8.md`.
111
+ - Removed before 1.0 (`MIGRATING-0.8.md`): `rays.cast`, `rays.pick`, `i18n.t`, `engine.openWindows`, `engine.decoders`, `EASINGS`, `assets.reportText` and `assets.users`.
112
+ - Removed and renamed before 1.0 (`MIGRATING-0.8.md`): `player.object` is `player.root`, `player.addTo` is `engine.add(player.root)`, `hud.add` is `hud.bump`, `dialogue.cps` is `dialogue.charsPerSecond`, `rtsCamera({ angle })` is `pitch`, `weather.define` is `weather.defineField`, `terrain.T` is `terrain.generator`, `terrain.CHUNK` is `terrain.chunkSize`.
113
+ - Marked experimental, no promise at 1.0: `player.saveMotion`, `player.loadMotion`, `engine.terrainDraw`, `engine.vegetationDraw`, `engine.weatherDraw`.
114
+ - Removed or renamed before 1.0 (`MIGRATING-0.8.md`): `rigid.R` is `rigid.rapier`; `collision.circles` and `collision.boxes` go (use `collision.forEachStatic`); `stream.readyCheck` is `stream.addReadyCheck`; `music.addTracks` is `music.define(name, track)`; `debug.startBench`, `debug.benchmarking` and the panel's stress button go (use `threedog stress`); the types `Object3D`, `Vector3`, `Vector2`, `Color`, `Quaternion`, `Material`, `BufferGeometry` and `Texture` are no longer exported from `threedog` (import them from `three`). `threedog assets` needs a verb (`optimize` or `check`). `doctor --json` prints `{ ok, summary, items }`.
115
+ - One meaning for `@experimental`: the name may change or go with no migration note. `api-count` reads the tag, a tag on a module or an engine member covers what hangs off it, and `docs/api-surface.txt` ends the line with it, so rule R55 lets it move and requires a note when a stable name gets marked. Newly marked: `net`, `Net`, `fakeNetwork`, `webSocket`, `threads`, `grids`, `Grids`, `Grid`, `Layer`, `hlod`, `ops.guard`, `ops.allow`, `terrain.edit`, `stream.source`, `stream.sources`, `stream.teleport`, `post.get`, `post.list`, `post.own`, `post.setAntialias` (tagged before, read by the lock only now), `rigid.rapier`, `rigid.world`, `rigid.playerBody`, `rigid.playerCollider`, `nav.navMesh`, `nav.query`, `nav.tileCache`, `nav.helper`, `assets.gltf`, `assets.draco`, `assets.ktx2`, `post.object`, `post.targets`, `shadows.csm`, `commits`, `swarm`, `terrainDraw`, `vegetationDraw`, `weatherDraw`, `bakeProbes`, `loadProbes`, `loadLightmap`, `moduleOrder`, `moduleStates`, `disabledModules`, `player.saveMotion`, `player.loadMotion`, `jobs.loadingMs`, `jobs.maxSteps`, `jobs.slowStepMs`, `stream.unloadFactor`, `batching.held`, `world.steps`, `level.heightfield`, all of `threedog/tsl` (`wind`, `cloudShadow`, `season`, `objectOrigin`, `uniforms`, `celLighting`, `detailBump`, `detailNoise`, `rim`, `shadowTint`, `waterFresnel`, `waterSurface`, `waterWave`, `wrapDiffuse`), `voxelGI`, `temporalAA`, `sunShafts`, `lightVolumes`. Only `--json` and MCP shapes are an interface; printed text may change.
116
+ - Uniforms renamed (`MIGRATING-0.8.md`): `uCloudScale` to `uCloudShadowScale`, `uCloudSpeed` to `uCloudShadowSpeed`, `uCloud` to `uWeatherCloud`, `uCurve` to `uSkyCurve`, `uCover` to `uGroundCover`, `uSunPower` to `uSunBrightness`, `uMoonPower` to `uMoonBrightness`. The dome's own `uCloudScale` and `uCloudSpeed` are now `uSkyCloudScale` and `uSkyCloudSpeed`, on `engine.sky.uniforms` and in sky hooks.
117
+ - `engine.batching`: the default cell is now four stream cells (256 m), not one (64 m). A cell no wider than a streamed block could not batch across blocks, so a model used a few times per block drew every copy alone. The city field run on WebGPU went from 19.8 ms to 9.4 ms a frame (real GPU, 14.4 km flight). Culling is coarser: 13-25% more triangles drawn there. A game with heavy props can set `createEngine({ batching: { cell: 64 } })`.
118
+ - Removed or renamed before 1.0 (`MIGRATING-0.8.md`): `engine.tick` is `engine.time.tick`; `engine.cpuMs`, `cpuMs`, `engine.cpuPhases`, `cpuPhases`, `cpuPhases.fixed`, `cpuPhases.frame`, `cpuPhases.render`, `cpuPhases.afterRender` are read through `engine.inspect.perf()`; `engine.terms`, `terms`, `terms.cloudShadow`, `terms.season` are `engine.shaderTerms`; `engine.view`, `view`, `view.manual` are `engine.autoView`; `terrain.isReadyAround` and `rigid.groundReady` are gone (`engine.stream.addReadyCheck` already waits on them); `lightPool.usage` is `engine.describe().lightPool`; `saves.queue` and `saves.prefix` are private (new `saves.putAttachment`, `saves.removeAttachment`, `saves.attachments`, `saves.storageKey`).
119
+ - Failure and "not found" have one shape (`MIGRATING-0.8.md`): `inventory.add` returns `{ ok: true, key, added }`, or `{ ok: false, code: 'full', facts }`, also on containers. `grids.get`, `inventory.get`, `interactions.get` give `undefined` when there is none, and `interactions.get` and `interactions.items` are typed.
120
+ - `clock.after(seconds, fnOrEvent, { data, channel })`: the third argument is options, as in `clock.every`; the old form throws.
121
+ - `player.onStep` and `player.onLand` were one-slot properties, and a second system silently took the slot: they are gone. Listen to the new `character:step` and to `character:land`.
122
+ - Writing `stream.radius`, `terrain.viewChunks`, `terrain.density`, `post.antialias` or `weather.auto` now takes effect like its `setXxx`.
123
+ - `engine.moduleOrder`, `moduleStates`, `disabledModules`, `bakeProbes`, `loadProbes` and `loadLightmap` are marked experimental.
124
+ - Tools: a second `tune write` always takes effect: a line with a hand comment or a Windows line ending used to run after the new value and win while the tool said "Written". The file keeps its line endings, and code in a material literal (`side: THREE.DoubleSide`) stays.
125
+ - Editor: steps run one at a time, each from the file as the last step left it, so an overlapping save, drag or Ctrl+Z no longer corrupts the undo history or gets refused as a conflict. A drag or a row being typed in survives a save landing under it; a dead dev server is a refused step. A file put back to the editor's last text now reloads the page. Add skips an id only the file has; a broken list in a json row is refused; a field written as `null` can be edited; key order no longer counts as a conflict; a failed check leaves a hand save alone; removing an NPC reloads the page.
126
+ - Tools: `threedog stress` stops on a lost WebGPU device or an uncaptured GPU error (it read as spare capacity), frees each step's instanced mesh, and keeps the load inside the view. Both stress pages now share `@threedog/tools/stress-load`, so a game on WebGL gets gpu ms too.
127
+ - `engine.stateRefused`: what the URL parameters or the latest `applyState` could not do. `shot` and `capture` fail on a value you named that the page refused (`--weather rian`). A weather refused early and accepted late is no longer reported, and a hook refusing `at` is a refusal, not a position error.
128
+ - `describe().world.changed` leaves out where a record with motion stands (a walking NPC), so the Changed line keeps what a command did; runtime rows hold a copy of the position.
129
+ - `check` in a game: file size (R1), copied passages in game docs (R22), paths, commands and links in game docs (R18), a module with no key (R51) and setup-time creation (R33) are warnings now. R33 stays an error only for `{ initial: true }`, and its fix names `// runtime: <reason>`. A stale GAMEMAP warns in a game and still fails for the engine's examples. `lib` no longer reads `createEngine(cfg)` as WebGL.
130
+ - No key is not an error: `interaction-no-key` is a dev warning and play goes on. `interaction.use` runs when code asks, `ops` does not offer it, and the `noKey` code is gone. `engine.input.bind('interact', [])` says no key on purpose.
131
+ - Sky: a second `engine.sky.environment()` replaces the first. `engine.sky.replace(false)` means no drawn sky. `sky({ time })` with a calendar warns once in either install order. `engine.sky.layer` takes any non-empty name. `engine.sky.sunDir` is the same vector as `uSunDir`, and a game's write stays (`engine.autoView.manual('sunDir', false)` gives it back). `camera.aspect` is the owned value `view.aspect`. A direct write to `uSkyTop`, `uSkyHorizon`, `uDaylight` or `uTimeOfDay` warns once (`signal-overwritten`) with the entry to use.
132
+ - `applyState`: `season` with no calendar and an `at` nothing knows go into `refused` instead of throwing after a partial apply. The `state-at` code is gone.
133
+ - `world`: `{ save: false }` records may hold anything, unless the kind is simulated with `worker: true`. A class instance in a saved record (`Vector3`, `Color`) is refused at once instead of failing after a load, and the error gives the line to copy.
134
+ - Fewer freezes from the loop: an `approach` interaction on a held character is refused with `cannotWalk`, an NPC yields when a game holds it on the base layer, a WebGL-only material added after start is reported without stopping play.
135
+ - New games: the template colors the engine's background instead of assigning one, so `sky()` shows and `palette.background` still works. Style advice in the template reads as defaults, with plain three.js named as equally valid.
136
+
137
+ - Loading: a model whose textures failed to decode (KTX2 transcoder, bad image) now counts as loaded with missing references: `describe().loading.ok` is false, `warnings` names the file, and `threedog loading` says "N partial" instead of "N/N ok". Before, GLTFLoader swallowed the failure and everything read ok.
138
+ - Audio: `describe().audio` (present while a bus is ducked or a voice plays) and `engine.audio.info` (now documented) report the duck level the active ducks ask for, not the gain node's value mid-fade, so a fade reads right on a headless page where the audio clock stands still.
139
+ - Errors: the `asset-load` hint tells "called before the backend is initialized" (a load before `engine.start()`) from a real 404; the `not-installed` hint says it is a plain TypeError and when engine.<module> is the cause. The error log names an Event or an empty-message rejection instead of `{"isTrusted":true}`.
140
+ - Tools: `shot --keep --out name.png` writes exactly `name.png` (the timestamp is only for generated names); the scenario line uses ground and weather ids, not the translated names. Recipes 16, 26 and 34 note the position formats, that `bloom` / `ao` rows already exist, and that occlusion culling hides nothing in step mode.
141
+ - Pathfinding: without a navmesh, `characters.findPath` returns `null` (`noPath` when detailed) for a target inside a wall or water, and its straight legs are sampled every 0.12 m, so a route no longer clips wall corners (up to 0.3 m before).
142
+ - Describe: records without a name (props, template instances) now appear in `nearby` by id with their kind, the nearest 8 only.
143
+ - Describe: `ambience` carries `audioLocked` while its rules wait for a click or key press, so an empty `on` on a bridge page is not read as "no rule matches here".
144
+ - Tools: `play --stop` asks the server up to three times and stops a stuck one named in dev.json, instead of removing the record and leaving the process alive.
145
+ - Docs: recipe 26 covers hiding the interface for a photo mode (engine ui and plain three.js), custom title items closing the title, and the HUD unit following the engine locale.
146
+
147
+ - Library: `lib pull` refuses an entry that cannot draw on the game's renderer, with nothing copied, and `lib check` fails on such a copy (GLSL in a WebGPU game, a node material in a WebGL game). `--force` copies it to port by hand; the check reads the copy, so a port clears it. Node materials and TSL now count as WebGPU only when an entry's `backends` are read from its code, and an entry without `backends` gets them from its files.
148
+ - Library: `lib pull` prints the import path where the file landed, not the path stored from the game the entry came from.
149
+ - Assets: `assets.texture()` and models with textures before `start()` work on the WebGPU route. The upload waits for the first frame instead of throwing "initTexture() called before the backend is initialized".
150
+ - Docs: COMMANDS.md says where each kind of library entry lands; the `modular-building` README says what `examples pull` copies and that the demo page stays in the engine repository.
151
+ - `threedog capture` works on WebGPU games: it hooks the draws of WebGPURenderer, prints the renderer it measured, skips Spector on real WebGPU and says so, and fails on a frame with no draws. It now prefers the hardware GPU.
152
+ - `threedog stress` measures the game: from a game folder or with `-w` the load goes on top of the game's scene on its own renderer. A WebGPU game without real WebGPU is refused. The neutral page stays for the engine repo and is named as such.
153
+ - `engine.inspect.perf()` says "nothing measured yet" before any draw is counted: new field `measured`, `ok` is false, no tick on frame metrics.
154
+ - `threedog bake light` traces rays through a BVH instead of a probe grid: sky no longer leaks into rooms through walls, and pillars shade the floor. `--spacing` is gone, `--samples` now means rays per texel (default 128). The sky now matches the strength of the hemisphere light it stands for, so bake again and compare. A map with no light fails and writes nothing; a failed shader is printed.
155
+ - `threedog tune write` merges into the earlier block instead of replacing it; the block passes `threedog types`; `tune` takes `-w`; with no file it names the values that need one.
156
+ - Docs: tuning without a mouse (COMMANDS), turning the ambient off after a bake and the `?bake=1` flag (recipe 34).
157
+
158
+ - Input: pressing the interact key with nothing to use is no longer silent. The press lands in the op history as a refused `interaction.use` (`inputLocked` with the context holding the input, or `nothingNear`), and `threedog test` prints it, the input lock and the open dialogue under a failed spec. `describe().ui.dialogue.advance` names the keys that advance a dialogue.
159
+ - `threedog init`: leaves a game that passes its first `threedog check` (it writes GAMEMAP.md; the extra `map` step is gone from the READMEs and recipe 01); a package already in `devDependencies` is not also added to `dependencies`; files the template layers wrote are no longer reported as "existing files kept".
160
+ - `threedog check -w <game>` reads that game alone: tsc and R18 no longer go through every game, example, spec and engine doc only to throw the results away, the generated-doc checks of the engine stay in the root check, and the other parts run beside the rules instead of after them. The line that counted other workspaces' type errors is gone with it.
161
+ - Characters and NPCs take `model: [name, ...args]` like props (it crashed inside `Object3D.add` and `check` could not see it); arguments on a file or async model stop with `character-option`. The open-world template declares `home` in `content/places.js`, so `{ place: 'home' }` passes `check`. `art board` and `lib` run in a repository root stop and ask for `-w <game>`. Recipe 02 says `humanoid` is your own asset, and the game template says how to set `locale`.
162
+ - Editor (dev server only, F2): first version done. Edit the selected entry's properties from its field table, add an entry from the game's templates and named models, delete one, undo and redo (Ctrl+Z, Ctrl+Y; the file comes back byte for byte, a hand edit in between refuses it). Moves now cover height and rotation, the real model follows the drag, and `static: false` entries, physics bodies, grid items (`cell`) and NPCs (`start`) can be picked and moved. `threedog content` write-back gained `unset` and `restore` in `contentWrite` for this; the CLI is unchanged.
163
+ - `engine.applyState` resolves to `{ ok, refused: [{ key, value, reason }] }`: a weather name the game lacks or a key no module handles is reported, not dropped. A module hook refuses with `{ refused: { key: reason } }` and lists its keys in `stateKeys`. `fresh: 1` now means yes; a `fresh`, `wait` or `pos` value it cannot read throws `state-value`.
164
+ - `describe()` has `vars` (story flags and counters) and `world.changed` / `world.removed` (what play changed, capped at 50 with the rest counted), so a snapshot and `expectDescribe` see them. Snapshots drop `picture.writers` (frame counters), compare story counters exactly, and an `--only` path found nowhere fails instead of matching nothing.
165
+ - A bad position is refused, not an engine error: `thing.set` answers `badPosition` in `can`, and an op whose argument is that position fails with that code, so gameplay no longer freezes on it. A NaN an op worked out itself is still an engine error, where it happened.
166
+ - Bridge commands report what took effect: `state` fails with the reason and exit 1, `step` and `hold` say how many seconds really passed and fail when short, `press` fails when the engine stopped, scenarios stop on a refused state or a stopped engine. `op` refuses a value that does not fit its shape, and accepts `position=3,0,4` for an untyped argument. `press` and `op` print a `Changed:` line.
167
+ - Bridge output: every cut says so and how to see the rest; `ops` no longer prints `[object Object]`; `log()` shows in `js` checks scripts and when a script throws; `status` counts only errors since `threedog reload`; `catalog --find` searches the library and says when nothing is found; `threedog --help` and `<bridge command> --help` exit 0.
168
+ - A page that died at start answers in seconds, not over 100: the wait counts errors from before the command, and the bridge's headless page records them from its first line.
169
+ - `new-game --open-world` games start with `presets.weather.temperate`, so `state weather=rain` works in them.
170
+ - `threedog how`: searches the api pages and every docs line, not only the AI.md rows and recipe headings; handles word forms (`pixelate`, `arrangement`); orders GLSL or TSL answers by the game's renderer (from `main.js`); says "the docs never use" a word only after a search of every docs line.
171
+ - Calls that did nothing and said nothing now warn or leave a record, none is refused: container start items that do not fit (warn, names the container), `quests.start` on a done quest (warn), a swarm spawned before the first new game or load and cleared by it (warn), `music.stinger` with audio not running (the `music:stinger` event still fires, with `played: false`; it also gets `played: true` when it sounded).
172
+ - Settings: `settings.reset(key?)` puts one value (or all) back to the engine's or the game's default; `resetBindings()` still does keys.
173
+ - Docs: `readParams` throws on a wrong type in every build (only an unknown key is dev-only); `heightScale` wording; recipe 11 sample car drives 20 m in 3 s; swarm in the new game's CLAUDE.md and GAMEMAP "Not used yet".
174
+
175
+ - Assets: manifest entries whose `fallback` names loop back (a to b to a) now fail once with `asset-fallback-cycle` naming the chain, instead of waiting on each other forever.
176
+ - Sky: removed the options `moonSize`, `starScale`, `gradientCurve`, `orbitTilt`, `orbitSway`. They only set the start value of a uniform or field that stays writable (`engine.uniforms.uMoonSize` etc.), so the engine keeps one entry, not two; using one throws `sky-option` naming the entry. Notes in `docs/MIGRATING-0.8.md`.
177
+ - `engine.remove` keeps a geometry or material another object in the scene still uses, and disposes it with its last user. `stream.add`'s default unload goes through it, so unloading one block no longer makes the renderer rebuild every block that shares its models. Code that relied on `remove` disposing a shared geometry at once should dispose it itself. On WebGPU the records of loaded objects now stay until those objects leave the scene, so peak GPU memory is higher (about 110 MB in the city stress run) and levels off.
178
+ - Batching: its per-frame check is bounded in meshes instead of roots, and batched originals stay out of three's walks during the engine's draw (`describe().threePatches`: `batching-draw-walk`). A district of streamed blocks went from about 60-70 ms to about 22 ms a frame.
179
+ - API lock for 1.0: `docs/api-surface.txt` lists every public name with its signature (engine repository only). `threedog check` rule R55 fails when the surface differs from it; a removed or retyped name also needs a line naming it under this heading. `threedog api-count --lock` rewrites the snapshot. The old `api count` total guard is gone (the snapshot covers it).
180
+
181
+ ## 0.7.1 (2026-11-05)
182
+
183
+ Never on npm: it reaches users inside 0.8.0. Bug fixes for asset lifetime, WebGPU memory and `assets optimize`, plus new optional tools; nothing public was removed. Upgrade notes are in `docs/MIGRATING-0.8.md`.
184
+
185
+ - Asset lifetime: a load now owns its data. Copies of a model that fell back count on the entry that really has the data, so `assets.trim()` and `release` no longer free what those copies use, and `modelNow` works for such a name. `users('shrub')` is the copies asked for by that name; `users('rock')`, the name it fell back to, counts them too. When the fallback's data is freed, the name loads again on its next use.
186
+ - A load ended while it runs (`release`, `trim`, a palette write, a name registered again, `dispose`) is freed when it arrives and never written back; a download is aborted, and a font never reaches `document.fonts`. Code awaiting it: after `release` and the like it gets a fresh load, never freed data; after `dispose` the promise stays pending for good, and so does any later `model()` / `texture()` / `font()`, so nothing rejects during teardown or resumes against a dead engine.
187
+ - A palette write no longer leaves a generated model's old build behind: it is freed with its last copy, or at once with none. Registering a name again does the same. Generated textures and internal `cached()` builds stay as they were, because nothing counts who uses them.
188
+ - Recipe 18 §4b follows one object from creation to removal and says who owns what at each step.
189
+ - New `--json` on `threedog check` and `threedog test`: one result on stdout, `{ ok, summary, items: [{ code, level, file, line, message, fix }] }` (fields only when known); the text goes to stderr and the exit code is unchanged. Items carry the rule id, the TS code, `content` or `test`, and the rule's fix. The MCP `check` tool reads this shape instead of parsing text.
190
+ - `new-game` and `init` write `AGENTS.md` beside `CLAUDE.md` (the same text) for tools that do not read CLAUDE.md; an existing `AGENTS.md` is kept.
191
+ - New optional module `swarm()`: many same-kind gameplay objects (bullets, enemy crowds, pickups, debris) in typed arrays, one `InstancedMesh` each. `engine.swarm({ name, capacity, geometry, material, fields })`, then `spawn`, `free`, `row`, `onStep`, `near`, `clear`, `dispose`. Stable handles, fixed-step update on a time channel, drawing smoothed between fixed steps, opt-in saves. Recipe 65. Nothing changes for a game that does not install it.
192
+ - New `engine.stepBlend`: how far the drawn frame is between two fixed steps, for drawing fixed-step state smoothly.
193
+ - New `threedog content stamp`, `content set --source` and `content capture`: copy an arrangement (`content/arrangements/<name>.js`, read by tools only) into plain entries, batch-edit every copy explicitly, and capture a named group from the running game into an arrangement. Rule R52 warns while a captured and stamped group is still named in code.
194
+ - Recipe 65 shows pure-picture bulk with TSL compute on WebGPU (plain three.js, no engine API).
195
+ - WebGPU memory: a mesh dropped while its material stayed in use kept its render record, geometry arrays and GPU buffers until the renderer died. The engine now sweeps these records every few seconds, for engine paths and plain `scene.remove` alike, so a game has nothing to do (recipe 56): a plain three.js scene dropping 60,000 meshes went from 1.1 GB of heap to a flat 200-260 MB, and a 7.8 km terrain flight from +72 MB to +25 MB, flat to 15.6 km. It reads a private three.js list; if an upgrade moves it, the sweep turns off with the warning `webgpu-records-unread`. `threePatches.off('webgpu-record-sweep')` switches it off.
196
+ - Dev warning `geometry-undisposed`: geometries nothing in the scene uses keep piling up on the renderer. The fix is `geometry.dispose()` when a mesh is gone for good.
197
+ - `threedog check` rule R53 fails on merge conflict markers committed in any tracked text file.
198
+ - `threedog assets optimize`: the optimized pack now comes last in `assets.js` (a game rewritten by the old command is moved over), so `/optimized/x.glb` wins over an original of the same name, and that override no longer prints the "replaced by manifest" warning. A cached model is no longer skipped from the problem count: `--strict` and a lower `--budget` judge it like a fresh run. `module-cycle` no longer fails with an internal TypeError when the first module in the list only waits behind a cycle.
199
+
5
200
  ## 0.7.0 (2026-11-05)
6
201
 
7
202
  - Public surface audit (`threedog api-count --unused`): removed `engine.level.object` (same as `level.root`); dropped from the public types (code stays, engine-internal) `engine.triggers.action`, `engine.settings.action`, `engine.interactions.action` (copies of the module option), `engine.inventory.defs`, `engine.quests.defs` (use `inventory.item(id)` and `quests.list()`). 98 more unused names are kept on purpose, each with a reason in `packages/tools/api-count.mjs`
@@ -26,7 +221,7 @@ What changed in each version and how a game upgrades.
26
221
  - New: picture parts. `PICTURE_SLOTS` and the type `PictureSlot` name the picture values only one writer may hold (sky, fog, tone, environment, background, sun); `describe('picture').picture.slots` shows the holders; `engine.unuse(name)` removes a module. On the dev server a write to a value another part holds warns `picture-held`, and a removed picture part's leftovers warn `picture-leftover` (recipes/62-picture-code.md 3e).
27
222
  - Fixed: the sky dome stayed in the scene after `engine.use(mySky(), { replaces: 'sky' })`.
28
223
  - Breaking: `look` no longer names picture things. The game folder is `picture/` and `createPicture(engine)`, gameplay calls `picture.lamp(id)`; the module type is `'picture'`; the drawing parts are `terrainDraw`, `vegetationDraw`, `weatherDraw` with slots `terrain-draw`, `vegetation-draw`.
29
- - Breaking: the look check is the picture check: `--no-picture`, `picture` and `pictureMs` in `shot --json`, the `Picture intent:` line in DESIGN.md, `lib add --kind picture`, `@threedog/tools/picture-check`. Seven recipes and the `plain-picture` example are renamed. Every old and new name is in MIGRATING-0.6.md.
224
+ - Breaking: the look check is the picture check: `--no-picture`, `picture` and `pictureMs` in `shot --json`, the `Picture intent:` line in DESIGN.md, `lib add --kind picture`, `@threedog/tools/picture-check`. Seven recipes and the `plain-picture` example are renamed.
30
225
  - New (dev server only): `describe('picture').writers` and `engine.explain({ picture: 'fog.far' })` (`threedog explain picture fog.far`) name the file:line that last changed a light, fog, tone, environment, background or material value; a value not tracked says so. Two places writing one value in one frame with different results give one warning (`picture-conflict`) naming both. The look check adds measured facts: a `ShaderMaterial` that ignores fog or tone, a light layout changed during play, transparent meshes whose pixels depend on draw order. Recipe 62 "Wiring `picture/` parts".
31
226
  - Breaking: `makeMaterial`, `engine.makeMaterial`, `look.materials`, `look.surface` and the glow verb are gone, and so are the material and patch plugin slots: materials are plain three.js. New: `applyEffects(mat, { lighting })`, `rampTexture`, the `uNight` signal.
32
227
  - Breaking: `createEngine({ style })` is gone and throws with the fix: the look is plain three.js in the game's `picture/` code, UI colors go in `createEngine({ ui })`, season tints are `engine.sky.seasonTints`; `types/style.d.ts` and `core/styleParts.js` are deleted.
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  A web 3D game engine on three.js 0.187: **core** (rendering, main loop, input, audio, saving, UI) -> **modules** (terrain, sky and weather, physics, characters, dialogue, inventory, quests... installed on demand); all art is the game's own (`picture/` folder, `assets.js`).
4
4
 
5
5
  ## Install
6
- This README describes threedog 0.7.0 (older releases on npm do not match it; upgrade steps are in `docs/MIGRATING-0.7.md`). To work on the engine itself, clone the [repository](https://github.com/penstic123-code/ThreeDog.js-Game-Engine), run `npm install`, then `npm run new-game -- my-game`. A game in its own folder:
6
+ This README describes threedog 0.8.0 (older releases do not match it; upgrade steps are in `docs/MIGRATING-0.8.md`). To work on the engine itself, clone the [repository](https://github.com/penstic123-code/Threedog.js-Game-Engine), run `npm install`, then `npm run new-game -- my-game`. A game in its own folder:
7
7
  ```sh
8
- npm install threedog@0.7 three@~0.187.0
9
- npm install @threedog/terrain-noise@0.7 # optional: the noise terrain generator terrainPreset() (without one the ground is flat)
10
- npm install -D vite @threedog/tools@0.7 # optional: the vite preset and the threedog command line
8
+ npm install threedog@0.8 three@~0.187.0
9
+ npm install @threedog/terrain-noise@0.8 # optional: the noise terrain generator terrainPreset() (without one the ground is flat)
10
+ npm install -D vite @threedog/tools@0.8 # optional: the vite preset and the threedog command line
11
11
  ```
12
- Then let it set up the folder: `node node_modules/@threedog/tools/bin/threedog.mjs init` (flags: `--open-world` for generated ground, sky, follow camera and a player; the default is a blank scene with a camera and a gray starter picture in `picture/`) writes index.html, main.js, vite.config.js, content/, CLAUDE.md and `.mcp.json` (Claude Code then starts the threedog MCP server by itself), never overwriting a file you have.
12
+ Then let it set up the folder: `npx threedog init` (flags: `--open-world` for generated ground, sky, follow camera and a player; the default is a blank scene with a camera and a gray starter picture in `picture/`) writes index.html, main.js, vite.config.js, content/, CLAUDE.md and `.mcp.json` (Claude Code then starts the threedog MCP server by itself), never overwriting a file you have. Finish with `npm install` (for what the new files need) and `npm run dev`.
13
13
  `three` is a peer dependency: your game and the engine share one copy. Types for three come with the engine (`@types/three`, same version), so `// @ts-check` JS and TypeScript both see real three.js types.
14
14
 
15
15
  ## Minimal usage
@@ -38,10 +38,7 @@ The picture is the game's own: plain three.js in its `picture/` folder (what `th
38
38
  Nothing else is a public path; files under `core/`, `modules/` etc. may move between versions.
39
39
 
40
40
  ## Changes to three.js
41
- The engine changes three.js in a few places, because three.js has no per-object hook for what it needs. `describe().threePatches` lists every one at run time, `threePatches.off(id)` turns off the ones that can be turned off, and `docs/THREE.md` says what each does to your code. Importing the engine does these page-wide:
42
- - `Object3D.prototype.add` / `remove` are wrapped once, so `scene.add` is adopted like `engine.add`.
43
- - `Mesh.prototype.customDepthMaterial` and `customDistanceMaterial` become accessors: when nothing was assigned, a mesh whose material has engine vertex patches (wind sway) returns a matching depth material, so its shadow moves with it. Assigning a value still wins; assigning `undefined` restores the default.
44
- - `THREE.ShaderChunk` gains `threedog_*` entries (new names, none of three's replaced).
41
+ The engine changes three.js in a few places, because three.js has no per-object hook for what it needs. `describe().threePatches` lists every one at run time, `threePatches.off(id)` turns off the ones that can be turned off, and `docs/THREE.md` is the full list, with what each does to your code.
45
42
 
46
43
  Raycasting is not a global change: a mesh registered as static gets its own bounds tree and its own `raycast`; `Mesh.prototype.raycast` is untouched.
47
44
 
@@ -16,8 +16,9 @@
16
16
  // Rule: animation is presentation; gameplay timing must not read it. The mixer advances per frame (dropped frames, step's frameEvery or a disposed model all skew it),
17
17
  // so hit windows, stun and cooldowns count in fixed steps, and sync(state, t) is how that gameplay time reaches the pose: the clip never runs ahead or ends by itself.
18
18
  import * as THREE from 'three';
19
- import { warnOnce, warnMissing, missingText } from './validate.js';
20
- import { readParams, keysSchema, isOptions } from './params.js';
19
+ import { warnOnce, warnMissing, missingText } from '../base/validate.js';
20
+ import { readParams, keysSchema } from '../base/params.js';
21
+ import { isOptions } from '../base/util.js';
21
22
  const GO_KEYS = ['fade'];
22
23
 
23
24
  // Config keys: a typo (loops: false, state: {...}) would silently play the wrong thing, so both levels are checked like any other options
@@ -26,7 +27,7 @@ const STATE_KEYS = ['clip', 'blend', 'param', 'sync', 'loop', 'then', 'lock', 't
26
27
 
27
28
  /**
28
29
  * Find a clip by exact name, else by the part after the last '|' ('Idle' finds 'CharacterArmature|Idle').
29
- * @example findClip(model.userData.animations, 'Sword_Slash')
30
+ * @example findClip(model.animations, 'Sword_Slash')
30
31
  */
31
32
  export function findClip(clips, name) {
32
33
  return THREE.AnimationClip.findByName(clips, name) ?? clips.find(c => c.name.slice(c.name.lastIndexOf('|') + 1) === name) ?? null;
@@ -34,6 +35,8 @@ export function findClip(clips, name) {
34
35
  const short = n => n.slice(n.lastIndexOf('|') + 1);
35
36
  const r3 = v => Math.round(v * 1000) / 1000;
36
37
 
38
+ const ONE = Object.freeze([1]); // the blend split of a plain state
39
+
37
40
  export class Animator {
38
41
  /** mappedIn (from Assets.animate): { label, states } when part of the mapping came from the manifest, so fix texts point at the data, not at code */
39
42
  constructor(engine, root, config = {}, mappedIn = null) {
@@ -48,7 +51,7 @@ export class Animator {
48
51
  this.transitions = transitions;
49
52
  this.params = { speed: 0, ...params };
50
53
  this.mixer = new THREE.AnimationMixer(root);
51
- this.clips = root.userData.animations || [];
54
+ this.clips = root.animations;
52
55
  this.actions = new Map(); // clip name (as written in the state) -> three.js AnimationAction
53
56
  this.state = null;
54
57
  this._layers = []; // states being shown: { name, def, w, target, rate, actions: [{ a, clip }], driven }
@@ -61,7 +64,7 @@ export class Animator {
61
64
  if (this.hasClips) {
62
65
  this._check();
63
66
  this.mixer.addEventListener('finished', ev => this._finished(ev.action));
64
- this._hook = engine.onFrame(dt => this.update(dt));
67
+ this._hook = engine._onAnimate(dt => this.update(engine.still ? 0 : dt));
65
68
  }
66
69
  }
67
70
  /** Dev check at build time: the same problems check() returns, minus the game's action list (the Animator does not know it). */
@@ -134,14 +137,15 @@ export class Animator {
134
137
  if (!def) { warnMissing('animState', state, Object.keys(this.states)); return null; }
135
138
  const actions = (def.blend ? def.blend.map(b => b.clip) : [def.clip]).map(clip => ({ a: this._action(clip), clip }));
136
139
  if (actions.some(x => !x.a)) return null; // missing clip: already reported by _check
137
- const f = this._fadeFor(this.state, state, fade), rate = f > 0 ? 1 / f : Infinity;
140
+ const f = this._fadeFor(this.state, state, fade), rate = f > 0 ? 1 / f : 1e9; // not Infinity: 0 * Infinity (dt 0 behind a full still) is NaN
138
141
  for (const l of this._layers) { l.target = 0; l.rate = rate; }
139
142
  let layer = this._layers.find(l => l.name === state);
140
143
  if (!layer) {
141
144
  layer = { name: state, def, w: this._layers.some(l => l.w > 0) ? 0 : 1, actions }; // the first state shows immediately
142
145
  this._layers.push(layer);
143
146
  for (const { a } of actions) {
144
- a.reset().setEffectiveWeight(0);
147
+ // a clip another layer is playing keeps its time (states may share a clip); a fresh one starts over, at the speed a blend may have left on it
148
+ if (!this._held1(a, layer)) a.reset().setEffectiveTimeScale(1).setEffectiveWeight(0);
145
149
  if (def.loop === false) { a.setLoop(THREE.LoopOnce, 1); a.clampWhenFinished = true; } else a.setLoop(THREE.LoopRepeat, Infinity);
146
150
  a.play();
147
151
  }
@@ -161,8 +165,9 @@ export class Animator {
161
165
  }
162
166
  const a = this.go(name, opts);
163
167
  if (a && this.state === name) {
164
- this._layers.find(l => l.name === name).once = true; // not interrupted by the character's per-frame go() until it ends
165
- if (!this.states[name].then) this._return = prev;
168
+ // only a clip that ends can hold the state until it ends: a looping state would lock the animator for good
169
+ if (this.states[name].loop === false) this._layers.find(l => l.name === name).once = true; // not interrupted by the character's per-frame go() until it ends
170
+ if (!this.states[name].then && prev !== name) this._return = prev; // a repeat press of the same action keeps the state to go back to
166
171
  }
167
172
  return a;
168
173
  }
@@ -222,10 +227,12 @@ export class Animator {
222
227
 
223
228
  /** @internal Per frame: advance fades, split blend-tree weights by parameter, sync stride, then advance the mixer (the engine calls it). */
224
229
  update(dt) {
230
+ if (this._held) { this.afterPose?.(dt); return; } // physics owns the bones (a ragdoll): the mixer writes nothing, attachments still follow the pose
225
231
  let j = 0; // fade, stop faded-out layers and compact in place (no arrays per frame)
226
232
  for (const l of this._layers) {
227
- l.w = l.target > l.w ? Math.min(1, l.w + dt * l.rate) : Math.max(0, l.w - dt * l.rate);
228
- if (l.w === 0 && l.target === 0) { for (const { a } of l.actions) a.setEffectiveWeight(0).stop(); continue; }
233
+ if (l.w < l.target) l.w = Math.min(l.target, l.w + dt * l.rate);
234
+ else if (l.w > l.target) l.w = Math.max(l.target, l.w - dt * l.rate);
235
+ if (l.w === 0 && l.target === 0) { for (const { a } of l.actions) if (!this._held1(a, l)) a.setEffectiveWeight(0).stop(); continue; }
229
236
  this._layers[j++] = l;
230
237
  }
231
238
  this._layers.length = j;
@@ -233,18 +240,21 @@ export class Animator {
233
240
  this.mixer.update(dt);
234
241
  this.afterPose?.(dt); // Character.onPose callbacks (the pose is final here)
235
242
  }
243
+ /** @internal is action a also held by a live layer other than l? (states may share a clip, and three keeps one action per clip) */
244
+ _held1(a, l) { return this._layers.some(o => o !== l && !(o.w === 0 && o.target === 0) && o.actions.some(x => x.a === a)); }
236
245
  _weights() {
237
246
  let total = 0;
238
- for (const l of this._layers) total += l.w;
247
+ for (const l of this._layers) { total += l.w; for (const x of l.actions) x.a.setEffectiveWeight(0); }
239
248
  for (const l of this._layers) {
240
- const lw = total > 0 ? l.w / total : 0, bw = l.def.blend ? this._blend(l.def) : [1];
249
+ const lw = total > 0 ? l.w / total : 0, bw = l.def.blend ? this._blend(l.def) : ONE;
241
250
  let dur = 0;
242
- l.actions.forEach((x, i) => { dur += bw[i] * x.a.getClip().duration; });
243
- l.actions.forEach((x, i) => {
244
- x.a.setEffectiveWeight(lw * bw[i]);
251
+ for (let i = 0; i < l.actions.length; i++) dur += bw[i] * l.actions[i].a.getClip().duration;
252
+ for (let i = 0; i < l.actions.length; i++) {
253
+ const { a } = l.actions[i];
254
+ a.setEffectiveWeight(a.weight + lw * bw[i]); // added: two layers on one clip each give their share
245
255
  // blended actions share one beat (walk and run footfalls land together)
246
- if (l.def.blend && l.def.sync !== false && dur > 0) x.a.setEffectiveTimeScale(x.a.getClip().duration / dur);
247
- });
256
+ if (l.def.blend && l.def.sync !== false && dur > 0) a.setEffectiveTimeScale(a.getClip().duration / dur);
257
+ }
248
258
  }
249
259
  }
250
260
  /** Blend-tree weights: a parameter between two `at` values splits proportionally across the two neighbours. */