threedog 0.2.1 → 0.7.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 (725) hide show
  1. package/CHANGELOG.md +371 -1
  2. package/README.md +21 -12
  3. package/core/Animator.js +15 -12
  4. package/core/Assets.js +92 -26
  5. package/core/Audio.js +45 -38
  6. package/core/Baked.js +30 -15
  7. package/core/Batching.js +102 -15
  8. package/core/Budget.js +40 -19
  9. package/core/Clock.js +40 -80
  10. package/core/DebugOverrides.js +75 -25
  11. package/core/Describe.js +105 -45
  12. package/core/Engine.js +203 -75
  13. package/core/Events.js +4 -1
  14. package/core/I18n.js +25 -13
  15. package/core/Input.js +175 -80
  16. package/core/Inspect.js +8 -5
  17. package/core/InspectMaterials.js +84 -0
  18. package/core/InspectPerf.js +68 -0
  19. package/core/InspectScene.js +13 -2
  20. package/core/Loading.js +2 -1
  21. package/core/MaterialInfo.js +7 -5
  22. package/core/Ops.js +50 -9
  23. package/core/Random.js +9 -2
  24. package/core/Rays.js +12 -7
  25. package/core/SaveStore.js +41 -9
  26. package/core/Saves.js +71 -15
  27. package/core/Stream.js +13 -10
  28. package/core/Threads.js +26 -7
  29. package/core/UrlState.js +69 -13
  30. package/core/Views.js +10 -6
  31. package/core/actor.js +1 -1
  32. package/core/adaptive.js +93 -0
  33. package/core/assetEntry.js +27 -7
  34. package/core/assetHot.js +176 -0
  35. package/core/assetLoad.js +44 -19
  36. package/core/assetManifest.js +53 -11
  37. package/core/assetReport.js +5 -5
  38. package/core/audioRules.js +13 -11
  39. package/core/audioVoice.js +69 -42
  40. package/core/batchGroups.js +9 -1
  41. package/core/canvasBox.js +1 -2
  42. package/core/catalog.js +21 -5
  43. package/core/cells.js +62 -0
  44. package/core/checks.js +10 -8
  45. package/core/chunkStream.js +87 -0
  46. package/core/control.js +149 -0
  47. package/core/copies.js +32 -0
  48. package/core/dayTime.js +12 -6
  49. package/core/debugView.js +85 -18
  50. package/core/describeRender.js +117 -21
  51. package/core/describeText.js +41 -21
  52. package/core/engineCamera.js +32 -0
  53. package/core/errorCodes.js +478 -32
  54. package/core/errorHints.js +41 -142
  55. package/core/errors.js +31 -8
  56. package/core/events.generated.js +13 -7
  57. package/core/gameLights.js +69 -0
  58. package/core/grayMap.js +20 -0
  59. package/core/grid.js +14 -13
  60. package/core/gridLoad.js +2 -1
  61. package/core/ground.js +6 -4
  62. package/core/headlessLoad.js +55 -0
  63. package/core/holds.js +78 -50
  64. package/core/inputContext.js +11 -7
  65. package/core/inputDefaults.js +24 -21
  66. package/core/inputPad.js +1 -1
  67. package/core/inputPointer.js +1 -1
  68. package/core/inputTouch.js +2 -2
  69. package/core/lifecycle.js +46 -12
  70. package/core/lightWatch.js +9 -5
  71. package/core/loop.js +109 -43
  72. package/core/math.js +18 -3
  73. package/core/moduleSlots.js +100 -0
  74. package/core/moduleTypes.js +86 -0
  75. package/core/modules.js +147 -29
  76. package/core/movement.js +2 -2
  77. package/core/namedModel.js +74 -0
  78. package/core/opsCheck.js +3 -3
  79. package/core/opsFail.js +15 -6
  80. package/core/opsGuard.js +4 -4
  81. package/core/opsRun.js +4 -3
  82. package/core/owned.js +171 -0
  83. package/core/page.js +44 -10
  84. package/core/params.js +30 -8
  85. package/core/pictureSlots.js +33 -0
  86. package/core/pictureWriters.js +343 -0
  87. package/core/plugins.js +245 -0
  88. package/core/saveApply.js +99 -17
  89. package/core/saveFiles.js +8 -6
  90. package/core/saveValues.js +46 -0
  91. package/core/saveVersions.js +20 -3
  92. package/core/scatter.js +48 -19
  93. package/core/sceneDelta.js +211 -0
  94. package/core/sceneMethods.js +31 -33
  95. package/core/screenToGround.js +1 -1
  96. package/core/services.js +27 -11
  97. package/core/session.js +28 -25
  98. package/core/shaderCost.js +78 -0
  99. package/core/shadowTypes.js +3 -2
  100. package/core/shadows.js +405 -0
  101. package/core/sharedPoint.js +303 -0
  102. package/core/skip.js +36 -28
  103. package/core/stackFrames.js +45 -0
  104. package/core/stacks.js +166 -0
  105. package/core/startup.js +153 -13
  106. package/core/streamSources.js +0 -11
  107. package/core/targeting.js +1 -1
  108. package/core/textureBytes.js +20 -0
  109. package/core/thingExplain.js +3 -3
  110. package/core/thingOps.js +29 -6
  111. package/core/things.js +22 -12
  112. package/core/threadPure.js +7 -3
  113. package/core/threePatches.js +47 -0
  114. package/core/tier.js +21 -10
  115. package/core/time.js +236 -0
  116. package/core/uiClock.js +25 -0
  117. package/core/util.js +8 -2
  118. package/core/validate.js +66 -87
  119. package/core/view.js +43 -0
  120. package/core/wrap.js +106 -0
  121. package/docs/AI.md +95 -104
  122. package/docs/API.md +35 -31
  123. package/docs/CODEMAP.md +231 -176
  124. package/docs/COMMANDS.md +63 -39
  125. package/docs/CONVENTIONS.md +99 -31
  126. package/docs/MIGRATING-0.3.md +248 -0
  127. package/docs/MIGRATING-0.4.md +320 -0
  128. package/docs/MIGRATING-0.5.md +68 -0
  129. package/docs/MIGRATING-0.6.md +126 -0
  130. package/docs/MIGRATING-0.7.md +39 -0
  131. package/docs/PERF.md +35 -7
  132. package/docs/THREE.md +82 -28
  133. package/docs/api/ambience.md +0 -1
  134. package/docs/api/assets.md +15 -11
  135. package/docs/api/audio.md +10 -14
  136. package/docs/api/budget.md +4 -0
  137. package/docs/api/calendar.md +41 -0
  138. package/docs/api/cameraRig.md +16 -5
  139. package/docs/api/characters.md +41 -24
  140. package/docs/api/clock.md +6 -5
  141. package/docs/api/collision.md +10 -7
  142. package/docs/api/content.md +6 -4
  143. package/docs/api/dialogue.md +9 -9
  144. package/docs/api/engine.md +95 -65
  145. package/docs/api/events.md +20 -14
  146. package/docs/api/grids.md +10 -3
  147. package/docs/api/ground.md +1 -1
  148. package/docs/api/hud.md +5 -2
  149. package/docs/api/i18n.md +1 -1
  150. package/docs/api/input.md +13 -7
  151. package/docs/api/interactions.md +10 -6
  152. package/docs/api/inventory.md +17 -17
  153. package/docs/api/level.md +0 -2
  154. package/docs/api/lightPool.md +3 -1
  155. package/docs/api/music.md +1 -1
  156. package/docs/api/nav.md +3 -0
  157. package/docs/api/occlusion.md +5 -0
  158. package/docs/api/openWorld.md +2 -1
  159. package/docs/api/particles.md +6 -3
  160. package/docs/api/photo.md +0 -2
  161. package/docs/api/pickups.md +21 -0
  162. package/docs/api/post.md +8 -5
  163. package/docs/api/quests.md +2 -3
  164. package/docs/api/rigid.md +16 -14
  165. package/docs/api/saves.md +6 -4
  166. package/docs/api/settings.md +2 -3
  167. package/docs/api/sky.md +18 -49
  168. package/docs/api/stream.md +1 -1
  169. package/docs/api/terrain.md +16 -7
  170. package/docs/api/terrainDraw.md +12 -0
  171. package/docs/api/timeline.md +3 -4
  172. package/docs/api/tools.md +32 -15
  173. package/docs/api/triggers.md +7 -10
  174. package/docs/api/vegetation.md +17 -9
  175. package/docs/api/vegetationDraw.md +10 -0
  176. package/docs/api/water.md +9 -21
  177. package/docs/api/weather.md +10 -15
  178. package/docs/api/weatherDraw.md +10 -0
  179. package/docs/api/world.md +3 -2
  180. package/docs/recipes/01-new-game.md +52 -42
  181. package/docs/recipes/02-npc.md +24 -7
  182. package/docs/recipes/03-items-pickups.md +57 -22
  183. package/docs/recipes/04-quests.md +12 -5
  184. package/docs/recipes/05-props-bake.md +174 -22
  185. package/docs/recipes/06-clock-events.md +100 -52
  186. package/docs/recipes/07-flow-scenes-pause.md +50 -10
  187. package/docs/recipes/08-weather-sky.md +134 -37
  188. package/docs/recipes/09-materials-lights-models.md +185 -0
  189. package/docs/recipes/10-blender-level.md +16 -4
  190. package/docs/recipes/11-vehicles.md +67 -10
  191. package/docs/recipes/13-animation.md +23 -9
  192. package/docs/recipes/14-custom-module.md +63 -29
  193. package/docs/recipes/15-perf.md +31 -10
  194. package/docs/recipes/16-dev-bridge.md +74 -40
  195. package/docs/recipes/18-world.md +26 -14
  196. package/docs/recipes/19-shooting-picking.md +12 -10
  197. package/docs/recipes/20-content-actions-save.md +60 -18
  198. package/docs/recipes/21-camera.md +55 -17
  199. package/docs/recipes/22-shop-gold.md +3 -3
  200. package/docs/recipes/23-ops.md +17 -11
  201. package/docs/recipes/26-ui-parts.md +86 -13
  202. package/docs/recipes/27-net.md +11 -5
  203. package/docs/recipes/28-terrain.md +36 -3
  204. package/docs/recipes/29-grid.md +46 -19
  205. package/docs/recipes/30-templates.md +72 -15
  206. package/docs/recipes/31-audio.md +20 -12
  207. package/docs/recipes/32-action-game.md +51 -4
  208. package/docs/recipes/34-environment-lighting.md +108 -21
  209. package/docs/recipes/35-picture-from-reference.md +147 -0
  210. package/docs/recipes/36-sky-ground-plants.md +158 -0
  211. package/docs/recipes/{37-terrain-look-hooks.md → 37-terrain-hooks.md} +9 -12
  212. package/docs/recipes/38-environment-hooks.md +67 -0
  213. package/docs/recipes/40-scene.md +114 -32
  214. package/docs/recipes/42-terrain-shape.md +2 -2
  215. package/docs/recipes/43-shader-patches-surfaces.md +206 -0
  216. package/docs/recipes/44-water-weather-hooks.md +191 -0
  217. package/docs/recipes/45-cascaded-shadows.md +130 -23
  218. package/docs/recipes/46-blender-art-route.md +17 -20
  219. package/docs/recipes/47-island-snow-backdrop.md +13 -15
  220. package/docs/recipes/49-game-module-contract.md +30 -17
  221. package/docs/recipes/50-own-renderer.md +4 -4
  222. package/docs/recipes/51-capability-catalog.md +3 -3
  223. package/docs/recipes/52-around-the-picture.md +181 -0
  224. package/docs/recipes/53-ground-up-close.md +12 -12
  225. package/docs/recipes/54-three-idioms.md +88 -0
  226. package/docs/recipes/55-mods-time-wrap.md +124 -0
  227. package/docs/recipes/56-webgpu-tsl.md +303 -0
  228. package/docs/recipes/57-control.md +104 -0
  229. package/docs/recipes/58-input.md +60 -0
  230. package/docs/recipes/59-depth-post-effects.md +83 -0
  231. package/docs/recipes/60-judge-the-picture.md +70 -0
  232. package/docs/recipes/61-deploy.md +27 -0
  233. package/docs/recipes/62-picture-code.md +244 -0
  234. package/docs/recipes/63-third-person-start.md +77 -0
  235. package/docs/recipes/64-particles.md +35 -0
  236. package/examples/action/.threedog/content-index.json +1 -0
  237. package/examples/action/GAMEMAP.md +20 -14
  238. package/examples/action/assets.js +8 -0
  239. package/examples/action/content/actions.js +1 -1
  240. package/examples/action/content/audio.js +5 -5
  241. package/examples/action/main.js +12 -15
  242. package/examples/action/models.js +23 -24
  243. package/examples/action/picture/index.js +13 -0
  244. package/examples/action/picture/lights.js +35 -0
  245. package/examples/action/picture/materials.js +8 -0
  246. package/examples/action/picture/palette.js +33 -0
  247. package/examples/plain-picture/.threedog/content-index.json +1 -0
  248. package/examples/plain-picture/FINDINGS.md +53 -0
  249. package/examples/plain-picture/GAMEMAP.md +90 -0
  250. package/examples/plain-picture/main.js +48 -0
  251. package/examples/plain-picture/picture/index.js +21 -0
  252. package/examples/plain-picture/picture/lights.js +54 -0
  253. package/examples/plain-picture/picture/materials.js +24 -0
  254. package/examples/plain-picture/picture/palette.js +16 -0
  255. package/examples/plain-picture/picture/sky.js +37 -0
  256. package/examples/pullable.json +133 -0
  257. package/examples/rc2d/.threedog/content-index.json +1 -0
  258. package/examples/rc2d/GAMEMAP.md +88 -0
  259. package/examples/rc2d/README.md +57 -0
  260. package/examples/rc2d/main.js +55 -0
  261. package/examples/rc2d/picture/index.js +18 -0
  262. package/examples/rc2d/picture/lights.js +11 -0
  263. package/examples/rc2d/picture/materials.js +18 -0
  264. package/examples/rc2d/picture/palette.js +15 -0
  265. package/examples/rc2d/picture/post.js +11 -0
  266. package/examples/rc2d/rc2d.js +187 -0
  267. package/examples/rc2d/shaders.js +144 -0
  268. package/examples/sheepisland/.threedog/content-index.json +1 -0
  269. package/examples/sheepisland/GAMEMAP.md +22 -17
  270. package/examples/sheepisland/assets.js +5 -0
  271. package/examples/sheepisland/content/templates.js +1 -1
  272. package/examples/sheepisland/content/vegetation.js +3 -1
  273. package/examples/sheepisland/main.js +29 -18
  274. package/examples/sheepisland/{style/models.js → models.js} +13 -24
  275. package/examples/sheepisland/picture/index.js +20 -0
  276. package/examples/sheepisland/picture/lights.js +34 -0
  277. package/examples/sheepisland/picture/materials.js +61 -0
  278. package/examples/sheepisland/picture/palette.js +60 -0
  279. package/examples/sheepisland/picture/sky.js +20 -0
  280. package/examples/sheepisland/views.js +1 -1
  281. package/examples/styletest/.threedog/content-index.json +1 -0
  282. package/examples/styletest/GAMEMAP.md +25 -22
  283. package/examples/styletest/assets.js +6 -0
  284. package/examples/styletest/content/templates.js +1 -1
  285. package/examples/styletest/content/vegetation.js +1 -1
  286. package/examples/styletest/main.js +25 -34
  287. package/examples/styletest/models.js +30 -30
  288. package/examples/styletest/params.js +2 -5
  289. package/examples/styletest/picture/env.js +38 -0
  290. package/examples/styletest/picture/index.js +16 -0
  291. package/examples/styletest/picture/lights.js +9 -0
  292. package/examples/styletest/picture/materials.js +28 -0
  293. package/examples/styletest/picture/palette.js +22 -0
  294. package/examples/techniques/contact-shadows/README.md +91 -0
  295. package/examples/techniques/contact-shadows/contactShadows.js +67 -0
  296. package/examples/techniques/contact-shadows/main.js +55 -0
  297. package/examples/techniques/contact-shadows/picture/index.js +14 -0
  298. package/examples/techniques/contact-shadows/picture/lights.js +34 -0
  299. package/examples/techniques/contact-shadows/picture/materials.js +12 -0
  300. package/examples/techniques/contact-shadows/picture/palette.js +17 -0
  301. package/examples/techniques/day-night-grade/README.md +83 -0
  302. package/examples/techniques/day-night-grade/main.js +41 -0
  303. package/examples/techniques/day-night-grade/picture/index.js +20 -0
  304. package/examples/techniques/day-night-grade/picture/lights.js +45 -0
  305. package/examples/techniques/day-night-grade/picture/materials.js +15 -0
  306. package/examples/techniques/day-night-grade/picture/palette.js +59 -0
  307. package/examples/techniques/day-night-grade/picture/post.js +25 -0
  308. package/examples/techniques/day-night-grade/picture/sky.js +33 -0
  309. package/examples/techniques/interior-light/README.md +106 -0
  310. package/examples/techniques/interior-light/interiorLight.js +47 -0
  311. package/examples/techniques/interior-light/main.js +87 -0
  312. package/examples/techniques/interior-light/picture/index.js +24 -0
  313. package/examples/techniques/interior-light/picture/lights.js +52 -0
  314. package/examples/techniques/interior-light/picture/materials.js +13 -0
  315. package/examples/techniques/interior-light/picture/palette.js +32 -0
  316. package/examples/techniques/interior-light/picture/sky.js +40 -0
  317. package/examples/techniques/modular-building/README.md +126 -0
  318. package/examples/techniques/modular-building/kit.js +426 -0
  319. package/examples/techniques/modular-building/main.js +39 -0
  320. package/examples/techniques/modular-building/picture/index.js +17 -0
  321. package/examples/techniques/modular-building/picture/lights.js +26 -0
  322. package/examples/techniques/modular-building/picture/materials.js +13 -0
  323. package/examples/techniques/modular-building/picture/palette.js +23 -0
  324. package/examples/techniques/night-lights/README.md +95 -0
  325. package/examples/techniques/night-lights/main.js +47 -0
  326. package/examples/techniques/night-lights/nightLights.js +95 -0
  327. package/examples/techniques/night-lights/picture/index.js +18 -0
  328. package/examples/techniques/night-lights/picture/lights.js +44 -0
  329. package/examples/techniques/night-lights/picture/materials.js +15 -0
  330. package/examples/techniques/night-lights/picture/palette.js +34 -0
  331. package/examples/techniques/night-lights/picture/post.js +9 -0
  332. package/examples/techniques/night-lights/picture/sky.js +36 -0
  333. package/examples/techniques/outlines-and-rim/README.md +59 -0
  334. package/examples/techniques/outlines-and-rim/main.js +61 -0
  335. package/examples/techniques/outlines-and-rim/outlines.js +64 -0
  336. package/examples/techniques/outlines-and-rim/picture/index.js +16 -0
  337. package/examples/techniques/outlines-and-rim/picture/lights.js +18 -0
  338. package/examples/techniques/outlines-and-rim/picture/materials.js +11 -0
  339. package/examples/techniques/outlines-and-rim/picture/palette.js +16 -0
  340. package/examples/techniques/outlines-and-rim/picture/post.js +10 -0
  341. package/examples/techniques/procedural-animation/README.md +79 -0
  342. package/examples/techniques/procedural-animation/creature.js +44 -0
  343. package/examples/techniques/procedural-animation/main.js +47 -0
  344. package/examples/techniques/procedural-animation/picture/index.js +15 -0
  345. package/examples/techniques/procedural-animation/picture/lights.js +35 -0
  346. package/examples/techniques/procedural-animation/picture/materials.js +10 -0
  347. package/examples/techniques/procedural-animation/picture/palette.js +16 -0
  348. package/examples/techniques/procedural-animation/picture/sky.js +31 -0
  349. package/examples/techniques/procedural-animation/proceduralAnim.js +118 -0
  350. package/examples/techniques/procedural-surface/README.md +69 -0
  351. package/examples/techniques/procedural-surface/main.js +65 -0
  352. package/examples/techniques/procedural-surface/picture/index.js +14 -0
  353. package/examples/techniques/procedural-surface/picture/lights.js +18 -0
  354. package/examples/techniques/procedural-surface/picture/materials.js +34 -0
  355. package/examples/techniques/procedural-surface/picture/palette.js +15 -0
  356. package/examples/techniques/procedural-surface/surface.js +120 -0
  357. package/examples/techniques/stylized-shading/README.md +74 -0
  358. package/examples/techniques/stylized-shading/main.js +62 -0
  359. package/examples/techniques/stylized-shading/picture/index.js +14 -0
  360. package/examples/techniques/stylized-shading/picture/lights.js +23 -0
  361. package/examples/techniques/stylized-shading/picture/materials.js +18 -0
  362. package/examples/techniques/stylized-shading/picture/palette.js +19 -0
  363. package/examples/techniques/stylized-shading/shading.js +131 -0
  364. package/examples/techniques/sun-and-key-light/README.md +133 -0
  365. package/examples/techniques/sun-and-key-light/keyLight.js +71 -0
  366. package/examples/techniques/sun-and-key-light/main.js +51 -0
  367. package/examples/techniques/sun-and-key-light/picture/index.js +13 -0
  368. package/examples/techniques/sun-and-key-light/picture/lights.js +33 -0
  369. package/examples/techniques/sun-and-key-light/picture/materials.js +9 -0
  370. package/examples/techniques/sun-and-key-light/picture/palette.js +29 -0
  371. package/examples/techniques/sun-and-key-light/picture/sky.js +16 -0
  372. package/examples/techniques/three-looks/README.md +21 -0
  373. package/examples/techniques/three-looks/main.js +58 -0
  374. package/examples/techniques/three-looks/picture/cartoon.js +23 -0
  375. package/examples/techniques/three-looks/picture/cinematic.js +27 -0
  376. package/examples/techniques/three-looks/picture/comic.js +27 -0
  377. package/examples/techniques/three-looks/picture/index.js +14 -0
  378. package/examples/techniques/three-looks/picture/sun.js +23 -0
  379. package/examples/techniques/wet-road/README.md +102 -0
  380. package/examples/techniques/wet-road/main.js +48 -0
  381. package/examples/techniques/wet-road/picture/index.js +17 -0
  382. package/examples/techniques/wet-road/picture/lights.js +57 -0
  383. package/examples/techniques/wet-road/picture/materials.js +16 -0
  384. package/examples/techniques/wet-road/picture/palette.js +24 -0
  385. package/examples/techniques/wet-road/picture/sky.js +46 -0
  386. package/examples/techniques/wet-road/wetRoad.js +209 -0
  387. package/examples/webgpu-tsl/.threedog/content-index.json +1 -0
  388. package/examples/webgpu-tsl/GAMEMAP.md +89 -0
  389. package/examples/webgpu-tsl/README.md +45 -0
  390. package/examples/webgpu-tsl/main.js +44 -0
  391. package/examples/webgpu-tsl/picture/index.js +18 -0
  392. package/examples/webgpu-tsl/picture/lights.js +25 -0
  393. package/examples/webgpu-tsl/picture/materials.js +36 -0
  394. package/examples/webgpu-tsl/picture/palette.js +23 -0
  395. package/examples/webgpu-tsl/picture/post.js +16 -0
  396. package/examples/webgpu-tsl/picture/sky.js +30 -0
  397. package/examples/world/.threedog/content-index.json +1 -0
  398. package/examples/world/GAMEMAP.md +31 -21
  399. package/examples/world/art/humanoid.js +38 -0
  400. package/examples/world/art/index.js +11 -0
  401. package/examples/world/art/models.js +57 -0
  402. package/examples/world/art/shapes.js +9 -0
  403. package/examples/world/assets.js +6 -0
  404. package/examples/world/content/audio.js +5 -5
  405. package/examples/world/content/items.js +1 -1
  406. package/examples/world/content/npcs.js +1 -1
  407. package/examples/world/content/props.js +1 -1
  408. package/examples/world/content/rules.js +1 -1
  409. package/examples/world/content/templates.js +1 -1
  410. package/examples/world/content/vegetation.js +1 -1
  411. package/examples/world/main.js +22 -18
  412. package/examples/world/models.js +17 -7
  413. package/examples/world/picture/index.js +20 -0
  414. package/examples/world/picture/lights.js +41 -0
  415. package/examples/world/picture/materials.js +34 -0
  416. package/examples/world/picture/palette.js +74 -0
  417. package/examples/world/picture/post.js +9 -0
  418. package/examples/world/picture/sky.js +39 -0
  419. package/index.d.ts +44 -54
  420. package/index.js +29 -25
  421. package/llms.txt +24 -15
  422. package/modules/ambience/Ambience.js +34 -23
  423. package/modules/calendar/Calendar.js +163 -0
  424. package/modules/calendar/contract.js +21 -0
  425. package/modules/calendar/index.js +82 -0
  426. package/modules/{sky → calendar}/schedule.js +17 -16
  427. package/modules/calendar/seasons.js +55 -0
  428. package/modules/camera/FirstPersonCamera.js +6 -15
  429. package/modules/camera/FixedCamera.js +33 -15
  430. package/modules/camera/FollowCamera.js +90 -16
  431. package/modules/camera/RtsCamera.js +18 -17
  432. package/modules/camera/common.js +73 -20
  433. package/modules/camera/contract.js +17 -0
  434. package/modules/camera/projection.js +11 -24
  435. package/modules/characters/Character.js +188 -48
  436. package/modules/characters/NPC.js +92 -41
  437. package/modules/characters/assetModel.js +8 -16
  438. package/modules/characters/behaviors.js +2 -1
  439. package/modules/characters/contract.js +13 -0
  440. package/modules/characters/footsteps.js +1 -1
  441. package/modules/characters/index.js +112 -49
  442. package/modules/characters/moveHelpers.js +4 -5
  443. package/modules/characters/movers/common.js +102 -19
  444. package/modules/characters/movers/manual.js +23 -0
  445. package/modules/characters/movers/rapier.js +19 -16
  446. package/modules/characters/movers/simple.js +14 -11
  447. package/modules/characters/movers/support.js +186 -0
  448. package/modules/characters/npcAvoid.js +47 -42
  449. package/modules/characters/npcSim.js +17 -9
  450. package/modules/characters/npcView.js +44 -16
  451. package/modules/characters/pathAsync.js +7 -3
  452. package/modules/characters/playerStrings.js +4 -3
  453. package/modules/characters/proceduralRig.js +19 -4
  454. package/modules/characters/useModel.js +2 -2
  455. package/modules/characters/vehicle.contract.js +21 -0
  456. package/modules/characters/walkTo.js +21 -7
  457. package/modules/collision/Collision.js +69 -27
  458. package/modules/collision/grid.js +8 -6
  459. package/modules/content/explain.js +2 -2
  460. package/modules/content/fields.js +102 -0
  461. package/modules/content/ids.js +8 -6
  462. package/modules/content/index.js +104 -27
  463. package/modules/content/loader.js +45 -33
  464. package/modules/content/models.js +58 -42
  465. package/modules/content/packs.js +6 -5
  466. package/modules/content/parts.js +41 -0
  467. package/modules/content/props.js +20 -11
  468. package/modules/content/rules.js +66 -0
  469. package/modules/content/stages.js +80 -0
  470. package/modules/content/templates.js +123 -30
  471. package/modules/debug/DebugPanel.js +24 -17
  472. package/modules/flow/contract.js +16 -0
  473. package/modules/flow/index.js +21 -15
  474. package/modules/gameplay/Container.js +41 -32
  475. package/modules/gameplay/Containers.js +30 -15
  476. package/modules/gameplay/Dialogue.js +113 -55
  477. package/modules/gameplay/Interactions.js +273 -72
  478. package/modules/gameplay/Inventory.js +72 -76
  479. package/modules/gameplay/Quests.js +75 -39
  480. package/modules/gameplay/boxOps.js +3 -3
  481. package/modules/gameplay/dialogue.contract.js +21 -0
  482. package/modules/gameplay/dialogueBox.js +4 -2
  483. package/modules/gameplay/dialogueBubbles.js +116 -0
  484. package/modules/gameplay/interactionPrompt.js +4 -1
  485. package/modules/gameplay/interactions.contract.js +16 -0
  486. package/modules/gameplay/inventory.contract.js +23 -0
  487. package/modules/gameplay/inventoryOps.js +19 -17
  488. package/modules/gameplay/pickups.js +306 -85
  489. package/modules/gameplay/questLog.js +6 -6
  490. package/modules/gameplay/quests.contract.js +17 -0
  491. package/modules/grid/Grid.js +92 -50
  492. package/modules/grid/Layer.js +27 -13
  493. package/modules/grid/index.js +96 -43
  494. package/modules/grid/ops.js +20 -18
  495. package/modules/grid/preview.js +37 -29
  496. package/modules/grid/strings.js +12 -0
  497. package/modules/grid/tiles.js +19 -22
  498. package/modules/hlod/index.js +52 -19
  499. package/modules/hud/index.js +48 -20
  500. package/modules/hud/parts.js +28 -13
  501. package/modules/level/heightfield.js +3 -1
  502. package/modules/level/index.js +49 -23
  503. package/modules/level/nodes.js +4 -3
  504. package/modules/lights/index.js +47 -19
  505. package/modules/music/Music.js +38 -21
  506. package/modules/music/rules.js +1 -1
  507. package/modules/nav/index.js +48 -42
  508. package/modules/net/Client.js +13 -6
  509. package/modules/net/Host.js +19 -5
  510. package/modules/net/Net.js +2 -1
  511. package/modules/net/index.js +13 -8
  512. package/modules/net/sync.js +9 -8
  513. package/modules/net/transports.js +77 -27
  514. package/modules/particles/Particles.js +58 -28
  515. package/modules/particles/contract.js +17 -0
  516. package/modules/particles/effect.js +54 -11
  517. package/modules/photo/Photo.js +56 -38
  518. package/modules/rigid/RigidBodies.js +194 -32
  519. package/modules/rigid/Vehicles.js +18 -15
  520. package/modules/rigid/sync.js +62 -17
  521. package/modules/settings/Settings.js +60 -55
  522. package/modules/settings/apply.js +38 -3
  523. package/modules/settings/sections.js +5 -3
  524. package/modules/settings/strings.js +3 -2
  525. package/modules/settings/view.js +5 -3
  526. package/modules/sky/Sky.js +132 -205
  527. package/modules/sky/clouds.js +37 -23
  528. package/modules/sky/dome.js +100 -0
  529. package/modules/sky/domeLayers.js +30 -15
  530. package/modules/sky/environment.js +45 -99
  531. package/modules/sky/fog.js +9 -139
  532. package/modules/sky/frame.js +60 -56
  533. package/modules/sky/season.js +21 -0
  534. package/modules/sky/shader.js +63 -35
  535. package/modules/sky/skyModule.js +52 -37
  536. package/modules/sky/tint.js +59 -0
  537. package/modules/terrain/ChunkManager.js +194 -110
  538. package/modules/terrain/chunkJob.js +1 -1
  539. package/modules/terrain/chunkQueries.js +6 -4
  540. package/modules/terrain/draw.js +154 -0
  541. package/modules/terrain/index.js +87 -54
  542. package/modules/terrain/terrainDefaults.js +2 -2
  543. package/modules/terrain/terrainEdit.js +18 -20
  544. package/modules/terrain/terrainGen.js +6 -4
  545. package/modules/terrain/terrainIsland.js +5 -4
  546. package/modules/terrain/terrainShape.js +12 -12
  547. package/modules/terrain/terrainShapeMain.js +8 -7
  548. package/modules/terrain/terrainTexture.js +21 -19
  549. package/modules/timeline/Timeline.js +95 -43
  550. package/modules/timeline/Tween.js +18 -10
  551. package/modules/timeline/letterbox.js +2 -2
  552. package/modules/timeline/shots.js +5 -1
  553. package/modules/triggers/index.js +111 -76
  554. package/modules/vegetation/Vegetation.js +229 -112
  555. package/modules/vegetation/densityMap.js +62 -0
  556. package/modules/vegetation/draw.js +191 -0
  557. package/modules/vegetation/groundChunks.js +52 -58
  558. package/modules/vegetation/index.js +32 -11
  559. package/modules/vegetation/modelGeometry.js +3 -2
  560. package/modules/vegetation/nearFade.js +8 -2
  561. package/modules/water/Water.js +157 -72
  562. package/modules/water/surface.js +86 -47
  563. package/modules/weather/Weather.js +96 -103
  564. package/modules/weather/particles.js +37 -14
  565. package/modules/weather/shaders.js +1 -1
  566. package/modules/weather/strings.js +2 -2
  567. package/modules/weather/weatherDraw.js +141 -0
  568. package/modules/world/World.js +26 -9
  569. package/modules/world/explain.js +1 -1
  570. package/modules/world/index.js +18 -4
  571. package/modules/world/persist.js +62 -2
  572. package/modules/world/pos.js +3 -2
  573. package/modules/world/records.js +8 -6
  574. package/modules/world/sim.js +60 -20
  575. package/modules/world/simFar.js +4 -3
  576. package/modules/world/state.js +3 -2
  577. package/modules/world/thingSource.js +1 -1
  578. package/modules/world/views.js +8 -6
  579. package/package.json +8 -3
  580. package/presets.js +43 -29
  581. package/render/PostFX.js +318 -135
  582. package/render/backend.js +486 -0
  583. package/render/cascades.js +195 -0
  584. package/render/cascades.tsl.js +96 -0
  585. package/render/daylight.js +39 -0
  586. package/render/detail.js +122 -41
  587. package/render/effects.js +155 -48
  588. package/render/engineUniforms.js +10 -1
  589. package/render/fuse.js +5 -4
  590. package/render/fx/cel.tsl.js +42 -0
  591. package/render/fx/cloudShadow.tsl.js +16 -0
  592. package/render/fx/detail.tsl.js +66 -0
  593. package/render/fx/index.js +28 -0
  594. package/render/fx/lighting.tsl.js +28 -0
  595. package/render/fx/nodeErrors.tsl.js +68 -0
  596. package/render/fx/noise.tsl.js +12 -0
  597. package/render/fx/objectOrigin.tsl.js +42 -0
  598. package/render/fx/particles.tsl.js +139 -0
  599. package/render/fx/patchNodes.tsl.js +403 -0
  600. package/render/fx/postWebGPU.tsl.js +181 -0
  601. package/render/fx/season.tsl.js +13 -0
  602. package/render/fx/sky.tsl.js +187 -0
  603. package/render/fx/uniforms.tsl.js +67 -0
  604. package/render/fx/water.tsl.js +53 -0
  605. package/render/fx/wind.tsl.js +22 -0
  606. package/render/fxNumbers.js +36 -0
  607. package/render/hotGlsl.js +24 -0
  608. package/render/layers.js +14 -0
  609. package/render/lighting.js +71 -18
  610. package/render/lightmap.js +142 -0
  611. package/render/lights.js +47 -6
  612. package/render/materials.js +55 -152
  613. package/render/modeling.js +73 -0
  614. package/render/neutral.js +23 -0
  615. package/render/occlusion.js +184 -0
  616. package/render/ownFrame.js +76 -0
  617. package/render/patches.js +317 -35
  618. package/render/postWebGL.js +205 -0
  619. package/render/probes.js +288 -0
  620. package/render/shaderErrors.js +154 -0
  621. package/render/slots.js +165 -0
  622. package/render/terms.js +163 -0
  623. package/render/uniformDecl.js +4 -3
  624. package/types/common.d.ts +2 -2
  625. package/types/core.d.ts +757 -346
  626. package/types/gameplay.d.ts +539 -330
  627. package/types/generated/core/Audio.d.ts +26 -42
  628. package/types/generated/core/Batching.d.ts +6 -2
  629. package/types/generated/core/Budget.d.ts +2 -8
  630. package/types/generated/core/DebugOverrides.d.ts +58 -9
  631. package/types/generated/core/I18n.d.ts +2 -2
  632. package/types/generated/core/Input.d.ts +110 -32
  633. package/types/generated/core/Ops.d.ts +31 -0
  634. package/types/generated/core/Random.d.ts +2 -2
  635. package/types/generated/core/Saves.d.ts +10 -2
  636. package/types/generated/core/Stream.d.ts +1 -1
  637. package/types/generated/core/Threads.d.ts +4 -1
  638. package/types/generated/core/Views.d.ts +0 -1
  639. package/types/generated/core/audioVoice.d.ts +17 -9
  640. package/types/generated/core/control.d.ts +55 -0
  641. package/types/generated/core/page.d.ts +9 -2
  642. package/types/generated/core/session.d.ts +2 -1
  643. package/types/generated/modules/ambience/Ambience.d.ts +0 -9
  644. package/types/generated/modules/calendar/Calendar.d.ts +84 -0
  645. package/types/generated/modules/calendar/index.d.ts +10 -0
  646. package/types/generated/modules/debug/DebugPanel.d.ts +2 -2
  647. package/types/generated/modules/grid/Grid.d.ts +61 -25
  648. package/types/generated/modules/grid/Layer.d.ts +13 -5
  649. package/types/generated/modules/grid/index.d.ts +56 -20
  650. package/types/generated/modules/music/Music.d.ts +5 -3
  651. package/types/generated/modules/net/index.d.ts +3 -3
  652. package/types/generated/modules/net/transports.d.ts +12 -3
  653. package/types/generated/modules/particles/Particles.d.ts +13 -6
  654. package/types/generated/modules/sky/Sky.d.ts +85 -110
  655. package/types/generated/modules/sky/skyModule.d.ts +1 -1
  656. package/types/generated/modules/timeline/Timeline.d.ts +8 -6
  657. package/types/generated/modules/water/Water.d.ts +50 -3
  658. package/types/generated/modules/weather/Weather.d.ts +44 -15
  659. package/types/generated/modules/weather/weatherDraw.d.ts +11 -0
  660. package/types/generated/modules/world/World.d.ts +20 -5
  661. package/types/generated/render/PostFX.d.ts +109 -29
  662. package/types/generated/render/lighting.d.ts +29 -0
  663. package/types/generated/render/materials.d.ts +31 -50
  664. package/types/generated/render/modeling.d.ts +30 -0
  665. package/types/generated/render/occlusion.d.ts +13 -0
  666. package/types/generated/render/patches.d.ts +16 -2
  667. package/types/generated/ui/UI.d.ts +6 -3
  668. package/types/nav.d.ts +6 -0
  669. package/types/physics.d.ts +140 -45
  670. package/types/tsl.d.ts +94 -0
  671. package/types/world.d.ts +489 -122
  672. package/ui/Focus.js +35 -14
  673. package/ui/LoadingScreen.js +3 -3
  674. package/ui/Parts.js +35 -15
  675. package/ui/UI.js +27 -17
  676. package/ui/cursor.js +115 -0
  677. package/ui/defaults.js +15 -11
  678. package/ui/theme.js +36 -27
  679. package/ui/touchPart.js +2 -2
  680. package/core/claims.js +0 -51
  681. package/core/look/coreParts.js +0 -112
  682. package/core/look/layers.js +0 -136
  683. package/core/look/part.js +0 -173
  684. package/core/look/report.js +0 -79
  685. package/core/look/write.js +0 -86
  686. package/core/renamed.js +0 -22
  687. package/core/styleParts.js +0 -98
  688. package/docs/api/entities.md +0 -61
  689. package/docs/api/style.md +0 -134
  690. package/docs/recipes/09-style-pack.md +0 -169
  691. package/docs/recipes/35-style-from-reference.md +0 -84
  692. package/docs/recipes/36-sky-ground-plant-looks.md +0 -118
  693. package/docs/recipes/38-environment-look-hooks.md +0 -88
  694. package/docs/recipes/41-thing-registry.md +0 -93
  695. package/docs/recipes/43-shader-patches-surface-looks.md +0 -135
  696. package/docs/recipes/44-water-weather-look-hooks.md +0 -135
  697. package/docs/recipes/48-make-material.md +0 -70
  698. package/docs/recipes/52-look.md +0 -146
  699. package/examples/action/look.js +0 -5
  700. package/examples/sheepisland/style/index.js +0 -79
  701. package/examples/styletest/look.js +0 -11
  702. package/examples/styletest/overrides.js +0 -33
  703. package/examples/styletest/panel.js +0 -135
  704. package/modules/entities/Entities.js +0 -243
  705. package/modules/entities/build.js +0 -25
  706. package/modules/entities/index.js +0 -4
  707. package/modules/sky/calendar.js +0 -80
  708. package/modules/sky/cascades.js +0 -125
  709. package/modules/sky/layers.js +0 -69
  710. package/modules/sky/look.js +0 -51
  711. package/modules/sky/lookFog.js +0 -80
  712. package/modules/sky/lookShadow.js +0 -50
  713. package/modules/sky/lookSky.js +0 -108
  714. package/modules/sky/shadow.js +0 -74
  715. package/modules/terrain/chunkLevels.js +0 -40
  716. package/modules/terrain/lookGround.js +0 -61
  717. package/modules/terrain/mountTerrain.js +0 -32
  718. package/modules/vegetation/lookWind.js +0 -37
  719. package/modules/water/look.js +0 -80
  720. package/modules/weather/look.js +0 -75
  721. package/modules/world/cells.js +0 -42
  722. package/render/lookSurface.js +0 -161
  723. package/render/postLook.js +0 -86
  724. package/render/surface.js +0 -69
  725. package/types/style.d.ts +0 -643
