threedog 0.8.0 → 1.0.1

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 (372) hide show
  1. package/CHANGELOG.md +223 -4
  2. package/README.md +6 -6
  3. package/core/assets/Animator.js +2 -0
  4. package/core/assets/Assets.js +44 -13
  5. package/core/assets/assetEntry.js +87 -22
  6. package/core/assets/assetHot.js +2 -1
  7. package/core/assets/assetReport.js +1 -2
  8. package/core/audio/Audio.js +24 -5
  9. package/core/base/I18n.js +6 -3
  10. package/core/base/Random.js +3 -1
  11. package/core/base/Vars.js +14 -4
  12. package/core/base/errorCodes.js +54 -16
  13. package/core/base/errorHints.js +12 -1
  14. package/core/base/errors.js +6 -4
  15. package/core/base/events.generated.js +10 -0
  16. package/core/base/follows.js +26 -0
  17. package/core/base/math.js +15 -8
  18. package/core/base/params.js +2 -2
  19. package/core/{saves → base}/saveValues.js +24 -6
  20. package/core/base/sections.js +97 -0
  21. package/core/base/spelling.js +32 -0
  22. package/core/base/validate.js +8 -29
  23. package/core/engine/Engine.js +61 -18
  24. package/core/engine/Loading.js +30 -3
  25. package/core/engine/copies.js +1 -1
  26. package/core/engine/headlessLoad.js +30 -13
  27. package/core/engine/lifecycle.js +30 -25
  28. package/core/engine/loop.js +22 -4
  29. package/core/engine/moduleSlots.js +91 -15
  30. package/core/engine/moduleTypes.js +13 -0
  31. package/core/engine/modules.js +248 -62
  32. package/core/engine/page.js +25 -8
  33. package/core/engine/plugins.js +15 -3
  34. package/core/engine/services.js +3 -0
  35. package/core/engine/startup.js +46 -36
  36. package/core/input/Input.js +39 -19
  37. package/core/input/inputKeyboard.js +39 -0
  38. package/core/input/inputPad.js +23 -2
  39. package/core/input/inputPointer.js +3 -1
  40. package/core/input/inputSeat.js +66 -0
  41. package/core/input/inputTouch.js +23 -6
  42. package/core/inspect/DebugOverrides.js +13 -2
  43. package/core/inspect/Describe.js +10 -6
  44. package/core/inspect/Inspect.js +31 -4
  45. package/core/inspect/UrlState.js +14 -10
  46. package/core/inspect/catalog.js +12 -5
  47. package/core/inspect/describeRender.js +3 -2
  48. package/core/inspect/describeText.js +6 -2
  49. package/core/inspect/metadata.generated.js +4140 -0
  50. package/core/inspect/pictureWriters.js +117 -33
  51. package/core/inspect/toolDoor.js +21 -0
  52. package/core/inspect/valueHistory.js +35 -0
  53. package/core/ops/Ops.js +32 -7
  54. package/core/ops/control.js +48 -23
  55. package/core/ops/holds.js +4 -3
  56. package/core/ops/opsAtomic.js +18 -6
  57. package/core/ops/opsCheck.js +7 -5
  58. package/core/ops/opsFail.js +5 -7
  59. package/core/ops/opsRun.js +2 -2
  60. package/core/ops/owned.js +20 -3
  61. package/core/ops/sharedPoint.js +7 -10
  62. package/core/ops/stacks.js +22 -1
  63. package/core/saves/SaveStore.js +52 -26
  64. package/core/saves/Saves.js +122 -27
  65. package/core/saves/saveApply.js +159 -61
  66. package/core/saves/saveFiles.js +30 -25
  67. package/core/saves/saveVersions.js +20 -6
  68. package/core/saves/session.js +76 -33
  69. package/core/saves/stateReplace.js +184 -0
  70. package/core/scene/Rays.js +21 -5
  71. package/core/scene/Views.js +6 -6
  72. package/core/scene/adaptive.js +13 -10
  73. package/core/scene/canvasBox.js +2 -0
  74. package/core/scene/compositeGround.js +72 -0
  75. package/core/scene/floor.js +17 -0
  76. package/core/scene/grid.js +2 -0
  77. package/core/scene/ground.contract.js +14 -0
  78. package/core/scene/ground.js +52 -17
  79. package/core/scene/pixel.js +154 -0
  80. package/core/scene/pixelRatio.js +167 -0
  81. package/core/scene/sceneDelta.js +3 -3
  82. package/core/scene/sceneMethods.js +11 -6
  83. package/core/scene/stepPoses.js +6 -1
  84. package/core/scene/thingExplain.js +1 -1
  85. package/core/scene/thingOps.js +22 -14
  86. package/core/scene/things.js +1 -1
  87. package/core/scene/tier.js +10 -0
  88. package/core/scene/view.js +126 -9
  89. package/core/stream/Batching.js +0 -1
  90. package/core/stream/Stream.js +24 -12
  91. package/core/stream/batchGroups.js +1 -0
  92. package/core/stream/scatter.js +5 -2
  93. package/core/stream/streamSources.js +2 -1
  94. package/core/threads/Commits.js +12 -7
  95. package/core/threads/Jobs.js +15 -5
  96. package/core/threads/Threads.js +5 -2
  97. package/core/time/Clock.js +3 -1
  98. package/core/time/skip.js +10 -4
  99. package/core/time/time.js +16 -10
  100. package/docs/AI.md +89 -72
  101. package/docs/API.md +18 -14
  102. package/docs/CODEMAP.md +68 -40
  103. package/docs/COMMANDS.md +22 -23
  104. package/docs/CONVENTIONS.md +120 -17
  105. package/docs/MIGRATING-0.8.md +2 -0
  106. package/docs/MIGRATING-1.0.md +101 -0
  107. package/docs/THREE.md +65 -12
  108. package/docs/api/cameraRig.md +3 -0
  109. package/docs/api/characters.md +13 -7
  110. package/docs/api/collider3d.md +9 -0
  111. package/docs/api/content.md +16 -15
  112. package/docs/api/dialogue.md +2 -1
  113. package/docs/api/engine.md +18 -16
  114. package/docs/api/events.md +14 -4
  115. package/docs/api/ground.md +2 -2
  116. package/docs/api/i18n.md +1 -1
  117. package/docs/api/input.md +2 -1
  118. package/docs/api/interactions.md +1 -1
  119. package/docs/api/inventory.md +1 -1
  120. package/docs/api/level.md +3 -2
  121. package/docs/api/nav.md +4 -2
  122. package/docs/api/particles.md +8 -5
  123. package/docs/api/pickups.md +1 -1
  124. package/docs/api/post.md +3 -4
  125. package/docs/api/quests.md +4 -2
  126. package/docs/api/rays.md +2 -0
  127. package/docs/api/rigid.md +3 -2
  128. package/docs/api/saves.md +8 -7
  129. package/docs/api/stream.md +4 -5
  130. package/docs/api/terrain.md +3 -4
  131. package/docs/api/terrainDraw.md +1 -1
  132. package/docs/api/timeline.md +2 -2
  133. package/docs/api/tools.md +3 -1
  134. package/docs/api/triggers.md +2 -0
  135. package/docs/api/vegetationDraw.md +1 -1
  136. package/docs/api/water.md +6 -2
  137. package/docs/api/weather.md +19 -4
  138. package/docs/api/weatherDraw.md +1 -1
  139. package/docs/api/world.md +1 -1
  140. package/docs/recipes/01-new-game.md +3 -3
  141. package/docs/recipes/02-npc.md +3 -4
  142. package/docs/recipes/03-items-pickups.md +11 -11
  143. package/docs/recipes/04-quests.md +2 -0
  144. package/docs/recipes/05-props-bake.md +9 -9
  145. package/docs/recipes/06-clock-events.md +6 -6
  146. package/docs/recipes/07-flow-scenes-pause.md +18 -15
  147. package/docs/recipes/08-weather-sky.md +5 -5
  148. package/docs/recipes/09-materials-lights-models.md +3 -3
  149. package/docs/recipes/10-blender-level.md +16 -4
  150. package/docs/recipes/11-vehicles.md +18 -6
  151. package/docs/recipes/12-navmesh.md +52 -8
  152. package/docs/recipes/13-animation.md +34 -8
  153. package/docs/recipes/14-custom-module.md +20 -8
  154. package/docs/recipes/15-perf.md +4 -4
  155. package/docs/recipes/16-dev-bridge.md +9 -8
  156. package/docs/recipes/18-world.md +13 -5
  157. package/docs/recipes/19-shooting-picking.md +3 -2
  158. package/docs/recipes/20-content-actions-save.md +26 -6
  159. package/docs/recipes/21-camera.md +17 -23
  160. package/docs/recipes/22-shop-gold.md +21 -12
  161. package/docs/recipes/23-ops.md +19 -15
  162. package/docs/recipes/26-ui-parts.md +3 -2
  163. package/docs/recipes/27-net.md +3 -3
  164. package/docs/recipes/28-terrain.md +3 -3
  165. package/docs/recipes/29-grid.md +1 -1
  166. package/docs/recipes/30-templates.md +10 -13
  167. package/docs/recipes/31-audio.md +2 -2
  168. package/docs/recipes/32-action-game.md +6 -5
  169. package/docs/recipes/33-stream-sources.md +4 -1
  170. package/docs/recipes/34-environment-lighting.md +7 -8
  171. package/docs/recipes/35-picture-from-reference.md +13 -9
  172. package/docs/recipes/36-ground-plants.md +3 -2
  173. package/docs/recipes/40-scene.md +11 -10
  174. package/docs/recipes/43-shader-patches-surfaces.md +7 -7
  175. package/docs/recipes/44-water-weather-hooks.md +9 -8
  176. package/docs/recipes/45-cascaded-shadows.md +3 -4
  177. package/docs/recipes/46-blender-art-route.md +3 -3
  178. package/docs/recipes/49-game-module-contract.md +2 -1
  179. package/docs/recipes/50-own-renderer.md +1 -0
  180. package/docs/recipes/51-capability-catalog.md +14 -8
  181. package/docs/recipes/52-around-the-picture.md +4 -4
  182. package/docs/recipes/55-mods-time-wrap.md +5 -4
  183. package/docs/recipes/56-webgpu-tsl.md +12 -1
  184. package/docs/recipes/57-control.md +30 -10
  185. package/docs/recipes/58-input.md +13 -0
  186. package/docs/recipes/60-judge-the-picture.md +1 -1
  187. package/docs/recipes/62-picture-code.md +106 -48
  188. package/docs/recipes/63-third-person-start.md +2 -1
  189. package/docs/recipes/64-particles.md +53 -4
  190. package/docs/recipes/65-swarm.md +2 -2
  191. package/docs/recipes/66-common-tasks.md +313 -0
  192. package/examples/action/.threedog/content-index.json +1 -1
  193. package/examples/action/GAMEMAP.md +3 -3
  194. package/examples/perf-island/.threedog/content-index.json +1 -1
  195. package/examples/perf-island/GAMEMAP.md +3 -3
  196. package/examples/perf-island/main.js +2 -2
  197. package/examples/plain-picture/GAMEMAP.md +3 -1
  198. package/examples/rc2d/GAMEMAP.md +1 -1
  199. package/examples/rc2d/rc2d.js +1 -1
  200. package/examples/styletest/.threedog/content-index.json +1 -1
  201. package/examples/styletest/GAMEMAP.md +3 -3
  202. package/examples/webgpu-tsl/GAMEMAP.md +1 -1
  203. package/examples/world/.threedog/content-index.json +1 -1
  204. package/examples/world/GAMEMAP.md +5 -4
  205. package/examples/world/main.js +3 -3
  206. package/index.d.ts +8 -5
  207. package/index.js +22 -1
  208. package/llms.txt +2 -1
  209. package/modules/ambience/Ambience.js +5 -3
  210. package/modules/calendar/index.js +7 -5
  211. package/modules/camera/FirstPersonCamera.js +3 -3
  212. package/modules/camera/FixedCamera.js +34 -20
  213. package/modules/camera/FollowCamera.js +20 -11
  214. package/modules/camera/RtsCamera.js +1 -0
  215. package/modules/camera/common.js +33 -22
  216. package/modules/camera/pixelSnap.js +62 -0
  217. package/modules/characters/Character.js +136 -43
  218. package/modules/characters/NPC.js +60 -28
  219. package/modules/characters/assetModel.js +2 -2
  220. package/modules/characters/astar.js +47 -28
  221. package/modules/characters/character.contract.js +21 -0
  222. package/modules/characters/contract.js +17 -3
  223. package/modules/characters/index.js +94 -34
  224. package/modules/characters/moveHelpers.js +80 -15
  225. package/modules/characters/mover.contract.js +14 -0
  226. package/modules/characters/movers/common.js +6 -4
  227. package/modules/characters/movers/rapier.js +12 -5
  228. package/modules/characters/movers/simple.js +25 -12
  229. package/modules/characters/movers/support.js +18 -7
  230. package/modules/characters/npcAvoid.js +15 -12
  231. package/modules/characters/npcSim.js +75 -25
  232. package/modules/characters/npcView.js +13 -6
  233. package/modules/characters/pathAsync.js +74 -24
  234. package/modules/characters/pathJob.js +38 -21
  235. package/modules/characters/player.js +59 -47
  236. package/modules/characters/seat.js +56 -0
  237. package/modules/characters/vehicle.contract.js +8 -5
  238. package/modules/characters/walkTo.js +31 -18
  239. package/modules/collision/Collision.js +44 -26
  240. package/modules/collision/contract.js +2 -2
  241. package/modules/collision/grid.js +6 -1
  242. package/modules/content/explain.js +1 -1
  243. package/modules/content/fields.js +3 -3
  244. package/modules/content/ids.js +3 -1
  245. package/modules/content/index.js +83 -27
  246. package/modules/content/loader.js +110 -130
  247. package/modules/content/markers.js +1 -1
  248. package/modules/content/models.js +48 -14
  249. package/modules/content/packs.js +2 -1
  250. package/modules/content/places.js +5 -4
  251. package/modules/content/props.js +8 -6
  252. package/modules/content/rules.js +29 -47
  253. package/modules/content/templates.js +66 -35
  254. package/modules/content/words.js +19 -6
  255. package/modules/debug/DebugPanel.js +4 -2
  256. package/modules/flow/contract.js +1 -0
  257. package/modules/flow/index.js +24 -14
  258. package/modules/gameplay/Container.js +5 -2
  259. package/modules/gameplay/Containers.js +9 -1
  260. package/modules/gameplay/Dialogue.js +82 -25
  261. package/modules/gameplay/Interactions.js +61 -32
  262. package/modules/gameplay/Inventory.js +56 -13
  263. package/modules/gameplay/Quests.js +133 -24
  264. package/modules/gameplay/boxOps.js +7 -0
  265. package/modules/gameplay/dialogueBubbles.js +14 -9
  266. package/modules/gameplay/inventoryOps.js +11 -7
  267. package/modules/gameplay/pickups.js +43 -16
  268. package/modules/gameplay/questLog.js +4 -2
  269. package/modules/gameplay/questSave.js +6 -1
  270. package/modules/gameplay/quests.contract.js +1 -1
  271. package/modules/grid/Grid.js +1 -1
  272. package/modules/grid/Layer.js +8 -4
  273. package/modules/grid/index.js +21 -15
  274. package/modules/grid/ops.js +43 -46
  275. package/modules/grid/tiles.js +1 -1
  276. package/modules/hlod/index.js +6 -3
  277. package/modules/hud/index.js +6 -4
  278. package/modules/hud/parts.js +4 -4
  279. package/modules/level/contract.js +2 -2
  280. package/modules/level/heightfield.js +17 -21
  281. package/modules/level/index.js +83 -26
  282. package/modules/level/load.js +165 -48
  283. package/modules/level/nodes.js +34 -16
  284. package/modules/lights/index.js +6 -3
  285. package/modules/lights/sources.js +3 -1
  286. package/modules/music/Music.js +4 -2
  287. package/modules/nav/contract.js +7 -5
  288. package/modules/nav/index.js +174 -44
  289. package/modules/nav/navPath.js +45 -10
  290. package/modules/net/index.js +1 -1
  291. package/modules/particles/Particles.js +85 -22
  292. package/modules/particles/effect.js +80 -28
  293. package/modules/particles/shaders.js +17 -0
  294. package/modules/photo/Photo.js +12 -10
  295. package/modules/rigid/RigidBodies.js +200 -57
  296. package/modules/rigid/Vehicles.js +15 -5
  297. package/modules/rigid/collider3d.contract.js +26 -0
  298. package/modules/rigid/ragdoll.js +55 -44
  299. package/modules/rigid/ragdollBones.js +83 -33
  300. package/modules/rigid/refresh.js +10 -0
  301. package/modules/rigid/sync.js +46 -15
  302. package/modules/settings/Settings.js +84 -37
  303. package/modules/settings/apply.js +15 -8
  304. package/modules/settings/sections.js +7 -4
  305. package/modules/settings/strings.js +2 -2
  306. package/modules/sky/skyModule.js +3 -1
  307. package/modules/swarm/Swarm.js +16 -6
  308. package/modules/terrain/ChunkManager.js +10 -16
  309. package/modules/terrain/index.js +17 -11
  310. package/modules/terrain/terrainEdit.js +13 -2
  311. package/modules/terrain/terrainGen.js +5 -3
  312. package/modules/terrain/terrainShape.js +1 -1
  313. package/modules/timeline/Timeline.js +58 -26
  314. package/modules/timeline/Tween.js +19 -13
  315. package/modules/timeline/shots.js +19 -10
  316. package/modules/triggers/index.js +87 -20
  317. package/modules/vegetation/Vegetation.js +4 -3
  318. package/modules/vegetation/draw.js +16 -0
  319. package/modules/vegetation/groundChunks.js +10 -7
  320. package/modules/vegetation/index.js +30 -7
  321. package/modules/water/Water.js +6 -2
  322. package/modules/weather/Weather.js +16 -15
  323. package/modules/weather/weatherDraw.js +7 -6
  324. package/modules/world/World.js +20 -7
  325. package/modules/world/explain.js +1 -1
  326. package/modules/world/index.js +13 -6
  327. package/modules/world/persist.js +23 -8
  328. package/modules/world/pos.js +4 -4
  329. package/modules/world/records.js +13 -7
  330. package/modules/world/sim.js +74 -23
  331. package/modules/world/simFar.js +2 -2
  332. package/modules/world/state.js +31 -6
  333. package/modules/world/thingSource.js +16 -3
  334. package/modules/world/views.js +19 -8
  335. package/package.json +7 -1
  336. package/render/PostFX.js +47 -29
  337. package/render/backend.js +5 -1
  338. package/render/fx/particles.tsl.js +8 -6
  339. package/render/fx/postWebGPU.tsl.js +3 -3
  340. package/render/layers.js +1 -1
  341. package/render/lightmap.js +23 -3
  342. package/render/occlusion.js +43 -12
  343. package/render/patches.js +2 -2
  344. package/render/postWebGL.js +4 -3
  345. package/render/probes.js +25 -0
  346. package/render/shadows.js +2 -2
  347. package/types/core.d.ts +142 -55
  348. package/types/gameplay.d.ts +92 -40
  349. package/types/generated/core/base/I18n.d.ts +2 -2
  350. package/types/generated/core/input/Input.d.ts +16 -2
  351. package/types/generated/core/input/inputSeat.d.ts +26 -0
  352. package/types/generated/core/inspect/DebugOverrides.d.ts +15 -1
  353. package/types/generated/core/ops/Ops.d.ts +2 -1
  354. package/types/generated/core/ops/control.d.ts +12 -2
  355. package/types/generated/core/saves/Saves.d.ts +26 -6
  356. package/types/generated/core/saves/session.d.ts +1 -1
  357. package/types/generated/core/scene/Views.d.ts +1 -1
  358. package/types/generated/core/stream/Stream.d.ts +6 -4
  359. package/types/generated/modules/grid/Grid.d.ts +1 -0
  360. package/types/generated/modules/particles/Particles.d.ts +4 -3
  361. package/types/generated/modules/timeline/Timeline.d.ts +5 -4
  362. package/types/generated/modules/weather/Weather.d.ts +1 -7
  363. package/types/generated/modules/world/World.d.ts +6 -4
  364. package/types/generated/render/PostFX.d.ts +6 -14
  365. package/types/nav.d.ts +36 -4
  366. package/types/physics.d.ts +55 -7
  367. package/types/pixel.d.ts +75 -0
  368. package/types/world.d.ts +14 -8
  369. package/ui/Parts.js +9 -2
  370. package/ui/theme.js +2 -2
  371. package/core/scene/engineCamera.js +0 -32
  372. package/modules/camera/projection.js +0 -21
