threedog 1.1.0 → 1.2.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 (363) hide show
  1. package/CHANGELOG.md +879 -798
  2. package/README.md +1 -1
  3. package/core/assets/Animator.js +41 -3
  4. package/core/assets/Assets.js +100 -24
  5. package/core/assets/assetEntry.js +73 -20
  6. package/core/assets/assetHot.js +68 -16
  7. package/core/assets/assetLoad.js +6 -6
  8. package/core/assets/assetLod.js +9 -2
  9. package/core/assets/assetManifest.js +12 -2
  10. package/core/assets/assetPart.js +54 -0
  11. package/core/assets/ik.js +271 -0
  12. package/core/assets/modelNeeds.js +37 -0
  13. package/core/assets/namedModel.js +102 -29
  14. package/core/assets/nodeVisibility.js +15 -0
  15. package/core/audio/Audio.js +36 -4
  16. package/core/audio/audioReverb.js +99 -0
  17. package/core/audio/audioRules.js +1 -1
  18. package/core/audio/audioVoice.js +1 -1
  19. package/core/base/Events.js +14 -4
  20. package/core/base/Random.js +1 -1
  21. package/core/base/Vars.js +1 -1
  22. package/core/base/docRef.js +51 -0
  23. package/core/base/errorCodes.js +178 -126
  24. package/core/base/errorHints.js +9 -7
  25. package/core/base/errors.js +25 -10
  26. package/core/base/events.generated.js +2 -0
  27. package/core/base/freeParts.js +76 -0
  28. package/core/base/math.js +28 -0
  29. package/core/base/sections.js +5 -5
  30. package/core/base/validate.js +31 -3
  31. package/core/engine/Engine.js +16 -6
  32. package/core/engine/Loading.js +5 -3
  33. package/core/engine/copies.js +1 -1
  34. package/core/engine/headlessLoad.js +4 -1
  35. package/core/engine/lifecycle.js +32 -16
  36. package/core/engine/loop.js +71 -27
  37. package/core/engine/moduleSlots.js +2 -2
  38. package/core/engine/moduleTypes.js +3 -3
  39. package/core/engine/modules.js +65 -39
  40. package/core/engine/page.js +6 -3
  41. package/core/engine/services.js +6 -5
  42. package/core/engine/startup.js +5 -5
  43. package/core/input/Input.js +28 -14
  44. package/core/input/inputContext.js +28 -16
  45. package/core/input/inputKeyboard.js +31 -3
  46. package/core/input/inputPad.js +4 -0
  47. package/core/input/inputPointer.js +2 -1
  48. package/core/input/inputSeat.js +1 -1
  49. package/core/inspect/Budget.js +109 -19
  50. package/core/inspect/DebugOverrides.js +28 -4
  51. package/core/inspect/Describe.js +17 -9
  52. package/core/inspect/Inspect.js +4 -2
  53. package/core/inspect/InspectMaterials.js +3 -1
  54. package/core/inspect/InspectPerf.js +19 -9
  55. package/core/inspect/InspectScene.js +32 -7
  56. package/core/inspect/MaterialInfo.js +19 -2
  57. package/core/inspect/UrlState.js +46 -27
  58. package/core/inspect/catalog.js +28 -9
  59. package/core/inspect/debugView.js +2 -1
  60. package/core/inspect/describeRender.js +25 -13
  61. package/core/inspect/describeText.js +14 -6
  62. package/core/inspect/lightWatch.js +1 -1
  63. package/core/inspect/metadata.generated.js +35 -17
  64. package/core/inspect/pictureChecks.js +148 -0
  65. package/core/inspect/pictureMenu.js +84 -0
  66. package/core/inspect/pictureWriters.js +26 -6
  67. package/core/inspect/textureBytes.js +12 -2
  68. package/core/inspect/toolDoor.js +2 -4
  69. package/core/ops/Ops.js +11 -4
  70. package/core/ops/holds.js +27 -10
  71. package/core/ops/opsAtomic.js +15 -7
  72. package/core/ops/opsGuard.js +2 -2
  73. package/core/ops/opsRun.js +8 -7
  74. package/core/ops/sharedPoint.js +72 -21
  75. package/core/ops/stacks.js +56 -16
  76. package/core/saves/SaveStore.js +9 -3
  77. package/core/saves/Saves.js +32 -23
  78. package/core/saves/saveApply.js +96 -44
  79. package/core/saves/saveIds.js +1 -1
  80. package/core/saves/saveVersions.js +7 -5
  81. package/core/saves/session.js +17 -8
  82. package/core/saves/stateReplace.js +34 -15
  83. package/core/scene/Rays.js +52 -10
  84. package/core/scene/Views.js +13 -7
  85. package/core/scene/adaptive.js +144 -21
  86. package/core/scene/drawOnly.js +17 -0
  87. package/core/scene/gameLights.js +44 -3
  88. package/core/scene/sceneMethods.js +13 -11
  89. package/core/scene/stepPoses.js +11 -3
  90. package/core/scene/targeting.js +5 -3
  91. package/core/scene/thingOps.js +1 -1
  92. package/core/scene/tier.js +15 -0
  93. package/core/stream/Batching.js +30 -7
  94. package/core/stream/Stream.js +26 -7
  95. package/core/stream/batchGroups.js +2 -2
  96. package/core/stream/chunkStream.js +7 -5
  97. package/core/stream/prepare.js +77 -0
  98. package/core/time/skip.js +3 -1
  99. package/core/time/time.js +4 -2
  100. package/docs/AI.md +82 -83
  101. package/docs/API.md +16 -16
  102. package/docs/CODEMAP.md +16 -11
  103. package/docs/COMMANDS.md +139 -142
  104. package/docs/CONVENTIONS.md +37 -49
  105. package/docs/MIGRATING-0.8.md +2 -2
  106. package/docs/MIGRATING-1.0.md +2 -2
  107. package/docs/THREE.md +28 -35
  108. package/docs/api/assets.md +3 -1
  109. package/docs/api/audio.md +4 -2
  110. package/docs/api/budget.md +5 -0
  111. package/docs/api/characters.md +10 -8
  112. package/docs/api/collision.md +6 -4
  113. package/docs/api/engine.md +16 -16
  114. package/docs/api/events.md +3 -2
  115. package/docs/api/ground.md +6 -5
  116. package/docs/api/hud.md +4 -2
  117. package/docs/api/input.md +5 -5
  118. package/docs/api/particles.md +2 -1
  119. package/docs/api/photo.md +3 -0
  120. package/docs/api/post.md +7 -4
  121. package/docs/api/quests.md +2 -2
  122. package/docs/api/rays.md +1 -2
  123. package/docs/api/saves.md +7 -7
  124. package/docs/api/settings.md +2 -2
  125. package/docs/api/tools.md +3 -1
  126. package/docs/api/vars.md +1 -1
  127. package/docs/api/vegetation.md +4 -2
  128. package/docs/api/world.md +1 -1
  129. package/docs/recipes/01-new-game.md +16 -17
  130. package/docs/recipes/02-npc.md +22 -18
  131. package/docs/recipes/03-items-pickups.md +37 -35
  132. package/docs/recipes/04-quests.md +15 -10
  133. package/docs/recipes/05-props-bake.md +101 -95
  134. package/docs/recipes/06-clock-events.md +28 -28
  135. package/docs/recipes/07-flow-scenes-pause.md +29 -26
  136. package/docs/recipes/08-weather-sky.md +52 -64
  137. package/docs/recipes/09-materials-lights-models.md +26 -17
  138. package/docs/recipes/10-blender-level.md +15 -10
  139. package/docs/recipes/11-vehicles.md +12 -7
  140. package/docs/recipes/12-navmesh.md +44 -26
  141. package/docs/recipes/13-animation.md +56 -45
  142. package/docs/recipes/14-custom-module.md +21 -18
  143. package/docs/recipes/15-perf.md +61 -55
  144. package/docs/recipes/16-dev-bridge.md +23 -33
  145. package/docs/recipes/18-world.md +36 -42
  146. package/docs/recipes/19-shooting-picking.md +20 -15
  147. package/docs/recipes/20-content-actions-save.md +48 -56
  148. package/docs/recipes/21-camera.md +45 -54
  149. package/docs/recipes/22-shop-gold.md +12 -7
  150. package/docs/recipes/23-ops.md +25 -23
  151. package/docs/recipes/26-ui-parts.md +67 -47
  152. package/docs/recipes/27-net.md +12 -7
  153. package/docs/recipes/28-terrain.md +24 -21
  154. package/docs/recipes/29-grid.md +32 -27
  155. package/docs/recipes/30-templates.md +21 -20
  156. package/docs/recipes/31-audio.md +39 -22
  157. package/docs/recipes/32-action-game.md +19 -14
  158. package/docs/recipes/33-stream-sources.md +15 -11
  159. package/docs/recipes/34-environment-lighting.md +126 -70
  160. package/docs/recipes/35-picture-from-reference.md +8 -8
  161. package/docs/recipes/36-ground-plants.md +27 -21
  162. package/docs/recipes/40-scene.md +19 -28
  163. package/docs/recipes/43-shader-patches-surfaces.md +15 -12
  164. package/docs/recipes/44-water-weather-hooks.md +34 -31
  165. package/docs/recipes/45-cascaded-shadows.md +35 -26
  166. package/docs/recipes/46-blender-art-route.md +6 -1
  167. package/docs/recipes/49-game-module-contract.md +13 -8
  168. package/docs/recipes/50-own-renderer.md +6 -2
  169. package/docs/recipes/51-capability-catalog.md +15 -8
  170. package/docs/recipes/52-around-the-picture.md +34 -32
  171. package/docs/recipes/53-ground-up-close.md +6 -1
  172. package/docs/recipes/55-mods-time-wrap.md +27 -19
  173. package/docs/recipes/56-webgpu-tsl.md +74 -43
  174. package/docs/recipes/57-control.md +18 -13
  175. package/docs/recipes/58-input.md +26 -16
  176. package/docs/recipes/59-depth-post-effects.md +8 -3
  177. package/docs/recipes/60-judge-the-picture.md +9 -8
  178. package/docs/recipes/61-deploy.md +5 -0
  179. package/docs/recipes/62-picture-code.md +70 -79
  180. package/docs/recipes/63-third-person-start.md +47 -45
  181. package/docs/recipes/64-particles.md +22 -10
  182. package/docs/recipes/65-swarm.md +18 -13
  183. package/docs/recipes/66-common-tasks.md +38 -35
  184. package/examples/action/GAMEMAP.md +2 -3
  185. package/examples/action/main.js +3 -3
  186. package/examples/action/picture/lights.js +3 -1
  187. package/examples/perf-island/GAMEMAP.md +3 -3
  188. package/examples/perf-island/picture/lights.js +2 -1
  189. package/examples/plain-picture/GAMEMAP.md +1 -1
  190. package/examples/rc2d/GAMEMAP.md +1 -1
  191. package/examples/styletest/GAMEMAP.md +2 -2
  192. package/examples/styletest/main.js +1 -1
  193. package/examples/techniques/interior-light/README.md +3 -3
  194. package/examples/techniques/interior-light/interiorLight.js +2 -4
  195. package/examples/techniques/interior-light/picture/lights.js +2 -1
  196. package/examples/techniques/modular-building/picture/lights.js +3 -1
  197. package/examples/techniques/outlines-and-rim/picture/lights.js +3 -1
  198. package/examples/techniques/procedural-animation/README.md +1 -1
  199. package/examples/techniques/procedural-animation/main.js +1 -1
  200. package/examples/webgpu-tsl/GAMEMAP.md +1 -1
  201. package/examples/world/GAMEMAP.md +2 -3
  202. package/examples/world/art/humanoid.js +1 -1
  203. package/examples/world/main.js +6 -3
  204. package/index.d.ts +2 -2
  205. package/llms.txt +101 -0
  206. package/modules/ambience/Ambience.js +21 -5
  207. package/modules/calendar/index.js +9 -5
  208. package/modules/calendar/schedule.js +23 -8
  209. package/modules/camera/FirstPersonCamera.js +3 -1
  210. package/modules/camera/FollowCamera.js +10 -5
  211. package/modules/camera/RtsCamera.js +4 -3
  212. package/modules/camera/common.js +70 -8
  213. package/modules/camera/contract.js +1 -1
  214. package/modules/characters/Character.js +16 -10
  215. package/modules/characters/NPC.js +31 -19
  216. package/modules/characters/assetModel.js +14 -9
  217. package/modules/characters/astar.js +6 -1
  218. package/modules/characters/contract.js +2 -2
  219. package/modules/characters/index.js +34 -22
  220. package/modules/characters/movers/manual.js +1 -1
  221. package/modules/characters/movers/rapier.js +17 -2
  222. package/modules/characters/movers/simple.js +1 -1
  223. package/modules/characters/movers/support.js +16 -7
  224. package/modules/characters/npcAvoid.js +2 -2
  225. package/modules/characters/npcSim.js +3 -2
  226. package/modules/characters/pathAsync.js +24 -8
  227. package/modules/characters/pathJob.js +1 -1
  228. package/modules/characters/player.js +10 -9
  229. package/modules/characters/playerStrings.js +5 -5
  230. package/modules/characters/proceduralRig.js +5 -5
  231. package/modules/characters/useModel.js +6 -0
  232. package/modules/characters/walkTo.js +1 -1
  233. package/modules/collision/Collision.js +29 -18
  234. package/modules/collision/grid.js +22 -4
  235. package/modules/content/index.js +3 -1
  236. package/modules/content/loader.js +1 -1
  237. package/modules/content/models.js +82 -33
  238. package/modules/content/props.js +2 -1
  239. package/modules/content/rules.js +11 -5
  240. package/modules/content/templates.js +3 -3
  241. package/modules/content/words.js +2 -2
  242. package/modules/debug/DebugPanel.js +9 -9
  243. package/modules/flow/index.js +9 -6
  244. package/modules/gameplay/Dialogue.js +34 -20
  245. package/modules/gameplay/Interactions.js +19 -15
  246. package/modules/gameplay/Inventory.js +9 -4
  247. package/modules/gameplay/Quests.js +12 -10
  248. package/modules/gameplay/pickups.js +23 -11
  249. package/modules/grid/index.js +1 -1
  250. package/modules/grid/preview.js +2 -2
  251. package/modules/grid/tiles.js +1 -1
  252. package/modules/hlod/index.js +4 -1
  253. package/modules/hud/index.js +47 -10
  254. package/modules/hud/parts.js +28 -9
  255. package/modules/level/geometry.js +8 -3
  256. package/modules/level/index.js +10 -5
  257. package/modules/level/load.js +4 -2
  258. package/modules/lights/sources.js +1 -1
  259. package/modules/music/Music.js +22 -4
  260. package/modules/nav/index.js +20 -10
  261. package/modules/particles/Particles.js +31 -14
  262. package/modules/particles/effect.js +20 -5
  263. package/modules/particles/lit.js +72 -0
  264. package/modules/photo/Photo.js +72 -28
  265. package/modules/photo/pathTrace.js +106 -0
  266. package/modules/rigid/RigidBodies.js +23 -14
  267. package/modules/rigid/Vehicles.js +3 -13
  268. package/modules/rigid/sync.js +2 -1
  269. package/modules/settings/Settings.js +52 -20
  270. package/modules/settings/apply.js +23 -9
  271. package/modules/settings/sections.js +39 -6
  272. package/modules/settings/strings.js +2 -0
  273. package/modules/settings/view.js +19 -3
  274. package/modules/sky/dome.js +15 -3
  275. package/modules/sky/environment.js +28 -12
  276. package/modules/sky/fog.js +1 -1
  277. package/modules/sky/frame.js +6 -1
  278. package/modules/sky/shader.js +4 -3
  279. package/modules/sky/skyModule.js +8 -4
  280. package/modules/swarm/Swarm.js +1 -1
  281. package/modules/terrain/ChunkManager.js +61 -15
  282. package/modules/terrain/chunkJob.js +2 -2
  283. package/modules/terrain/index.js +20 -5
  284. package/modules/terrain/terrainEdit.js +8 -4
  285. package/modules/terrain/terrainTexture.js +4 -2
  286. package/modules/timeline/Timeline.js +4 -3
  287. package/modules/timeline/Tween.js +3 -0
  288. package/modules/timeline/letterbox.js +1 -0
  289. package/modules/triggers/index.js +36 -17
  290. package/modules/vegetation/Vegetation.js +81 -19
  291. package/modules/vegetation/densityMap.js +13 -8
  292. package/modules/vegetation/draw.js +147 -24
  293. package/modules/vegetation/groundChunks.js +20 -5
  294. package/modules/vegetation/index.js +3 -3
  295. package/modules/vegetation/modelGeometry.js +9 -4
  296. package/modules/water/Water.js +11 -8
  297. package/modules/weather/Weather.js +7 -2
  298. package/modules/weather/shaders.js +25 -5
  299. package/modules/weather/weatherDraw.js +20 -6
  300. package/modules/world/World.js +2 -1
  301. package/modules/world/index.js +2 -2
  302. package/modules/world/persist.js +6 -2
  303. package/modules/world/views.js +15 -2
  304. package/package.json +4 -1
  305. package/presets.js +5 -5
  306. package/render/PostFX.js +84 -41
  307. package/render/backend.js +137 -16
  308. package/render/cascades.js +3 -1
  309. package/render/cascades.tsl.js +2 -0
  310. package/render/daylight.js +7 -1
  311. package/render/detail.js +7 -4
  312. package/render/effects.js +27 -8
  313. package/render/fogLook.js +24 -0
  314. package/render/fuse.js +5 -2
  315. package/render/fx/detail.tsl.js +9 -7
  316. package/render/fx/index.js +7 -2
  317. package/render/fx/library.tsl.js +1 -0
  318. package/render/fx/lightShaft.tsl.js +114 -0
  319. package/render/fx/noise.tsl.js +25 -8
  320. package/render/fx/objectOrigin.tsl.js +39 -10
  321. package/render/fx/particles.tsl.js +23 -6
  322. package/render/fx/patchNodes.tsl.js +17 -12
  323. package/render/fx/pcss.tsl.js +51 -0
  324. package/render/fx/postWebGPU.tsl.js +89 -29
  325. package/render/fx/sky.tsl.js +3 -9
  326. package/render/fxNumbers.js +10 -4
  327. package/render/impostor.tsl.js +107 -0
  328. package/render/lighting.js +33 -1
  329. package/render/lightmap.js +42 -28
  330. package/render/lights.js +19 -3
  331. package/render/materials.js +6 -4
  332. package/render/mergeCommon.js +4 -1
  333. package/render/occlusion.js +14 -4
  334. package/render/patches.js +79 -41
  335. package/render/postRuns.js +32 -0
  336. package/render/postWebGL.js +97 -10
  337. package/render/probes.js +10 -14
  338. package/render/shaderErrors.js +2 -1
  339. package/render/shadowCache.tsl.js +33 -5
  340. package/render/shadows.js +42 -16
  341. package/render/slots.js +8 -5
  342. package/render/vertexInputs.js +52 -0
  343. package/types/core.d.ts +114 -46
  344. package/types/gameplay.d.ts +56 -23
  345. package/types/generated/core/audio/Audio.d.ts +27 -1
  346. package/types/generated/core/base/Random.d.ts +1 -1
  347. package/types/generated/core/input/Input.d.ts +6 -8
  348. package/types/generated/core/input/inputSeat.d.ts +1 -1
  349. package/types/generated/core/inspect/Budget.d.ts +26 -0
  350. package/types/generated/core/inspect/DebugOverrides.d.ts +0 -2
  351. package/types/generated/core/saves/Saves.d.ts +10 -7
  352. package/types/generated/core/saves/session.d.ts +8 -2
  353. package/types/generated/core/scene/Rays.d.ts +1 -3
  354. package/types/generated/modules/particles/Particles.d.ts +1 -1
  355. package/types/generated/modules/world/World.d.ts +2 -1
  356. package/types/generated/render/PostFX.d.ts +35 -9
  357. package/types/physics.d.ts +796 -764
  358. package/types/pixel.d.ts +1 -1
  359. package/types/tsl.d.ts +62 -1
  360. package/types/world.d.ts +12 -3
  361. package/ui/Focus.js +7 -5
  362. package/ui/Parts.js +1 -1
  363. package/ui/touchPart.js +6 -3