package/CHANGELOG.md CHANGED
@@ -1,5 +1,375 @@
1
1
  # Changelog (threedog)
2
2
 
3
- The engine has not been released yet, so this log is not maintained before release. At release time it is written in one pass from git history and `docs/API.md`: "what changed, how a game upgrades", placed under the version heading.
3
+ What changed in each version and how a game upgrades.
4
+
5
+ ## 0.7.0 (2026-11-05)
6
+
7
+ - 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`
8
+ - Follow camera: `collision({ cameraOcclusion })` now defaults to `'both'`: meshes registered with `engine.rays.addStatic(mesh, { occluder: true })` stop the arm without a gameplay collider (a crown, an eave). Level buildings count too; `'colliders'` keeps the old test.
9
+ - `character.placeAt` over a registered support stands on it; `mover: 'manual'` runs the `states` hook. Recipe 57 "Moved by script" (ride, lift, ladder), recipe 32 says what a support needs.
10
+ - Script runs: `?fresh` / `applyState({ fresh })` / `threedog state fresh=1` delete the saves for a clean start; `inputLocked` carries `facts.by`; `snap --play`; `shot` and `snap` name the backend that drew the picture; `snap` timeouts say what the page was doing; a `js` script waiting on a stopped clock ends with the reason; the WebGPU fallback is one line in errors.log.
11
+ - `threedog assets optimize [--dry]`: Meshopt + KTX2 copies of art/models/ in public/optimized/, textures encoded by slot (a normal map is never compressed as color), `assets.js` pointed at the results, reruns skip unchanged files, per-file size / GPU memory / problems. `npm run assets` crashed on start (a name used twice); fixed.
12
+ - Light probes: `engine.bakeProbes` now builds three's per-pixel probe grid on both renderers, stored in half precision; `follow`, `height`, `probes.probe` and `own()` are gone, probe files are version 2 (MIGRATING-0.7.md). `describe().render.probes` reports lit objects outside the grid and light counted twice.
13
+ - Real-time light on WebGPU: `@threedog/post-effects/tsl` adds `voxelGI`, `temporalAA`, `sunShafts`, `lightVolumes`. Post effects gain `needsBuffers` (normal, diffuse, velocity merged into one scene render), `backend`, `skipOnLowTier` and `facts`; `describe().render.post` says `held` and why.
14
+ - Occlusion culling: `engine.occlusion.enabled` skips hlod cells and batched groups while hidden, on both renderers; `describe().render.occlusion`.
15
+ - Lightmaps: `threedog bake light` (system Chrome, real WebGPU) and `engine.loadLightmap(file)`; `describe().render.lightmap`.
16
+ - `celLighting` in `threedog/tsl`: colored cel bands on `MeshToonNodeMaterial`, cast shadows in the same bands. `paletteLut` in `@threedog/post-effects`: a fixed palette for `lut()`. Docs no longer say `rampTexture` colors work on three's toon: it reads only the red channel.
17
+ - New games start on WebGPU with TSL: `threedog new-game` and `init` write `import 'threedog/tsl'` and `createEngine({ renderer: 'webgpu' })`; `--webgl` starts the GLSL form instead. `--example` and `templates/example` are removed. `createEngine` called with no `renderer` still builds the WebGL renderer. With no WebGPU in the browser the game runs on three's WebGL2 backend, slower.
18
+ - `engine.hud.value(id)` reads the current value of a counter or bar. `describe().renderer` gives `requested`, `backend`, `reason`, and `gpu`, `tsl`, `glsl`, `compute` (what that backend can run).
19
+ - `threedog/layers` exports `RESERVED_LAYERS`, the one table of the three.js layers the engine keeps (26 to 29 and 31); a game's own layers are 1 to 25.
20
+ - `threedog js --wait <seconds>`: a script waiting on the game clock on a page nobody steps ends with the reason instead of a silent timeout.
21
+
22
+ ## 0.6.0 (2026-11-04)
23
+
24
+ - Fixed: on WebGPU, cascades on a light whose `target` has a parent took the target's local position, so shadows fell another way than the light shone; they use its world position now, as WebGL does.
25
+ - Breaking: `grids.preview({ look })` is `{ draw }` and a layer's `tiles: { look }` is `tiles: { color }`; an unknown `tiles` key now throws.
26
+ - 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
+ - Fixed: the sky dome stayed in the scene after `engine.use(mySky(), { replaces: 'sky' })`.
28
+ - 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.
30
+ - 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
+ - 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
+ - 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.
33
+ - Docs: recipes 09 (style folder) and 48 (makeMaterial) are merged into `recipes/09-materials-lights-models.md`: materials are plain three.js in `picture/`, module looks are `.material`, the UI look is `createEngine({ ui })`. Recipe 43 teaches shader code through `applyEffects` only; the `lighting` spec key becomes a plain `lighting` slot patch there.
34
+ - Breaking: the dev panel (`?panel=1`) reads and writes three.js objects directly; its style export, "apply and rebuild" and `?ov=` are gone, `engine.styleWorkbench` is `engine.devPanel`, and the `threedog tune` block holds plain three.js writes.
35
+ - Breaking: `threedog style check` is removed; `threedog style palette | compare` are now `threedog picture palette | compare` (bridge `picture-palette`, `picture-compare`; MCP `picture_palette`, `picture_compare`).
36
+ - Breaking: `style.character` is gone: `characters({ animation })`, and `engine.characters.material` is the plain three.js material of every placeholder capsule.
37
+ - Breaking: `style.triggers` is gone: `triggers({ debugColor, debugOpacity })`.
38
+ - Breaking: `style.palette` is gone: `engine.assets.palette`, a plain writable object that generators read as `this.palette`; a write rebuilds what is asked for after it.
39
+ - Breaking: cached and baked models read their materials back as recorded (plain three.js, `neutralMaterial`), no longer rebuilt from a material role. `assets.report()` says `madeByEngine`; `explain().materials` lost `keys`.
40
+ - Breaking: `style.grid` is gone: `grids({ ok, bad, previewOpacity, previewHeight, tiles, tileLift })`; the preview's and tiles' plain three.js materials are `pv.material` and `layer.material`.
41
+ - Breaking: `style.pickup` is gone: `pickups({ color, size, lift })`, and `engine.pickups.material` is the plain three.js material of boxes and geometry-only models.
42
+ - Breaking: `style.ui` is gone; the UI look sits in `createEngine({ ui: { theme, css, fonts, templates } })` beside the part names, and `engine.ui.templates` is writable.
43
+ - Breaking: `look.ground` and `style.terrain` are gone. The ground's look is `terrain({ colors, biomeColors, steep, variation, detail })`, `engine.terrain.material` (get / set), `.uniforms`, `.patches`, `.recolor()` (recipe 36).
44
+ - Breaking: `look.water` and `style.water` are gone. The water's look is `engine.water.material` (get / set), `.uniforms`, `.patches`, `.shader()`, `.normalMap()` (recipe 44).
45
+ - Breaking: `style.particles` is gone: `particles({ effects, default })`; an effect's `.material` is get / set and drawn as given, `.uniforms` its `{ value }` objects (recipe 64).
46
+ - Breaking: weather looks are `weather({ rain, snow, area, lightning, lightningBrightness, overcastColor })` options; `engine.weather.define(field, spec)` and `engine.weather.particles` (plain `.material`, `.uniforms`, `.spec`) replace `look.weather`.
47
+ - Breaking: plants take plain materials. `engine.vegetation.material`, `.patches`, `.sway()` and `.color()` replace `look.wind` and `look.vegetation`; wind strength and speed are `engine.uniforms.uWindAmp` / `uWindFreq`.
48
+ - `threedog art board`: every art resource of a game on one page, with where it is used, what is unused, missing or not traced, and copy lines for the AI; `--json` is the same data, `--live` and the dev panel's "art" folder show what the running game really loaded.
49
+ - `?at=<place>` (`threedog shot --at <place>`, `applyState({ at })`): skips the start screen and stands the player at a named place with the game's camera on it at once. `?pos` no longer opens on a camera glide either (new event `state:placed`).
50
+ - `interactions.add(mesh, { label, onUse, once, counter })`: `once` hides the mesh after a use, `counter` adds to a HUD counter (new `hud.add(name, n)`), both saved in the new `interactions` save part; pick-and-count things no longer need pickups and an inventory. Recipe 03 says which to use when.
51
+ - `createEngine({ ui: { theme } })` is the one place to reskin: every default part (dialogue, prompt, HUD, toast, menus, title) reads its variables, and recipe 26 "Reskin" lists them on one screen. The HUD now follows `bg` / `fg` / `accent` unless `hudBg` / `hudFg` / `hudAccent` are set; new `radiusSmall` and `shadowSmall` replace the corners and shadows that were fixed in the CSS (the default toast is no longer a pill).
52
+ - Breaking: the sky writes no light, fog, exposure or environment; it computes the signals and draws the dome. Your `picture/` code reads `engine.uniforms` and writes three.js (recipe 62).
53
+ - Breaking: `sky({ sun | hemisphere | fog })` throw naming what to write; delete the option. `createEngine({ lights: false })` drops the placeholder lights, which are now still.
54
+ - Breaking: no fog by default. `style.sky.fog` and `look.fog.set` write `scene.fog` once; a fog that changes over the day is yours.
55
+ - Breaking: no default tone curve (`renderer.toneMapping` stays three.js's default unless `style.toneMapping` names one), and no room environment map unless `look.lights` `env.intensity` is above 0. `env.share` is gone.
56
+ - Breaking: `style.exposure` and `look.tone` exposure are numbers, and `look.lights` keys take no function: exposure and light over the day are your `picture/` code.
57
+ - Breaking: weather no longer multiplies `look.lights.*` or `look.fog.far`; it writes the signals `uWeatherLight` and `uWeatherFog`. `uViewDistance` is new (stream radius without terrain, a fog's far; `terrain({ viewFog: true })` writes it).
58
+ - Breaking: plain game materials get the cloud-shadow patch only once the game turns cloud shadow on, in one recompile at that moment.
59
+ - Breaking: `style.sky.groundTint` and `part.author.drive / driven / feed` are gone (nothing left reads them).
60
+ - `describe().render.defaults` lists what the engine itself still puts on the picture, each with how to stop it.
61
+ - The `look.*` verbs are deprecated: no new features, recipe 52 says what to write instead. Removal is a later step.
62
+ - `threedog new-game`: `main.js` wires a start screen, autosave and Esc pause + settings menu (delete a line to drop one), the template's CLAUDE.md opens with an "Already here" table, recipe 63 is a 16-line third-person start. R40 hints at a hand-written localStorage save or pause; `shot` says when the start screen covers the picture.
63
+ - Esc under pointer lock opens the menu on the first press: the browser keeps that key, so a lock the player ended counts as the back key when nothing else is open and the game is running. `page:pointerlock` also says `byEngine`.
64
+ - `threedog lib add --kind look` stores one file from `picture/` (or a `.glsl`) in the library and `lib pull` puts it back under `picture/` (`picture/shaders/` for `.glsl`); a look file that imports siblings is refused at add. `art copy` of a folder takes `.glsl` files along. Recipe 62 section 3c.
65
+ - `engine.shadows.cascades(light, { count: 3 })`: cascaded shadows for a game's own DirectionalLight, with or without a sky, on both renderers; returns a handle (`set`, `remove`). `look.shadow.set({ cascades })` runs on the same code; the look check's usage line for a game's own light points here; recipe 45.
66
+ - The look check points the way: over-budget facts (new budget entries `shadowMaps`, `shadowMapSize`), usage lines for cascaded shadows and `lightPool`, new facts for near-black shadows, shadow stripes and stepped edges, and fog named first when it is most of the picture. They read the game's own lights too. Recipe 60 "When the look check names a feature".
67
+ - `threedog new-game` generates a `picture/` folder instead of `style/`: the gray starting picture as plain three.js the game owns (`index`, `palette`, `lights`,
68
+ `materials`), with `createEngine({ lights: false })`; recipe 62. Styles keep working. Water with no fog reflects the sky's horizon color, not a fixed gray.
69
+ - Prop and template `collide: 'circle'` now stands on the model's base (the lowest fifth of its height above the ground), not on its widest extent: a lamp's arm or a tree's crown no longer blocks walkers or pulls the follow camera in. Characters can walk closer to such models; a box is unchanged. New form: `collide: { circle: 0.25, occluder: false }`. A mistyped `collide` is refused at load.
70
+ - `lightPool`: a camera cut (`engine.views.show`, a fixed-camera shot) moves the lights at once, without the fade; `shot --view` drew the old spot's lamps. `views.show` emits `camera:shot`.
71
+ - `threedog shot <url>`: a local dev server of another game's folder is refused; one that cannot say is reported. The scene is counted again after the picture, with a warning if it changed.
72
+ - Black-frame hint lists shader programs that failed to compile. Test runner: a second argument to `ev` fails.
73
+ - `threedog shot` and `threedog capture` wait for the game's code after `await engine.start()` (lamps added after a later await): no request in
74
+ flight and the scene's objects / lights / materials unchanged for 0.3 s, at most 10 s; shot says how long it waited and what was added.
75
+ - `presets.camera.overShoulder` looks up (minPitch -1.05) like `thirdPersonAction`; every camera preset that locks the mouse can look up (tested).
76
+ - The look check names the material whose hiding brings a black frame back (a ShaderMaterial with NaN / Inf, spread by bloom), and reports fog
77
+ that is most of the color in a large share of the picture, with its near / far and color.
78
+ - Deploying under a sub-path: `threedog build my-game --base /my-game/` (Git Bash's rewrite of `/my-game/` is undone), and root-relative
79
+ manifest paths (`'/models/x.glb'`) now follow the build's base; recipes/61-deploy.md. The pack test builds and serves under a sub-path.
80
+ - `threedog describe` and the other bridge commands: when a threedog dev server of another folder answers, the message says so instead of
81
+ "no dev server".
82
+ - Dev error log: a repeated warning (warned again after each reload) is counted, not written again.
83
+ - Recipe 32: bullet time needs `engine.time.channel('enemies')` first, and world records follow it through `world.simulate(kind, { channel })`.
84
+
85
+ ## 0.5.0 (2026-11-04)
86
+
87
+ - Install instructions agree everywhere (README, package READMEs, COMMANDS.md): until 0.4.0 is on npm, use the engine from the repository;
88
+ after that, `npm install threedog@0.4 three@~0.187.0` and `@threedog/tools@0.4`. Each says which version it describes.
89
+ - Node: every package.json (and a new game's) declares `^20.19.0 || >=22.12.0`, the range vite 8 needs. `threedog dev / build / preview /
90
+ test / shot / perf / stress / capture / gallery / bake` stop first on an older Node, printing the version found, the range and how to fix it;
91
+ `threedog doctor` reports the same check.
92
+ - New-game CLAUDE.md: a clear request is built directly (no confirmation round); the AI asks only about choices that change the result and
93
+ cannot be inferred, writes its other picks as "(picked, not asked)" and lists them in its report; a change updates only the records it makes wrong.
94
+
95
+ - After-await fixes (outside review of 0.4.0). A module unloaded while its async init awaited (replaces, a plugin removed) can no longer act on a
96
+ same-named module installed after it: each install has its own identity; what the old init tracks or `ctx.mod`s afterwards is removed at once, its queued `ctx.whileCompiling` warm-ups do not run
97
+ (dev warning `[module-handle]`), and its completion or failure leaves the newcomer's state and handles alone.
98
+ - `saves.apply`: a listener that throws after an `await` inside an async `load()` now fails and rolls back the load like one that throws before
99
+ it (the capture lasts until the load settles, one scope per load). The rollback point is a copy of every part's `save()`, so
100
+ `save: () => state, load: d => Object.assign(state, d)` rolls back correctly; `save()` data that cannot be copied refuses the load
101
+ (`[save-part-threw]`, MIGRATING-0.5).
102
+ - Plugins composed: a post effect keeps its place across `plugins.off` / `on` (equal `order`s keep the order the names were first added in,
103
+ plugin effects are placed in plugin-list order), so A, B no longer come back B, A. `look.post.set({ A: false })` pauses in place,
104
+ `plugins.off` unloads. Each style-pack plugin is its own owner (`style:<pack>/<file>`): switching B off no longer drops A's material. Two
105
+ plugins writing the same key on one layer are a dev `[shared-conflict]` naming both, unless one file says `export const replaces = '<file>'`.
106
+ `plugins.off` / `on` return `{ off | on, reach, rebuilt, note }`; `plugins.list()` and `describe().slots` give each plugin's reach (`live` or
107
+ `new materials only`); `off('<pack>')` says the pack's starting values stay. New `engine.look.materials.rebuild()`: materials already made
108
+ are made again from the current layers (patches, replace, type) and swapped in place, keeping call params, hand-set colors and wind / cloud
109
+ shadow; `plugins.off` / `on` of a material or patch plugin calls it (`{ rebuild: false }` skips it) (MIGRATING-0.5).
110
+
111
+ - Turning shadows off (look.shadow, the settings menu) is the renderer switch only: `renderer.shadowMap.enabled`. No light's `castShadow` is
112
+ written any more, so a game that changes `castShadow` while shadows are off keeps its value when they come back. `describe().owned['shadows.off']`
113
+ is gone; budget `shadowLights` is 0 while shadows are off (MIGRATING-0.5).
114
+ - `threedog lib pull` of a code entry writes a working plugin: the code in `plugins/<name>/`, plus the wiring file `plugins/<name>.js` that calls
115
+ its factory, from the entry's new `plug` line (`lib add --plug "makeIt({ ... })"`, else the exported function; `pull --plug` overrides).
116
+ - `[plugin-shape]` errors name the file, what it exports and the exact fix: a factory function, a module with no `type` or no hook, an effect
117
+ with no name.
118
+ - One entry per look value: `water()`, `sky()` and `terrain()` options that were look values are gone; each is a `look.water` / `look.sky` /
119
+ `look.ground` param (style layer: `style.water`, `style.sky`, `style.terrain.config`). New params: `look.water` `normalMap normalScale
120
+ normalRepeat normalSpeed shininess specular`; `look.sky` `keyframes sunSize sunGlow sunBrightness moonSize moonColor moonBrightness
121
+ starDensity starScale gradientCurve groundTint orbitTilt orbitSway dim.tint dim.stars`; `look.ground` `normals`. `sky({ skybox })` →
122
+ `look.sky.replace`. The old options throw in dev naming the call (MIGRATING-0.5).
123
+ - `water({ material })` is gone: the water surface material has one entry, `engine.look.water.replace(fn)` (style layer: `style.water.material`).
124
+ It throws in dev naming the call. `water({ uniforms })` stays: it declares the uniforms the `look.water.patch` hooks read (MIGRATING-0.5).
125
+ - Type declarations: `look.clouds`, the leaked three.js `Light` export, the `.engine` back-references (terrain, characters, cameraRig, control,
126
+ views) and three test-only readouts (`audio.info`, `ambience.info`, `level.buildMs`) are gone from the types; runtime unchanged (MIGRATING-0.5).
127
+ - Shared values check number values the same way on `engine.mod` and on `handle.change()`: set / add / mul are finite numbers; clamp is
128
+ `{ min?, max? }` with each given bound a finite number and min <= max; `stacks.define({ min, max })` the same. A wrong one throws `[shared-value]`
129
+ naming what was given and the fix, instead of making the value NaN (`clamp: { max: 'oops' }`, `{ max: NaN }`) or holding a reversed range.
130
+ - Colliders take `occluder: false` (`collision.addCircle` / `addBox` / `addSegment` / `addObject`): walkers are still stopped, the follow
131
+ camera's occlusion check ignores it. A forest of trunk colliders no longer collapses the camera onto the player.
132
+ - `shot --play` starts straight in play: the engine's new `?play` URL key (`applyState({ play })`) does what the title's Start does
133
+ (`engine.session.newGame()`, the title part closes; flow leaves its start state). Games no longer need a `?play` key of their own.
134
+ - Page arguments rewritten by Git Bash are also undone from its `EXEPATH` root, and `shot` prints the page it really opens when the argument
135
+ was rewritten (`npm run shot -- /` echoes `> threedog shot C:/Git/`, which read like the wrong page).
136
+ - `threedog how "game test"` finds how to write a game's own test (a CONVENTIONS.md entry row pointing at COMMANDS.md "A game's tests").
137
+ - The api page of `collision.addBlocked` gives the `bounds` shape `{ minX, maxX, minZ, maxZ }`.
138
+ - The repository `.gitignore` no longer ignores every `shots/` folder: tool output stays under `.threedog/`, a game's own screenshots can be committed.
139
+ - Follow camera `ground: 'shorten'` samples the arm at most 0.2 m apart (capped at 160 samples, so 0.2 m up to a 32 m arm) instead of 12 fixed
140
+ samples: a narrow rise in the ground height (a 0.25 m bump in the middle of an 8 m arm) now shortens the arm instead of being stepped over.
141
+
142
+ ## 0.4.0 (2026-11-04)
143
+
144
+ - Sky colors for a game shader: `engine.uniforms.uSkyHorizon` / `uSkyTop` hold the colors the sky draws this frame (tint and lightning included);
145
+ the default fog color is the same horizon. `weather.set(name, { seconds: 0 })` switches at once (before any step); negative seconds throw.
146
+ The type check names the expression a call was made on (`` `engine.random` is not a function ... (it is Random; call one of its methods) ``).
147
+ - One small look API: every `engine.look.<part>` has `set` / `patch(hook)` / `add` / `replace(thing)` / `manual` / `value`, and `patch` only
148
+ swaps a named hook. `look.materials.patch` is now `look.materials.add`; `look.fog.replace` is removed (a fog of your own is `scene.fog = ...`,
149
+ the engine yields); the module plumbing (`write`, `extend`, `drive`, `tick` ...) moved to `part.author`. Removed verbs throw naming the new call
150
+ (MIGRATING-0.4).
151
+ - Post effects have one entry, `engine.look.post.add(x, { name, slot, order, owner })`: a plain three.js Pass, a WebGPU node function or an effect
152
+ `{ name, create, node, fuse }`; the plugins folder and a style's plugins go through it, so every effect switches with `look.post.set`. Removed:
153
+ `engine.post.addPass / insertPass / removePass`, `look.post.patch`, `style.post`, `postAdd / postRemove`, `createEngine({ post })` (each throws or
154
+ is gone, see MIGRATING-0.4). A function exported by a plugin file is a `[plugin-shape]` error on both renderers (it was a WebGPU post pass).
155
+ A Pass that renders the scene itself replaces the scene render (it drew the scene twice). WebGPU: removing an effect frees its nodes (leak fixed).
156
+ - Material roles have one entry, `engine.look.materials`: the style's `materials` table is its style layer and `makeMaterial` reads nothing else
157
+ (look.materials.set also reaches Material-instance roles). Style packs bundle look plugins (`style.plugins`, plugged by `engine.plugins` on the
158
+ style layer, `plugins.off('<style>')`). The world example's `lowpoly` style is replaced by a small `world` style; its models moved to `examples/world/art/`.
159
+
160
+ ### Breaking (module types, leftovers)
161
+
162
+ - A module's `type` decides how its errors are handled: a `look` or `ui` module that throws is switched off and the game keeps running; the
163
+ `presentation: true` flag is gone. `stage` only orders hooks; the stages `world` / `presentation` are renamed `ground` / `effects`.
164
+ - `engine.time.manual` is gone (`engine.mod('time.<channel>', { owner, set })`).
165
+ - The terrain data part reads no style: chunk colors and the `viewFog` fog distance belong to the terrain look (owner `terrainLook`, removed with it).
166
+ - The 0.2 rename traps (`[renamed-field]` on `clock.timeScale`, sky calendar fields, `.reason`, `runState.by`, `describe().ui.inputContexts`,
167
+ dialogue `{ lock }`, `style.pickup.model`, item `mesh`) are removed; `[item-mesh]` is gone.
168
+ - New-game template: the style lists `plugins` (with a `style/plugins/` folder) instead of `post: []`; the blank game no longer depends on
169
+ `@threedog/post-effects`. `threedog how` labels THREE.md rows that name engine APIs `engine + three.js`, not `plain three.js`.
170
+
171
+ ### Breaking (time, input, character control)
172
+
173
+ - One time source: `engine.time` counts fixed steps (`engine.tick`); `real`, `ambient`, the calendar and channels are views (`engine.time.now(name)`). `engine.elapsed` and `engine.time.real` are gone (`engine.time.now('real')`); `describe().time` has `tick / real / ambient / calendar`; the `clock` save part is folded into `time` (old saves load).
174
+ - Input by context: modules declare actions (`input.action`, `ctx.input.action`), the game binds keys (`input.bind`, `createEngine({ bindings })`), the player rebinds on the settings layer (`input.rebind`, `input.rebound()`). `input.define` and `createEngine({ padBindings })` are gone; the base context is `walk` (was `gameplay`). F3, F4, dialogue 1-9, RTS Q / R and the cutscene skip keys are no longer bound by default (`presets.bindings.debug / dialogNumbers / rtsRotate / cutsceneSkip`).
175
+ - Character control: one control slot per character (`engine.control.take(ch, { owner, layer, step })`, layers base < script < cutscene < net). Gone: control `'none'`, writable `player.control`, `presets.player.none`, timeline `lockInput` (`actors`).
176
+
177
+ ### Added (plugins folder)
178
+
179
+ - `plugins/` next to a page's html: each file is plugged at `engine.start()` by what it exports (Object3D, Pass / node pass, Material, ShaderPatch, module); order by file name or `plugins/plugins.json`; `engine.plugins.off(name)` / `on(name)`; a wrong shape is `[plugin-shape]`.
180
+ - `describe().slots`: what is plugged where, from which file, what it affects.
181
+ - Plain `PointLight` / `SpotLight`: counted by `engine.budget` `lights` (limit 8) / `shadowLights`, listed in `describe().render.lights`; a casting light at intensity 0 stops redrawing its shadow map.
182
+ - `threedog lib pull` puts code entries (shader, material, effect, module) in `plugins/` by default (models and textures still in `art/`).
183
+
184
+ ### Breaking (physics, nav, weather, collision)
185
+
186
+ - `weather.set(name, seconds)` is `weather.set(name, { seconds })`; a number throws `[module-params]` in dev.
187
+ - `engine.collision.circles` / `.boxes` are Sets (insertion order, O(1) remove): `.length` is `.size`, `.filter` / `.map` need `[...set]`.
188
+ - `engine.interactions.items` is a read-only array built on each read (insertion order); writing to it does nothing. `get(id)` is the fast lookup.
189
+ - New `engine.collision.mirror({ add, remove })`: one add / remove diff of the static colliders, used by rigid and nav (their own copies are gone).
190
+ - New `engine.assets.useTexture(name, use, { where, instead, opts })`: fetch a texture for a stand-in; a failed load is one `[load-failed]` warning
191
+ naming the slot. detail, surface, particles, weather particles and water use it (sky still has its own).
192
+ - rigid rebuilds its physics world once per new game / load (it rebuilt on `session:end` and again on `world:load`); a refused load leaves physics as it was.
193
+ - New options with the old values as defaults: `weather({ lightningFirst: 5, lightningInterval: [6, 20] })`, `nav({ maxObstacles: 1024, maxAgents: 128, arrive: 0.6 })`.
194
+ - `nav()` declares `optional: { collision }`.
195
+
196
+ ### Breaking (per-frame waste, save loads, look write paths)
197
+
198
+ - The weather look's entries on the look points are owned by the module `weatherLook` (was owner `'weather'`): `holders().find(h => h.owner === 'weatherLook')`. It takes each entry once through `ctx.mod` and rewrites it with the new `handle.change(value)`, so a frame adds no entry and no cleanup handle.
199
+ - While a save part's `load()` is still pending (it returned a Promise), gameplay is frozen: no fixed step runs and `ops.run` / `ops.can` fail with code `loading` until every part is applied.
200
+ - `ops.list({ available: true })` (and so `describe().actions`) no longer throws for an op whose `offers` throws or offers an arg set that fails its args check: such an op shows as an entry with code `offersFailed` / `badOffer` and `facts.error`.
201
+ - Post effects have a fifth slot, `tone` (exclusive, between `hdr` and `ldr`): an effect there replaces the engine's tone-mapping output (OutputPass on WebGL, renderOutput on WebGPU) and must output display color; `describe().render.toneMapping` then names it.
202
+
203
+ ### Added (per-frame waste, save loads, look write paths)
204
+
205
+ - `handle.change(value)` on every `engine.mod` / `ctx.mod` handle: rewrites that entry's value in place (same op and layer); false on a stale handle.
206
+ - `describe().look.<part>.<key>.pack`: the style part that set a style-layer value when `createEngine({ style: [...] })` merged several (its `name`, else `style[<index>]`).
207
+ - Rule R48: engine code writes `toneMappingExposure`, `shadowMap.enabled / type` and `environmentIntensity` only inside the owning look part's apply (allowlist with reasons in the rule file).
208
+ - Rule R49: every shader patch and post fuse the engine and its add-ons ship has a `tsl` form next to `glsl`, so it draws on WebGPURenderer (WebGL-only-by-design patches listed with reasons in the rule file).
209
+ - Camera rigs are no longer wrapped method by method (a pose compare on every call, `forward()` read every fixed step included): the built-in rigs mark their own placement once (fixed `cut`, rts `moveTo({ instant })`).
210
+ - Staged content templates no longer serialize each copy's model every frame; an open menu with an idle cursor reads no layout per frame (the control list is cached and re-read on a move, a confirm or a DOM change).
211
+
212
+ ### Breaking (plain three.js is adopted)
213
+
214
+ - `engine.scene.add(obj)` registers the root like `engine.add` (thing registry, describe, thing.set); engine modules mark their own objects with `engineOwned`.
215
+ - `engine.post.addPass(pass)` / `insertPass(pass, i)` / `removePass(pass)`: a plain three.js Pass (WebGL) or `(input, ctx) => node` (WebGPU) joins the chain; RenderPass / OutputPass of the engine's own are skipped.
216
+ - A game rendering the canvas itself takes the frame: the engine stops drawing its own and warns once `[own-frame]`; removing the call hands it back.
217
+ - Plain lit three.js materials (Lambert / Phong / Standard / Physical / Toon) that enter the scene take the engine's cloud shadow (and a `look.cloudShadow.replace`), on both renderers, sharing one program per type. Opt out per material with `material.userData.cloudShadow = false`; materials already given engine patches are left alone; listed in `describe().owned['cloudShadow.plain']`. Snow / season cover stays opt-in: `applyEffects(mat, { season: 'ground' })`.
218
+ - Vegetation on its own ground (no terrain): adding a species places only that species on the loaded chunks (it dropped and rebuilt every chunk). Terrain and own-ground chunks stream through one helper (`core/chunkStream.js`).
219
+
220
+ ### Breaking (consistency sweep)
221
+
222
+ - `music.stop(fade)` is `music.stop({ fade })` (like `play`); a number throws `[module-params]` in dev.
223
+ - `setValidate` is gone; `createEngine({ validate })` is per engine (`engine.validate`). Page-wide warnings stay on while any live engine has checks on (it was: the last `createEngine` decided for the page).
224
+ - The event-name spelling check (`[event-typo]`) now also runs in the `npm test` bundle (it read raw `import.meta.env.DEV` and was off there).
225
+ - Dev notes print through `note(text, key?)` (core/validate.js); R45 flags a bare `console.info` in engine code.
226
+ - No three.js prototype is changed for rays: `Mesh.prototype.raycast` and `BufferGeometry.prototype.computeBoundsTree / disposeBoundsTree` are three's again. Registered static meshes still get a BVH (own `mesh.raycast`). A game that relied on BVH for its own `THREE.Raycaster` adds three-mesh-bvh's setup itself.
227
+ - New `threePatches` export and `describe().threePatches`: the remaining class changes (`shadow-accessors`, `node-setup-position`), each undone page-wide with `threePatches.off(id)`.
228
+ - AI.md: the "When something happens -> which tool" list moved to recipe 16 §11 (the MCP server reads it there).
229
+ - No module option takes keys any more; modules only declare their actions and the game binds them (`createEngine({ bindings })` / `engine.input.bind`). Gone: `inventory({ keys, pad })`, `quests({ keys, pad })`, `photo({ keys, pad })`, `interactions({ keys })`, `grids.preview({ rotateKeys })`, `characters({ brakeKeys, brakePad })`, `createPlayer({ jumpKeys, runKeys })` (each now `[module-params]`). `presets.keys` is gone; its maps are `presets.bindings.inventory / quests / photo / gridRotate / brake`, plus new `presets.bindings.walk` (run / jump, what `presets.player.*` used to carry) and `presets.bindings.interact` (E / gamepad X, what `presets.interactions.*` used to carry). `presets.player.*` and `presets.interactions.*` hold no keys now. Migrate: `createEngine({ bindings: { ...presets.bindings.walk, ...presets.bindings.interact, ...presets.bindings.inventory } })`; "no key" is a binding to `[]`.
230
+ - `createEngine` options are typed in their schema (`engine.catalog('core').params` shows `bool`, `number`, `object|array` ... instead of `any`): a wrong shape such as `batching: 'yes'` or `fov: 'wide'` now throws `[module-params]` at the call (it used to pass and fail later or be ignored). An unknown `fallback` is `[module-params]` too (was `[engine-misuse]`). Param schemas accept several shapes as `'bool|object'`.
231
+ - R6 (options tables) is an error now: a module's schema and its d.ts options interface must name the same keys; a schema default written again as a destructuring default in the same function fails; a modules/ options table with `keys` / `pad` / `xKeys` fails.
232
+ - `inventory({ pauseGame })` of the wrong type is `[module-params]` (was `[inventory-misuse]`; the schema already checked it).
233
+ - Timing arguments are options objects (a number in their place throws `[module-params]` in dev): sound handle `h.fade(to, s)` / `h.stop(s)` are `h.fade({ to, seconds })` / `h.stop({ fade })`; `timeline.tween(t, to, duration, ease)` is `tween(t, to, { duration, ease })`; `fadeScreen(engine, to, seconds)` is `fadeScreen(engine, to, { seconds })`; `anim.go(state, fade)` / `anim.action(name, fade)` take `{ fade }`; fixed camera `blend(name, seconds, ease)` is `blend(name, { seconds, ease })`.
234
+ - Handles end with `remove()`: a tween promise's `cancel()` and a `dialogue.say()` promise's `stop()` are `remove()`; a sound handle gains `remove()` (same as `stop()`); a look part's `dispose()` is `remove()` (it owns no GPU resource). R7 now fails (was a warning) on any returned object with `stop()` / `cancel()` and no `remove()`, with no allowlist.
235
+ - `flow.transition` called `music.stop(fade)` positionally (it threw in dev since `music.stop({ fade })`); fixed.
236
+ - An unbound module action no longer throws at `engine.use` (`interactions()` without keys, `inventory()` without keys); reading it warns `[input-unbound]` once in dev, so binding after `use` works.
237
+ - Actions a module declares outside its ctx leave with it: the rts camera's `rotateLeft / rotateRight` (declared by the camera module), the player's `jump / run / brake` (declared at `characters()` install, optional), a grid preview's `rotate` (removed with the preview).
238
+
239
+ ### Breaking (module types and capabilities)
240
+
241
+ - Every module declares `type`: `'world' | 'look' | 'actor' | 'rules' | 'ui' | 'net' | 'tool'` (what it may own; `stage` still says when it runs). A module without one throws `[module-type]` with the fix: add `type: 'rules'` for game logic.
242
+ - Dev checks by type throw `[module-type-rule]` with the fix: a `look` module may not `ops.define` or write world records; a `ui` module may not `input.bind` or `saves.register`. A `world` module's file may not draw (rule R47).
243
+ - `requires` names a capability (`'world'`, `'inventory'`, `'sky'`), provided by a module's `provides`; a missing one names both fixes (install the engine part, or your own provider). Built-ins provide theirs (world, level, collision, rigid, nav, calendar, weather, sky, particles, inventory, quests, dialogue, interactions). After `{ replaces }`, `engine.<capability>` is the new provider's API.
244
+ - `describe().modules` is a list of `{ name, type, provides?, requires? }` (was a list of names).
245
+ - `weather()` returns two modules, installed by the same `engine.use(weather(...))`: `weather` (state, `engine.weather`: types, current, set, auto, save, events) and `weatherLook` (look, `engine.weatherLook`: particles `systems`, `flash`, `apply`, `particles`, `area`; `describe().weatherLook.rainVisible / snowVisible`). `engine.weather.systems / flash / apply / particles / area` and `describe().weather.rainVisible / snowVisible` are gone.
246
+ - Calendar: `timeOfDay`, `day` and `dayLength` are views of the `'calendar'` time channel (an origin plus `engine.clock.now`), not a counter of their own; writing them moves the origin. `day:start` / `season:change` / clock-time timers fire right after time moves (new `engine.time.onMove(fn)`), on a step and on a skip. `calendar.tick()` is gone; the save part also stores `at` (older saves still load).
247
+
248
+
249
+ ### Breaking (module boundaries)
250
+
251
+ - Core, render and ui name no module; modules register what core needs. A module's loading-screen name `module.<name>` is registered by the module with its own text (`engine.i18n.add` in install); `describe().player` drops `running` / `jumping` (compare `state` yourself); the light-count warning skips lights marked `userData.fixedCount` (light pools set it) instead of names starting `lightPool_`; night glow reads the `daylight` measure (`engine.audio.measure`: calendar, or the sky without one); the baseline sun follow steps aside for whoever holds `shadow.follow`; the title's Settings button comes from `engine.ui.titleItem('settings', ...)` (an unknown string in title `items` throws, listing the added ids); the water surface numbers moved to `render/fxNumbers.js`.
252
+ - New: `saves.register(key, { checkNewGame(data) })` (dev check of a part's new-game data; the world's "records placed by code" warning moved there), `engine.ops.route(fn)` / `engine.ops.refused(name, args, { reason, actor })`, `engine.world.pauseSimulation()`, `engine.inventory.contents()` / `setContents(data, { only })`. net uses only these; a game's own inventory provider needs `contents` / `setContents` for net to sync it.
253
+ - Checks: R25 follows a module held in a local (`const inv = e.inventory; inv._x`); R46 (another module's internal files) is an error; R27 also flags module names kept in `core/I18n.js`; R3 looks for `module.<name>` in the module's own folder.
254
+
255
+ ### Breaking (look values on shared points)
256
+
257
+ - Every `engine.look.<part>.<key>` is a shared point (`describe().shared['look.fog.far']`): the game's value is the base, effects multiply on top, the settings menu can only restrict. A game's `look.lights.set({ sun: { intensity: 3 } })` now dims in rain and fades at sunset (it used to cover both); for the exact number use `look.lights.manual('sun')` or `{ layer: 'system' }`.
258
+ - Two owners `set` one look value on one layer throw `[shared-conflict]` in dev (was: the later write won). Fix: one owner, `mul` / `add`, or another `layer`.
259
+ - `engine.mod('sky.sunLight' | 'sky.ambient' | 'sky.fog' | 'sky.tint' | 'sky.flash' | 'sky.cover')` are now `look.lights.sun.intensity`, `look.lights.hemi.intensity`, `look.fog.far`, `look.sky.tint`, `look.sky.flash`, `look.ground.cover`; `engine.sky.modifiers` is gone (read `engine.stacks.get(name).value()` or `describe().shared`).
260
+ - Shadows: `createEngine({ shadows, shadowType })`, `engine.setShadows`, `engine.shadows`, `engine.shadowType` and `look.lights` `sun.shadow` are gone; use `engine.look.shadow.set({ enabled, type })` (core, works without a sky; a sky adds cascades, extent ...).
261
+ - Fog: `createEngine({ fogFar })`, `engine.setFogFar` and `engine.fogFar` are gone; the start value is `style.sky.fog.far` / `sky({ fog: { far } })`, a game sets `look.fog.set({ far })`, `terrain({ viewFog: true })` makes the terrain look write the layer below it (owner `terrainLook`, removed with that module).
262
+ - Fog: an explicit `near` or `density` is kept as given; the weather multiplies `far` only (it used to scale density too).
263
+ - Settings menu: shadows / bloom / ao off is a `set: false` on the settings layer; on removes it, so a scene that turned them off stays off and a low-tier device's bloom stays off.
264
+ - `look.<part>.set(...)`'s handle `remove()` returns whether it removed anything.
265
+
266
+ ### Breaking (terrain and vegetation: data and look)
267
+
268
+ - `terrain()` and `vegetation()` each install two modules: data (`engine.terrain`, `engine.vegetation`) and look (`engine.terrainLook`, slot
269
+ `'terrain-look'`; `engine.vegetationLook`, slot `'vegetation-look'`). A game draws either its own way with
270
+ `engine.use(mine, { replaces: 'terrain-look' })` + `engine.terrain.view({ add, change, remove, show })` (or `'vegetation-look'` +
271
+ `engine.vegetation.view({ species, change, ring, show, drop })`) and keeps collision, paths, felling and saves (recipe 28 sections 6 and 7).
272
+ Code that lists module names (`openWorld().map(m => m.name)`) now sees `terrainLook` and `vegetationLook` too.
273
+ - Chunk records hold data only. Removed: `c.terrain` / `c.group` (terrain meshes: `engine.terrainLook.meshes.get(c)`), `c.veg` / `c.vegGroup`
274
+ (plant meshes: `engine.vegetationLook.mesh(c, name)`; placement data: `c.plants[name]`, felled slots `c.hidden[name]`),
275
+ `im.userData.hidden` / `im.userData.ids` (use `c.hidden[name]` and `c.plants[name].ids`).
276
+ - `vegetation.define()` returns the species' data; `geometry`, `lodGeometry`, `material` and `fadeUniforms` moved to
277
+ `engine.vegetationLook.kind(name)`. `Vegetation.levelOf` / `updateFade` and the terrain look internals `mountTerrain.js`, `chunkLevels.js`,
278
+ `terrainMat` / `sideMat` are gone.
279
+ - A chunk job that keeps failing is tried 3 times, then reported (`terrain:chunkFailed`, `[terrain-chunk-failed]`,
280
+ `describe().perf.chunks.failed`); `engine.terrain.retry()` sends it again (it used to sit in loading for ever).
281
+ - `terrain.setDensity` places only the plants again (ground collision is kept); `look.ground.replace` swaps the material in place.
282
+
283
+ ## 0.3.0 (2026-11-03)
284
+
285
+ WebGL renderer. Upgrade steps for a 0.2 game, most common first, with the error each old form now gives: [docs/MIGRATING-0.3.md](docs/MIGRATING-0.3.md).
286
+
287
+ ### Breaking
288
+
289
+ - Options: more option bags go through one schema (`readParams`): an unknown or removed option throws `[module-params]` in dev (release: warns once, ignored). This covers `createEngine`, `openWorld`, module factories, `npcs.add`, `createPlayer`, `triggers.add`, `addWheeled`, `audio.addBus`.
290
+ - Calendar: time of day, days, seasons, clock-time timers and their save moved from `sky()` to the new `calendar()` module (`engine.calendar`). `sky({ dayLength | day | seasons | daysPerSeason | hoursPerDay })` throws `[sky-option]`; `engine.sky.timeOfDay / day / season / ...` throw `[renamed-field]` in dev; `engine.sky.at / between / daily / onSeason` are gone. `openWorld` installs `calendar` (object form `calendar: {}`, was `sky: {}`).
291
+ - Pickups: new `pickups()` module. `inventory.spawnPickup / nearestPickup` and `inventory({ pickupRadius, bobDistance })` are gone (`pickups.spawn(position, { give })`, `pickups({ radius, showDistance })`). Event `item:pickup` → `pickup:take`; `container:add / remove` removed (`item:add / remove` carry `container`, `actor`). Pickup handle `id` is the world record id. `style.pickup.model` is not read (the shape is an asset model by name). Content pickups need `pickups()` `[module-needs]`.
292
+ - NPCs: `talk / talkLabel / talkRadius` → `interact: { op: 'npc.talk', label, radius, args }`.
293
+ - Clock and holds: `engine.clock.timeScale` removed (`engine.mod('clock.rate', { owner, set })`; `clock.rate` is read-only). `engine.resume / unfreeze` removed: `pause` / `freeze` return `{ owner, remove() }` (no chaining). `defineState` returns a handle. `runState.by` → `runState.owners`.
294
+ - Sky and lights: `engine.sky.sun / hemi` → `engine.lights.sun / hemi`; `sky.modify` removed (`engine.look.*`, `engine.mod`); `sky({ sun | hemisphere | fog: 'manual' })` throws `[sky-option]` (`look.lights.manual`, `look.fog.manual`). `look.tone` has no `mapping` (the engine writes `renderer.toneMapping` once at creation; change it in three.js). `setFogFar` no longer writes `scene.fog`.
295
+ - Style shader keys moved to look hooks: `style.sky.fog.glsl`, `style.sky.clouds.glsl / uniforms`, `style.wind.glsl / uniforms`, `style.water.glsl`, `water({ glsl })` throw and name `look.<part>.patch(slot, ...)`. Style functions (`backdrop`, fog `color`, tone `exposure`) receive `{ time, weather, season, state, sky }` instead of the sky.
296
+ - Audio: `audio.register(name, synth)` removed; a synth is an asset (`assets.manifest({ sounds: { name: fn } })`). `audio.sounds` rules `'synth'` / `{ synth }` throw `[audio-synth-gone]`. `audio.addBus(name, { level, owner })` returns a handle.
297
+ - Assets: model `params` in a manifest is a schema (`{ h: { type: 'number', default: 3 } }`), not values. `assets.cached` is no longer public.
298
+ - Characters: `canSwim` → `water: 'swim' | 'block' | 'wade' | fn`; the speed argument of `move()` and `moveInput.speed` are ignored (`engine.mod('move.speed', ...)`).
299
+ - Vehicles: `rigid.addVehicle` → `rigid.addWheeled`; `seat` → `seats: []`; `seatPosition / exitPosition` take a seat index; `vehicle:enter / exit` carry a `Rideable`.
300
+ - Removed: `entities` module, `engine.entities`, events `entity:spawn / remove / state / stage` (content templates with `stages`, event `template:stage`); `engine.spawn` (`engine.content.spawn`); `vegetation.add` (`vegetation.define`); `triggers({ debug })` / `setDebug` (`engine.debug.view('triggers')`); dialogue `lock` option (`channel: 'bubble'`).
301
+ - Changed shapes: `quests.state` is a method `state(id)`; `trade()` and grid `check / preview / place` results use `code` (was `reason`) plus `facts`, `nextActions`; `describe().ui.inputContexts` → `describe().holds.input`.
302
+ - The 0.2 rename stubs (`[renamed-api]` for `setExposure`, `setToneMapping`, `sky.setEnvironment / setShadow`, `weather.define`, `post.add / enable`, `look.clouds`, `cameraOverride`, views `pos`, `style.character`) are removed; those names are now plain `TypeError` / `undefined` (renamed result fields are the exception below: a dev-only error pointing at the new name, no compatibility).
303
+ - 0.2 names that used to do the wrong thing silently now throw `[renamed-field]` in dev naming the new form, all through one rename table helper (`renamed` in `core/validate.js`; release builds skip it): `dialogue.say / start({ lock })` → `channel: 'bubble'`; `engine.clock.timeScale` → `engine.mod('clock.rate')`; the names that moved from `engine.sky` to `engine.calendar` (an explicit list); `style.pickup.model`; result `.reason`, `runState.by`, `describe().ui.inputContexts`. Writing `clock.rate` throws `[mod-owner]` (it is read-only).
304
+
305
+ ### Added
306
+
307
+ - `calendar()` (`at / between / daily / onSeason / untilMark`, `isDay`, `daylight`) and `pickups()` modules, both in the `index.js` exports.
308
+ - `engine.mod` / `engine.stacks`: owned, timed, saved modifiers for any quantity (`move.speed`, `clock.rate`, sky multipliers), event `mod:end`; `engine.time` channels; `onFixed(fn, { channel, phase })`; `onRender(fn)`; `engine.wrap(target, method, fn)`; `input.gate(action, owner)`, `input.push({ owner })`, `describe().holds`.
309
+ - Look: `look.<part>.manual(keys)`, `look.state(patch)`, `look.shadow.include(material)`, `look.materials.glow` (emissive that follows daylight), `look.view`, `lights.env.intensity` / `lights.env.share`, sun `shadow`, hemi `ground`; sky `top` / `horizon`; `style.sky.dim: { tint, stars }` (default on; false keeps a sky.tint at full color at night, or stars through cloud cover); `replace(m, { effects: false })`; `terrain({ material, effects: false })`. `describe().owned` and `describe().look.<part>.<key>.writer` say who writes each value; the engine yields to a game's direct three.js write.
310
+ - Shaders: named patch slots (`{ slot, pars, glsl }`), callable `#include <threedog_detail>` / `<threedog_lighting>`, uniforms `uSunDir`, `uDaylight`, `uTimeOfDay`; material texture slots (`{ texture, channel, repeat, wrap, colorSpace }`), `aoMap`, `lightMap`, screen projection.
311
+ - Rendering: light probe bake scaffold (`engine.bakeProbes` / `loadProbes`); `bakeVertexAO`; post `ao({ radius, intensity })`; dev views `overdraw` / `shaderCost`, `debug.defineView`, `debug.reloadGlsl`, `debug.reloadAssets`; `inspect.materials()` / `inspect.perf()`.
312
+ - Assets: `manifest([packs])`, `paramsOf / setParams` (hot swap), per-entry `cache: false`, `castShadow`, `receiveShadow`; textures as a Texture or factory; sounds as synth functions.
313
+ - Content: `contentParts` (one kind split over files), `engine.content.fields()`, `content.spawn`, field tables checked by content-check, content write-back.
314
+ - Characters: `maxJumps`, `airJumpSpeed`, `jumpBuffer`, `fall`, `states`, `channel`, `id`, mover `'manual'` (switchable at runtime), `launch`, `addJumps`, `resetJumps`, `jumpState`, `stat()`, `characters.support` (moving platforms), `safeGround`; events `character:launch`, `character:fall`, `character:water`. Anything can be ridden (`Rideable`, several seats, passengers).
315
+ - Gameplay: hold / approach interactions (events `interaction:hold`, `interaction:interrupt`), per-actor bags `inventory.of(actor)`, `quests.advance`, dialogue bubbles (`channel: 'bubble'`, event `dialogue:bubble`), UI focus navigation and choice cursor, HUD anchors, grid levels / occupancy layers, `npcs.add({ channel })`.
316
+ - Cameras: follow camera `projection` / `size`, `ground`, `mouseLook`, `hideTargetNear`, `setView / getView`, preset `thirdPersonAction`; `screenToGround` on every camera rig.
317
+ - Saves: `saves.register({ movedFrom })`; `dispose({ keepContext })`; net WebSocket heartbeat / reconnect; worker watchdog.
318
+ - Exports: `calendar`, `pickups`, `contentParts`, `bakeVertexAO`. Tools package exports `@threedog/tools/browser`, `look`, `contract`, `panel`, `gallery`.
319
+ - Optional technique examples, copied into a game rather than installed as modules (`threedog examples list`).
320
+ - World: near tiers `world.simulate(kind, { fullRadius, nearEvery })` (records beyond `fullRadius` run near once every `nearEvery` seconds with the accumulated dt). NPCs use them: those farther than half of `world.radius` now step 15 times a second instead of every fixed step.
321
+ - Assets: `assets.modelNow(name)` of a registered model nothing has loaded yet (code-built ones included) warns once in dev `[asset-not-loaded]`, naming `modelNow(name) ?? await model(name)` and `preload: true`.
322
+ - Grids: default player text `grid.<code>` (zh-CN, en) for every built-in failure code (`outOfBounds`, `occupied`, `wrongGround`, `notFlat`, `noGrid`, `idTaken`, `unknown`, `notPlaced`, `noTarget`, `badFields`), registered by `grids()`; `engine.t('grid.' + r.code)` no longer warns `[unknown-name]`.
323
+ - Light pool: `lightPool.add(at, { dusk })` lets a source follow the time of day on the same daylight curve as `look.materials.glow` (street lamps off at noon, their light given to lit sources); default off.
324
+ - HUD: `hud.counter(id, { value })` takes text too (a clock, a quest step); without a value it shows the label alone instead of "0".
325
+
326
+ ### Changed defaults
327
+
328
+ - Lighting (changes every game's default look under a sky): the style's ambient column is now the whole diffuse fill. The neutral room environment takes its share (`look.lights` `env.share`, 0..1, default 0.5) and the hemisphere light the rest (`env.intensity` stays the absolute `scene.environmentIntensity`, also under a sky: a game's value is written as given); before, the room map added about four times the ambient on top, so sunlit and shaded faces looked alike (rainy-street noon: shadows 19% darker -> 50%). Packs tuned against the old fill may want a higher ambient column.
329
+ - Post effects: a listed effect is on. `lut`, `grain`, `vignette`, `chromatic`, `dof`, `ao` and `outline` no longer default to `enabled: false` (placed in `style.post` they silently did nothing); pass `enabled: false` to list one off. `style check` counts on-effects by the same rule.
330
+ - Lighting: under a sky the neutral room environment follows the sky's day curve (nights darker on PBR); sun shadow bias is a few centimeters in world terms (contact shadows); neutral sky keyframes hold night longer.
331
+ - Post: on the low tier `look.post.set({ '<effect>.enabled': false })` turns off a costly effect the game added (it was a no-op). Photo bloom follows the game's post chain.
332
+ - `freeze()` keeps `uTime` moving (`{ ambient: true }` stops it). `jump()` is buffered. `item:add / remove` fire for every container.
333
+ - Batching merges only engine-placed content; game meshes opt in with `userData.batch = true`.
334
+ - i18n locale matched by language (`'zh'` → `'zh-CN'`); unknown locale warns once. `input.simulate` throws on an unknown action.
335
+ - Cold start: nothing renders before ready; shaders compile for the real target.
336
+ - NPCs: near tiers are off by default (every near NPC walks every fixed step; before, NPCs beyond half `world.radius` moved every 4th step in visible jumps). Large crowds opt in with `characters({ npcTiers: { fullRadius, nearEvery } })` or `engine.npcs.tiers(opts)`.
337
+
338
+ ### Fixed
339
+
340
+ - Interactions: an interaction on a model the game moved away from its world record is found where the model stands (was missed beyond 2 m). One xz index keyed by each item's world position, re-filed only when it moved.
341
+ - Scene delta (cascades, fog, glow): a class with its own `material` accessor (troika-three-text) keeps it; the engine's material-swap hook calls the original getter / setter instead of shadowing them.
342
+ - UI display timers (toasts) run on the page's own clock: wall clock in the game, the stepped time on a headless page, so `threedog step` then `snap` no longer shows every toast from the step.
343
+ - Sky: stars sit behind the drawn clouds and dim with the weather's cloud cover (`uCloud`), so a rainy or overcast night shows no starry sky (without weather the default cover 0.25 leaves them at 75%).
344
+ - Adaptive resolution changes the render scale before a frame draws, not after: the frame of the change was presented blank (a screenshot caught it black).
345
+ - Weather grey (and any `sky.tint`) follows the sky's light: the tint color is dimmed by how bright the sky is now, so a rainy night stays dark instead of turning lit grey; the brightest sky row is unchanged.
346
+ - Under a sky the room environment follows the sky's light (ambient column x sky color), not the ambient column alone: Standard / Lambert / Phong no longer stay day-lit at night while Toon goes dark.
347
+ - `describe()` shows set values (post params, exposure, light intensity) as set (`0.25`, `1.12`), not rounded to one decimal.
348
+
349
+ ### Saves
350
+
351
+ - 0.2 saves load. The calendar takes the old `sky` part (`movedFrom`); saved NPC `talk` fields become `interact`; the `world` part is version 5 (migrated on load). 0.2 builds refuse 0.3 saves as `'tooNew'`.
352
+ - A save with a `null` part is refused as corrupt; a load error in any part, `world:load` listener or `afterLoad` rolls the game back.
353
+ - Physics: new save part `rigid`. Bodies added with `addBox / addBall / addHull({ id })`, and every vehicle, save pose, rotation, velocities and sleep; a load restores them (before, a toppled crate came back upright and at rest, and a car stayed where it was at load time). Ids are unique across bodies and vehicles (`[rigid-misuse]`). Not synced by `net()`. newGame / load rebuild the physics world and emit `rigid:rebuilt { world, player, bodies }` once the bodies are back: a game re-creates its own joints there (they used to vanish silently). In dev, a rebuild that dropped joints with none re-created by the next step warns `[rigid-misuse]`.
354
+
355
+ ### Tools
356
+ - `threedog snap` on a paused (step-driven) page draws the current state once before reading, without advancing game time: at tick 0 it saved a black picture.
357
+ - `threedog how`: among equal matches an AI.md row (the one recommended entry) ranks before recipe sections and technique examples; the recipe column no longer counts as task words. `docs/CONVENTIONS.md` "One task, which entry" says which entry is first where a task has several.
358
+
359
+ - Removed: `threedog new-style`, `--style` on `new-game` / `init`, positional `content set <id> <field> <json>` (now `field=value`). A game's look lives in its own `style/` folder; no published style packages.
360
+ - Game folder: a command run inside a game acts on that game wherever it sits (nested in another repo's npm workspaces, or outside `games/` here); `-w .` and `-w <path>` name a game by its folder. `threedog init [folder]` takes the folder to create (was a name for the current folder) and refuses a workspaces root.
361
+ - Errors: `engine.error.at` is the first stack line of a gameplay error (also on the describeText error line); bridge commands print `engine error [code] where: message (at …)` instead of `engine error [object Object]`.
362
+ - Error summaries (the dev log's repeat line, `threedog errors`, play / verify / test results) keep the end of a long message, where engine errors put the requirement and `[code]` (was cut at 100–220 characters).
363
+ - `new-game` starts blank; `--open-world` gives terrain, sky, follow camera and a player.
364
+ - Added: `threedog stress`, `tune show | write`, `gallery [--shots]`, `art list | copy`, `content add | remove`, `--gpu` / `--software`, `doctor --json`, `map -w <game>`. `threedog shot` prints the look numbers after every shot (`--ref`, `--no-look`, `--json`).
365
+ - The look check reaches every picture: `threedog snap` (dev bridge / MCP) runs it on the live page (`--no-look` skips it); `threedog shot http://localhost:5173/` opens a running page without building; `threedog shot --image file.png` gives the pixel-only part for a picture taken any other way and says what needs the live page. Glare is printed as `fact:` with the detail lost under it (on vs off), a `contradiction:` only where DESIGN.md says no glare (`Look intent: no-glare`).
366
+ - Look check: large clipped areas, large near-black areas and a night not dark from lighting (`clipped`, `crushed`, `time-flat`) are now `fact:` lines, a `contradiction:` only where DESIGN.md declares the opposite. DESIGN.md takes an optional `Look intent:` line of listed words (`no-glare`, `no-pitch-black`, `dark-nights`, `bright-nights`, `strong-light`, `bright`, `muted`, ...), the only source of a look wish: the free words of the "Look and controls" table and "Not for this game" are no longer read; an unknown word is reported. `style check` no longer warns above 2 post effects: it notes which are on, which are costly, and how to see each one's cost.
367
+ - content-check: fields of props, templates, pickups and kinds; model names from the game's `assets.js`; old NPC `talk` and `'synth'` sound rules are errors. Rules R41–R45 (engine code); R39 removed.
368
+ - Template: a new game's package.json depends on `@threedog/post-effects` (the style's `post` line uses it); the outside-the-repo check installs exactly the template's dependencies.
369
+ - Template: a new game has the `shot`, `types`, `perf`, `bake`, `assets` and `doctor` scripts the docs name (`npm run shot` works in a standalone game).
370
+ - Error hints: a property read on `null` no longer gets the "module not installed" hint (`null-value`: a lookup or helper such as three.js `mergeGeometries` returned null).
371
+ - Look check: a `light:` fact (key vs fill share of the brightness, how much darker shadows are; a contradiction only under a DESIGN.md "strong / dramatic light"), a fact when the camera stands inside a closed mesh, each exposure next to noon / midnight when a style's exposure curve differs; the printed block is short (at most four one-sentence hints, ranked; `--json` keeps all).
372
+ - `threedog shot` / `snap` print only what bears on the picture under it (time, weather, camera; `threedog describe` for the rest, `--json` / `--describe-only` keep the whole state). `threedog check` prints warnings as one count line per rule (`--verbose` lists them).
373
+ - Ops `interaction.use` / `pickup.take`: a `tooFar` result carries `facts: { distance, radius, at }`. `presets.keys.gridRotate` is in the types. GAMEMAP counts an action named by an interaction as used. The dev model-cache warning names the plugin's error instead of "no model cache".
4
374
 
5
375
  ## 0.1.0 (unreleased)
package/README.md CHANGED
@@ -1,40 +1,49 @@
1
1
  # threedog
2
2
 
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) -> **style pack** (all art).
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
7
  ```sh
7
- npm install threedog three@~0.187.0
8
- npm install @threedog/terrain-noise # optional: the noise terrain generator terrainPreset() (without one the ground is flat)
9
- npm install -D vite @threedog/tools # optional: the vite preset and the threedog command line
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
10
11
  ```
11
- Or let it set up the folder: `npx threedog init` (flags: `--example` for a small gameplay sample, `--style empty|<path-or-package>`; the default is a clean start with an empty style pack in `style/`) 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: `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
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.
13
14
 
14
15
  ## Minimal usage
15
16
  ```js
17
+ import 'threedog/tsl'; // WebGPU with TSL, what a new game starts on; a game started with --webgl leaves this line out and the renderer option below
16
18
  import { createEngine, presets, openWorld } from 'threedog';
17
19
  import { terrainPreset } from '@threedog/terrain-noise'; // optional terrain generator (npm install @threedog/terrain-noise)
18
20
 
19
- const engine = createEngine({ canvas: document.getElementById('view') }); // no style pack: gray placeholders
21
+ const engine = createEngine({ canvas: document.getElementById('view'), renderer: 'webgpu' }); // no picture code yet: gray placeholders
20
22
  engine.use(openWorld({ camera: 'follow', seed: 7, terrain: terrainPreset() }));
21
23
  engine.characters.createPlayer({ ...presets.player.thirdPerson });
22
24
  engine.start();
23
25
  ```
24
- A look is a style pack you pass in (yours or a published one): `createEngine({ canvas, style: yourPack })`.
26
+ The picture is the game's own: plain three.js in its `picture/` folder (what `threedog new-game` generates), reading signals from `engine.uniforms`. A new game runs on WebGPU with TSL shaders, or on WebGL with GLSL shaders through `--webgl`. A browser without WebGPU still runs the WebGPU form, on three's WebGL2 backend, slower; `describe().renderer` says why.
25
27
  `vite.config.js` with the preset: `import { gameConfig } from '@threedog/tools/vite'; export default gameConfig(import.meta.dirname);`
26
28
 
27
29
  ## Entry points
28
30
  - `threedog`: the whole public API (`THREE` is re-exported, so `import { THREE } from 'threedog'` is the same three instance).
29
- - Style packs are separate packages (yours or published): the engine ships no art (visuals only; the noise terrain generator `terrainPreset()` is `@threedog/terrain-noise`); without a style pack everything is a neutral gray placeholder.
31
+ - The engine ships no art (visuals only; the noise terrain generator `terrainPreset()` is `@threedog/terrain-noise`); without picture code everything is a neutral gray placeholder.
32
+ - `threedog/tsl`: the WebGPU route; import it before `createEngine({ renderer: 'webgpu' })`. Also TSL helpers for materials and lighting.
33
+ - `threedog/layers`: `RESERVED_LAYERS`, the three.js layers the engine keeps (a game's own are 1 to 25).
34
+ - `threedog/grid`: `sampleGrid`, `gridFromPixels`, `decodePng` (2D fields; no three.js, works in workers and tests).
35
+ - `threedog/worker`: `serve(handler)`, the worker side of `engine.threads` lanes.
30
36
  - `threedog/error-hints`: the developer error hint table (used by `@threedog/tools`).
31
37
 
32
38
  Nothing else is a public path; files under `core/`, `modules/` etc. may move between versions.
33
39
 
34
- ## Global changes to three.js
35
- Importing the engine changes two defaults on `THREE.Mesh.prototype`, for every mesh in the page:
36
- - `Mesh.prototype.raycast` is replaced by three-mesh-bvh's accelerated raycast (`BufferGeometry.prototype.computeBoundsTree` / `disposeBoundsTree` are added). Results are the same as three's own raycast; meshes without a bounds tree fall back to it.
37
- - `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 (including in your own code) still wins; assigning `undefined` restores the default. The value is stored under a symbol, so `Object.hasOwn(mesh, 'customDepthMaterial')` is false.
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).
45
+
46
+ 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.
38
47
 
39
48
  ## Docs
40
49
  Shipped in the package: `docs/AI.md` (how to use the engine, written for AI assistants), `docs/API.md` + `docs/api/` (per module), `docs/recipes/` (task guides), `docs/THREE.md` (using three.js directly).
package/core/Animator.js CHANGED
@@ -8,15 +8,17 @@
8
8
  // anim.set('speed', 3); anim.go('move'); anim.action('wave');
9
9
  // anim.sync('attack', fighter.t); ... anim.sync(null); // gameplay time drives the pose; null hands control back
10
10
  // States are the mapping: game names (idle / attack / hurt) on the left, whatever the asset calls the clip on the right.
11
- // The mapping belongs to the model file, so it can live as data in the asset manifest (models: { hero: { url, animation: { states } } }): Assets.animate
12
- // merges it under the code's config, and swapping the model then never touches game code. anim.check([...actions]) lists what the game would miss.
13
- // A clip name also matches the part after the last '|' ('Idle' finds 'CharacterArmature|Idle', as Blender exports name them).
11
+ // The mapping can live in the asset manifest (models: { hero: { url, animation: { states } } }), merged under the code's config, so a new model
12
+ // never touches game code. anim.check([...actions]) lists what the game would miss.
13
+ // A clip name also matches the part after the last '|' ('Idle' finds 'CharacterArmature|Idle').
14
14
  // Weights are managed here: each state has a fading weight, blend trees split it by parameter; all action weights sum to 1.
15
15
  // A one-shot action emits anim:end { root, state } when done, then moves to its `then`. Native objects: mixer, actions (clip name -> AnimationAction).
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, checkOptions } from './validate.js';
19
+ import { warnOnce, warnMissing, missingText } from './validate.js';
20
+ import { readParams, keysSchema, isOptions } from './params.js';
21
+ const GO_KEYS = ['fade'];
20
22
 