package/docs/CODEMAP.md CHANGED
@@ -10,10 +10,12 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
10
10
 
11
11
  | Module (engine.xxx) | Type | File |
12
12
  |---|---|---|
13
- | cameraRig (firstPersonCamera()) | undefined | modules/camera/FirstPersonCamera.js |
14
- | cameraRig (fixedCamera()) | undefined | modules/camera/FixedCamera.js |
15
- | cameraRig (followCamera()) | undefined | modules/camera/FollowCamera.js |
16
- | cameraRig (rtsCamera()) | undefined | modules/camera/RtsCamera.js |
13
+ | cameraRig (firstPersonCamera()) | picture | modules/camera/FirstPersonCamera.js |
14
+ | cameraRig (fixedCamera()) | picture | modules/camera/FixedCamera.js |
15
+ | cameraRig (followCamera()) | picture | modules/camera/FollowCamera.js |
16
+ | cameraRig (rtsCamera()) | picture | modules/camera/RtsCamera.js |
17
+ | timeline | rules | modules/timeline/Timeline.js |
18
+ | level | world | modules/level/index.js |
17
19
  | terrain | world | modules/terrain/index.js |
18
20
  | vegetation | world | modules/vegetation/index.js |
19
21
  | world | world | modules/world/index.js |
@@ -21,17 +23,33 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
21
23
  | sky | picture | modules/sky/skyModule.js |