package/docs/AI.md CHANGED
@@ -1,139 +1,138 @@
1
- # Using threedog.js (read first)
1
+ # threedog.js tasks (on demand)
2
2
 
3
- threedog.js: a web 3D game engine on plain three.js 0.187, **core** -> **modules** (`engine.use`); all art is the game's own (else gray placeholders).
3
+ threedog.js: a web 3D game engine on plain three.js 0.187, **core** -> **modules** (`engine.use`); all art is the game's own.
4
4
  Paths: `node_modules/threedog/docs/`. `threedog how "<2-4 English words>"`; no words: browse.
5
5
 
6
- ## Start by task
7
- | The task | Where it goes |
8
- |---|---|
9
- | Lights, materials, models, shaders, fog, picture effects | Native three.js on `engine.scene / camera / renderer` (`THREE.md`), joined up with `onFrame`, `onRender`, `post.add` |
10
- | Time, input, asset loading, saving, pausing, streaming | Check the engine first: rows below |
11
- | Buying, picking up, attacking, opening doors: anything validated and recorded | `engine.ops` |
12
- | Facts that persist, exist far away or keep changing | `engine.world`, `content` |
13
- | Game-specific rules and looks | The game writes them; the engine coordinates (`engine.mod`) |
14
- | Composing modules | `engine.use`, `requires` / `provides` when needed, `ctx.track`. A simple module may omit `type` |
15
- | Troubleshooting | `describe`: state; `explain`: why; `catalog`: what exists; `inspect`: what can be done here; `thing`: one object |
16
-
17
- **The engine lacks it?** Plain JS and three.js, joined through modules, events, ops, assets and saves, is the expected path; a small feature needs no provider protocol.
6
+ ## Three rules
7
+ 1. **Each thing has a name**: `engine.describe()` lists it; `engine.explain({ module: name })` says why.
8
+ 2. **Each thing has an owner**: `add*` / `on*` return a handle, `h.remove()` undoes it (except `engine.add`, `world.add`, `addPlayer`: CONVENTIONS.md); `define` names a kind.
9
+ 3. **What several sides change has one owner**; the rest use it: values `engine.mod` (add / mul / clamp by layer), services `provides` / `replaces`, control and keys: top layer; time: one clock.
10
+ Verbs: `define`, `add`, `set`, `remove`, `describe`.
18
11
 