21
23
  // Config keys: a typo (loops: false, state: {...}) would silently play the wrong thing, so both levels are checked like any other options
22
24
  const CONFIG_KEYS = ['fade', 'states', 'transitions', 'params'];
@@ -36,7 +38,7 @@ export class Animator {
36
38
  /** 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 */
37
39
  constructor(engine, root, config = {}, mappedIn = null) {
38
40
  // config is the code's options merged over the manifest mapping, so name both places a typo can be in
39
- checkOptions(mappedIn ? `assets.animate() / ${mappedIn.label}` : 'assets.animate()', config, CONFIG_KEYS);
41
+ readParams(mappedIn ? `assets.animate() / ${mappedIn.label}` : 'assets.animate()', keysSchema(CONFIG_KEYS), config);
40
42
  const { fade = 0.25, states = {}, transitions = {}, params = {} } = config;
41
43
  this.engine = engine;
42
44
  this._mappedIn = mappedIn;
@@ -64,7 +66,7 @@ export class Animator {
64
66
  }
65
67
  /** Dev check at build time: the same problems check() returns, minus the game's action list (the Animator does not know it). */
66
68
  _check() {
67
- for (const [st, def] of Object.entries(this.states)) checkOptions(`assets.animate() ${this._where(st)}`, def, STATE_KEYS);
69
+ for (const [st, def] of Object.entries(this.states)) if (isOptions(def)) readParams(`assets.animate() ${this._where(st)}`, keysSchema(STATE_KEYS), def);
68
70
  for (const p of this._problems()) warnOnce(p);
69
71
  }
70
72
  /** Where a state is written: the manifest entry when the mapping came from there (data), else the code's states. */
@@ -113,11 +115,12 @@ export class Animator {
113
115
  set(param, v) { this.params[param] = v; return this; }
114
116
 
115
117
  /**
116
- * Switch to a state (fade = transition seconds). Returns the action, or null (with a dev warning) if the state or its clip does not exist.
118
+ * Switch to a state ({ fade }: transition seconds). Returns the action, or null (with a dev warning) if the state or its clip does not exist.
117
119
  * Does not switch while the current state is locked and unfinished, or while sync() drives a state.
118
- * @example anim.go('idle'); anim.go('run', 0.1)
120
+ * @example anim.go('idle'); anim.go('run', { fade: 0.1 })
119
121
  */
120
- go(state, fade) {
122
+ go(state, opts) {
123
+ const fade = opts === undefined ? undefined : readParams('animator.go()', keysSchema(GO_KEYS), opts).fade;
121
124
  if (this._driven) return this._layers.find(l => l.name === this._driven).actions[0].a;
122
125
  const cur = this._layers.find(l => l.name === this.state && l.target === 1);
123
126
  if (cur && state === this.state && !cur.done) return cur.actions[0].a; // already in this state (a finished one-shot may replay)
@@ -149,14 +152,14 @@ export class Animator {
149
152
  this._weights();
150
153
  return actions[0].a;
151
154
  }
152
- /** Play a one-shot action: when done, go to the state's `then`; without `then` (or given a bare clip name) return to the previous state. */
153
- action(name, fade) {
155
+ /** Play a one-shot action: when done, go to the state's `then`; without `then` (or given a bare clip name) return to the previous state ({ fade } like go). */
156
+ action(name, opts) {
154
157
  const prev = this.state, def = this.states[name];
155
158
  if (!def) {
156
159
  if (!findClip(this.clips, name)) { if (this.hasClips) warnMissing('clip', name, this.clips.map(c => short(c.name))); return null; }
157
160
  this.states[name] = { clip: name, loop: false, lock: true };
158
161
  }
159
- const a = this.go(name, fade);
162
+ const a = this.go(name, opts);
160
163
  if (a && this.state === name) {
161
164
  this._layers.find(l => l.name === name).once = true; // not interrupted by the character's per-frame go() until it ends
162
165
  if (!this.states[name].then) this._return = prev;