22
24
  | water | picture | modules/water/Water.js |
23
25
  | weather | world | modules/weather/Weather.js |
24
- | weatherDraw | picture | modules/weather/weatherDraw.js |
25
- | pickups | rules | modules/gameplay/pickups.js |
26
+ | weatherDraw | picture | modules/weather/Weather.js |
27
+ | dialogue | rules | modules/gameplay/Dialogue.js |
26
28
  | grids | world | modules/grid/index.js |
29
+ | interactions | rules | modules/gameplay/Interactions.js |
30
+ | pickups | rules | modules/gameplay/pickups.js |
27
31
  | swarm | rules | modules/swarm/Swarm.js |
28
32
  | triggers | rules | modules/triggers/index.js |
33
+ | hud | ui | modules/hud/index.js |
29
34
  | particles | picture | modules/particles/Particles.js |
35
+ | settings | ui | modules/settings/Settings.js |
30
36
  | terrainDraw | picture | modules/terrain/index.js |
31
37
  | vegetationDraw | picture | modules/vegetation/index.js |
38
+ | ambience | picture | modules/ambience/Ambience.js |
39
+ | characters | actor | modules/characters/index.js |
40
+ | collision | world | modules/collision/Collision.js |
32
41
  | content | rules | modules/content/index.js |
42
+ | debugPanel | ui | modules/debug/DebugPanel.js |
43
+ | flow | rules | modules/flow/index.js |
44
+ | hlod | picture | modules/hlod/index.js |
33
45
  | inventory | rules | modules/gameplay/Inventory.js |
46
+ | lightPool | picture | modules/lights/index.js |
47
+ | nav | world | modules/nav/index.js |
48
+ | net | net | modules/net/index.js |
49
+ | photo | tool | modules/photo/Photo.js |
34
50
  | quests | rules | modules/gameplay/Quests.js |
51
+ | rigid | world | modules/rigid/RigidBodies.js |
52
+ | music | picture | modules/music/Music.js |
35
53
 
36
54
  ## Files
37
55
 