19
12
  ## Common mistakes
20
13
  - `Math.random()`, `setTimeout`, `performance.now()`, `addEventListener('keydown')` in game logic: `engine.random.next()`, `engine.clock.after`, fixed `dt`, `input.bind`.
21
14
  - Changing gameplay state from a frame hook or a raw callback: do it in `onFixed`, in an op, or via `engine.nextFixed(fn)`.
22
15
  - Saving positions or object references: save stable ids; `await` every `saves.*` call; a mesh a save must know about gets `engine.add(obj, { id })`.
23
16
  - Awaiting `level.load` / `content.load` in a save part's `load(data, turn)`: pass `{ turn }`, or it waits for ever.
24
- - Editing generated docs (API.md, api/, CODEMAP, `types/generated/`): change the code, `npm run map`.
25
- - Guessing a name: see `api/<module>.md`; errors carry `err.code` / `fix` / `docs`.
17
+ - Guessing a name: `how --read <name>`, `api/<module>.md`; errors carry `err.code` / `fix` / `docs`.
18
+ - Generated docs (API.md, api/, CODEMAP): edit the source, then `npm run map`.
26
19
 
27
- ## What to read, in order
28
- Taking over a game: `STATUS.md` first. A new feature: a row or `threedog how` -> recipe -> `api/<module>.md`. Several entries: `CONVENTIONS.md`. Also: `THREE.md`, `COMMANDS.md`; upgrading: `MIGRATING-1.0.md`.
20
+ ## Reading order
21
+ A row or `threedog how` -> recipe -> `api/<module>.md`. Also: `CONVENTIONS.md`, `THREE.md`, `COMMANDS.md`.
29
22
 
30
23
  ## What exists: look here first
31
- Recommendations. Your own code wires in time by `onFixed` and `engine.clock`, saving by `engine.saves.register`, cleanup by handles (`ctx.track`).
24
+ ### Which one
25
+ | To do | Use | Recipe |
26
+ |---|---|---|
27
+ | Say it happened, no answer; cause chain, randomness | `engine.events`, `engine.random.next()` | 06-clock-events.md |
28
+ | Player actions, UI buttons (can refuse) | `engine.ops.define` | 23-ops.md §1 |
29
+ | A value several systems change; one-holder parts | `engine.mod`, `engine.stacks`, `provides`, `wrap` | 55-mods-time-wrap.md §"The rules in full" |
30
+ | Content: items, NPCs, places, packs; change an entry for good | `engine.content`, `threedog content set` | 20-content-actions-save.md §1b |
31
+ | Save game, load game, autosave, story flags, counters | `engine.saves.define`, `engine.vars` | 20-content-actions-save.md §4 |
32
+ | Preferences outside the save; turn off my effect | `engine.settings` (`limits: 'post.x.enabled'`) | 26-ui-parts.md §6 |
33
+ | Timers, skip time; game time: rules, AI | `engine.clock` (after, every), `engine.onFixed(dt)`, `engine.time.now(…)` | 06-clock-events.md §1 |
34
+ | What shows: animation, camera, HUD (`engine.stepBlend`) | `engine.onFrame` | 06-clock-events.md §1 |
35
+ | Picture per frame | `engine.onRender` | 62-picture-code.md §0 |
36
+
32
37
  ### Picture and sound
33
38
  | To do | Use | Recipe |
34
39
  |---|---|---|
35
- | The picture in three.js (`picture/`): lights, fog, exposure, parts | `lights: false`, `engine.uniforms` | 62-picture-code.md, 34-environment-lighting.md |
36
- | Picture, writers; try a value | `describe().picture`, `explain({ value })`, `debug.watch`, `debug.override` | 52-around-the-picture.md, 62-picture-code.md |
37
- | Materials, textures, a module's picture | `engine.water.material` | 09-materials-lights-models.md |
38
- | Own material or shader (toon, cel shading) | TSL (WebGPU), `ShaderMaterial` (WebGL), `rampTexture`, `celLighting` | 43-shader-patches-surfaces.md, 56-webgpu-tsl.md |
39
- | WebGPU (new games' default), TSL node materials, WebGL fallback | `renderer: 'webgpu'`, `import 'threedog/tsl'` | 56-webgpu-tsl.md |
40
+ | The picture in three.js (`picture/`): lights, fog, exposure, parts | `lights: false`, `engine.uniforms` | 62-picture-code.md §0, 34-environment-lighting.md |
41
+ | Picture, writers; try a value | `describe().picture`, `explain({ value })`, `debug.watch`, `debug.override` | 52-around-the-picture.md §"Who writes it", 62-picture-code.md §3c |
42
+ | Materials, textures, a module's picture | `engine.water.material` | 09-materials-lights-models.md §1 |
43
+ | Own material or shader (toon, cel shading) | TSL (WebGPU), `ShaderMaterial` (WebGL), `rampTexture`, `celLighting` | 43-shader-patches-surfaces.md §"Your own material", 56-webgpu-tsl.md §"A minimal TSL material" |
44
+ | WebGPU (new games' default), TSL node materials, WebGL fallback | `renderer: 'webgpu'`, `import 'threedog/tsl'` | 56-webgpu-tsl.md §"WebGPU or WebGL" |
40
45
  | three.js idioms, own renderer | the idiom table in `THREE.md`, `createEngine({ renderer })` | 50-own-renderer.md |
41
- | Dust, smoke | `engine.particles` | 64-particles.md |
42
- | Sky, season tints, weather, wet roads | `engine.sky`, `engine.weather`, `engine.weatherDraw` | 08-weather-sky.md |
43
- | Water, rain / snow, snow cover (own rain: `THREE.md`) | `engine.water`, `weather({ rain, snow })` | 44-water-weather-hooks.md |
46
+ | Dust, smoke (`lit: true`) | `engine.particles` | 64-particles.md |
47
+ | Sky, season tints, weather, wet roads | `engine.sky`, `engine.weather`, `engine.weatherDraw` | 08-weather-sky.md §1 |
48
+ | Water, rain, snow cover (own rain: `THREE.md`) | `engine.water`, `weather({ rain, snow })` | 44-water-weather-hooks.md |
44
49
  | Shadows: blur, follow, cost | `engine.shadows` | 45-cascaded-shadows.md |
45
- | Own far, fov; clouds | `engine.autoView`, `engine.shaderTerms` | 52-around-the-picture.md |
46
- | Environment light, reflections, probes, lightmaps, GI, culling | `engine.sky.environment`, `engine.bakeProbes`, `engine.loadLightmap`, `engine.occlusion` | 34-environment-lighting.md |
47
- | Post passes: color grading, bloom, outline, depth, AO | `engine.post.add(pass)`, `@threedog/post-effects` | 52-around-the-picture.md#post-effect-chain, 59-depth-post-effects.md |
50
+ | Own far, fov; clouds | `engine.autoView`, `engine.shaderTerms` | 52-around-the-picture.md §"Atmosphere" |
51
+ | Environment light, reflections, probes, lightmaps, GI, culling, shafts | `engine.sky.environment`, `engine.bakeProbes`, `engine.loadLightmap`, `engine.occlusion`, `lightShaft` | 34-environment-lighting.md §"Environment maps" |
52
+ | Post passes: color grading, bloom, outline, depth, AO | `engine.post.add(pass)`, `@threedog/post-effects` | 52-around-the-picture.md §"Post effect chain", 59-depth-post-effects.md |
48
53
  | Many lights (torches); windows, signs at night | `engine.lightPool`, `uNight` | 09-materials-lights-models.md §1b |
49
- | Picture from a reference; judge | `threedog picture palette`, `threedog examples list` | 35-picture-from-reference.md, 60-judge-the-picture.md |
54
+ | Picture from a reference; judge | `threedog picture palette`, `threedog examples list` | 35-picture-from-reference.md §"The loop", 60-judge-the-picture.md |
50
55
  | Reuse effects, models of old games | `threedog lib` | 05-props-bake.md |
51
56
  | Sound, music, ambience | `engine.audio`, `engine.music`, `engine.ambience` | 31-audio.md |
52
57
 
53
58
  ### Rules, state, time
54
59
  | To do | Use | Recipe |
55
60
  |---|---|---|
56
- | Items, chests, shops, gold; things to pick up | `engine.inventory`, `engine.pickups` (`.material`) | 03-items-pickups.md, 22-shop-gold.md |
57
- | Quests, objective markers | `engine.quests`, `engine.hud.marker()` | 04-quests.md |
58
- | Player actions, UI buttons | `engine.ops.define` | 23-ops.md |
59
- | What can the player do here, why not | `engine.inspect`, `engine.explain`, `engine.catalog` | 51-capability-catalog.md |
60
- | Save game, load game, autosave, story flags, counters | `engine.saves.register` (`load(data, turn)`), `engine.vars` | 20-content-actions-save.md |
61
- | New game / continue, scene flow, fades, pause for a menu, cutscenes | `engine.session`, `engine.flow`, `engine.freeze`, `engine.timeline` | 07-flow-scenes-pause.md |
62
- | Timers, read / skip time | `engine.clock` (after, every), `engine.time.now(…)` | 06-clock-events.md |
63
- | Slow or speed up time, bullet time | `engine.mod('clock.rate')` | 55-mods-time-wrap.md |
64
- | Time of day, day / night, seasons | `engine.calendar` | 06-clock-events.md |
65
- | Events, cause chain, randomness | `engine.events`, `engine.random.next()` | 06-clock-events.md |
66
- | Multiplayer | `engine.net` | 27-net.md |
61
+ | Items, chests, shops, gold; things to pick up | `engine.inventory`, `engine.pickups` | 03-items-pickups.md §"Items and pickups", 22-shop-gold.md |
62
+ | Quests, objective markers | `engine.quests`, `engine.hud.marker()` | 04-quests.md §1 |
63
+ | What can the player do here, why not | `engine.inspect`, `engine.explain`, `engine.catalog` | 51-capability-catalog.md §1 |
64
+ | New game / continue, scene flow, fades, pause for a menu, cutscenes | `engine.session`, `engine.flow`, `engine.freeze`, `engine.timeline` | 07-flow-scenes-pause.md §4 |
65
+ | Slow or speed up time, bullet time | `engine.mod('clock.rate')` | 55-mods-time-wrap.md §"Time channels" |
66
+ | Time of day, day / night, seasons | `engine.calendar` | 08-weather-sky.md §4, 06-clock-events.md |
67
+ | Multiplayer | `engine.net` | 27-net.md §1 |
67
68
 
68
69
  ### Characters, input, UI
69
70
  | To do | Use | Recipe |
70
71
  |---|---|---|
71
- | Third-person start (walk, pause, menu) | `createPlayer` | 63-third-person-start.md |
72
- | Player, characters, who steers one | `engine.player`, `engine.characters` (`.material`), `engine.control` | 57-control.md, 13-animation.md |
73
- | Keys, gamepad, rebinding, seats | `engine.input` | 58-input.md |
74
- | Camera: followCamera (third person), first person, fixedCamera, rts; switch: setCamera | `engine.cameraRig`, `engine.page` | 21-camera.md |
72
+ | Third-person start (player walks, walking player, pause) | `addPlayer` | 63-third-person-start.md §1 |
73
+ | Player, characters | `engine.player`, `engine.characters`, `engine.control` | 57-control.md §"Who takes what", 13-animation.md |
74
+ | Keys, gamepad, rebinding, seats | `engine.input` | 58-input.md §1 |
75
+ | Camera: followCamera (third person), first person, fixedCamera, rts; setCamera | `engine.cameraRig`, `engine.page` | 21-camera.md §1 |
75
76
  | 2D, side-scroller, orthographic; 2D lights | `presets.player.sideScroller`; example `rc2d` | 21-camera.md §6 |
76
- | Pixel art, pixel perfect camera | `pixelSize`, `pixelSnap` | 62-picture-code.md §4b |
77
- | Skeletal animation | `engine.assets.animate`, `engine.hlod` | 13-animation.md, 15-perf.md |
78
- | Pathfinding, navmesh, NPC jumps and gaps | `engine.characters.findPath`, `engine.nav` | 12-navmesh.md |
79
- | Physics, ragdoll, collision, vehicles | `engine.collision`, `engine.rigid`, `engine.collider3d` | 11-vehicles.md |
80
- | Ray / mouse picking, shooting, lock-on | `engine.rays` | 19-shooting-picking.md |
81
- | Prompts, trigger zones | `engine.interactions`, `engine.triggers` | 20-content-actions-save.md |
77
+ | Pixel art | `pixelSize`, `pixelSnap` | 62-picture-code.md §4b |
78
+ | Skeletal animation, IK | `engine.assets.animate`, `anim.addAim`, `.addFeet`, `engine.hlod` | 13-animation.md §3, 15-perf.md |
79
+ | Pathfinding, navmesh, NPC jumps and gaps, gates | `engine.characters.findPath`, `engine.nav` | 12-navmesh.md §2 |
80
+ | Physics, ragdoll, collision, vehicles | `engine.collision`, `engine.rigid`, `engine.collider3d` | 11-vehicles.md §3 |
81
+ | Ray / mouse picking, shooting, lock-on | `engine.rays` | 19-shooting-picking.md §1 |
82
+ | Prompts, trigger zones | `engine.interactions`, `engine.triggers` | 20-content-actions-save.md §3 |
82
83
  | Press E on a mesh | `interactions.add(mesh, { once, counter })` | 03-items-pickups.md |
83
- | Reskin UI | `createEngine({ ui: { theme } })` | 26-ui-parts.md |
84
- | Start at a place | `?at=<place>` | 07-flow-scenes-pause.md |
85
- | NPCs and what they do, dialogue | `engine.npcs`, `engine.dialogue` | 02-npc.md |
86
- | Barks over an NPC | `dialogue.say(text, { channel: 'bubble' })` | 26-ui-parts.md "Two channels" |
87
- | UI, menus, HUD, popup message, languages, settings, photo mode | `engine.ui`, `makeWindow`, `toast(engine, text)`, `engine.hud`, `engine.i18n`, `engine.settings`, `engine.photo` | 26-ui-parts.md |
84
+ | Reskin UI | `createEngine({ ui: { theme } })` | 26-ui-parts.md §"Reskin" |
85
+ | Start at a place | `?at=<place>` | 07-flow-scenes-pause.md §2 |
86
+ | NPC conversation: talk to an NPC, what NPCs do | `engine.npcs`, `engine.dialogue` | 02-npc.md §1 |
87
+ | Speech bubble over a head, barks | `dialogue.say(text, { channel: 'bubble' })` | 26-ui-parts.md §4 |
88
+ | UI, menus, HUD, languages, settings, photo mode | `engine.ui`, `makeWindow`, `toast(engine, text)`, `engine.hud`, `engine.i18n`, `engine.settings`, `engine.photo` | 26-ui-parts.md §1, 26-ui-parts.md §6 |
89
+ | Action game: hp, attacks, enemy AI, drops | your ops + `world.simulate` | 32-action-game.md §1 |
88
90
  | Ambient occlusion, soft shadows | `engine.post.add(ao())`, `bakeVertexAO` | 52-around-the-picture.md |
89
- | Settings turn off my effect | `settings.define(k, true, { limits: 'post.<name>.enabled' })` | 26-ui-parts.md |
90
- | Action game: hp, attacks, enemy AI, drops | your ops + `world.simulate` | 32-action-game.md |
91
- | Many bullets, debris | `engine.swarm` | 65-swarm.md |
92
- | Enemy crowds, hordes, flocks | `engine.swarm` | 65-swarm.md |
91
+ | Many bullets, debris | `engine.swarm` | 65-swarm.md §"Which tool for many things" |
92
+ | Enemy crowds, flocks | `engine.swarm` | 65-swarm.md §"Which tool for many things" |
93
93
 
94
94
  ### Project, world, content
95
95
  | To do | Use | Recipe |
96
96
  |---|---|---|
97
- | New game, project layout, preset start | `npx threedog init` (repo: `new-game`), `createEngine`, `openWorld()` | 01-new-game.md |
98
- | Put something in the scene | `scene.add(obj)`; saved: `engine.add(obj, { id })` | 40-scene.md |
99
- | Content data, packs, change an entry for good | `engine.content`, `threedog content set` | 20-content-actions-save.md |
100
- | Reusable objects (prefabs), groups of them | `templates`, flat `props` | 30-templates.md |
101
- | Props, many repeated objects, static batching | content `props`, `engine.batching` | 05-props-bake.md |
102
- | What is this thing, does it persist | `engine.pick(x, y)`, `engine.explain({ thing: id })` | 30-templates.md §5, 40-scene.md |
103
- | Teleport the player, far-away and saved objects, streaming | `player.placeAt`, `engine.stream.teleport`, `engine.world` | 18-world.md, 33-stream-sources.md |
104
- | Blender level | `engine.level`; `engine.vegetation.define` | 10-blender-level.md |
105
- | Terrain, height, edits | `engine.terrain`, `engine.ground` | 28-terrain.md |
106
- | Ground picture | `engine.terrain.material`, `terrain({ detail, shape })` | 36-ground-plants.md, 53-ground-up-close.md |
107
- | Grid placement, plots, build on cells; a grid from a PNG | `engine.grids`, `sampleGrid`, `assets.gridFromImage` | 29-grid.md, 28-terrain.md §9 |
108
- | Assets, loading; code-made models; LOD | `engine.assets.manifest`, `.palette`, `.lod`, `engine.loading` | 05-props-bake.md, 15-perf.md |
109
- | Blender -> GLB art; fixed views before / after | `threedog assets check`, `engine.views` | 46-blender-art-route.md |
97
+ | New game, project layout, preset start | `npx threedog init` (repo: `new-game`), `createEngine`, `openWorld()` | 01-new-game.md §0 |
98
+ | Put something in the scene | `scene.add(obj)`; saved: `engine.add(obj, { id })` | 40-scene.md §1 |
99
+ | Reusable objects (prefabs), groups of them | `templates`, flat `props` | 30-templates.md §1 |
100
+ | Props, many repeated objects, static batching | content `props`, `engine.batching` | 05-props-bake.md §2b |
101
+ | What is this thing, does it persist | `engine.pick(x, y)`, `engine.explain({ thing: id })` | 30-templates.md §5, 40-scene.md §9 |
102
+ | Teleport the player, far-away and saved objects, streaming | `player.placeAt`, `engine.stream.teleport`, `engine.world` | 18-world.md §6, 33-stream-sources.md |
103
+ | Blender level | `engine.level` | 10-blender-level.md §1 |
104
+ | Grass, trees | `engine.vegetation.define` | 05-props-bake.md §2e, 36-ground-plants.md |
105
+ | Terrain, height | `engine.terrain`, `engine.ground` | 28-terrain.md §2 |
106
+ | Ground picture | `engine.terrain.material`, `terrain({ detail, shape })` | 36-ground-plants.md §"Ground color", 53-ground-up-close.md |
107
+ | Grid placement, plots, build on cells; a grid from a PNG | `engine.grids`, `sampleGrid`, `assets.gridFromImage` | 29-grid.md §1, 28-terrain.md §9 |
108
+ | Assets, loading; code-made models; LOD; setup per model | `engine.assets.manifest`, `.onModel`, `.palette`, `.lod`, `engine.loading` | 05-props-bake.md §3, 15-perf.md |
109
+ | Blender -> GLB art; fixed views before / after | `threedog assets check`, `engine.views`, manifest `needs` | 46-blender-art-route.md §1, 05-props-bake.md §2f |
110
110
 
111
111
  ### Composing modules
112
112
  | To do | Use | Recipe |
113
113
  |---|---|---|
114
- | A value several systems change; one-holder parts | `engine.mod`, `engine.stacks`, `provides`, `wrap` | 55-mods-time-wrap.md |
115
- | Replace a module (dialogue, camera) | `replaces`, `runContract` | 55-mods-time-wrap.md "Replacing a module" |
116
- | Your own module: `type`, `requires`, swap a part (`provides` + `{ replaces }`) | `engine.use`, `.unuse` | 14-custom-module.md, 49-game-module-contract.md |
114
+ | Replace a module (dialogue, camera) | `replaces`, `runContract` | 55-mods-time-wrap.md §"Replacing a module" |
115
+ | Your own module: `type`, `requires`, swap a part (`provides` + `{ replaces }`) | `engine.use`, `.unuse` | 14-custom-module.md §1, 49-game-module-contract.md |
117
116
  | Drop-in file per piece, no main.js | `plugins/`, `engine.plugins`, `describe().slots` | 40-scene.md |
118
117
 
119
118
  ### Advanced
120
119
  | To do | Use | Recipe |
121
120
  |---|---|---|
122
121
  | Own ground or plant drawing, keep collision | `engine.terrain.view`, `engine.terrainDraw`, `engine.vegetationDraw` | 28-terrain.md §6 |
123
- | Worker results, far records' models, raw navmesh or physics, content sections, own mover | `engine.commits`, `world.present`, `nav.query`, `rigid.world`, module `content`, `characters.kit` | 15-perf.md, 18-world.md, 12-navmesh.md, 11-vehicles.md, 14-custom-module.md, 57-control.md |
122
+ | Worker results, far records' models, raw navmesh or physics, content sections, own mover | `ctx.commits`, `world.present`, `nav.query`, `rigid.world`, module `content`, `characters.kit` | 15-perf.md, 18-world.md, 12-navmesh.md, 11-vehicles.md, 14-custom-module.md, 57-control.md |
124
123
 
125
124
  ### Troubleshooting and speed
126
125
  | To do | Use | Recipe |
127
126
  |---|---|---|
128
- | Broke, looks wrong or slow: which tool | `.threedog/errors.log`, `engine.describe`, `engine.explain` | 16-dev-bridge.md §11 |
129
- | Drive and check the live game | the dev bridge (`verify <scenario>`) | 16-dev-bridge.md |
130
- | Slow, low fps, workers, budgets | `engine.jobs`, `engine.threads`, `engine.commits`, `engine.budget`, `engine.debug`, `threedog stress` | 15-perf.md |
127
+ | Broke; describe, explain, shot: which tool | `.threedog/errors.log`, `engine.describe`, `engine.explain` | 16-dev-bridge.md §11 |
128
+ | Picture looks wrong: judge it | `threedog shot` | 60-judge-the-picture.md §"How to judge" |
129
+ | Drive and check the live game | the dev bridge (`verify <scenario>`) | 16-dev-bridge.md §1 |
130
+ | Slow, low fps | `engine.jobs`, `engine.threads`, `engine.budget`, `engine.debug` | 15-perf.md §1 |
131
131
  | Deploy | `npm run build` | 61-deploy.md |
132
132
 
133
133
  ## Conventions (`CONVENTIONS.md`)
134
134
  - **A position is one argument**, then an options object. **Units** are meters, Y up, north -Z; characters face +Z.
135
- - **Registrations return a handle** (`h.remove()`, `ctx.track` takes it). **Ready is `ready`**. **Events are `noun:action`**. **`owner`** is the name you pass.
136
- - **`onFixed`** is game time, **`onFrame`** presentation; draw what `onFixed` moves with `engine.stepBlend`, or it stutters.
135
+ - **Ready is `ready`**. **Events are `noun:action`**. **`owner`** is the name you pass.
137
136
 
138
137
  ## Stability
139
138
  `@experimental`: may change or go with no migration note.
package/docs/API.md CHANGED
@@ -15,41 +15,41 @@
15
15
  - `engine.describeText(opts?: { radius?, full?, path? }) → string` — The same information as English text, summary first: at most 30 lines…
16
16
  - `engine.applyState(params: StateParams) → Promise<{ ok: boolean, refused: {…` — Set up a scenario: time of day, weather, player position, load a save, advance time, skip cutscenes
17
17
  - `engine.onFixed(fn: (dt: number) => void, opts?: { channel?, phase? }) → Handle` — Fixed-step logic (60 times per second, dt in fixed seconds): movement, physics, cooldowns, and game…
18
- - `engine.onFrame(fn: (dt: number) => void) → Handle` — Once per frame (dt in frame seconds): animation, camera, UI and UI keys…
18
+ - `engine.onFrame(fn: (dt: number) => void) → Handle` — Once per frame
19
19
  - `engine.add(obj: T, ...more: (Object3D | { id?, save? })[]) → T` — Add objects to the scene and register them (engine.thing), returns the first one
20
20
  - `engine.remove(...objs: Object3D[])` — Fully delete an object (use it when you no longer want the object): removes it from its parent, unr…
21
21
  - `engine.surface(x: number, z: number, refY?: number) → number` — Ground height (meters) at (x, z)
22
22
  - `engine.snapToGround(obj: T, offset?: number) → T` — Put an object on the ground under it (y = ground height + offset) and return the object
23
23
  - `engine.raycast(origin: Vec3Like, dir: Vec3Like, opts?: RaycastOptions) → RayHit | null` — Ray: shoot from origin along dir, returns the nearest hit or null…
24
24
  - `engine.pick(ndcX: number, ndcY: number, opts?: RaycastOptions) → RayHit | null` — Shoot a ray through the camera from screen coordinates (-1..1, e.g. input.pointer.ndcX/ndcY)
25
- - `engine.freeze(owner?: string | { owner?, kind?, ambient? }, opts?: { kind?, ambient? }) → OwnerHandle` — Gameplay pause (menu, flow's paused): fixed steps are skipped entirely…
25
+ - `engine.freeze(owner?: string | { owner?, kind?, still? }, opts?: { kind?: 'title'; still?: boolean }) → OwnerHandle` — Gameplay pause (menu, flow's paused): fixed steps are skipped entirely…
26
26
  - `engine.haltLoop(owner?: string | { owner?: string }) → OwnerHandle` — Pause the real-time loop: the picture stops and even rendering stops, only step() advances…
27
- - `engine.stateApplied` — (experimental) Scenario is ready: start() completed, and the URL parameters / the latest applyState…
27
+ - `engine.stateApplied` — Scenario is ready: start() completed, and the URL parameters / the latest applyState have all been …
28
28
  - `engine.ready` — phase is 'ready' or 'running': the world is built and the loading screen is gone…
29
- - `engine.player` — The player (exists only after characters.createPlayer())
29
+ - `engine.player` — The player (exists only after characters.addPlayer())
30
30
  - `engine.scene` — three.js scene
31
31
  - `engine.camera` — The camera the engine draws with, a plain THREE.PerspectiveCamera to begin with
32
32
 
33
33
  ## Core objects (engine.xxx, no install needed)
34
34
  - [`engine.events`](api/events.md) the event bus: traceFocus note trace recent on once emit; event table
35
- - [`engine.input`](api/input.md) Input: read by "action": action bind touchButton simulate seat rebind rebound keysOf isUnbound label down pressed released pressedRaw …
35
+ - [`engine.input`](api/input.md) Input: read by "action": define bind touchButton simulate seat rebind rebound keysOf isUnbound label down pressed released pressedRaw …
36
36
  - [`engine.clock`](api/clock.md) calendar seconds and "after how long / every how long": after every
37
37
  - [`engine.vars`](api/vars.md) story flags and counters (autosaved): flag setFlag counter bump
38
- - [`engine.saves`](api/saves.md) engine.saves handles saving: register putAttachment removeAttachment attachments storageKey flush collect check apply save load list remove export …
39
- - [`engine.assets`](api/assets.md) Assets: manifest builder paramsOf setParams preload font model lod modelNow geometry gridFromImage texture useTexture release …
40
- - [`engine.audio`](api/audio.md) buses: addBus setVolume duck condition measure value matches volumeOf sfx noiseBurst tone load play
38
+ - [`engine.saves`](api/saves.md) engine.saves handles saving: define putAttachment removeAttachment attachments storageKey flush collect check apply save load list remove export …
39
+ - [`engine.assets`](api/assets.md) Assets: manifest builder paramsOf setParams preload font model lod modelNow onModel geometry gridFromImage texture useTexture …
40
+ - [`engine.audio`](api/audio.md) buses: addBus setVolume reverb duck condition measure value matches volumeOf sfx noiseBurst tone load play
41
41
  - [`engine.i18n`](api/i18n.md) string tables: add setLocale has
42
- - [`engine.rays`](api/rays.md) engine.rays is the ray registry…: addStatic forget addProvider
42
+ - [`engine.rays`](api/rays.md) engine.rays is the ray registry…: addStatic addProvider
43
43
  - [`engine.jobs`](api/jobs.md) engine.jobs queues build work in a binary heap: add run
44
44
  - [`engine.stream`](api/stream.md) engine.stream builds on demand by space: only entries n…: add source teleport addReadyCheck sources
45
- - [`engine.budget`](api/budget.md) performance budget (turned on by createEngine: enable disable metric limitOf report checkStartup values byTag
46
- - [`engine.post`](api/post.md) PostFX: object targets add get own list render
45
+ - [`engine.budget`](api/budget.md) performance budget (turned on by createEngine: enable disable metric limitOf report checkStartup values record notice byTag
46
+ - [`engine.post`](api/post.md) PostFX: object targets add get byRole own list render
47
47
  - [`engine.occlusion`](api/occlusion.md) Occlusion
48
- - [`engine.ground`](api/ground.md) Ground: whoever provides the ground height is the "terr…: height slope type has voidY forEachCollider viewRange chunkCollision staticTrimeshes staticVersion
48
+ - [`engine.ground`](api/ground.md) Ground provider: whoever provides the ground height is …: height slope type water has voidY forEachCollider viewRange chunkCollision staticTrimeshes staticVersion
49
49
 
50
50
  ## Modules (installed with engine.use; the openWorld preset installs only world and environment, see [api/openWorld.md](api/openWorld.md))
51
51
  - [`engine.terrain`](api/terrain.md) terrain() Procedural terrain, data part: recolor view retry rebuild edit
52
- - [`engine.vegetation`](api/vegetation.md) vegetation() Vegetation: sway color view rebuild setShadowRing define get list isRemoved removeInstance restoreInstance instanceAt
52
+ - [`engine.vegetation`](api/vegetation.md) vegetation() Vegetation: sway color view rebuild setShadowRing define get list isRemoved removeInstance restoreInstance instanceAt …
53
53
  - [`engine.sky`](api/sky.md) sky() Sky dome and the sun / daylight / sky-color signals, from the calendar's time; it writes no light or fog: keyframes clouds layer replace environment
54
54
  - [`engine.calendar`](api/calendar.md) calendar() Time of day, day, seasons and clock-time timers: at between daily onSeason untilMark
55
55
  - [`engine.weather`](api/weather.md) weather() Weather state: defineField set label
@@ -68,20 +68,20 @@
68
68
  - [`engine.swarm`](api/swarm.md) swarm
69
69
  - [`engine.settings`](api/settings.md) settings() Settings menu: get set preset define addSection open close toggle reset resetBindings rebind actionList …
70
70
  - [`engine.music`](api/music.md) music() Background music: define play stop stinger rules override pick
71
- - [`engine.characters`](api/characters.md) characters() Characters: findSpawn createPlayer moveInput addVehicle support removePlayer findPath findPathAsync; Character, NPC; engine.npcs: list add remove behavior tiers get character avoid (behavior and avoid: see recipes/02-npc)
71
+ - [`engine.characters`](api/characters.md) characters() Characters: findSpawn addPlayer moveInput addVehicle support removePlayer findPath findPathAsync; Character, NPC; engine.npcs: list add remove behavior tiers get character avoid (behavior and avoid: see recipes/02-npc)
72
72
  - [`engine.interactions`](api/interactions.md) interactions() Interaction prompts: add get
73
73
  - [`engine.dialogue`](api/dialogue.md) dialogue() Dialogue: define start say bubbles end
74
74
  - [`engine.inventory`](api/inventory.md) inventory() Inventory: of define item count has list get add remove trade setData container …
75
75
  - [`engine.pickups`](api/pickups.md) pickups() pickups: spawn nearest
76
76
  - [`engine.quests`](api/quests.md) quests() Quests: define start state advance isDone isActive isFailed check list
77
- - [`engine.photo`](api/photo.md) photo() Photo mode: take subject
77
+ - [`engine.photo`](api/photo.md) photo() Photo mode: take trace subject
78
78
  - [`engine.ambience`](api/ambience.md) ambience() Ambience: add rules nearWater
79
79
  - [`engine.nav`](api/nav.md) nav() Navmesh: findPath dispose
80
80
  - [`engine.hlod`](api/hlod.md) hlod() hlod: add
81
81
  - [`engine.lightPool`](api/lightPool.md) lightPool() Light pool: add
82
82
  - [`engine.content`](api/content.md) content() Content loading: load condition test run place where template fields spawn
83
83
  - [`engine.flow`](api/flow.md) flow() Game flow and scene transitions: define go transition
84
- - [`engine.hud`](api/hud.md) hud() Objective markers, counters, progress bars: marker counter bump value bar remove
84
+ - [`engine.hud`](api/hud.md) hud() Objective markers, counters, progress bars: marker addCounter bump value bar button hint remove
85
85
 
86
86
  ## Custom drawing (only to replace how a module draws: the facades above are the entry; `engine.use(mine, { replaces })`, recipe 28 §6)
87
87
  - [`engine.terrainDraw`](api/terrainDraw.md) terrain() terrainDraw: recolor
package/docs/CODEMAP.md CHANGED
@@ -58,16 +58,16 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
58
58
  - index.js: Engine entry
59
59
 
60
60
  **core/**
61
- - assets/ Asset management: Asset manifest: register every model, tex… — Animator.js, Assets.js, Baked.js, assetEntry.js, assetHot.js, assetLoad.js, assetLod.js, assetManifest.js, assetReport.js, namedModel.js
62
- - audio/ Audio core: buses (master, music, sfx, ambience, ui + the g… — Audio.js, audioRules.js, audioVoice.js
63
- - base/ Stable error codes: errors the engine raises by name end th… — Events.js, I18n.js, Random.js, Vars.js, easing.js, errorCodes.js, errorHints.js, errors.js, events.generated.js, follows.js, math.js, mulberry32.js, params.js, saveValues.js, sections.js, spelling.js, util.js, validate.js
61
+ - assets/ Asset management: Asset manifest: register every model, tex… — Animator.js, Assets.js, Baked.js, assetEntry.js, assetHot.js, assetLoad.js, assetLod.js, assetManifest.js, assetPart.js, assetReport.js, ik.js, modelNeeds.js, namedModel.js, nodeVisibility.js
62
+ - audio/ Audio core: buses (master, music, sfx, ambience, ui + the g… — Audio.js, audioReverb.js, audioRules.js, audioVoice.js
63
+ - base/ Stable error codes: errors the engine raises by name end th… — Events.js, I18n.js, Random.js, Vars.js, docRef.js, easing.js, errorCodes.js, errorHints.js, errors.js, events.generated.js, follows.js, freeParts.js, math.js, mulberry32.js, params.js, saveValues.js, sections.js, spelling.js, util.js, validate.js
64
64
  - engine/ Module installation (part of Engine, mixed into Engine.prot… — Engine.js, Loading.js, copies.js, headlessLoad.js, lifecycle.js, loop.js, moduleSlots.js, moduleTypes.js, modules.js, page.js, plugins.js, services.js, startup.js
65
65
  - input/ Input: read by "action", not by "key" — Input.js, inputContext.js, inputDefaults.js, inputKeyboard.js, inputPad.js, inputPointer.js, inputSeat.js, inputTouch.js
66
- - inspect/ Generated by npm run map, do not edit by hand — Budget.js, DebugOverrides.js, Describe.js, Inspect.js, InspectMaterials.js, InspectPerf.js, InspectScene.js, MaterialInfo.js, UrlState.js, catalog.js, checks.js, debugView.js, describeRender.js, describeText.js, geometryWatch.js, lightWatch.js, metadata.generated.js, pictureWriters.js, shaderCost.js, textureBytes.js, toolDoor.js, valueHistory.js
66
+ - inspect/ Generated by npm run map, do not edit by hand — Budget.js, DebugOverrides.js, Describe.js, Inspect.js, InspectMaterials.js, InspectPerf.js, InspectScene.js, MaterialInfo.js, UrlState.js, catalog.js, checks.js, debugView.js, describeRender.js, describeText.js, geometryWatch.js, lightWatch.js, metadata.generated.js, pictureChecks.js, pictureMenu.js, pictureWriters.js, shaderCost.js, textureBytes.js, toolDoor.js, valueHistory.js
67
67
  - ops/ Shared points: the ONE way several owners change a shared t… — Ops.js, actor.js, control.js, holds.js, opsAtomic.js, opsCheck.js, opsFail.js, opsGuard.js, opsHistory.js, opsRun.js, owned.js, sharedPoint.js, stackFrames.js, stacks.js, wrap.js
68
68
  - saves/ Saves: each module registers "how to save and load", and sa… — SaveStore.js, Saves.js, saveApply.js, saveFiles.js, saveIds.js, saveVersions.js, session.js, stateReplace.js
69
- - scene/ Object registry behind engine.thing: every root handed to e… — Rays.js, Views.js, adaptive.js, canvasBox.js, compositeGround.js, floor.js, gameLights.js, grayMap.js, grid.js, gridLoad.js, ground.contract.js, ground.js, movement.js, pictureSlots.js, pixel.js, pixelRatio.js, sceneDelta.js, sceneMethods.js, screenToGround.js, stepPoses.js, targeting.js, thingExplain.js, thingOps.js, things.js, threePatches.js, tier.js, view.js
70
- - stream/ Automatic batching, engine.batching: the same static model … — Batching.js, Stream.js, batchGroups.js, cells.js, chunkStream.js, scatter.js, streamCells.js, streamSources.js
69
+ - scene/ Object registry behind engine.thing: every root handed to e… — Rays.js, Views.js, adaptive.js, canvasBox.js, compositeGround.js, drawOnly.js, floor.js, gameLights.js, grayMap.js, grid.js, gridLoad.js, ground.contract.js, ground.js, movement.js, pictureSlots.js, pixel.js, pixelRatio.js, sceneDelta.js, sceneMethods.js, screenToGround.js, stepPoses.js, targeting.js, thingExplain.js, thingOps.js, things.js, threePatches.js, tier.js, view.js
70
+ - stream/ Automatic batching, engine.batching: the same static model … — Batching.js, Stream.js, batchGroups.js, cells.js, chunkStream.js, prepare.js, scatter.js, streamCells.js, streamSources.js
71
71
  - threads/ engine.threads: a small worker pool — Commits.js, Jobs.js, Threads.js, pureWorker.js, threadPure.js, threadServe.js
72
72
  - time/ engine.time: the one time source — Clock.js, dayTime.js, skip.js, time.js, uiClock.js
73
73
 
@@ -89,8 +89,8 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
89
89
  - music/ Background music module entry — Music.js, rules.js
90
90
  - nav/ Navmesh (Recast): generated after a level loads; engine.charact… — navPath.js
91
91
  - net/ net() module: optional co-op multiplayer, host-authoritative st… — Client.js, Host.js, Net.js, sync.js, transports.js
92
- - particles/ Particles module: dust, falling leaves, splashes, chimney smoke… — Particles.js, effect.js, shaders.js
93
- - photo/ Photo mode: a sharper shot, then restore — Photo.js
92
+ - particles/ Particles module: dust, falling leaves, splashes, chimney smoke… — Particles.js, effect.js, lit.js, shaders.js
93
+ - photo/ Photo mode: a sharper shot, then restore — Photo.js, pathTrace.js
94
94
  - rigid/ Real physics (Rapier): objects that topple, roll, get pushed an… — RigidBodies.js, Vehicles.js, collider3d.contract.js, ragdoll.js, ragdollBones.js, refresh.js, sync.js
95
95
  - settings/ Settings menu module entry — Settings.js, apply.js, sections.js, strings.js, view.js
96
96
  - sky/ Sky module: signals (engine.uniforms: uSunDir, uSunColor, uSkyT… — Sky.js, clouds.js, dome.js, domeLayers.js, environment.js, fog.js, frame.js, season.js, shader.js, skyModule.js, tint.js
@@ -112,10 +112,12 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
112
112
  - detail.js: The `detail` surface patch: grain, paper, brush strokes or …
113
113
  - effects.js: Built-in shader effects
114
114
  - engineUniforms.js: Engine uniforms (helper of patches.js)
115
+ - fogLook.js: What fog a scene is drawn with, for the parts that match so…
115
116
  - fuse.js: Fused post pass
116
- - fx/ threedog/tsl entry: the TSL Fn library — cel.tsl.js, cloudShadow.tsl.js, detail.tsl.js, library.tsl.js, lighting.tsl.js, nodeErrors.tsl.js, noise.tsl.js, objectOrigin.tsl.js, particles.tsl.js, patchNodes.tsl.js, postWebGPU.tsl.js, season.tsl.js, sky.tsl.js, uniforms.tsl.js, water.tsl.js, wind.tsl.js
117
+ - fx/ threedog/tsl entry: the TSL Fn library — cel.tsl.js, cloudShadow.tsl.js, detail.tsl.js, library.tsl.js, lightShaft.tsl.js, lighting.tsl.js, nodeErrors.tsl.js, noise.tsl.js, objectOrigin.tsl.js, particles.tsl.js, patchNodes.tsl.js, pcss.tsl.js, postWebGPU.tsl.js, season.tsl.js, sky.tsl.js, uniforms.tsl.js, water.tsl.js, wind.tsl.js
117
118
  - fxNumbers.js: The numbers inside the engine's shared shader functions, wr…
118
119
  - hotGlsl.js: Shader hot reload in dev
120
+ - impostor.tsl.js: Impostor cards for far plants (vegetation.define({ impostor…
119
121
  - layers.js: The three.js layers the engine keeps for itself, in one tab…
120
122
  - lighting.js: The `lighting` patch (applyEffects(mat, { lighting })) and …
121
123
  - lightmap.js: Baked lightmaps: reads the file `threedog bake light` write…
@@ -128,6 +130,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
128
130
  - occlusion.js: Occlusion culling for the engine's own big things (hlod cel…
129
131
  - ownFrame.js: The game draws the frame itself: the engine notices and yie…
130
132
  - patches.js: Named shader patches
133
+ - postRuns.js: Where a post effect definition can run: one rule for the ch…
131
134
  - postWebGL.js: Post chain on WebGLRenderer (EffectComposer)
132
135
  - probes.js: Baked light probes
133
136
  - recordSweep.js: WebGPURenderer keeps one RenderObject per drawn mesh in a s…
@@ -138,6 +141,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
138
141
  - slots.js: Semantic patch slots
139
142
  - terms.js: Built-in material terms a game can take over whole: the clo…
140
143
  - uniformDecl.js: Declares style-supplied GLSL uniforms
144
+ - vertexInputs.js: Vertex inputs of a WebGPURenderer program, counted before t…
141
145
 
142
146
  **ui/**
143
147
  - Focus.js: UI focus stack and choice cursor
@@ -206,6 +210,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
206
210
  | photo:denied | photo | — |
207
211
  | photo:taken | photo | — |
208
212
  | pickup:take | gameplay | — |
213
+ | post:add | render/PostFX.js | settings |
209
214
  | quest:done | gameplay | — |
210
215
  | quest:fail | gameplay | — |
211
216
  | quest:part | gameplay | — |
@@ -224,7 +229,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
224
229
  | settings:shadows | render/shadows.js | vegetation |
225
230
  | state:applied | core/inspect/UrlState.js | — |
226
231
  | state:placed | core/inspect/UrlState.js | camera |
227
- | state:replaced | core/engine/startup.js, core/inspect/UrlState.js, core/saves/stateReplace.js | calendar |
232
+ | state:replaced | core/engine/startup.js, core/saves/stateReplace.js | calendar |
228
233
  | template:stage | content | — |
229
234
  | terrain:chunkFailed | terrain | — |
230
235
  | terrain:void | rigid, terrain | — |
@@ -311,7 +316,7 @@ Modules declare actions without keys; the game binds them (createEngine({ bindin
311
316
  - modules/photo/Photo.js: module.* (1), photo.* (1)
312
317
  - modules/rigid/RigidBodies.js: module.* (1)
313
318
  - modules/rigid/Vehicles.js: vehicle.* (2)
314
- - modules/settings/strings.js: settings.* (43), title.* (1), module.* (1)
319
+ - modules/settings/strings.js: settings.* (44), title.* (1), module.* (1)
315
320
  - modules/sky/skyModule.js: module.* (1)
316
321
  - modules/swarm/Swarm.js: module.* (1)
317
322
  - modules/terrain/index.js: module.* (2)