@@ -42,13 +60,13 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
42
60
  **core/**
43
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
44
62
  - audio/ Audio core: buses (master, music, sfx, ambience, ui + the g… — Audio.js, audioRules.js, audioVoice.js
45
- - 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, math.js, mulberry32.js, params.js, util.js, validate.js
46
- - engine/ Engine core: what every 3D web game needs (rendering and po… — 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
47
- - input/ Input: read by "action", not by "key" — Input.js, inputContext.js, inputDefaults.js, inputPad.js, inputPointer.js, inputTouch.js
48
- - inspect/ "Who wrote this picture value": the last file:line that cha… — 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, pictureWriters.js, shaderCost.js, textureBytes.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
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
+ - 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
49
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
50
- - saves/ Saves: each module registers "how to save and load", and sa… — SaveStore.js, Saves.js, saveApply.js, saveFiles.js, saveIds.js, saveValues.js, saveVersions.js, session.js
51
- - scene/ Object registry behind engine.thing: every root handed to e… — Rays.js, Views.js, adaptive.js, canvasBox.js, engineCamera.js, gameLights.js, grayMap.js, grid.js, gridLoad.js, ground.js, movement.js, pictureSlots.js, sceneDelta.js, sceneMethods.js, screenToGround.js, stepPoses.js, targeting.js, thingExplain.js, thingOps.js, things.js, threePatches.js, tier.js, view.js
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
52
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
53
71
  - threads/ engine.threads: a small worker pool — Commits.js, Jobs.js, Threads.js, pureWorker.js, threadPure.js, threadServe.js
54
72
  - time/ engine.time: the one time source — Clock.js, dayTime.js, skip.js, time.js, uiClock.js
@@ -56,8 +74,8 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
56
74
  **modules/** (one line per folder: what it does; its files besides the index.js / contract.js every module has)
57
75
  - ambience/ Ambience module: a rule table of background sounds — Ambience.js
58
76
  - calendar/ calendar() hooks, saves, scenario time — Calendar.js, schedule.js, seasons.js
59
- - camera/ Camera module collection — FirstPersonCamera.js, FixedCamera.js, FollowCamera.js, RtsCamera.js, common.js, projection.js
60
- - characters/ Characters module: player (keyboard/stick control, camera follo… — Character.js, NPC.js, assetModel.js, astar.js, behaviors.js, footsteps.js, moveHelpers.js, movers/common.js, movers/manual.js, movers/rapier.js, movers/simple.js, movers/support.js, npcAvoid.js, npcSim.js, npcView.js, pathAsync.js, pathJob.js, pathWorker.js, player.js, playerStrings.js, proceduralRig.js, useModel.js, vehicle.contract.js, walkTo.js
77
+ - camera/ Camera module collection — FirstPersonCamera.js, FixedCamera.js, FollowCamera.js, RtsCamera.js, common.js, pixelSnap.js
78
+ - characters/ Characters module: player (keyboard/stick control, camera follo… — Character.js, NPC.js, assetModel.js, astar.js, behaviors.js, character.contract.js, footsteps.js, moveHelpers.js, mover.contract.js, movers/common.js, movers/manual.js, movers/rapier.js, movers/simple.js, movers/support.js, npcAvoid.js, npcSim.js, npcView.js, pathAsync.js, pathJob.js, pathWorker.js, player.js, playerStrings.js, proceduralRig.js, seat.js, useModel.js, vehicle.contract.js, walkTo.js
61
79
  - collision/ Lightweight collision: characters are upright cylinders, trees/… — Collision.js, grid.js
62
80
  - content/ Content loader: game data files into the engine — explain.js, fields.js, ids.js, loader.js, markers.js, models.js, packs.js, parts.js, places.js, props.js, rules.js, stages.js, templates.js, words.js
63
81
  - debug/ Performance panel + time/weather debugging — DebugPanel.js
@@ -73,7 +91,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
73
91
  - net/ net() module: optional co-op multiplayer, host-authoritative st… — Client.js, Host.js, Net.js, sync.js, transports.js
74
92
  - particles/ Particles module: dust, falling leaves, splashes, chimney smoke… — Particles.js, effect.js, shaders.js
75
93
  - photo/ Photo mode: a sharper shot, then restore — Photo.js
76
- - rigid/ Real physics (Rapier): objects that topple, roll, get pushed an… — RigidBodies.js, Vehicles.js, ragdoll.js, ragdollBones.js, sync.js
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
77
95
  - settings/ Settings menu module entry — Settings.js, apply.js, sections.js, strings.js, view.js
78
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
79
97
  - swarm/ Swarm module: many same-kind gameplay objects (bullets, enemy c… — Swarm.js, draw.js, grid.js
@@ -146,6 +164,7 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
146
164
  | character:model | characters | — |
147
165
  | character:step | characters | characters |
148
166
  | character:water | characters | — |
167
+ | content:failed | content | — |
149
168
  | day:start | calendar | — |
150
169
  | dialogue:bubble | gameplay | — |
151
170
  | dialogue:end | gameplay | music |
@@ -155,15 +174,22 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
155
174
  | engine:ready | core/engine/startup.js | content, flow, rigid |
156
175
  | flow:change | flow | — |
157
176
  | flow:transition | flow | — |
158
- | ground:change | terrain | characters |
177
+ | ground:change | terrain | characters, rigid |
159
178
  | i18n:change | core/base/I18n.js | core/input/inputTouch.js, gameplay, hud, settings, timeline, ui/UI.js |
160
179
  | input:context | core/input/inputContext.js | — |
161
180
  | input:rebind | core/input/Input.js | gameplay, timeline, ui/UI.js |
162
181
  | interaction:hold | gameplay | — |
163
182
  | interaction:interrupt | gameplay | — |
164
183
  | item:use | gameplay | — |
165
- | level:loaded | level | characters, hlod, nav |
184
+ | level:failed | level | — |
185
+ | level:loaded | level | hlod, nav |
186
+ | level:loading | level | — |
187
+ | level:playable | level | — |
188
+ | level:unloaded | level | hlod, nav |
189
+ | link:enter | characters | — |
190
+ | link:exit | characters | — |
166
191
  | module:disabled | core/base/errors.js | — |
192
+ | module:restored | core/engine/modules.js | content |
167
193
  | music:change | music | — |
168
194
  | music:stinger | music | — |
169
195
  | net:close | net | — |
@@ -185,32 +211,34 @@ Type = what the module may own (core/engine/moduleTypes.js): world, picture, act
185
211
  | quest:part | gameplay | — |
186
212
  | quest:start | gameplay | — |
187
213
  | quest:step | gameplay | — |
214
+ | quest:unpaid | gameplay | — |
188
215
  | rigid:rebuilt | rigid | rigid |
189
216
  | save:imported | core/saves/saveFiles.js | photo |
190
- | save:loaded | core/saves/saveApply.js | characters |
217
+ | save:loaded | core/saves/saveApply.js | — |
191
218
  | save:written | core/saves/Saves.js | — |
192
219
  | season:change | calendar | calendar |
193
220
  | session:end | core/saves/session.js | core/time/skip.js, flow, gameplay, hud, music, rigid, timeline |
194
- | session:failed | core/saves/session.js | flow, rigid |
195
- | session:start | core/saves/session.js | core/scene/things.js, camera, flow |
221
+ | session:failed | core/saves/saveApply.js, core/saves/session.js | flow, rigid |
222
+ | session:start | core/saves/session.js | core/scene/things.js, camera, flow, gameplay |
196
223
  | settings:change | settings | — |
197
224
  | settings:shadows | render/shadows.js | vegetation |
198
225
  | state:applied | core/inspect/UrlState.js | — |
199
226
  | state:placed | core/inspect/UrlState.js | camera |
227
+ | state:replaced | core/engine/startup.js, core/inspect/UrlState.js, core/saves/stateReplace.js | calendar |
200
228
  | template:stage | content | — |
201
229
  | terrain:chunkFailed | terrain | — |
202
230
  | terrain:void | rigid, terrain | — |
203
231
  | time:skip | core/time/skip.js | — |
204
232
  | timeline:end | timeline | — |
205
233
  | timeline:start | timeline | — |
206
- | trigger:enter | triggers | camera, content |
207
- | trigger:exit | triggers | content |
234
+ | trigger:enter | triggers | camera, triggers |
235
+ | trigger:exit | triggers | triggers |
208
236
  | ui:close | ui/Parts.js, ui/UI.js | core/engine/services.js, settings |
209
237
  | ui:open | ui/Parts.js, ui/UI.js | core/engine/services.js, settings |
210
238
  | vegetation:remove | vegetation | — |
211
239
  | vegetation:restore | vegetation | — |
212
- | vehicle:enter | characters | characters |
213
- | vehicle:exit | characters | characters |
240
+ | vehicle:enter | characters | — |
241
+ | vehicle:exit | characters | — |
214
242
  | water:add | core/scene/ground.js | water |
215
243
  | water:remove | core/scene/ground.js | water |
216
244
  | weather:change | weather | — |
@@ -226,16 +254,6 @@ Modules declare actions without keys; the game binds them (createEngine({ bindin
226
254
 
227
255
  | Action | Context | Text key | Declared at |
228
256
  |---|---|---|---|
229
- | moveForward (default KeyW, ArrowUp) | walk | input.moveForward | core/input/inputDefaults.js |
230
- | moveBack (default KeyS, ArrowDown) | walk | input.moveBack | core/input/inputDefaults.js |
231
- | moveLeft (default KeyA, ArrowLeft) | walk | input.moveLeft | core/input/inputDefaults.js |
232
- | moveRight (default KeyD, ArrowRight) | walk | input.moveRight | core/input/inputDefaults.js |
233
- | confirm (default Space, Enter, PadA) | walk | input.confirm | core/input/inputDefaults.js |
234
- | cancel (default Escape, PadB) | walk | input.cancel | core/input/inputDefaults.js |
235
- | uiUp (default ArrowUp, KeyW, PadUp) | walk | input.uiUp | core/input/inputDefaults.js |
236
- | uiDown (default ArrowDown, KeyS, PadDown) | walk | input.uiDown | core/input/inputDefaults.js |
237
- | uiLeft (default ArrowLeft, KeyA, PadLeft) | walk | input.uiLeft | core/input/inputDefaults.js |
238
- | uiRight (default ArrowRight, KeyD, PadRight) | walk | input.uiRight | core/input/inputDefaults.js |
239
257
  | rotateLeft | walk | camera.rotateLeft | camera |
240
258
  | rotateRight | walk | camera.rotateRight | camera |
241
259
  | jump | walk | input.jump | characters |
@@ -243,20 +261,30 @@ Modules declare actions without keys; the game binds them (createEngine({ bindin
243
261
  | brake | vehicle | input.brake | characters |
244
262
  | debugPanel | walk | debug.toggle | debug |
245
263
  | 'choice'+i | dialog | dialogue.choice | gameplay |
246
- | action | walk | input.interact | gameplay |
247
- | action | walk | inventory.action | gameplay |
248
- | action | walk | quests.action | gameplay |
264
+ | interact (parameter action) | walk | input.interact | gameplay |
265
+ | inventory (parameter action) | walk | inventory.action | gameplay |
266
+ | quests (parameter action) | walk | quests.action | gameplay |
249
267
  | rotate (parameter rotate) | walk | grid.rotate | grid |
250
268
  | photo | walk | photo.action | photo |
251
269
  | cancel (parameter action) | walk | settings.action | settings |
252
270
  | skip | cutscene | timeline.skipAction | timeline |
253
271
  | triggersDebug (parameter action) | walk | triggers.debug | triggers |
272
+ | moveForward (default KeyW, ArrowUp) | walk | input.moveForward | core/input/inputDefaults.js |
273
+ | moveBack (default KeyS, ArrowDown) | walk | input.moveBack | core/input/inputDefaults.js |
274
+ | moveLeft (default KeyA, ArrowLeft) | walk | input.moveLeft | core/input/inputDefaults.js |
275
+ | moveRight (default KeyD, ArrowRight) | walk | input.moveRight | core/input/inputDefaults.js |
276
+ | confirm (default Space, Enter, PadA) | walk | input.confirm | core/input/inputDefaults.js |
277
+ | cancel (default Escape, PadB) | walk | input.cancel | core/input/inputDefaults.js |
278
+ | uiUp (default ArrowUp, KeyW, PadUp) | walk | input.uiUp | core/input/inputDefaults.js |
279
+ | uiDown (default ArrowDown, KeyS, PadDown) | walk | input.uiDown | core/input/inputDefaults.js |
280
+ | uiLeft (default ArrowLeft, KeyA, PadLeft) | walk | input.uiLeft | core/input/inputDefaults.js |
281
+ | uiRight (default ArrowRight, KeyD, PadRight) | walk | input.uiRight | core/input/inputDefaults.js |
254
282
 
255
283
  ## i18n key groups (engine.t; full keys are in each string table)
256
284
 
257
285
  - core/base/I18n.js: common.* (8), loading.* (6), input.* (14), key.* (5), ground.* (1), shop.* (1)
258
286
  - core/engine/page.js: page.* (3)
259
- - core/saves/saveFiles.js: saves.* (8)
287
+ - core/saves/saveFiles.js: saves.* (9)
260
288
  - modules/ambience/Ambience.js: module.* (1)
261
289
  - modules/calendar/index.js: module.* (1)
262
290
  - modules/camera/common.js: module.* (1), camera.* (2)
@@ -268,7 +296,7 @@ Modules declare actions without keys; the game binds them (createEngine({ bindin
268
296
  - modules/flow/index.js: module.* (1)
269
297
  - modules/gameplay/Dialogue.js: module.* (1), dialogue.* (2)
270
298
  - modules/gameplay/Interactions.js: module.* (1)
271
- - modules/gameplay/Quests.js: module.* (1), quests.* (7)
299
+ - modules/gameplay/Quests.js: module.* (1), quests.* (8)
272
300
  - modules/gameplay/inventoryOps.js: module.* (1), inventory.* (7)
273
301
  - modules/gameplay/pickups.js: module.* (1), pickups.* (1)
274
302
  - modules/grid/strings.js: module.* (1), grid.* (11)
@@ -283,7 +311,7 @@ Modules declare actions without keys; the game binds them (createEngine({ bindin
283
311
  - modules/photo/Photo.js: module.* (1), photo.* (1)
284
312
  - modules/rigid/RigidBodies.js: module.* (1)
285
313
  - modules/rigid/Vehicles.js: vehicle.* (2)
286
- - modules/settings/strings.js: settings.* (42), title.* (1), module.* (1)
314
+ - modules/settings/strings.js: settings.* (43), title.* (1), module.* (1)
287
315
  - modules/sky/skyModule.js: module.* (1)
288
316
  - modules/swarm/Swarm.js: module.* (1)
289
317
  - modules/terrain/index.js: module.* (2)
package/docs/COMMANDS.md CHANGED
@@ -12,7 +12,7 @@ After `-w` write the directory or the package name (inside a game directory a pl
12
12
  - Test: `npm test -w games/my-game`, or `threedog test -w my-game`; `npm test` at the root tests every workspace (engine + each game).
13
13
  - Build: `npm run build -w games/my-game`; `npm run build` at the root builds all (every *.html in a workspace root is bundled, no change to
14
14
  vite.config.js needed); under a sub-path of a site: `threedog build my-game --base /my-game/` (recipes/61-deploy.md).
15
- - Screenshot / bake / compress models: `npm run shot -- -w my-game / --describe-only` (`--out day.png` your own name, still in `.threedog/shots/` (a path with a directory is written as given), `--tier low|high` render at that device tier (default: the desktop tier, skipped effects are named), `--keep` timestamped file name, picture numbers and hints after every shot, `--no-picture` skips them, `--ref image` also compares with a reference, `--json` one JSON object; an unknown option fails naming the closest one), `npm run bake -- -w my-game`, `npm run assets -- optimize -w my-game`.
15
+ - Screenshot / bake / compress models: `npm run shot -- -w my-game / --describe-only` (`--out day.png` your own name, still in `.threedog/shots/` (a path with a directory is written as given), `--tier low|high` render at that device tier (default: the desktop tier, skipped effects are named), `--keep` timestamped file name; the rest in the table below), `npm run bake -- -w my-game`, `npm run assets -- optimize -w my-game`.
16
16
  - A game's tests: every `games/<game>/tests/specs/*.mjs` runs (each exports a `specs` array; the runner finds the files, nothing to register); without
17
17
  `tests/specs/` a smoke test runs automatically (page opens, engine ready, no console errors). Minimal example:
18
18
  ```js
@@ -32,11 +32,11 @@ export const specs = [{
32
32
  ```
33
33
  Tests run against the built bundle (not the dev server): main.js must set `window.engine = engine;` before `await engine.start()`, otherwise the
34
34
  test waits for the engine until timeout (the error explains why).
35
- A spec whose run() reads pixels (`page.screenshot`) moves to software rendering, which is much slower; `software: false` on the spec keeps it on the GPU for a real picture.
35
+ A spec whose run() reads pixels (`page.screenshot`) moves to software rendering, which is much slower; `software: false` on the spec keeps it on the GPU for a real picture. Frame times measured beside other pages read several times too high: give such a spec `serial: true`, or run with `--jobs 1`. A spec file and what it imports run in Node. Importing `threedog` there works, but a file that touches `document` or `window` at its top level fails: move that code into a function, move plain data into a file of its own, or read the value in the page through `ev`.
36
36
  A test that steers: `frames(n)` and `wait(ms)` follow the machine, so under load the same script takes a different path. Hold the loop with
37
37
  `engine.haltLoop('my-test')` and advance game time yourself, `await page.keyboard.down('KeyW'); await ev(() => engine.step(0.25));`: the same steps give the same path on any machine.
38
- - New game: `npm run new-game -- name [--open-world] [--webgl]` (blank scene with a camera by default; `--open-world` adds generated ground, sky, follow camera and a player; the game runs on WebGPU and writes shaders in TSL, `--webgl` on WebGL with GLSL; see `recipes/01-new-game.md`).
39
- - Game in your own folder (outside this repo): after `npm install threedog@0.8 three@~0.187.0 @threedog/tools@0.8`, run `node node_modules/@threedog/tools/bin/threedog.mjs init [folder] [--open-world] [--webgl]` (folder: the one to create, default the current folder): it copies the new-game template without overwriting anything, merges package.json and writes `.mcp.json`, so Claude Code opened in that folder starts the threedog MCP server by itself.
38
+ - New game: `npm run new-game -- name [--open-world | --pixel] [--webgl]` (the blank and `--open-world` starts: `recipes/01-new-game.md`; `--pixel` starts a sprite character in a pixel-snapped orthographic view with input, interaction, dialogue and saves wired, gray placeholders, not together with `--open-world`; the game runs on WebGPU and writes shaders in TSL, `--webgl` on WebGL with GLSL).
39
+ - Game in your own folder (outside this repo): after `npm install threedog@1 three@~0.187.0 @threedog/tools@1`, run `node node_modules/@threedog/tools/bin/threedog.mjs init [folder] [--open-world] [--webgl]` (folder: the one to create, default the current folder): it copies the new-game template without overwriting anything, merges package.json and writes `.mcp.json`, so Claude Code opened in that folder starts the threedog MCP server by itself.
40
40
 
41
41
  > Git Bash (MSYS) rewrites arguments that start with `/` into a path under the Git install (`/` turns into `C:/Program Files/Git/`). Page arguments (`shot`, `capture`, `--page`) undo that by themselves, through `npm run` too (npm still echoes `> threedog shot C:/...`; shot then prints the page it really opens); if the Git folder cannot be found the error says so: then write `shot styletest`, set `MSYS_NO_PATHCONV=1`, or use PowerShell.
42
42
 
@@ -47,31 +47,31 @@ export const specs = [{
47
47
  |---|---|
48
48
  | `npm run dev` | Development. Browser errors are sent automatically to the terminal and to the workspace's `.threedog/errors.log` (e.g. `games/my-game/.threedog/errors.log`): read that file first when something breaks, before taking screenshots. Known error classes carry `Possible cause: …` and `Read: recipes/…` lines (tables `core/base/errorCodes.js` for engine errors, `core/base/errorHints.js` for browser / JavaScript ones) |
49
49
  | `npm run check` | Run after every change (order: if the docs need regenerating `map` -> `check` -> related tests; otherwise `check` -> related tests): rule checks (`packages/tools/rules/`, the engine's hard rules among them; detection and allowlists are at the top of each file; the save round trip is in npm test) + types + content validation + generated docs up to date. Errors print in full, warnings as one count line per rule; `-- --verbose` lists them (the first 15 per rule), `-- --all` every one. `-- --rule R4` runs one rule (`R04` works; an unknown id fails and lists them), `-- -w game` (or `threedog check -w game`, or `check` run inside a game folder, as `new-game` does) reports only that game's rule, type and content problems and sets the exit code from them alone, with other games and the engine as one count line each; plain `check` at the repo root stays repo-wide (run it before committing engine changes); `-- --json` prints one JSON result instead (shape below, text to stderr, same exit code) |
50
- | R40 bypass hints (part of `check`, warnings only) | Game code that hand-rolls timers, `Math.random`, an inventory, grid/height blending, a localStorage save or its own pause is pointed to the engine system that already does it. Off per line `// hint-off(kind)`, per file `// hint-off-file(kind)`, per project `package.json "threedog": { "hints": false | { "kind": false } }`, per run `THREEDOG_HINTS=off`. A deliberate choice goes in DESIGN.md Systems |
50
+ | R40 bypass hints (part of `check`, warnings only) | Game code that hand-rolls what an engine system does is pointed to that system: timers (also `await new Promise(r => setTimeout(r, ms))`), `Math.random`, an inventory, quests, grid/height blending, a localStorage save (any `setItem` except an obvious preference), pause, a settings menu, raw `keydown` listeners, `AudioContext`, a dialogue box, a loading screen, a language table, an interact-distance check, box collision, an `AnimationMixer`, a `requestAnimationFrame` loop, a camera follow, a particle loop, a tween, a pool of shots, a pointer raycast, a physics library. Each system declares its own hint; it works the same in a game installed from npm. Plain `check` lists the first 5 and ends "check passed, N bypasses"; `check --rule R40` lists all. Off per line `// hint-off(kind)`, per file `// hint-off-file(kind)`, per project `package.json "threedog": { "hints": false | { "kind": false } }`, per run `THREEDOG_HINTS=off`. A deliberate choice goes in DESIGN.md Systems |
51
51
  | `npm run types` | Type check only (does game code misuse the engine API). Plain JS TypeScript cannot follow (a field added to your own object later, a union from your own ternary, TSL node inference) is a `!` hint, not an error: no `// @ts-nocheck` needed |
52
52
  | `npm test` | Full browser tests (slow; test pages run in parallel, `-- --jobs N` sets how many, `--jobs 1` one at a time; without `--jobs`, at most 2 software-rendered pages at once; a spec with `serial: true` runs alone; a failure that happens only beside other pages is retried alone and listed). Normally `threedog test name` runs only the related ones (matched by test-name substring, any case, e.g. `-- hlod`; a word that matches nothing fails), `-- -w game` tests one game. Prints only failed items (with their failed checks), a progress line and the summary; `-- --verbose` prints every check. `-- --update-snapshots` makes tests that use `expectDescribe` write their describe baselines (`tests/snapshots/*.describe.json`) instead of comparing. `threedog test pack` (the build test): after a real build of each game, open only dist from a static server and check that the engine is ready, no 4xx resources, no console errors; `-- --json` prints the result as the same JSON shape, one item per failed check |
53
53
  | `threedog session [--minutes N]` / `session stop` / `session status` | Optional: keeps one small local process alive (127.0.0.1, token, `.threedog/session.json`) so later bridge commands skip module loading (about 0.1 to 0.15 s less per command); exits by itself after N idle minutes (default 10). Every command works the same without it: no session, a dead one or an unreachable one falls back to a direct call. Restart it after editing the tools |
54
54
  | `threedog bake light [-w game] [--out public/light/level.lightmap] [--size 1024] [--samples 128] [--page /]` | Bake a lightmap of the meshes marked `userData.static` in system Chrome on the real GPU; stops if WebGPU is not real. `recipes/34-environment-lighting.md`. `--samples` is rays per texel: raise it if flat walls look blotchy. A map with no light fails and writes nothing |
55
- | `threedog art list <source>` · `threedog art copy <source> [names…] [--to art/] [--force] [--dry]` | Reuse art code by copying it into this game (no dependency, no link back): the source is a game folder (its `art/`), a local folder or file, or an installed package. `list` shows modules, exported generator functions with their first JSDoc line, asset files; `copy` brings the named modules plus their local imports and the textures / models they name, rewrites relative imports, never overwrites a changed file without `--force` (then nothing is written), prints the `engine.assets.manifest` lines. MCP: `art_list`. `recipes/09-materials-lights-models.md` section 2a |
55
+ | `threedog art list <source>` · `threedog art copy <source> [names…] [--to art/] [--force] [--dry]` | Reuse art code by copying it into this game (no dependency, no link back): the source is a game folder (its `art/`), a local folder or file, or an installed package. What `list` shows and what `copy` brings along: the recipe. MCP: `art_list`. `recipes/09-materials-lights-models.md` section 2a |
56
56
  | `threedog art board [-w game] [--out file.html] [--json] [--live] [--lib dir]` | Every art resource of one game on one page (default `.threedog/art-board/index.html`): models, textures, sounds, fonts, materials, shaders and library entries, each with a preview where one exists, its file, size and where it is used as file:line. Status: used, unused, missing, or not traced (a name built at run time or plain text that may mean it; never called unused). Each item copies one line for the AI; several items plus a note copy one request. `--json` prints the same data. `--live` also asks the running game (dev server, dev bridge) what it has really loaded; `?panel=1` shows the same list in folder "art". A model gets a picture once `threedog gallery --shots` has made one. |
57
57
  | `threedog lib status [-w game] [--lib dir]` | What this game pulled from the library (read from its `.threedog-lib.json`, which every `lib pull` writes): each entry changed or not, and newer in the library or not. It only reports: a pull belongs to the game and nothing updates it |
58
58
  | `threedog lib check [-w game]` | Do the things this game pulled fit together? Fails on a need nothing gives, on two entries writing one three.js value, and on code the game's renderer cannot run (GLSL in a WebGPU game, a node material in a WebGL game); sizes and styles that do not fit are notes. It reads the game's copies, so an edit or a port clears a clash |
59
- | `threedog lib add <file|folder|exportName> [-w game] [--name n] [--summary s] [--kind k] [--use s] [--plug "makeIt({ ... })"] [--style a,b] [--usage s] [--no-proof] [--preview url|png] [--force]` · `threedog lib list [words] [--card] [-w game]` · `threedog lib pull <name> [-w game] [--to art/] [--plug "makeIt({ ... })"] [--force] [--dry]` · `threedog lib page` | Your own library of art and techniques from earlier games, kept outside the engine (`~/.threedog/library`; `THREEDOG_LIBRARY` or `--lib dir` moves it): one folder per entry with the copied files, `entry.json` (kind model / texture / material / shader / effect / module / other, summary, the use line, backends, params, which game and day it came from) and `preview.png`. `add` copies from a game the way `art copy` does (local imports, textures, models), summary defaults to the first JSDoc line, never replaces a different existing entry without `--force`; a model or texture gets the gallery turntable when the game registers it, a code entry a picture only with `--preview <url of a running scene>` or `--preview file.png`. `list` is one line per entry (words narrow it); `pull` copies an entry into this game (no link back, no update command; the game adapts it) and prints the use line with the path where the file landed. An entry that cannot draw on the game's renderer (`backends` in `entry.json`, `lib list` shows it, `lib list webgpu` narrows to it) is refused with nothing copied; `--force` copies it to port by hand. Where it lands goes by kind: a `picture` or `material` entry in `picture/` (a `.glsl` in `picture/shaders/`) with no wiring file, you import it yourself; a model or texture in `art/`; a `shader`, `effect` or `module` entry in `plugins/<name>/` plus the wiring file `plugins/<name>.js` that calls its factory (the entry's plug line, set by `add --plug`, else its exported function; `pull --plug` overrides), so it plugs at start with nothing hand-written; a `system` in `systems/<name>/` plus that wiring file; `page` writes `index.html` with all previews. MCP: `lib_list`. recipes/05-props-bake.md §2d |
59
+ | `threedog lib add <file|folder|exportName> [-w game] [--name n] [--summary s] [--kind k] [--use s] [--plug "makeIt({ ... })"] [--style a,b] [--usage s] [--no-proof] [--preview url|png] [--force]` · `threedog lib list [words] [--card] [-w game]` · `threedog lib pull <name> [-w game] [--to art/] [--plug "makeIt({ ... })"] [--force] [--dry]` · `threedog lib page` | Your own library of art and techniques from earlier games, kept outside the engine (`~/.threedog/library`; `THREEDOG_LIBRARY` or `--lib dir` moves it): one folder per entry with the copied files, `entry.json` (kind model / texture / material / shader / effect / module / other, summary, the use line, backends, params, which game and day it came from) and `preview.png`. `add` copies from a game the way `art copy` does (local imports, textures, models), summary defaults to the first JSDoc line, never replaces a different existing entry without `--force`; a model or texture gets the gallery turntable when the game registers it, a code entry a picture only with `--preview <url of a running scene>` or `--preview file.png`. `list` is one line per entry (words narrow it); `pull` copies an entry into this game and prints the use line with the path where the file landed. An entry that cannot draw on the game's renderer (`backends` in `entry.json`, `lib list` shows it, `lib list webgpu` narrows to it) is refused with nothing copied; `--force` copies it to port by hand. Where it lands goes by kind: a `picture` or `material` entry in `picture/` (a `.glsl` in `picture/shaders/`) with no wiring file, you import it yourself; a model or texture in `art/`; a `shader`, `effect` or `module` entry in `plugins/<name>/` plus the wiring file `plugins/<name>.js` that calls its factory (the entry's plug line, set by `add --plug`, else its exported function; `pull --plug` overrides), so it plugs at start with nothing hand-written; a `system` in `systems/<name>/` plus that wiring file; `page` writes `index.html` with all previews. MCP: `lib_list`. recipes/05-props-bake.md §2d |
60
60
  | `threedog examples list` · `threedog examples pull <name> [--out dir] [--force]` | Technique and optional examples you copy and adapt (the list is `examples/pullable.json` in the engine package; the summary is each README's first line). `pull` copies the game-facing files to `<game>/techniques/<name>/` (or `--out`), never overwrites a changed file without `--force` (then nothing is written), prints the import line and the packages the code imports. An unknown name fails with did-you-mean |
61
- | `threedog how "<task>"` | Ranks the AI.md task rows and recipe headings for a task in your own words. `recipes/51-capability-catalog.md` section 5 |
61
+ | `threedog how "<task>" [--full]`, `--browse [category]`, `--card <id> [--full]` | One recommended route for a task in your own words (not the only allowed one): is it installed in this game, what is missing, a minimal example, the next route; `--full` lists the other routes. With no words, or `--browse`: the categories, then one line per capability. `--card`: what a capability solves, when it does not fit, install, dependencies, time, saves, an example and what verified it. The MCP tool `how` has the same three as fields `task`, `browse`, `card`. `recipes/51-capability-catalog.md` section 5 |
62
62
  | `threedog content set <id> x=12 place=home … [--expect x=5] [--in props] [--file content/x.js] [--dry]` | Write a permanent change into the content entry (several fields, one write, all-or-nothing; refused when `--expect` no longer matches). `recipes/40-scene.md` |
63
63
  | `threedog content add <kind> id=<id> field=value … [--file content/props/town.js]` · `threedog content remove <id> [--in kind]` | Append one entry at the end of a kind (always with an id) / delete one. Reads and checks only that file (id index `.threedog/content-index.json`). `recipes/40-scene.md` |
64
- | `threedog content stamp <arrangement> id=stall-1 x=20 z=5 [rot=1.6] [--dry]` | (experimental) Copy `content/arrangements/<arrangement>.js` (entries around zero, each with a local `part`; read by tools only) into the game: one place in `content/places.js` and one plain props entry per part, id `<id>-<part>`, `source: <arrangement>`. An id clash lists every clash; any failure writes nothing |
64
+ | `threedog content stamp <arrangement> id=stall-1 x=20 z=5 [rot=1.6] [--dry]` | (experimental) Copy `content/arrangements/<arrangement>.js` (recipe 30 section 7) into the game: one place in `content/places.js` and one plain props entry per part, id `<id>-<part>`, `source: <arrangement>`. An id clash lists every clash; any failure writes nothing |
65
65
  | `threedog content set --source <arrangement> <part> field=value … [--dry]` | Explicit batch edit: the same change in that part of every copy, all or nothing, and it prints how many changed (`--dry` lists them first). Copies do not follow automatically, and the arrangement file is not changed. Without `--source`, `content set` edits only that entry |
66
66
  | `threedog content capture <groupName> --as <arrangement> [--page /p.html] [--force] [--dry]` | (experimental) From the running game (dev server): read a named `THREE.Group`'s direct children (position, turn, scale relative to the group, named model or template of each) and write the arrangement. Placement only, never geometry. A child with no named model, a tilt or an uneven scale is listed by name with the fix, and nothing is written. Afterwards delete the code that placed the group, or it appears twice; `check` warns (R52) while its name is still in the code |
67
67
  | `threedog mcp [--allow-js]` | The dev bridge as an MCP server over stdio. `recipes/16-dev-bridge.md` section 10 |
68
68
  | `threedog assets check new.glb --against old.glb` | What the old export had and the new one lacks. `recipes/46-blender-art-route.md` |
69
69
  | `threedog shot --view name [--compare before.png]` | A named camera view (`engine.views.define`) and a pixel diff against an earlier picture. `recipes/46-blender-art-route.md` |
70
- | Result of every bridge command | CLI text ends with one line on the game state and the way back (`Game loop halted, tick 180: threedog resume restores real-time running`; frozen by a menu says which). MCP adds `structuredContent` { ok, code, summary, runtime { ready, mode running|halted|frozen, tick, headless, blockedBy[] }, data } and an `outputSchema` on every tool. `code`: ok, blocked (ran, refused), not-ready, no-server / starting / busy / page-error / no-bridge (cannot reach the game), command-error. **Advance game time**: step, press, hold, skip, scenario, verify. **No game time**: op, state, eval, js, resume, reload. Everything else only observes. eval / js and describe with a path or --full / --all print no state line (parseable); runtime still has it. MCP `data` over 3 KB keeps its small fields and names `threedog <cmd> --json` for the rest (the text already summarizes it) |
70
+ | Result of every bridge command | CLI text ends with one line on the game state and the way back (`Game loop halted, tick 180: threedog resume restores real-time running`; frozen by a menu says which). MCP adds `structuredContent` { ok, code, summary, runtime { ready, mode running|halted|frozen, tick, headless, blockedBy[] }, data } and an `outputSchema` on every tool. `code`: ok, blocked (ran, refused), not-ready, no-server / starting / busy / page-error / no-bridge (cannot reach the game), command-error. **Advance game time**: step, press, hold, skip, scenario, verify. **No game time**: op, state, eval, js, resume, reload. Everything else only observes. eval / js and describe with a path or --full / --all print no state line (parseable); runtime still has it. |
71
71
  | `npm run map` | Regenerate CODEMAP, API.md + api/, each game's GAMEMAP and the event-name list (generated from `EventMap` in core.d.ts; add a new event to EventMap first) after changing code, JSDoc or content (run it before `check`) |
72
72
  | `npm run shot -- / --time 18:30 --weather rain --pos x,z` (or `--at place`: in play at a named place) | Only when you need to see the picture; by default 1 image of 960x540 into the workspace's .threedog/shots/; **read the state as text first with `--describe-only`**. Under a picture it prints only what bears on it (time, weather, camera; the same lines as `threedog snap`); `--describe-only` and `--json` give the whole state. `/<page>.html` switches the page, `-w game` switches the game, `--wait seconds` advances time. The shot waits until loading is finished (`--load-timeout` seconds, default 120) and fails naming what is still pending, then for the game's own code after `await engine.start()` (no request open and the scene's objects / lights / materials unchanged for 0.3 s, at most 10 s; it prints how long and what was added; if the scene still changes after the picture, it warns that the picture may be incomplete); a page error before `window.engine` fails at once with the error. `--no-build` reuses the last dist/ (code unchanged); a playing cutscene is skipped unless `--keep-cutscene`; `--play` starts straight in play, past the title screen the way its Start does (the engine's `?play` URL key) |
73
- | `npm run shot -- / [--ref image] [--no-picture] [--json]` · `shot http://localhost:5173/` · `shot --image file.png` | After every shot (and every `threedog snap`, on the live page): picture numbers measured on the 3D canvas (mean luminance, contrast = std of luminance and the p5-p95 range, saturation, share clipped white / near black, shadow area and how much shadows darken) and hints. **Contradictions** (always on): shadows on but none measurable, a light the game added that changes no pixel. **Facts** (each a contradiction only where DESIGN.md declares the opposite): glare, naming each light or glowing material that blows pixels out with its current values and the detail lost under it, and large clipped areas (`no-glare`); large near-black areas (`no-pitch-black`); time of day that barely changes the picture or a night not dark from lighting (renders 12:00 and 00:00 when the game runs calendar + sky or the shot sets `--time`; `dark-nights`); `light:` the share of the lit brightness from the sun / key and from the fill (each turned off once) and how much darker shadowed areas are (`strong-light`); the camera standing inside a closed mesh; a black frame, naming the material whose hiding alone brings the picture back (newest materials first; a ShaderMaterial is told the usual NaN / Inf causes, and shader programs that failed to compile are listed); fog that is most of the color in a large share of the picture, with its near / far and color. **Intent** (only against what the game declared): the listed words on DESIGN.md's optional `Picture intent:` line (the only place the check reads a wish; the table's free text is never read), or `--ref`. Each hint states the fact and the likely cause with the parameter and its current value, never a target; nothing fails and nothing is changed. Printed short: the numbers line (noon / midnight with each exposure when the two differ), then at most four one-sentence hint lines, contradictions first and then by measured size, and `N more: threedog shot --json (picture.hints)`; `--json` has every hint in full. A few extra renders of the current view (about 0.3 s on a GPU), every touched value put back. `--json` prints one object (file, look, probe, hints, describe) for MCP / the dev bridge. A full URL opens that already running page without a build, and a local server of another game's folder is refused (one that cannot say which game it serves gets a printed note); `--image` reads a picture taken any other way and gives the pixel part only (shares, near-white spots, intent), saying what needs the live page. A screenshot of your own skips the check: take pictures with `shot` or `snap`. recipes/35 |
74
- | `npm run shot -- styletest --view room --time dusk --weather rain` | The fixed style-judging scene (`examples/styletest`, page `/styletest.html`; a bare name is a page of the workspace). `--view` = a named camera (overview, character, water, room, path, ui), `--time` also takes day / dusk / night, `--weather` clear / rain / snow; same arguments every round, so only the style differs. `--panel` is not a shot option: open `/styletest.html?panel=1` in a browser for the workbench (recipes/35) |
73
+ | `npm run shot -- / [--ref image] [--no-picture] [--json]` · `shot http://localhost:5173/` · `shot --image file.png` | After every shot (and every `threedog snap`, on the live page): picture numbers measured on the 3D canvas and hints: contradictions, facts and intent, listed in recipes/35 "Picture check after every shot". Nothing fails and nothing is changed. Printed short: the numbers line (noon / midnight with each exposure when the two differ), then at most four one-sentence hint lines, contradictions first and then by measured size, and `N more: threedog shot --json (picture.hints)`. A few extra renders of the current view (about 0.3 s on a GPU), every touched value put back. `--json` prints one object (file, look, probe, every hint in full, describe) for MCP / the dev bridge. A full URL opens that already running page without a build, and a local server of another game's folder is refused (one that cannot say which game it serves gets a printed note); `--image` reads a picture taken any other way and gives the pixel part only (shares, near-white spots, intent), saying what needs the live page. A screenshot of your own skips the check: take pictures with `shot` or `snap`. recipes/35 |
74
+ | `npm run shot -- styletest --view room --time dusk --weather rain` | The fixed style-judging scene (`examples/styletest`, page `/styletest.html`; a bare name is a page of the workspace). Views and the `--time` / `--weather` words: recipes/35. Same arguments every round, so only the style differs. `--panel` is not a shot option: open `/styletest.html?panel=1` in a browser for the workbench (recipes/35) |
75
75
  | `threedog capture [page] [--top N] [--no-spector] [--spector-url url] [--full] [--no-build]` | Find out what a frame draws: renders one steady frame headless and prints draw calls, shadow-map draws, render passes (post effects) and the largest draws with world record id, budget tag and material purpose. Also records the WebGL command stream of that frame with Spector.js (fetched on first use into `.threedog/cache/`, not a dependency) to `.threedog/captures/`; `--no-spector` skips it, `--spector-url` fetches it from another source. Works on the game's own renderer, WebGL or WebGPU, and prints which one it measured; Spector only runs on WebGL. A frame with no draws fails |
76
76
  | `npm run bake` | Before release, or to take code-generated models into Blender: exports public/models/baked/*.glb (`-- -w game`) |
77
77
  | `npm run assets -- check [glb or folder] [--json] [--strict]` | Inspect models without building (default art/models/; a game with no such folder has nothing to check and passes, and only models are read: sprite and texture PNGs are never looked at): the level manifest (spawns, col_ colliders, trigger_ zones, npcs, markers, template / id nodes, missing templates, duplicate ids), material and color-space suspicions (data texture in a color slot, BLEND, texture without UV, oversized texture), statistics. `--json` for tools, exit 1 on errors (`--strict`: on warnings too). `npm run check` also reads the level glbs for content validation |
@@ -79,15 +79,15 @@ export const specs = [{
79
79
  | `npm run perf` | Performance comparison (plain three.js vs engine vs per-module cost in openWorld). Prints the renderer first. `threedog perf -w my-game [frames]`: your game's page in play, standing still: frame ms, JS ms, draw calls, memory |
80
80
  | `threedog stress [-w game] [--only a,b] [--frames 30] [--json]` | At what load this game drops: from a game folder (or `-w`) the load ramps go on top of the game's own scene on its own renderer in system Chrome, one axis at a time (extra meshes, triangles, instances, point lights), after a line with the game alone; then the load that fits 16.7 and 33 ms per axis. A WebGPU game on a browser without real WebGPU is refused. In the engine repo with no game it runs the neutral page `tests/stress/` for the engine's own measurements, and says so |
81
81
  | `--gpu` · `--software` · `THREEDOG_RENDER=gpu` or `software` | Renderer of the headless browser. `shot`, the dev bridge's headless page, `gallery --shots`, `perf` and `stress` prefer the hardware GPU (ANGLE d3d11 / metal / vulkan), check the renderer string after launch and fall back to SwiftShader with one note line; tests that read rendered pixels (`software: true` on the spec; unmarked ones are caught at the end of a GPU run) start on SwiftShader (same pixels everywhere), the others on the GPU when it is reachable |
82
- | `threedog content ids [-w game \| folder] [--write]` | Stateful content entries (pickups, template instances with state / container / interact / body) that rely on their index id: prints the id each has now as `-`/`+` lines (dry run); `--write` writes them into `content/*.js`. Rename later through `content/renames.js` (recipe 30) | <!-- r18-ignore-line -->
82
+ | `threedog content ids [-w game \| folder] [--write]` | Stateful content entries that rely on their index id: prints the id each has now as `-`/`+` lines (dry run); `--write` writes them in. Recipe 30, "Writing the ids, renaming them" | <!-- r18-ignore-line -->
83
83
  | `npm run doctor` | Check the environment, one line per item: ✓ passed · ✗ problem -> fix · – info only; `-- --ci` does not fail the command on problems; `-- --json` prints the same shape as `check --json`: `{ ok, summary, items }` (items are the problems and info lines); exit code 0 only when `ok`. Checks Node version, node_modules, workspace links, package-lock consistency, `.threedog` writable, the physical copy (real path, version, package.json mtime) of engine / tools / three per context (check, run/build per game; a `MISMATCH` line when contexts use different copies, e.g. vendor/ vs node_modules), port 5173, the dev server recorded in `.threedog/dev.json`, then renders one real engine frame on software rendering (what tests use; failing is a problem) and on the GPU path (whether a hardware GPU is available to headless; info only), and whether `EXT_disjoint_timer_query_webgl2` gives GPU ms. Run it first when the environment acts strange |
84
84
  | `threedog api-count [--unused] [--json] [--games dirA,dirB]` | Engine repository only: counts the public surface an AI meets (createEngine options, engine members and their sub-objects, module options and APIs, exports of `threedog` / `threedog/tsl` / `@threedog/post-effects`, CLI commands and options, error codes) from the type declarations, one line per group; `--unused` lists the items no engine source, example, template or recipe code block uses (deletion candidates, a name heuristic); unused items kept on purpose (CLI commands, error codes, tuning options with a default) are reported apart as `kept`. For engine maintainers deciding what to delete |
85
- | `threedog picture palette <image> [--n 8] [--average] [--region x,y,w,h] [--ignore-ui] [--crop out.png] [--json]` | Dominant colors of a reference picture and a one-line summary (headless Chromium reads the pixels). `--average` adds the mean color (HSL); `--region` measures one rectangle; `--ignore-ui` cuts a flat frame around the picture (edge row / column one flat color, frame 3% to 45% of the picture; a plain sky at the edge looks the same, so check with `--crop out.png`, which saves the measured area). The output says what was measured; `--json` prints the JSON only (summary inside). A path that starts with `-` goes after `--`. A measurement, not a design decision |
85
+ | `threedog picture palette <image> [--n 8] [--average] [--region x,y,w,h] [--ignore-ui] [--crop out.png] [--json]` | Dominant colors of a reference picture and a one-line summary. `--average` adds the mean color (HSL); `--region` measures one rectangle; `--ignore-ui` cuts a flat frame around the picture (edge row / column one flat color, frame 3% to 45% of the picture; a plain sky at the edge looks the same, so check with `--crop out.png`, which saves the measured area). The output says what was measured; `--json` prints the JSON only (summary inside). A path that starts with `-` goes after `--`. A measurement, not a design decision |
86
86
  | `threedog picture compare <reference> <screenshot> [--region x,y,w,h] [--ref-region ..] [--shot-region ..] [--json]` | Differences as numbers: brightness, saturation, contrast (std of luma), fine detail (variance of the Laplacian of luma; read as a ratio), average and main color (hue / saturation / lightness), plus one neutral sentence ("18% darker, 2.3x more broken up"). Both pictures are scaled down to one size, never enlarged (detail is measured at the smaller picture's scale), and the notes say so. Regions are matched by position: a shifted feature shows as a large hue difference, so cut the same content with `--ref-region` / `--shot-region`. **An aid to judging, not a replacement for looking; no number is a quality score and there is no "similarity %".** recipes/35 |
87
- | `?panel=1` with `import('@threedog/tools/panel').then(m => m.openPanel(engine))` | The dev panel in any game: live sliders straight on the three.js objects (exposure, `scene.fog`, lights, module materials and uniforms, materials by name, `engine.uniforms`), post effects, UI colors, "write back" for `threedog tune`. Needs the optional dev package `tweakpane`; production builds of the vite preset get a stub. `recipes/35-picture-from-reference.md` |
87
+ | `?panel=1` with `import('@threedog/tools/panel').then(m => m.openPanel(engine))` | The dev panel in any game: live sliders straight on the three.js objects, "write back" for `threedog tune`. `recipes/35-picture-from-reference.md` |
88
88
  | `threedog tune show [-w game]` · `threedog tune write [file] [--apply] [-w game]` | Values from `.threedog/tune.json` as one `// threedog:tune begin ... end` block of plain three.js writes (`engine.scene.fog.far = 90;`, `material.setValues` by name, UI CSS variables) in `file`. A later write merges into the block, so values the panel no longer holds stay; delete a line to drop it. Model generator params (the panel's models folder) become the `default` in that model's `params` schema where it is registered (no file needed for those). Without `--apply` it only prints the diff. `recipes/35-picture-from-reference.md` |
89
- | Tuning without a mouse | The panel is for a person. An AI does not need it: try values with `threedog eval` (`engine.scene.fog.far = 90`), look with `threedog snap`, then write what it settled on into `.threedog/tune.json` as `{ "values": { "engine.scene.fog.far": 90, "engine.scene.background": "#336699" }, "css": { "accent": "#7fd3ff" }, "materials": { "rock": { "roughness": 0.8 } }, "models": { "tree": { "height": 4 } } }` and run `threedog tune write main.js --apply`. Or write the value straight into the code; the file only saves reviewing the change first |
90
- | `threedog gallery [-w game] [--port 5181]` · `threedog gallery --shots [--size 256] [--only a,b] [--mode silhouette,value]` | Every registered model and texture on a turntable under three neutral light setups (midday, low sun, overcast; tone mapping copied from the game). Without `--shots` it serves the game in dev and prints the `?gallery=1` URL (any dev page opens it with `?gallery=1`); `--shots` writes `.threedog/gallery/<name>-<light>.png`, `index.html` and `index.json` headless. `--mode` adds review pictures beside them: `silhouette` (each model pure black on white: `fill`, `boxFill`, `aspect`) and `value` (the midday shot as grayscale luminance: `p5` / `p50` / `p95` inside the outline); the facts are printed per asset and stored in `index.json`, with no thresholds. Compare one with a reference: `threedog picture compare <ref> <png> --out diff.png`. `recipes/05-props-bake.md` section 2c |
89
+ | Tuning without a mouse | The panel is for a person. An AI does not need it: try values with `threedog js` (`engine.scene.fog.far = 90`), look with `threedog snap`, then write what it settled on into `.threedog/tune.json` as `{ "values": { "engine.scene.fog.far": 90, "engine.scene.background": "#336699" }, "css": { "accent": "#7fd3ff" }, "materials": { "rock": { "roughness": 0.8 } }, "models": { "tree": { "height": 4 } } }` and run `threedog tune write main.js --apply`. Or write the value straight into the code; the file only saves reviewing the change first |
90
+ | `threedog gallery [-w game] [--port 5181]` · `threedog gallery --shots [--size 256] [--only a,b] [--mode silhouette,value]` | Every registered model and texture on a turntable under three neutral light setups (midday, low sun, overcast; tone mapping copied from the game). Without `--shots` it serves the game in dev and prints the `?gallery=1` URL (any dev page opens it with `?gallery=1`); `--shots` writes `.threedog/gallery/<name>-<light>.png`, `index.html` and `index.json` headless. `--mode` adds review pictures beside them: `silhouette` (each model pure black on white: `fill`, `boxFill`, `aspect`) and `value` (the midday shot as grayscale luminance: `p5` / `p50` / `p95` inside the outline); the facts are printed per asset and stored in `index.json`, with no thresholds. `recipes/05-props-bake.md` section 2c |
91
91
  | `npm run build` | Bundle each workspace into its own dist/ |
92
92
  | `threedog preview [game]` (or `-w game`, as for dev and build) | Serve a workspace's built dist/ (vite preview) to open the production build in a browser. It is the shipped game, so URL keys (`?play`, `?time`…) are not read; `shot`, `test` and `dev` read them, or set `createEngine({ urlState: true })` (`?fresh` stays dev-only) |
93
93
  | `threedog relay [port]` | The WebSocket relay for the net module (default port 8787, no dependencies). `recipes/27-net.md` |
@@ -106,8 +106,7 @@ They drive the running game. Run them inside the game folder or with `-w game`;
106
106
  | `threedog press` | press a key or action: press interact / press KeyE / press e (held 0.1 s, then renders 1/60 s; --for 0.02 shortens the hold) |
107
107
  | `threedog hold` | hold for N seconds: hold moveForward 1.5. moveForward walks along the camera's heading, so with a follow camera at its start angle it goes diagonally, not along an axis: place things by reading player after a short hold |
108
108
  | `threedog state` | change the scenario without a reload: state time=18:30 weather=rain pos=40,-20 (pos=x,z has no height: the hero stands on the highest support over that spot, a ledge included; to stand under it, js "engine.player.placeAt([x, y, z])") |
109
- | `threedog eval` | evaluate an expression in the page (engine is available, await works; one expression prints its value, several statements print what they return): eval "engine.calendar.timeOfDay"; long scripts: eval --file path. A script that calls assert(cond, msg) or expect(v).toBe/toEqual/toBeCloseTo/toBeGreaterThan(x, msg) (or expect(v, msg)) runs as checks in ONE call: failed checks are recorded and the script goes on, a throw stops it; output ✓ 7 checks passed, or the failures then ✗ 2 of 7 checks failed; exit 1 on failure; --verbose adds passes, log lines and the return value. A script without those calls is the plain eval. Both modes get the globals engine, step(seconds), log(...), assert, expect. --wait <seconds>, default 120: how long a script may wait on a page that looks stopped (driven by manual step, nothing loading, no clock tick); the command then ends and says the script may be waiting on the game clock, and the script may still run in the page |
110
- | `threedog js` | alias of eval (the command has no eval in it, so the Bash sandbox does not block it): js "engine.calendar.timeOfDay" / js --file path |
109
+ | `threedog js` | evaluate an expression in the page (engine is available, await works; one expression prints its value, several statements print what they return): js "engine.calendar.timeOfDay"; long scripts: js --file path. A script that calls assert(cond, msg) or expect(v).toBe/toEqual/toBeCloseTo/toBeGreaterThan(x, msg) (or expect(v, msg)) runs as checks in ONE call: failed checks are recorded and the script goes on, a throw stops it; output ✓ 7 checks passed, or the failures then ✗ 2 of 7 checks failed; exit 1 on failure; --verbose adds passes, log lines and the return value. A script without those calls is the plain form. Both modes get the globals engine, step(seconds), log(...), assert, expect. --wait <seconds>, default 120: how long a script may wait on a page that looks stopped (driven by manual step, nothing loading, no clock tick); the command then ends and says the script may be waiting on the game clock, and the script may still run in the page |
111
110
  | `threedog snap-describe` | describe snapshot instead of a screenshot, a baseline of the gameplay part of describe(): snap-describe save\|diff name [--only a,b] [--ignore x.y] [--tolerance 0.5] (recipes/16-dev-bridge.md section 7); in tests one line expectDescribe({ check, ev }, name, { only, tolerance }) from @threedog/tools/describe-snapshot |
112
111
  | `threedog snap` | save a screenshot to .threedog/shots/name.png and run the picture check on the page, as threedog shot does (snap name, or snap path/to/file.png used as given; --play first leaves the title as shot --play; --width N scales the returned image down, the saved file stays full size; --no-picture skips the check) |
113
112
  | `threedog errors` | page errors with id (E1…), time, tick, source and count; the same error repeated is one line with its first and last id / time and ×N. errors = new since the last read; errors latest [N] = the last N (default 3), same answer every time; errors --since E5 = after id 5, never moves the read position. Every result prints a cursor (known classes come with the cause and the doc page) |
@@ -118,12 +117,13 @@ They drive the running game. Run them inside the game folder or with `-w game`;
118
117
  | `threedog inspect` | what is around the player (or inspect npc_3 / inspect 10,-4) and which ops it can do now, with reasons. inspect materials (engine.inspect.materials(), plain three.js: scene.traverse + texture.colorSpace) = every material: textures (slot, size, color space, estimated GPU MB, shared-by), engine- or game-made, shader patches and their slots, meshes sharing it; materials that read the same are one line with ×N; wrong color spaces first (color map not sRGB = washed out; normal / roughness map marked sRGB). inspect perf (engine.inspect.perf(), plain three.js: renderer.info) = the last frame against budgets: draw calls, triangles, programs, texture MB (estimate), JS ms by phase, compile stalls during play, costliest programs; ✗ lines name the next call. Budgets: engine.budget limits, else a desktop reference. The engine benchmark suite is npm run perf |
119
118
  | `threedog scene` | the mesh exists but is not drawn: use this first. Counts, one Not drawn because: line over every Mesh / Points / Line / Sprite, then the first 6 undrawn ones (surprising before plain view culling) with every reason, most likely first: visible=false on it or a parent, layers vs camera, material flags, scale 0 / NaN, NaN position or vertices, empty geometry, behind the camera, beyond camera.far, outside the view. "maybe" reasons (depthWrite off, fully fogged...) do not stop drawing. scene [--hidden (only undrawn)] [--limit N \| --full (40)] [--json]. Code: engine.inspect.scene(). Cannot see shader output |
120
119
  | `threedog pick` | what is at screen pixel x,y (from the canvas top-left): pick 480,270 -> record id, kind, template, where it is defined (content file:line), fields |
121
- | `threedog thing` | everything about one id as JSON: thing player-chest (definition file:line, template, model, materials, state, collision rules, related ops, save status, how to change it; thing.explain(), recipes/40-scene.md section 9) |
122
- | `threedog explain` | why: explain op shop.buy shop=bakery item=bread (can it run; --full adds its last attempt) / explain quest first-light (where it is stuck) / explain picture fog.far (which line last changed it). engine.explain; recipes/23-ops.md, recipes/62-picture-code.md |
120
+ | `threedog explain` | why: explain op shop.buy shop=bakery item=bread (can it run; --full adds its last attempt) / explain quest first-light (where it is stuck) / explain value fog.far (which line last changed it) / explain thing player-chest (where it is defined; --full: everything about the id as JSON) / explain module quests / explain capability ground. engine.explain; recipes/23-ops.md, recipes/40-scene.md section 9, recipes/62-picture-code.md |
123
121
  | `threedog scenario` | run one scenario test (tests/scenarios/<name>.json) on this page: scenario barter (prints failed checks and the Coverage block of verify; the scenario leaves the page halted) |
124
122
  | `threedog catalog` | what the game can do, from its registrations: catalog = a line per module with ops or problems, the rest named on one line (--full: a line each); catalog shop = one module (dependencies, params + defaults, ops with args and failure codes, saved parts, time hooks, problems, doc / recipe / source files); catalog shop.buy = one op; catalog --find throw; --json for the raw data; recipes/51-capability-catalog.md |
125
123
  | `threedog loading` | what loading waits for / what failed / does it block the start (answers while start() is stuck); loading hero: one task with its manifest and path; recipes/05-props-bake.md |
126
124
  | `threedog play` | start the game for the AI: starts the dev server if none runs (detached, output in .threedog/dev.log), waits for the bridge and the engine, prints the page address and whether a headless or a live browser page is connected (play --stop stops the server play started) |
125
+ | `threedog impact` | before a change, what it touches, from the files alone: impact coin / impact shop.buy / impact stack / impact collider3d lists content, calls, saved parts, templates, tests and engine facts, then says what it cannot see (names computed in game code, what only a page or a save holds). --full lists every place |
126
+ | `threedog report` | one file another AI can rerun a problem from: engine version, seed, tick, describe, recent ops, errors with hints, modules and capability state, steps to reproduce and a derived scenario; no tokens or user paths. Writes .threedog/reports/ (--out file); --scenario also writes tests/scenarios/report.json for threedog verify report. Works with no page, and says what is then missing |
127
127
  | `threedog status` | is it ready: engine ready / loading / page errors / running, halted or frozen. When the bridge cannot answer it names one of five causes with one next step: no server (threedog play), server still starting (wait, status again), server busy and not answering in time (wait, status again), page script error (threedog errors latest), no dev bridge installed (use gameConfig) |
128
128
  | `threedog verify` | run a scenario (tests/scenarios/<name>.json) and report PASS / FAIL, what it tested (ops with outcomes, describe sections compared, time advanced) and what it never touched (ops never run, sections never compared, steps skipped after a failure, key path, picture): verify barter. Also a Layers: line (steps by layer: direct = op/describe call, simulated-input = bridge press; real-browser-input is always 0 and printed as not verified, visual 0 because scenario snapshots are describe, not pixels), tests that mention an error code seen, and the threedog test command to re-run. A page error during the run fails it. JSON adds layers / layerCounts / evidence (per-check layers, notProven, ops / modules coverage; text: Evidence, NOT proven, Coverage: ops ran/total with refused ones marked, modules tested / indirect / untested, lists capped with "+N more") |
129
129
  <!-- end of generated rows -->
@@ -135,8 +135,7 @@ They drive the running game. Run them inside the game folder or with `-w game`;
135
135
  - To wait for the page: `page.waitForFunction(() => window.engine?.stateApplied)` (start has finished and all URL parameters are applied), then read `engine.stateRefused` for what the URL could not do (`shot` and `capture` fail on it); never read
136
136
  `_`-prefixed private fields. When the dev bridge / `npm test` / `npm run shot` cannot reach the engine (no `window.engine` after 40 seconds, or it
137
137
  exists but never becomes ready), the error states the page status, the latest page errors and the fix.
138
- - Advancing dialogue headlessly: `engine.step(1)` lets the typing finish, then press a number key or run
139
- `engine.ops.run('dialogue.choose', { index: i })` (while typing it completes the sentence first).
138
+ - Advancing dialogue headlessly: recipe 02.
140
139
  - Debug objects on window: `window.engine = engine` is already declared; for a game's own, write `/** @type {any} */ (window).game = {...}`
141
140
  (`npm run types` reports properties on window as web hints, not errors).
142
141
  - To operate a running game use the dev bridge, see `recipes/16-dev-bridge.md`.