@jgengine/core 0.9.0 → 0.11.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 (631) hide show
  1. package/CHANGELOG.md +34 -3
  2. package/LICENSE +203 -661
  3. package/README.md +1 -1
  4. package/dist/ai/crowd.d.ts +55 -0
  5. package/dist/ai/crowd.js +114 -0
  6. package/dist/ai/flock.d.ts +5 -2
  7. package/dist/ai/flock.js +5 -2
  8. package/dist/ai/groupAssist.d.ts +1 -0
  9. package/dist/ai/groupAssist.js +1 -0
  10. package/dist/ai/heatSystem.d.ts +76 -0
  11. package/dist/ai/heatSystem.js +97 -0
  12. package/dist/ai/interestScheduler.d.ts +107 -0
  13. package/dist/ai/interestScheduler.js +118 -0
  14. package/dist/ai/jobBoard.d.ts +1 -0
  15. package/dist/ai/jobBoard.js +1 -0
  16. package/dist/ai/laneSelect.d.ts +5 -2
  17. package/dist/ai/laneSelect.js +5 -2
  18. package/dist/ai/mobBrain.d.ts +1 -0
  19. package/dist/ai/mobBrain.js +1 -0
  20. package/dist/ai/spawnDirector.d.ts +19 -1
  21. package/dist/ai/spawnDirector.js +53 -26
  22. package/dist/ai/spawnPoint.d.ts +7 -0
  23. package/dist/ai/spawnPoint.js +7 -0
  24. package/dist/ai/targetAcquisition.d.ts +84 -0
  25. package/dist/ai/targetAcquisition.js +92 -0
  26. package/dist/anim/easing.d.ts +19 -0
  27. package/dist/anim/easing.js +19 -0
  28. package/dist/anim/oscillator.d.ts +12 -0
  29. package/dist/anim/oscillator.js +25 -0
  30. package/dist/area/areaEffectField.d.ts +127 -0
  31. package/dist/area/areaEffectField.js +175 -0
  32. package/dist/area/stackPolicy.d.ts +47 -0
  33. package/dist/area/stackPolicy.js +99 -0
  34. package/dist/audio/audioFalloff.d.ts +5 -2
  35. package/dist/audio/music.d.ts +53 -0
  36. package/dist/audio/music.js +34 -0
  37. package/dist/audio/synth.d.ts +60 -0
  38. package/dist/audio/synth.js +8 -0
  39. package/dist/authoring.d.ts +15 -0
  40. package/dist/authoring.js +15 -0
  41. package/dist/board/laneBoard.d.ts +13 -0
  42. package/dist/board/laneBoard.js +13 -0
  43. package/dist/board/timelineBoard.d.ts +10 -0
  44. package/dist/board/timelineBoard.js +10 -0
  45. package/dist/combat/abilityKit.d.ts +18 -0
  46. package/dist/combat/abilityKit.js +24 -9
  47. package/dist/combat/animationState.d.ts +5 -0
  48. package/dist/combat/animationState.js +5 -0
  49. package/dist/combat/breakMeters.d.ts +10 -0
  50. package/dist/combat/breakMeters.js +10 -0
  51. package/dist/combat/castRunner.d.ts +5 -0
  52. package/dist/combat/castRunner.js +5 -0
  53. package/dist/combat/comboPoints.d.ts +5 -0
  54. package/dist/combat/comboPoints.js +5 -0
  55. package/dist/combat/comboString.d.ts +5 -0
  56. package/dist/combat/comboString.js +5 -0
  57. package/dist/combat/damageInterceptors.d.ts +192 -0
  58. package/dist/combat/damageInterceptors.js +251 -0
  59. package/dist/combat/damageMatchup.d.ts +68 -0
  60. package/dist/combat/damageMatchup.js +42 -0
  61. package/dist/combat/damageResolution.d.ts +63 -0
  62. package/dist/combat/damageResolution.js +50 -0
  63. package/dist/combat/death.d.ts +7 -1
  64. package/dist/combat/death.js +5 -0
  65. package/dist/combat/deathReason.d.ts +14 -0
  66. package/dist/combat/deathReason.js +1 -0
  67. package/dist/combat/defensiveWindow.d.ts +5 -0
  68. package/dist/combat/defensiveWindow.js +5 -0
  69. package/dist/combat/dotField.d.ts +47 -0
  70. package/dist/combat/dotField.js +52 -0
  71. package/dist/combat/downed.d.ts +5 -0
  72. package/dist/combat/downed.js +5 -0
  73. package/dist/combat/effects.d.ts +5 -0
  74. package/dist/combat/effects.js +5 -0
  75. package/dist/combat/encounterSequence.d.ts +258 -0
  76. package/dist/combat/encounterSequence.js +426 -0
  77. package/dist/combat/hitReaction.d.ts +57 -1
  78. package/dist/combat/hitReaction.js +45 -5
  79. package/dist/combat/magazine.d.ts +54 -0
  80. package/dist/combat/magazine.js +96 -0
  81. package/dist/combat/projectiles.d.ts +7 -2
  82. package/dist/combat/projectiles.js +48 -17
  83. package/dist/combat/receivedDamage.d.ts +117 -0
  84. package/dist/combat/receivedDamage.js +92 -0
  85. package/dist/combat/regenShield.d.ts +39 -0
  86. package/dist/combat/regenShield.js +49 -0
  87. package/dist/combat/renderCues.d.ts +51 -0
  88. package/dist/combat/renderCues.js +44 -0
  89. package/dist/combat/resourcePool.d.ts +5 -0
  90. package/dist/combat/resourcePool.js +5 -0
  91. package/dist/combat/rewardAllocation.d.ts +121 -0
  92. package/dist/combat/rewardAllocation.js +251 -0
  93. package/dist/combat/shotOrigin.d.ts +30 -1
  94. package/dist/combat/shotOrigin.js +70 -2
  95. package/dist/combat/statusApplication.d.ts +96 -0
  96. package/dist/combat/statusApplication.js +81 -0
  97. package/dist/combat/telegraph.d.ts +11 -2
  98. package/dist/combat/telegraph.js +11 -2
  99. package/dist/combat/thresholdCrossings.d.ts +85 -0
  100. package/dist/combat/thresholdCrossings.js +116 -0
  101. package/dist/combat.d.ts +34 -0
  102. package/dist/combat.js +34 -0
  103. package/dist/commands/commandRegistry.d.ts +11 -0
  104. package/dist/commands/commandRegistry.js +9 -2
  105. package/dist/crafting/crop.d.ts +18 -0
  106. package/dist/crafting/crop.js +18 -0
  107. package/dist/crafting/production.d.ts +5 -0
  108. package/dist/crafting/production.js +5 -0
  109. package/dist/devtools/rewriteTunables.d.ts +17 -0
  110. package/dist/devtools/rewriteTunables.js +276 -0
  111. package/dist/devtools/saveEndpoint.d.ts +46 -0
  112. package/dist/devtools/saveEndpoint.js +48 -0
  113. package/dist/devtools/transformTunables.d.ts +3 -0
  114. package/dist/devtools/transformTunables.js +3 -0
  115. package/dist/devtools/tunableSchema.d.ts +31 -0
  116. package/dist/devtools/tunableSchema.js +31 -0
  117. package/dist/economy/currency.d.ts +12 -1
  118. package/dist/economy/currency.js +12 -1
  119. package/dist/economy/listingBook.d.ts +91 -0
  120. package/dist/economy/listingBook.js +144 -0
  121. package/dist/economy/resourceLedger.d.ts +222 -0
  122. package/dist/economy/resourceLedger.js +353 -0
  123. package/dist/economy/sharedWallet.d.ts +14 -0
  124. package/dist/economy/sharedWallet.js +14 -0
  125. package/dist/economy/techTree.d.ts +12 -0
  126. package/dist/economy/techTree.js +12 -0
  127. package/dist/economy/wallet.d.ts +26 -2
  128. package/dist/economy/wallet.js +35 -6
  129. package/dist/editor/commands.d.ts +248 -0
  130. package/dist/editor/commands.js +865 -0
  131. package/dist/editor/document.d.ts +186 -0
  132. package/dist/editor/document.js +884 -0
  133. package/dist/editor/grid.d.ts +229 -0
  134. package/dist/editor/grid.js +366 -0
  135. package/dist/editor/gridAdapters.d.ts +80 -0
  136. package/dist/editor/gridAdapters.js +134 -0
  137. package/dist/editor/index.d.ts +97 -0
  138. package/dist/editor/index.js +10 -0
  139. package/dist/editor/liveSync.d.ts +127 -0
  140. package/dist/editor/liveSync.js +249 -0
  141. package/dist/editor/runtimeInspector.d.ts +88 -0
  142. package/dist/editor/runtimeInspector.js +239 -0
  143. package/dist/editor/types.d.ts +175 -0
  144. package/dist/editor/types.js +29 -0
  145. package/dist/faction/reputation.d.ts +5 -0
  146. package/dist/faction/reputation.js +5 -0
  147. package/dist/format/distance.d.ts +17 -0
  148. package/dist/format/distance.js +18 -0
  149. package/dist/format/duration.d.ts +27 -0
  150. package/dist/format/duration.js +45 -0
  151. package/dist/format/speed.d.ts +17 -0
  152. package/dist/format/speed.js +25 -0
  153. package/dist/game/connectedPlayers.d.ts +30 -0
  154. package/dist/game/connectedPlayers.js +21 -0
  155. package/dist/game/cosmetics.d.ts +9 -0
  156. package/dist/game/cosmetics.js +16 -0
  157. package/dist/game/defineGame.d.ts +141 -2
  158. package/dist/game/defineGame.js +39 -1
  159. package/dist/game/defineSystem.d.ts +88 -0
  160. package/dist/game/defineSystem.js +45 -0
  161. package/dist/game/dialogue.d.ts +33 -0
  162. package/dist/game/dialogue.js +21 -0
  163. package/dist/game/events.d.ts +50 -13
  164. package/dist/game/events.js +5 -0
  165. package/dist/game/feed.d.ts +33 -0
  166. package/dist/game/feed.js +35 -2
  167. package/dist/game/gamePhase.d.ts +11 -0
  168. package/dist/game/gamePhase.js +16 -0
  169. package/dist/game/keyValueStore.d.ts +25 -0
  170. package/dist/game/keyValueStore.js +61 -0
  171. package/dist/game/leaderboard.d.ts +5 -0
  172. package/dist/game/leaderboard.js +5 -0
  173. package/dist/game/levelSequence.d.ts +24 -2
  174. package/dist/game/levelSequence.js +51 -2
  175. package/dist/game/loadout.d.ts +5 -0
  176. package/dist/game/loadout.js +5 -0
  177. package/dist/game/lootFilter.d.ts +2 -0
  178. package/dist/game/lootFilter.js +2 -0
  179. package/dist/game/lootPipeline.d.ts +164 -0
  180. package/dist/game/lootPipeline.js +216 -0
  181. package/dist/game/lootTable.d.ts +21 -0
  182. package/dist/game/lootTable.js +15 -4
  183. package/dist/game/modelAnimation.d.ts +8 -0
  184. package/dist/game/modelAnimation.js +18 -0
  185. package/dist/game/objectives.d.ts +43 -0
  186. package/dist/game/objectives.js +36 -0
  187. package/dist/game/paramLayers.d.ts +148 -0
  188. package/dist/game/paramLayers.js +185 -0
  189. package/dist/game/ping.d.ts +5 -0
  190. package/dist/game/ping.js +5 -0
  191. package/dist/game/playableGame.d.ts +160 -12
  192. package/dist/game/quest.d.ts +8 -0
  193. package/dist/game/quest.js +29 -0
  194. package/dist/game/race.d.ts +141 -0
  195. package/dist/game/race.js +169 -0
  196. package/dist/game/recordBook.d.ts +5 -5
  197. package/dist/game/recordBook.js +4 -1
  198. package/dist/game/ruleSelection.d.ts +75 -0
  199. package/dist/game/ruleSelection.js +127 -0
  200. package/dist/game/runDraft.d.ts +5 -0
  201. package/dist/game/runDraft.js +5 -0
  202. package/dist/game/saveStore.d.ts +111 -0
  203. package/dist/game/saveStore.js +312 -0
  204. package/dist/game/snapshotHistory.d.ts +67 -0
  205. package/dist/game/snapshotHistory.js +95 -0
  206. package/dist/game/social.d.ts +38 -1
  207. package/dist/game/social.js +71 -0
  208. package/dist/game/spawnPoints.d.ts +5 -0
  209. package/dist/game/spawnPoints.js +5 -0
  210. package/dist/game/systemRuntime.d.ts +50 -0
  211. package/dist/game/systemRuntime.js +157 -0
  212. package/dist/game/systemSchedule.d.ts +72 -0
  213. package/dist/game/systemSchedule.js +242 -0
  214. package/dist/game/toasts.d.ts +43 -0
  215. package/dist/game/toasts.js +44 -0
  216. package/dist/game/trade.d.ts +10 -0
  217. package/dist/game/trade.js +10 -0
  218. package/dist/game/unlocks.d.ts +8 -0
  219. package/dist/game/unlocks.js +16 -0
  220. package/dist/game/vfxInstance.d.ts +138 -0
  221. package/dist/game/vfxInstance.js +96 -0
  222. package/dist/game/worldItem.d.ts +17 -4
  223. package/dist/game/worldItem.js +17 -4
  224. package/dist/gameplay.d.ts +91 -0
  225. package/dist/gameplay.js +91 -0
  226. package/dist/index.d.ts +5 -7
  227. package/dist/index.js +5 -7
  228. package/dist/input/actionBindings.d.ts +24 -5
  229. package/dist/input/actionBindings.js +23 -5
  230. package/dist/input/axisInput.d.ts +13 -1
  231. package/dist/input/axisInput.js +22 -1
  232. package/dist/input/controlGroups.d.ts +67 -0
  233. package/dist/input/controlGroups.js +41 -0
  234. package/dist/input/touchScheme.d.ts +82 -6
  235. package/dist/input/touchScheme.js +123 -10
  236. package/dist/interaction/contextMenu.d.ts +1 -0
  237. package/dist/interaction/contextMenu.js +1 -0
  238. package/dist/interaction/lockpick.d.ts +61 -0
  239. package/dist/interaction/lockpick.js +168 -0
  240. package/dist/interaction/proximityPrompt.d.ts +5 -1
  241. package/dist/interaction/proximityPrompt.js +5 -3
  242. package/dist/interaction/qte.d.ts +5 -0
  243. package/dist/interaction/qte.js +5 -0
  244. package/dist/interaction/skillCheck.d.ts +5 -0
  245. package/dist/interaction/skillCheck.js +5 -0
  246. package/dist/inventory/inventoryModel.d.ts +12 -0
  247. package/dist/inventory/inventoryModel.js +12 -0
  248. package/dist/inventory/shapedGrid.d.ts +16 -0
  249. package/dist/inventory/shapedGrid.js +16 -0
  250. package/dist/inventory/slotModel.d.ts +10 -0
  251. package/dist/inventory/slotModel.js +10 -0
  252. package/dist/item/durability.d.ts +5 -0
  253. package/dist/item/durability.js +5 -0
  254. package/dist/item/itemIdentity.d.ts +171 -0
  255. package/dist/item/itemIdentity.js +138 -0
  256. package/dist/item/itemInstanceRegistry.d.ts +32 -0
  257. package/dist/item/itemInstanceRegistry.js +34 -0
  258. package/dist/item/itemgen.d.ts +163 -0
  259. package/dist/item/itemgen.js +151 -0
  260. package/dist/item/modularItem.d.ts +5 -0
  261. package/dist/item/modularItem.js +5 -0
  262. package/dist/item/use.d.ts +5 -0
  263. package/dist/item/use.js +5 -0
  264. package/dist/item/useBehavior.d.ts +142 -0
  265. package/dist/item/useBehavior.js +105 -0
  266. package/dist/item/weapon.d.ts +5 -0
  267. package/dist/item/weapon.js +5 -0
  268. package/dist/math/scalar.d.ts +25 -0
  269. package/dist/math/scalar.js +47 -0
  270. package/dist/meta/changelog.d.ts +4 -1
  271. package/dist/meta/changelog.js +36 -1
  272. package/dist/movement/avoidance.d.ts +45 -0
  273. package/dist/movement/avoidance.js +123 -0
  274. package/dist/movement/cameraRig.d.ts +8 -0
  275. package/dist/movement/cameraRig.js +8 -0
  276. package/dist/movement/dash.d.ts +11 -0
  277. package/dist/movement/dash.js +11 -0
  278. package/dist/movement/formation.d.ts +135 -0
  279. package/dist/movement/formation.js +194 -0
  280. package/dist/movement/glideModel.d.ts +5 -0
  281. package/dist/movement/glideModel.js +5 -0
  282. package/dist/movement/grappleSwing.d.ts +5 -0
  283. package/dist/movement/grappleSwing.js +5 -0
  284. package/dist/movement/leaderTrail.d.ts +5 -0
  285. package/dist/movement/leaderTrail.js +5 -0
  286. package/dist/movement/movementModel.d.ts +38 -7
  287. package/dist/movement/movementModel.js +54 -13
  288. package/dist/movement/playerMovement.d.ts +41 -0
  289. package/dist/movement/playerMovement.js +236 -0
  290. package/dist/movement/poseState.d.ts +13 -0
  291. package/dist/movement/poseState.js +16 -0
  292. package/dist/movement/steering.d.ts +8 -0
  293. package/dist/movement/steering.js +18 -0
  294. package/dist/multiplayer/combatSnapshot.d.ts +3 -0
  295. package/dist/multiplayer/combatSnapshot.js +3 -0
  296. package/dist/multiplayer/lagCompensation.d.ts +5 -0
  297. package/dist/multiplayer/lagCompensation.js +5 -0
  298. package/dist/multiplayer/presenceModel.d.ts +9 -1
  299. package/dist/multiplayer/presenceModel.js +9 -1
  300. package/dist/multiplayer/simultaneousCommit.d.ts +3 -0
  301. package/dist/multiplayer/simultaneousCommit.js +3 -0
  302. package/dist/multiplayer.d.ts +11 -0
  303. package/dist/multiplayer.js +11 -0
  304. package/dist/nav/pathFollow.d.ts +57 -0
  305. package/dist/nav/pathFollow.js +109 -0
  306. package/dist/orders/orderKinds.d.ts +156 -0
  307. package/dist/orders/orderKinds.js +197 -0
  308. package/dist/orders/orderQueue.d.ts +208 -0
  309. package/dist/orders/orderQueue.js +211 -0
  310. package/dist/physics/drivableVehicle.d.ts +29 -0
  311. package/dist/physics/drivableVehicle.js +16 -0
  312. package/dist/physics/kinematicVehicle.d.ts +21 -1
  313. package/dist/physics/kinematicVehicle.js +23 -8
  314. package/dist/physics/physicsWorld.d.ts +24 -12
  315. package/dist/physics/physicsWorld.js +11 -5
  316. package/dist/physics/radialImpulse.d.ts +25 -0
  317. package/dist/physics/radialImpulse.js +27 -0
  318. package/dist/procedural.d.ts +3 -0
  319. package/dist/procedural.js +3 -0
  320. package/dist/progression/statGraph.d.ts +116 -0
  321. package/dist/progression/statGraph.js +318 -0
  322. package/dist/puzzle/cellGrid.d.ts +9 -0
  323. package/dist/puzzle/cellGrid.js +9 -0
  324. package/dist/puzzle/fallingPiece.d.ts +9 -0
  325. package/dist/puzzle/fallingPiece.js +9 -0
  326. package/dist/puzzle/nonogram.d.ts +39 -0
  327. package/dist/puzzle/nonogram.js +136 -0
  328. package/dist/random/nameGen.d.ts +5 -0
  329. package/dist/random/nameGen.js +5 -0
  330. package/dist/random/pick.d.ts +8 -0
  331. package/dist/random/pick.js +31 -0
  332. package/dist/random/rng.d.ts +24 -0
  333. package/dist/random/rng.js +30 -8
  334. package/dist/random/seedLink.d.ts +4 -0
  335. package/dist/random/seedLink.js +4 -0
  336. package/dist/relation/keyedValues.d.ts +54 -0
  337. package/dist/relation/keyedValues.js +115 -0
  338. package/dist/relation/thresholds.d.ts +62 -0
  339. package/dist/relation/thresholds.js +62 -0
  340. package/dist/render/color.d.ts +12 -0
  341. package/dist/render/color.js +26 -0
  342. package/dist/render/lookPreset.d.ts +41 -0
  343. package/dist/render/lookPreset.js +29 -0
  344. package/dist/render/postProcessing.d.ts +76 -0
  345. package/dist/render/postProcessing.js +21 -0
  346. package/dist/rules/predicate.d.ts +53 -0
  347. package/dist/rules/predicate.js +64 -0
  348. package/dist/rules/ruleEffects.d.ts +38 -0
  349. package/dist/rules/ruleEffects.js +37 -0
  350. package/dist/rules/triggeredRules.d.ts +160 -0
  351. package/dist/rules/triggeredRules.js +241 -0
  352. package/dist/runtime/adapter.d.ts +58 -0
  353. package/dist/runtime/adapter.js +54 -5
  354. package/dist/runtime/cameraDirector.d.ts +1 -0
  355. package/dist/runtime/cameraDirector.js +1 -0
  356. package/dist/runtime/commandRunner.d.ts +1 -0
  357. package/dist/runtime/commandRunner.js +1 -0
  358. package/dist/runtime/context/combatFx.d.ts +23 -0
  359. package/dist/runtime/context/combatFx.js +161 -0
  360. package/dist/runtime/context/registries.d.ts +13 -0
  361. package/dist/runtime/context/registries.js +84 -0
  362. package/dist/runtime/context/worldItems.d.ts +21 -0
  363. package/dist/runtime/context/worldItems.js +37 -0
  364. package/dist/runtime/descriptors/baseline.d.ts +48 -0
  365. package/dist/runtime/descriptors/baseline.js +134 -0
  366. package/dist/runtime/descriptors/features.d.ts +74 -0
  367. package/dist/runtime/descriptors/features.js +281 -0
  368. package/dist/runtime/gameContext.d.ts +163 -19
  369. package/dist/runtime/gameContext.js +385 -339
  370. package/dist/runtime/gameRuntime.d.ts +1 -0
  371. package/dist/runtime/gameRuntime.js +1 -0
  372. package/dist/runtime/headlessRunner.d.ts +60 -0
  373. package/dist/runtime/headlessRunner.js +44 -0
  374. package/dist/runtime/hostPersistence.d.ts +12 -0
  375. package/dist/runtime/hostPersistence.js +12 -0
  376. package/dist/runtime/hostedGameRunner.d.ts +54 -0
  377. package/dist/runtime/hostedGameRunner.js +85 -0
  378. package/dist/runtime/hostedWorldSession.d.ts +73 -0
  379. package/dist/runtime/hostedWorldSession.js +64 -0
  380. package/dist/runtime/inputSnapshot.d.ts +21 -3
  381. package/dist/runtime/inputSnapshot.js +8 -2
  382. package/dist/runtime/motionIntents.d.ts +12 -1
  383. package/dist/runtime/motionIntents.js +26 -1
  384. package/dist/runtime/perContext.d.ts +15 -0
  385. package/dist/runtime/perContext.js +21 -0
  386. package/dist/runtime/runtimeSave.d.ts +79 -0
  387. package/dist/runtime/runtimeSave.js +105 -0
  388. package/dist/runtime/save.d.ts +4 -0
  389. package/dist/runtime/save.js +4 -0
  390. package/dist/runtime/snapshot.d.ts +7 -0
  391. package/dist/runtime/snapshot.js +7 -0
  392. package/dist/runtime/visibility.d.ts +2 -1
  393. package/dist/runtime/visibility.js +2 -1
  394. package/dist/runtime/worldChannel.d.ts +62 -0
  395. package/dist/runtime/worldChannel.js +114 -0
  396. package/dist/runtime/worldMirror.d.ts +36 -0
  397. package/dist/runtime/worldMirror.js +44 -0
  398. package/dist/runtime/worldProjection.d.ts +47 -0
  399. package/dist/runtime/worldProjection.js +52 -0
  400. package/dist/runtime/worldReplication.d.ts +69 -0
  401. package/dist/runtime/worldReplication.js +217 -0
  402. package/dist/runtime/worldSnapshot.d.ts +44 -0
  403. package/dist/runtime/worldSnapshot.js +30 -0
  404. package/dist/scene/assetCatalog.d.ts +22 -0
  405. package/dist/scene/assetCatalog.js +4 -0
  406. package/dist/scene/assetDiagnostics.d.ts +69 -0
  407. package/dist/scene/assetDiagnostics.js +110 -0
  408. package/dist/scene/assetGenerator.d.ts +65 -0
  409. package/dist/scene/assetGenerator.js +64 -0
  410. package/dist/scene/assetSpace.d.ts +137 -0
  411. package/dist/scene/assetSpace.js +259 -0
  412. package/dist/scene/authoredTriggers.d.ts +169 -0
  413. package/dist/scene/authoredTriggers.js +340 -0
  414. package/dist/scene/behaviorRuntime.d.ts +75 -0
  415. package/dist/scene/behaviorRuntime.js +217 -0
  416. package/dist/scene/behaviors.d.ts +14 -2
  417. package/dist/scene/behaviors.js +7 -2
  418. package/dist/scene/bodyBind.d.ts +60 -0
  419. package/dist/scene/bodyBind.js +51 -0
  420. package/dist/scene/builtinSceneKinds.d.ts +5 -0
  421. package/dist/scene/builtinSceneKinds.js +62 -0
  422. package/dist/scene/colliders.d.ts +18 -0
  423. package/dist/scene/colliders.js +61 -1
  424. package/dist/scene/entityStats.d.ts +13 -0
  425. package/dist/scene/entityStats.js +30 -0
  426. package/dist/scene/entityStore.d.ts +41 -1
  427. package/dist/scene/entityStore.js +75 -0
  428. package/dist/scene/facing.d.ts +18 -0
  429. package/dist/scene/facing.js +26 -0
  430. package/dist/scene/modelSockets.d.ts +33 -0
  431. package/dist/scene/modelSockets.js +29 -0
  432. package/dist/scene/objectQuery.d.ts +2 -0
  433. package/dist/scene/objectQuery.js +2 -0
  434. package/dist/scene/objectStore.d.ts +4 -0
  435. package/dist/scene/objectStore.js +6 -0
  436. package/dist/scene/possession.d.ts +8 -0
  437. package/dist/scene/possession.js +14 -0
  438. package/dist/scene/roster.d.ts +3 -0
  439. package/dist/scene/roster.js +12 -0
  440. package/dist/scene/sceneKinds.d.ts +240 -0
  441. package/dist/scene/sceneKinds.js +214 -0
  442. package/dist/scene/sceneOwnership.d.ts +169 -0
  443. package/dist/scene/sceneOwnership.js +179 -0
  444. package/dist/scene/selectionBookmarks.d.ts +93 -0
  445. package/dist/scene/selectionBookmarks.js +122 -0
  446. package/dist/scene/vehicleSeat.d.ts +68 -0
  447. package/dist/scene/vehicleSeat.js +59 -0
  448. package/dist/sensor/concealment.d.ts +3 -0
  449. package/dist/sensor/concealment.js +3 -0
  450. package/dist/sensor/freezeMonitor.d.ts +1 -0
  451. package/dist/sensor/freezeMonitor.js +1 -0
  452. package/dist/sensor/frustumSensor.d.ts +7 -3
  453. package/dist/sensor/frustumSensor.js +7 -3
  454. package/dist/sensor/hiddenStateProbe.d.ts +5 -2
  455. package/dist/sensor/hiddenStateProbe.js +5 -2
  456. package/dist/sensor/recordingBuffer.d.ts +2 -1
  457. package/dist/sensor/recordingBuffer.js +2 -1
  458. package/dist/sensor/replayLoop.d.ts +6 -2
  459. package/dist/sensor/replayLoop.js +6 -2
  460. package/dist/sensor/revealQuery.d.ts +2 -1
  461. package/dist/sensor/revealQuery.js +2 -1
  462. package/dist/sensor/visionCone.d.ts +10 -3
  463. package/dist/sensor/visionCone.js +10 -3
  464. package/dist/session/contestedChannel.d.ts +1 -0
  465. package/dist/session/contestedChannel.js +1 -0
  466. package/dist/session/extraction.d.ts +1 -0
  467. package/dist/session/extraction.js +1 -0
  468. package/dist/session/roles.d.ts +6 -0
  469. package/dist/session/roles.js +6 -0
  470. package/dist/session/roundState.d.ts +8 -0
  471. package/dist/session/roundState.js +2 -0
  472. package/dist/settings/settingsModel.d.ts +1 -0
  473. package/dist/settings/settingsModel.js +1 -0
  474. package/dist/stats/accumulatorMeter.d.ts +6 -0
  475. package/dist/stats/accumulatorMeter.js +6 -0
  476. package/dist/stats/eventMeter.d.ts +5 -0
  477. package/dist/stats/eventMeter.js +5 -0
  478. package/dist/stats/rollCheck.d.ts +5 -0
  479. package/dist/stats/rollCheck.js +5 -0
  480. package/dist/stats/statModifiers.d.ts +5 -0
  481. package/dist/stats/statModifiers.js +5 -0
  482. package/dist/store/defineKeyedStore.d.ts +38 -0
  483. package/dist/store/defineKeyedStore.js +42 -0
  484. package/dist/store/defineStore.d.ts +33 -0
  485. package/dist/store/defineStore.js +35 -0
  486. package/dist/store/observableKeyedStore.d.ts +9 -0
  487. package/dist/store/observableKeyedStore.js +43 -2
  488. package/dist/survival/decayMeter.d.ts +55 -0
  489. package/dist/survival/decayMeter.js +130 -55
  490. package/dist/survival/moodle.d.ts +2 -0
  491. package/dist/survival/regionHealth.d.ts +6 -0
  492. package/dist/survival/regionHealth.js +5 -0
  493. package/dist/tactics/fallingGrid.d.ts +6 -4
  494. package/dist/tactics/fallingGrid.js +6 -4
  495. package/dist/tactics/predictiveQuery.d.ts +3 -0
  496. package/dist/tactics/predictiveQuery.js +3 -0
  497. package/dist/tactics/snapshot.d.ts +2 -0
  498. package/dist/tactics/snapshot.js +2 -0
  499. package/dist/tactics/surface.d.ts +1 -0
  500. package/dist/tactics/surface.js +1 -0
  501. package/dist/tactics/tacticalGrid.d.ts +1 -0
  502. package/dist/tactics/tacticalGrid.js +1 -0
  503. package/dist/time/beatClock.d.ts +14 -4
  504. package/dist/time/beatClock.js +14 -4
  505. package/dist/time/calendarClock.d.ts +3 -0
  506. package/dist/time/calendarClock.js +3 -0
  507. package/dist/time/idleProgress.d.ts +4 -0
  508. package/dist/time/idleProgress.js +4 -0
  509. package/dist/time/simClock.d.ts +2 -0
  510. package/dist/time/simClock.js +20 -5
  511. package/dist/ui/actionModel.d.ts +110 -0
  512. package/dist/ui/actionModel.js +159 -0
  513. package/dist/ui/gameLayout.d.ts +144 -0
  514. package/dist/ui/gameLayout.js +148 -0
  515. package/dist/ui/hudDocument.d.ts +114 -0
  516. package/dist/ui/hudDocument.js +220 -0
  517. package/dist/ui/hudLayout.d.ts +33 -1
  518. package/dist/ui/hudLayout.js +204 -17
  519. package/dist/ui/orientation.d.ts +39 -0
  520. package/dist/ui/orientation.js +49 -0
  521. package/dist/ui/selectionModel.d.ts +92 -0
  522. package/dist/ui/selectionModel.js +88 -0
  523. package/dist/ui/swingTimer.d.ts +42 -0
  524. package/dist/ui/swingTimer.js +38 -0
  525. package/dist/ui/tooltipModel.d.ts +63 -0
  526. package/dist/ui/tooltipModel.js +82 -0
  527. package/dist/ui.d.ts +15 -0
  528. package/dist/ui.js +15 -0
  529. package/dist/visibility/bounds.d.ts +8 -1
  530. package/dist/visibility/bounds.js +8 -1
  531. package/dist/visibility/frustum.d.ts +12 -3
  532. package/dist/visibility/frustum.js +12 -3
  533. package/dist/visibility/spatialIndex.js +34 -20
  534. package/dist/work/jobQueue.d.ts +201 -0
  535. package/dist/work/jobQueue.js +253 -0
  536. package/dist/work/unitTraining.d.ts +58 -0
  537. package/dist/work/unitTraining.js +52 -0
  538. package/dist/world/authoredObjects.d.ts +58 -0
  539. package/dist/world/authoredObjects.js +69 -0
  540. package/dist/world/buildingGenerator.d.ts +18 -0
  541. package/dist/world/buildingGenerator.js +62 -0
  542. package/dist/world/buildings.d.ts +5 -0
  543. package/dist/world/buildings.js +5 -0
  544. package/dist/world/catenary.d.ts +22 -0
  545. package/dist/world/catenary.js +69 -0
  546. package/dist/world/environmentSummary.d.ts +11 -2
  547. package/dist/world/environmentSummary.js +11 -1
  548. package/dist/world/features.d.ts +244 -7
  549. package/dist/world/features.js +92 -4
  550. package/dist/world/footprintGrid.d.ts +59 -0
  551. package/dist/world/footprintGrid.js +141 -0
  552. package/dist/world/geometry.d.ts +64 -0
  553. package/dist/world/geometry.js +94 -0
  554. package/dist/world/grassKind.d.ts +51 -0
  555. package/dist/world/grassKind.js +101 -0
  556. package/dist/world/pathInstances.d.ts +27 -0
  557. package/dist/world/pathInstances.js +27 -0
  558. package/dist/world/pathTerrain.d.ts +80 -0
  559. package/dist/world/pathTerrain.js +142 -0
  560. package/dist/world/placeAsset.d.ts +81 -0
  561. package/dist/world/placeAsset.js +77 -0
  562. package/dist/world/placement.d.ts +4 -0
  563. package/dist/world/placement.js +4 -0
  564. package/dist/world/placementController.d.ts +6 -0
  565. package/dist/world/placementController.js +6 -0
  566. package/dist/world/polyline.d.ts +34 -0
  567. package/dist/world/polyline.js +81 -0
  568. package/dist/world/roads.d.ts +55 -0
  569. package/dist/world/roads.js +184 -0
  570. package/dist/world/scatterRegion.d.ts +164 -0
  571. package/dist/world/scatterRegion.js +409 -0
  572. package/dist/world/sceneShapes.d.ts +43 -0
  573. package/dist/world/sceneShapes.js +1 -0
  574. package/dist/world/segment.d.ts +27 -0
  575. package/dist/world/segment.js +43 -0
  576. package/dist/world/soilKind.d.ts +48 -0
  577. package/dist/world/soilKind.js +92 -0
  578. package/dist/world/spatialSample.d.ts +241 -0
  579. package/dist/world/spatialSample.js +465 -0
  580. package/dist/world/streets.d.ts +80 -0
  581. package/dist/world/streets.js +144 -0
  582. package/dist/world/terraform.d.ts +213 -1
  583. package/dist/world/terraform.js +655 -20
  584. package/dist/world/terrain.d.ts +138 -12
  585. package/dist/world/terrain.js +346 -28
  586. package/dist/world/terrainGuides.d.ts +182 -0
  587. package/dist/world/terrainGuides.js +343 -0
  588. package/dist/world/vec2.d.ts +81 -0
  589. package/dist/world/vec2.js +128 -0
  590. package/dist/world/vec3.d.ts +49 -0
  591. package/dist/world/vec3.js +76 -0
  592. package/dist/world/vegetation.d.ts +71 -0
  593. package/dist/world/vegetation.js +151 -0
  594. package/dist/world/visibilityField.d.ts +154 -0
  595. package/dist/world/visibilityField.js +271 -0
  596. package/dist/world/volumetricClouds.d.ts +52 -0
  597. package/dist/world/volumetricClouds.js +43 -0
  598. package/dist/world/walls.d.ts +9 -0
  599. package/dist/world/walls.js +9 -0
  600. package/dist/world/waterKind.d.ts +55 -0
  601. package/dist/world/waterKind.js +99 -0
  602. package/dist/world.d.ts +132 -0
  603. package/dist/world.js +132 -0
  604. package/package.json +32 -8
  605. package/skills/jgengine/SKILL.md +51 -0
  606. package/skills/jgengine/api.md +434 -0
  607. package/skills/jgengine/capabilities.md +29 -0
  608. package/skills/jgengine/reference-cartridge.md +72 -0
  609. package/skills/jgengine-combat/SKILL.md +34 -0
  610. package/skills/jgengine-combat/api.md +549 -0
  611. package/skills/jgengine-combat/capabilities.md +169 -0
  612. package/skills/jgengine-combat/reference.md +98 -0
  613. package/skills/jgengine-gameplay/SKILL.md +39 -0
  614. package/skills/jgengine-gameplay/api.md +1794 -0
  615. package/skills/jgengine-gameplay/capabilities.md +378 -0
  616. package/skills/jgengine-gameplay/reference-systems.md +60 -0
  617. package/skills/jgengine-world/SKILL.md +38 -0
  618. package/skills/jgengine-world/api.md +2652 -0
  619. package/skills/jgengine-world/capabilities.md +370 -0
  620. package/skills/jgengine-world/reference.md +222 -0
  621. package/dist/cartridge/runtime.d.ts +0 -15
  622. package/dist/cartridge/runtime.js +0 -556
  623. package/dist/cartridge/spec.d.ts +0 -188
  624. package/dist/cartridge/spec.js +0 -19
  625. package/dist/cartridge/validate.d.ts +0 -2
  626. package/dist/cartridge/validate.js +0 -78
  627. package/dist/store/engineStore.d.ts +0 -22
  628. package/dist/store/engineStore.js +0 -50
  629. package/dist/store/features.d.ts +0 -10
  630. package/dist/store/features.js +0 -23
  631. package/llms.txt +0 -4983
@@ -1,6 +1,10 @@
1
1
  import type { AudioBusDef, SoundDef } from "../audio/audioFalloff.js";
2
+ import type { MusicTheme } from "../audio/music.js";
3
+ import type { PostProcessingConfig } from "../render/postProcessing.js";
4
+ import type { LookPreset } from "../render/lookPreset.js";
2
5
  import type { TouchControlsConfig } from "../input/touchScheme.js";
3
6
  import type { GameSettingsConfig } from "../settings/settingsModel.js";
7
+ import type { GameOrientation } from "../ui/orientation.js";
4
8
  import type { HudPlatform, HudViewportConfig } from "../ui/hudScale.js";
5
9
  import type { PositionedPrompt } from "../interaction/proximityPrompt.js";
6
10
  import type { CatalogEntityRole, GameContext, GameContextContent } from "../runtime/gameContext.js";
@@ -47,6 +51,10 @@ export interface CameraFollowState {
47
51
  };
48
52
  distance: number;
49
53
  }
54
+ /** Props handed to a `WorldOverlay` component (#542): explicit `ctx` access so canvas-layer VFX read live engine state directly, without an extra hook or a module-global workaround. */
55
+ export interface WorldOverlayProps {
56
+ ctx: GameContext;
57
+ }
50
58
  export interface FirstPersonCameraConfig {
51
59
  /** Camera height above the followed entity's origin. Default 1.6. */
52
60
  eyeHeight?: number;
@@ -56,7 +64,7 @@ export interface FirstPersonCameraConfig {
56
64
  maxPitch?: number;
57
65
  /** Show the centered crosshair overlay. Default true. */
58
66
  reticle?: boolean;
59
- /** Render a simple first-person weapon in view. Default true. */
67
+ /** Render a viewmodel in view: the built-in three-mesh gun, or `PlayableGame.viewmodel` when set (#542). `false` renders no viewmodel regardless of `PlayableGame.viewmodel`. Default true. */
60
68
  viewmodel?: boolean;
61
69
  }
62
70
  /**
@@ -74,7 +82,7 @@ export interface FirstPersonCameraConfig {
74
82
  * - `observer` — detached spectator/photo cam bound to any entity or fixed point; never reads player input.
75
83
  * - `turntable` — slow auto-orbit of a fixed point: a rotating display stand for a scene. The friendly, flat spelling of `observer`'s point-orbit mode; providing `camera.turntable` selects it without an explicit `rig`.
76
84
  * - `sideScroll` — fixed lateral follow (2.5D platformer/beat-'em-up side view); reads no player input.
77
- * - `inspection` — model-viewer rig (#207.7): left-drag orbit, middle/right-drag pan, scroll zoom toward a configurable anchor; orbits a fixed point, reads no player/entity input.
85
+ * - `inspection` — model-viewer / editor rig (#207.7, #866): middle-drag pan, right-drag orbit, scroll zoom toward a configurable anchor; orbits a fixed point, reads no player/entity input.
78
86
  * - `none` — no camera rig is mounted; use for HUD-only presentations or a game that manages its own camera.
79
87
  */
80
88
  export type CameraRigKind = "orbit" | "first" | "topDown" | "rts" | "shoulder" | "lockOn" | "chase" | "observer" | "turntable" | "sideScroll" | "inspection" | "none";
@@ -323,7 +331,7 @@ export interface InspectionCameraConfig {
323
331
  /** Vertical orbit clamp (radians). Unset allows a full pole-to-pole orbit, unlike the tighter default on the classic orbit rig. */
324
332
  minPolarAngle?: number;
325
333
  maxPolarAngle?: number;
326
- /** Middle-mouse/right-drag pan. Default true for this rig. */
334
+ /** Middle-mouse pan. Default true for this rig. */
327
335
  pan?: boolean;
328
336
  rotateSpeed?: number;
329
337
  zoomSpeed?: number;
@@ -438,6 +446,10 @@ export interface GameCameraConfig {
438
446
  };
439
447
  initialDistance?: number;
440
448
  initialHeight?: number;
449
+ /** Initial horizontal boom facing (radians): 0 = camera behind on -Z, PI = camera on +Z. Seeds the orbit rig; unset keeps the legacy -Z placement. */
450
+ initialYaw?: number;
451
+ /** Initial boom elevation (radians): 0 = level, positive = camera above the target looking down. Seeds the orbit rig; unset derives elevation from `initialHeight`/`initialDistance`. */
452
+ initialPitch?: number;
441
453
  /** Lock orbit radius while the follow target moves (default true in shell). */
442
454
  followLock?: boolean;
443
455
  /** When false, orbit target stays fixed (cinematic / debug). Default true. */
@@ -455,6 +467,14 @@ export interface GameCameraConfig {
455
467
  /** Vertical look clamp (three.js polar angle, radians): 0 = top-down over the head, PI/2 = level, >PI/2 = look up from below. Widen for top-down or vertical aim; unset keeps the standard chase feel. */
456
468
  minPolarAngle?: number;
457
469
  maxPolarAngle?: number;
470
+ /** Signed boom-elevation clamp `[min, max]` (radians): min < 0 dips the camera below the target, max > 0 rises overhead. Maps onto `minPolarAngle`/`maxPolarAngle` (polar = PI/2 − pitch); explicit polar fields win. */
471
+ pitchClamp?: readonly [number, number];
472
+ /** Spring-arm occlusion for the orbit rig: pull the camera in past walls/terrain so it never clips inside geometry. Off unless `enabled`. */
473
+ collision?: {
474
+ enabled?: boolean;
475
+ padding?: number;
476
+ minTargetDistance?: number;
477
+ };
458
478
  }
459
479
  export interface EntitySpriteConfig {
460
480
  url: string;
@@ -492,6 +512,21 @@ export interface VoxelCollisionConfig {
492
512
  /** Tallest ledge walked up without jumping. Default 0.6. */
493
513
  stepHeight?: number;
494
514
  }
515
+ /** Movement-state clip set for `ModelAnimationConfig.states`: the shell reads the entity's live speed each frame and crossfades between these clips, so a walking mob animates without any game-side driver. */
516
+ export interface ModelAnimationStates {
517
+ /** Clip name while the entity is stationary. */
518
+ idle: string;
519
+ /** Clip name while the entity is moving. */
520
+ walk: string;
521
+ /** Clip name above `runSpeed`; omit to keep `walk` at any speed. */
522
+ run?: string;
523
+ /** Speed (world units/sec) above which the entity counts as moving. Default 0.5. */
524
+ walkSpeed?: number;
525
+ /** Speed above which `run` plays when provided. Default 6. */
526
+ runSpeed?: number;
527
+ /** Crossfade duration in seconds when the state changes. Default 0.2. */
528
+ fadeSec?: number;
529
+ }
495
530
  /** Rig playback for a `ModelConfig`'s GLTF animation clips — looping idles, one-shots, and held poses. */
496
531
  export interface ModelAnimationConfig {
497
532
  /** Clip name to play; defaults to the GLB's first clip. */
@@ -504,6 +539,26 @@ export interface ModelAnimationConfig {
504
539
  paused?: boolean;
505
540
  /** Seek the clip to this time in seconds; combine with `paused: true` to hold a specific pose ("pose library" usage). */
506
541
  time?: number;
542
+ /** Speed-driven idle/walk/run clip switching, crossfaded by the shell from the entity's live movement; overrides `clip` while set. */
543
+ states?: ModelAnimationStates;
544
+ /**
545
+ * One-shot clips keyed by event name, each played once over the locomotion state then released back to it.
546
+ * Reserved keys `hit` and `death` auto-fire on this entity's `combat.hitReaction` / `entity.died`; any other
547
+ * key fires when the game emits `entity.animation` (`ctx.game.playEntityAnimation(instanceId, event)`). A
548
+ * `string[]` picks a random variant per trigger. `death` clamps on its final frame instead of returning.
549
+ */
550
+ oneShots?: Record<string, string | readonly string[]>;
551
+ }
552
+ /**
553
+ * Real PBR map URLs (e.g. `buildMaterialCatalog(...).resolve(id)!.maps` from `@jgengine/assets`)
554
+ * layered onto a model's material — the seam for texturing an otherwise-flat/untextured GLB. Any
555
+ * role may be omitted to keep the model's own map.
556
+ */
557
+ export interface ModelMaterialMaps {
558
+ color?: string;
559
+ normal?: string;
560
+ roughness?: string;
561
+ ao?: string;
507
562
  }
508
563
  /** Per-entity PBR material override (#151.3) applied to every `MeshStandardMaterial` in the model's cloned scene graph. */
509
564
  export interface ModelMaterialOverride {
@@ -512,10 +567,38 @@ export interface ModelMaterialOverride {
512
567
  roughness?: number;
513
568
  emissive?: string;
514
569
  emissiveIntensity?: number;
570
+ /** Real PBR texture maps applied over the model's material — see {@link ModelMaterialMaps}. */
571
+ maps?: ModelMaterialMaps;
572
+ }
573
+ /** Parents a prop/weapon model to a named bone or node on the host model's rig — a sword on `handslot.r`, a spellbook offhand — following the bone's animated transform each frame. */
574
+ export interface ModelAttachment {
575
+ /** Bone or node name in the rig to parent to (e.g. `"handslot.r"`). */
576
+ slot: string;
577
+ /** The attached model — a catalog asset id or an inline `ModelConfig`. */
578
+ model: string | ModelConfig;
579
+ /** Local position offset at the bone, in the attached model's own space. */
580
+ position?: [number, number, number];
581
+ /** Local Euler rotation (radians) applied at the bone. */
582
+ rotation?: [number, number, number];
583
+ /** Uniform scale of the attached model at the bone. Default 1. */
584
+ scale?: number;
585
+ }
586
+ /** Static child model stacked at a fixed local offset under its parent's transform — no bone/rig resolution, unlike `ModelAttachment`. Assembles a compound entity (e.g. a modular castle wall + tower + roof) from several single-mesh kit pieces. */
587
+ export interface ModelPart {
588
+ /** The child model — a catalog asset id or an inline `ModelConfig`; resolves through the catalog exactly like the top-level model and gets its own `dims`/anchor centering. */
589
+ model: string | ModelConfig;
590
+ /** Local position offset under the parent's transform. */
591
+ position?: [number, number, number];
592
+ /** Local Euler rotation (radians) under the parent's transform. */
593
+ rotation?: [number, number, number];
594
+ /** Uniform scale of the part under the parent's transform. Default 1. */
595
+ scale?: number;
515
596
  }
516
597
  export interface ModelConfig {
517
598
  url: string;
518
599
  scale?: number;
600
+ /** Normalize the rendered model to this world-unit height: the shell measures the loaded scene's bounding box, scales it so its height matches, and grounds its lowest point at the placement Y. Composes with `scale` as a multiplier. */
601
+ targetHeight?: number;
519
602
  y?: number;
520
603
  /** How the model registers on its placement point. `"center"` (default) horizontally centers the measured footprint on the point and ground-snaps its lowest vertex to the point's Y — the correct behavior for corner-pivot modular kits. `"origin"` renders at the raw GLB origin (legacy). */
521
604
  anchor?: "center" | "origin";
@@ -525,6 +608,10 @@ export interface ModelConfig {
525
608
  material?: ModelMaterialOverride;
526
609
  /** Plays a GLTF animation clip on the model when the source has any (skinned or not); omit to render the rig's bind pose. */
527
610
  animation?: ModelAnimationConfig;
611
+ /** Props/weapons parented to named bones on this model's rig; each follows its bone through animation. */
612
+ attachments?: readonly ModelAttachment[];
613
+ /** Static kit-of-parts pieces stacked at fixed local offsets — no bone/rig involved. Use this for a compound entity assembled from several modular meshes (a castle keep from base + mid + roof pieces); use `attachments` for props parented to an animated rig's bones. */
614
+ parts?: readonly ModelPart[];
528
615
  }
529
616
  export interface ObjectStyle {
530
617
  color?: string;
@@ -540,6 +627,14 @@ export interface DirectionalLightingConfig {
540
627
  intensity?: number;
541
628
  position: readonly [number, number, number];
542
629
  castShadow?: boolean;
630
+ /** Shadow map resolution in px (square) when `castShadow`. Higher = crisper, costlier. Default 1024. */
631
+ shadowMapSize?: number;
632
+ /** Half-extent of the orthographic shadow camera in world units — sized to the shadowed area. Default 40. */
633
+ shadowCameraSize?: number;
634
+ /** Shadow depth bias to fight acne. Default -0.0004. */
635
+ shadowBias?: number;
636
+ /** Shadow normal bias to fight peter-panning. Default 0.02. */
637
+ shadowNormalBias?: number;
543
638
  }
544
639
  export interface HemisphereLightingConfig {
545
640
  skyColor?: string;
@@ -579,6 +674,18 @@ export interface PlayerMovementConfig {
579
674
  beforeCommit?: (frame: MovementCommitFrame) => readonly [number, number, number] | undefined | void;
580
675
  /** Gates the built-in sprint (`runSpeedMultiplier`) behind live game state — a stamina stat, an encumbrance check (#282.3). Called each frame while sprint is held; `false` walks. */
581
676
  canSprint?: (ctx: GameContext) => boolean;
677
+ /** Fraction of walk speed while backpedalling (holding `moveBack`). Overrides the engine default (0.65). */
678
+ backpedalMult?: number;
679
+ /** Radians/second the rendered body rotates toward its movement heading (shortest arc), so strafing/backpedalling read as a turn rather than an instant flip; also the rate the internally-integrated `turnLeft`/`turnRight` heading turns when the shell doesn't own yaw. Unset = body facing snaps instantly (no change to existing feel). */
680
+ turnSpeed?: number;
681
+ /** On-foot swimming when the terrain declares a `waterLevel` and the player is submerged: caps speed and floats them at the surface. `true` uses defaults; default off. */
682
+ swim?: {
683
+ speedMultiplier?: number;
684
+ } | boolean;
685
+ /** Slide the player downhill on terrain steeper than they can stand on (heightfield worlds only). `true` uses defaults; default off. */
686
+ slopeSlide?: {
687
+ maxClimbSlope?: number;
688
+ } | boolean;
582
689
  }
583
690
  /** One frame's movement resolution handed to `PlayerMovementConfig.beforeCommit`. */
584
691
  export interface MovementCommitFrame {
@@ -589,17 +696,36 @@ export interface MovementCommitFrame {
589
696
  /** The live game context (#282.2) — movement rules read stores/stats directly instead of module-level bridge objects. */
590
697
  ctx: GameContext;
591
698
  }
592
- export interface PlayableGame<TUi = unknown, TWorldOverlay = unknown, TRenderEntity = never, TRenderObject = never> {
699
+ /** How a screenshot host reaches live gameplay in this game — the data behind `shoot --mode play`. */
700
+ export interface GameCaptureConfig {
701
+ /** Commands run (in order, via `ctx.game.commands.run`) right after boot when a capture host requests the play screen — the same commands the start-menu buttons dispatch. A bare string runs with a default input; the object form carries the input a command needs (e.g. `[{ name: "class.select", input: { classId: "siren" } }, "startRun"]`). A name the game never registers fails the capture loudly instead of shipping a menu screenshot. */
702
+ play?: readonly (string | {
703
+ name: string;
704
+ input?: unknown;
705
+ })[];
706
+ /** Named capture states beyond live gameplay — any screen worth screenshotting on demand (`lobby`, `store`, `game_over`), each mapping to the command sequence that reaches it from boot. `shoot <game> --state <name>` runs that sequence and captures whatever is on screen — menus included, no live-play guard. An unknown state name fails the capture with the declared list. */
707
+ states?: Record<string, readonly (string | {
708
+ name: string;
709
+ input?: unknown;
710
+ })[]>;
711
+ /** Extra milliseconds the capture host waits after `play` commands before taking the play-mode screenshot — cover an intro cinematic or spawn-in fade. Default 2500. */
712
+ settleMs?: number;
713
+ /** Bot-playtest read hook: maps live game state to a flat vector of numeric progress metrics the `drive --playtest` harness samples over time (e.g. `{ x, z, score, phase }`). Genre-agnostic — "progress" is whatever the game reports; the engine stays neutral. The harness watches these numbers move under scripted input: any metric changing beyond an epsilon counts as forward progress, all metrics flat past the softlock threshold under active input flags a softlock. Return every value that should count as advancing; omit to opt the game out of the playtest rung. */
714
+ probe?: (ctx: GameContext) => Record<string, number>;
715
+ }
716
+ export interface PlayableGame<TUi = unknown, TWorldOverlay = unknown, TRenderEntity = never, TRenderObject = never, TViewmodel = unknown, TOverlay = TWorldOverlay> {
593
717
  game: GameDefinition;
594
718
  content: GameContextContent;
595
- loop: Required<GameLoop<GameContext>>;
719
+ loop: Required<Omit<GameLoop<GameContext>, "onPlayerLeave">> & Pick<GameLoop<GameContext>, "onPlayerLeave">;
596
720
  GameUI: TUi;
597
721
  /** Which shell mount to use. Default `"3d"` (canvas, camera rig, pointer, world rendering). `"hud"` mounts no 3D canvas, camera rig, or pointer — the game is `GameUI` plus the command/input loop, for board/card/menu games. */
598
722
  presentation?: "3d" | "hud";
599
- /** Optional canvas-layer VFX component (e.g. traveling projectiles). */
600
- WorldOverlay?: TWorldOverlay;
723
+ /** Optional canvas-layer VFX component (e.g. traveling projectiles); receives `{ ctx }` (#542) so overlay VFX read live engine state without a separate hook or a module-global workaround. */
724
+ WorldOverlay?: TOverlay;
601
725
  /** Replaces the default demo backdrop (ground + grid + rocks) with the game's own scene — ground, sky, structures. Camera, input, HUD, entity rendering, and the loop stay shell-provided; supply your world without forking the shell. When unset and `game.world` is an `environment()` descriptor, the shell auto-renders that world here — no manual wiring needed. */
602
726
  environment?: TWorldOverlay;
727
+ /** Custom first-person viewmodel (#542), read when the active rig is first-person. Rendered inside the shell's camera-locked, muzzle-tracked anchor in place of the built-in three-mesh gun; receives a live `cuesRef` (velocity/bob/firing/reloading/recoil) driven from the followed entity — see `@jgengine/shell/camera`'s `ViewmodelProps`. Set `camera.firstPerson.viewmodel: false` to render no viewmodel at all regardless of this field. */
728
+ viewmodel?: TViewmodel;
603
729
  /** Per-entity visual override: return your own mesh for an entity and the shell still positions it and drives selection/targeting. Return null/undefined to fall back to model → sprite → primitive. */
604
730
  renderEntity?: TRenderEntity;
605
731
  /** Per-object visual override: return your own mesh for a placed scene object and the shell still positions it and drives picking. Return null/undefined to fall back to objectModels → styled box. */
@@ -618,27 +744,45 @@ export interface PlayableGame<TUi = unknown, TWorldOverlay = unknown, TRenderEnt
618
744
  prompts?: (ctx: GameContext) => readonly PositionedPrompt[];
619
745
  /** Camera tuning (perspective, orbit, first-person) for the dev game player shell. */
620
746
  camera?: GameCameraConfig;
747
+ /** Screenshot-host recipe for reaching live gameplay past a start menu (`shoot --mode play` runs `capture.play` automatically). Any game with a start/title screen declares this. */
748
+ capture?: GameCaptureConfig;
621
749
  /** Cast/receive shadows across the scene (R3F Canvas shadow pass). Default true. */
622
750
  shadows?: boolean;
623
751
  /** Pointer-driven input: click-to-move, box-select, right-click verbs, cursor aim (#22/#30/#31). */
624
752
  pointer?: PointerConfig;
625
753
  /** Touch controls on coarse-pointer devices. Unset derives a scheme from `input` (virtual joystick for movement actions, on-screen buttons for the rest); a config refines it with gestures and curated buttons; `false` opts out. */
626
754
  touch?: TouchControlsConfig | false;
627
- /** Preferred phone orientation. When a coarse-pointer device is held the other way the shell shows a dismissible rotate hint; purely advisory, never blocks play. */
628
- orientation?: "landscape" | "portrait";
755
+ /** Phone orientation contract. Legacy `"landscape"`/`"portrait"` stays advisory (a dismissible rotate hint). The object form `{ mobile: "landscape-required" }` is strict — the shell shows an engine-owned rotate screen and blocks gameplay until the device is turned. See `GameOrientation`. */
756
+ orientation?: GameOrientation;
629
757
  /** Where the game is meant to be played. Default `["web", "mobile"]` — design-resolution HUD fit is on for every game: `HudCanvas` auto-scales from `hudFit.designSize` down to the live viewport, so the desktop layout shrinks to fit a phone instead of overflowing it. Declare `["web"]` to opt a desktop-only game out (compact displays fall back to the legacy fixed 0.85 zoom). */
630
758
  platforms?: readonly HudPlatform[];
631
759
  /** HUD design resolution + scale clamps (default 1600×900, scale 0.4–1). `mobile` overrides tune the phone fit separately — the same resolution system drives desktop UI-scale and phone shrink. */
632
760
  hudFit?: HudViewportConfig;
633
- /** Opt in to world-space health bars floating over non-local entities that carry the stat. `roles` restricts bars to entities whose catalog entry declares one of the given roles. */
761
+ /** Opt in to world-space health bars floating over non-local entities that carry the stat. `roles` restricts bars to entities whose catalog entry declares one of the given roles; `maxDistance` hides bars beyond this many world units from the player (default 60). */
634
762
  worldHealthBars?: boolean | {
635
763
  statId?: string;
636
764
  roles?: readonly CatalogEntityRole[];
765
+ maxDistance?: number;
766
+ };
767
+ /**
768
+ * Opt in to billboarded nameplates (name + optional HP bar) floating over non-local entities — the
769
+ * MMO "who's this and how hurt are they" readout. `roles` restricts to entities whose catalog entry
770
+ * declares one of the given roles (default: all); `maxDistance` hides nameplates beyond this many
771
+ * world units from the player (default 40). Headless: skin every part via `className`/`data-*` hooks
772
+ * on `WorldNameplates` (`@jgengine/shell/world/WorldHud`) — this flag only turns the readout on and
773
+ * scopes which entities it covers.
774
+ */
775
+ nameplates?: boolean | {
776
+ statId?: string;
777
+ roles?: readonly CatalogEntityRole[];
778
+ maxDistance?: number;
637
779
  };
638
- /** Sound catalog + mix buses (music/sfx/ambient/…) the shell's Web Audio glue plays from. Catalog-first — no per-game audio wiring. */
780
+ /** Sound catalog + mix buses (music/sfx/ambient/…) the shell's Web Audio glue plays from. Catalog-first — no per-game audio wiring. `sounds` may be sample (`url`) or procedural (`synth`); `music` holds procedural themes crossfaded via `ctx.game.audio.music(id)`. */
639
781
  audio?: {
640
782
  sounds: Record<string, SoundDef>;
641
783
  buses?: Record<string, AudioBusDef>;
784
+ music?: Record<string, MusicTheme>;
785
+ musicBus?: string;
642
786
  };
643
787
  /** Continuous positional emitter keyed by entity kind name: while a matching entity exists, the shell plays and repositions the mapped `audio.sounds` id (looping engine hum, campfire crackle, footstep loop) with listener-distance falloff. */
644
788
  entitySounds?: Record<string, string>;
@@ -650,11 +794,15 @@ export interface PlayableGame<TUi = unknown, TWorldOverlay = unknown, TRenderEnt
650
794
  collision?: VoxelCollisionConfig;
651
795
  /** Movement-control levers (axis/grid constraints, object collision, pre-commit hook) for the shell-driven walk controller. */
652
796
  movement?: PlayerMovementConfig;
797
+ /** Default-look preset (#773). Unset/`"cinematic"` composes a real sky, a shadow-casting sun+hemisphere rig, a network-free image-based-lighting environment (soft PBR reflections), and a tuned tone-map/bloom/AO/vignette post stack, so a scene reads lit-like-a-game out of the box; `"flat"` opts out to the bare ambient+directional default. Upgraded default primitive materials (tuned PBR + subtle procedural surface detail) apply under both presets. Any explicit `lighting`/`backdrop`/`postProcessing` always wins. */
798
+ look?: LookPreset;
653
799
  /** Declarative ambient/directional/hemisphere lighting (#207.5); replaces the shell's hardcoded default lights when present, regardless of world kind. */
654
800
  lighting?: LightingConfig;
655
801
  /** Generic background/sky/fog (#207.6), applied for any world kind including a custom `environment` component. */
656
802
  backdrop?: BackdropConfig;
657
- /** F2 debug overlay (frame/sim timing, logs, backend latency, keybinds, live tunables). On for every game by default; `false` disables the toggle. */
803
+ /** Declarative post-processing chain (AO/bloom/tone-map/grade). When set, the shell mounts an EffectComposer and owns the render; absent leaves the renderer drawing directly (unchanged). */
804
+ postProcessing?: PostProcessingConfig;
805
+ /** F2+D debug overlay (frame/sim timing, logs, backend latency, keybinds, live tunables). On for every game by default; `false` disables the toggle. */
658
806
  devtools?: boolean;
659
807
  /** Player settings menu. Auto-mounted for every game (Sound / Graphics / Gameplay / Controls); unset uses the defaults, `false` opts out. Add game-specific rows via `extra`, switch overlay/full-page via `mode`, or swap the gear for compact on-screen buttons via `surface: "quick"`. */
660
808
  settings?: GameSettingsConfig | false;
@@ -89,7 +89,15 @@ export interface QuestJournal {
89
89
  bind(action: "entity.died" | "inventory.added"): () => void;
90
90
  snapshot(userId: string): QuestSnapshotEntry[];
91
91
  hydrate(userId: string, data: QuestSnapshotEntry[]): void;
92
+ /** Whole-store capture across every user — the world-save/replication seam (per-user `snapshot` can't enumerate users). */
93
+ snapshotAll(): Record<string, QuestSnapshotEntry[]>;
94
+ hydrateAll(data: Record<string, QuestSnapshotEntry[]>): void;
92
95
  }
96
+ /**
97
+ * Track accepted quests and their per-objective progress, granting rewards on completion.
98
+ *
99
+ * @capability quest-log track accepted quests and their per-objective progress
100
+ */
93
101
  export declare function createQuestJournal(deps: QuestJournalDeps): QuestJournal;
94
102
  export interface QuestAcceptOptions {
95
103
  hasUnlock?(id: string): boolean;
@@ -1,6 +1,11 @@
1
1
  function clamp(value, min, max) {
2
2
  return Math.min(max, Math.max(min, value));
3
3
  }
4
+ /**
5
+ * Track accepted quests and their per-objective progress, granting rewards on completion.
6
+ *
7
+ * @capability quest-log track accepted quests and their per-objective progress
8
+ */
4
9
  export function createQuestJournal(deps) {
5
10
  const catalog = new Map();
6
11
  const users = new Map();
@@ -230,6 +235,30 @@ export function createQuestJournal(deps) {
230
235
  }
231
236
  users.set(userId, quests);
232
237
  },
238
+ snapshotAll() {
239
+ const out = {};
240
+ for (const [userId, quests] of users) {
241
+ out[userId] = Array.from(quests, ([questId, state]) => ({
242
+ questId,
243
+ status: state.status,
244
+ progress: Object.fromEntries(state.progress),
245
+ }));
246
+ }
247
+ return out;
248
+ },
249
+ hydrateAll(data) {
250
+ users.clear();
251
+ for (const [userId, entries] of Object.entries(data)) {
252
+ const quests = new Map();
253
+ for (const entry of entries) {
254
+ quests.set(entry.questId, {
255
+ status: entry.status,
256
+ progress: new Map(Object.entries(entry.progress)),
257
+ });
258
+ }
259
+ users.set(userId, quests);
260
+ }
261
+ },
233
262
  };
234
263
  }
235
264
  export function applyQuestRewards(rewards, appliers) {
@@ -135,4 +135,145 @@ export declare class RaceState {
135
135
  private compare;
136
136
  update(now: number, positions: Record<string, readonly [number, number, number]> | Map<string, readonly [number, number, number]>): readonly RaceEvent[];
137
137
  }
138
+ /**
139
+ * A checkpoint race state machine — laps, forks, live standings, splits, and pluggable win conditions.
140
+ *
141
+ * @capability race-track a checkpoint race with laps, standings, splits, and win conditions
142
+ */
138
143
  export declare function createRaceState(config: RaceStateConfig): RaceState;
144
+ /** Wall-clock lap timing: the current/last/best/total split-book every racing HUD reads. */
145
+ export interface LapTimerSnapshot {
146
+ /** Seconds elapsed in the lap now underway. */
147
+ currentLap: number;
148
+ /** Duration of the lap just completed, or `null` before the first lap closes. */
149
+ lastLap: number | null;
150
+ /** Fastest completed lap so far, or `null` before the first lap closes. */
151
+ bestLap: number | null;
152
+ /** Total time across every lap, including the current one. */
153
+ total: number;
154
+ /** Number of laps completed. */
155
+ lapCount: number;
156
+ /** Completed lap durations in order — the split book for a results screen. */
157
+ splits: readonly number[];
158
+ }
159
+ /**
160
+ * Wall-clock lap timer complementing {@link RaceState}: feed it `tick(dt)` each frame and call
161
+ * `completeLap()` when the race emits a player `lap.completed` event. It accumulates the current lap,
162
+ * carries best/last, banks splits, and `penalize()` folds a time penalty into the running lap — the
163
+ * timing bookkeeping every racer reimplemented on top of the position-only race state.
164
+ */
165
+ export interface LapTimer {
166
+ /** Advance the current lap and total by `dt` seconds. */
167
+ tick(dt: number): void;
168
+ /** Close the current lap: bank its split, update last/best, reset the current lap to 0, and return its time. */
169
+ completeLap(): number;
170
+ /** Add a time penalty (seconds) to the lap currently underway. */
171
+ penalize(seconds: number): void;
172
+ /** Clear all timing back to the start line. */
173
+ reset(): void;
174
+ /** Immutable view of the current timing state. */
175
+ snapshot(): LapTimerSnapshot;
176
+ }
177
+ /**
178
+ * Create a {@link LapTimer} starting at lap 0 with no splits, best, or last time recorded.
179
+ *
180
+ * @capability lap-timer wall-clock current/last/best lap timing with splits
181
+ */
182
+ export declare function createLapTimer(): LapTimer;
183
+ /**
184
+ * The lifecycle every race runs through before, during, and after the clock: `idle` on the grid,
185
+ * `countdown` on the lights, `racing` once they go green, `finished` at the flag. A pure value driven
186
+ * by the transition functions below — it carries no track, racer, or lap data, so it composes with
187
+ * {@link RaceState} (position/laps) and {@link LapTimer} (wall-clock) rather than duplicating them.
188
+ */
189
+ export type RacePhase = "idle" | "countdown" | "racing" | "finished";
190
+ /** Immutable lifecycle snapshot: the current {@link RacePhase} plus the two clocks it owns. */
191
+ export interface RaceSessionState {
192
+ /** Where the session sits in the start→countdown→race→finish lifecycle. */
193
+ readonly phase: RacePhase;
194
+ /** Seconds left on the countdown, or 0 outside the `countdown` phase. */
195
+ readonly countdown: number;
196
+ /** Seconds of green-flag racing accumulated so far. */
197
+ readonly elapsed: number;
198
+ }
199
+ /** Options for {@link startRaceCountdown}. */
200
+ export interface RaceCountdownOptions {
201
+ /** Countdown length in seconds before the race goes green (default 3). A value ≤ 0 starts racing immediately. */
202
+ readonly seconds?: number;
203
+ }
204
+ /**
205
+ * The pre-race session on the grid: `idle`, both clocks at zero. Call {@link startRaceCountdown} to
206
+ * light the lights, or hold here until the field is ready.
207
+ *
208
+ * @capability race-session pure idle→countdown→racing→finished clock every racer wraps around its state
209
+ */
210
+ export declare function idleRaceSession(): RaceSessionState;
211
+ /**
212
+ * Drop the lights: return a fresh `countdown` session of `seconds` (default 3). A non-positive length
213
+ * skips straight to `racing` for a standing start with no countdown.
214
+ */
215
+ export declare function startRaceCountdown(options?: RaceCountdownOptions): RaceSessionState;
216
+ /**
217
+ * Advance the session by `dt` seconds: bleed the countdown down and flip to `racing` when it reaches
218
+ * zero, or accumulate `elapsed` while `racing`. `idle` and `finished` are inert. Overshoot past the
219
+ * countdown is dropped rather than banked into `elapsed`, so the race clock always starts from zero.
220
+ */
221
+ export declare function tickRaceSession(session: RaceSessionState, dt: number): RaceSessionState;
222
+ /** Cross the flag: move a `racing` session to `finished`, freezing its `elapsed`. A no-op in any other phase. */
223
+ export declare function finishRaceSession(session: RaceSessionState): RaceSessionState;
224
+ /** Whether a racer won or lost, derived from where they placed against the winning-places cutoff. */
225
+ export type RaceOutcome = "win" | "lose";
226
+ /** A racer's finishing position (`place`, 1-based) in a finish order, and the {@link RaceOutcome} it earns. */
227
+ export interface RacePlacement {
228
+ readonly racerId: string;
229
+ /** 1-based finishing position: `1` is the winner. */
230
+ readonly place: number;
231
+ readonly outcome: RaceOutcome;
232
+ }
233
+ /** Options for {@link racePlacements} / {@link placementOf} / {@link raceOutcomeOf}. */
234
+ export interface PlacementOptions {
235
+ /** How many top places count as a win (default 1). A podium finish would pass `3`. */
236
+ readonly winningPlaces?: number;
237
+ }
238
+ /**
239
+ * Turn a finish-order ranking (index 0 = winner, e.g. the `ranking` of a `race.finished` event) into
240
+ * per-racer {@link RacePlacement}s — the `1st/2nd/3rd` + win/lose every results screen shows.
241
+ *
242
+ * @capability race-placements finish order into per-racer place + win/lose for a results screen
243
+ */
244
+ export declare function racePlacements(finishOrder: readonly string[], options?: PlacementOptions): readonly RacePlacement[];
245
+ /**
246
+ * One racer's {@link RacePlacement} within a finish order, or `null` if they never crossed the line.
247
+ *
248
+ * @capability race-placements look up one racer's place + win/lose within a finish order
249
+ */
250
+ export declare function placementOf(finishOrder: readonly string[], racerId: string, options?: PlacementOptions): RacePlacement | null;
251
+ /**
252
+ * The win/lose verdict for one racer in a finish order — `ranking[0] === player ? "win" : "lose"`, the
253
+ * check every racing game hand-rolls, generalized to a `winningPlaces` cutoff. A racer absent from the
254
+ * order counts as a `lose`.
255
+ */
256
+ export declare function raceOutcomeOf(finishOrder: readonly string[], racerId: string, options?: PlacementOptions): RaceOutcome;
257
+ /**
258
+ * Per-segment durations from a cumulative split book (`splits[i]` = elapsed time at checkpoint `i`):
259
+ * `segments[i] = splits[i] − splits[i−1]`, the first measured from `start` (default 0). Turns the
260
+ * cumulative splits {@link RacerProgress} records into the individual leg times a results screen shows.
261
+ *
262
+ * @capability lap-splits turn cumulative split times into per-segment leg times
263
+ */
264
+ export declare function splitSegments(splits: readonly number[], start?: number): number[];
265
+ /**
266
+ * Per-lap durations from a cumulative split book with `gatesPerLap` checkpoints per lap — each lap's time
267
+ * is its finish-gate split minus the previous lap's finish. Only complete laps are returned.
268
+ *
269
+ * @capability lap-splits per-lap durations from a cumulative split book
270
+ */
271
+ export declare function lapDurations(splits: readonly number[], gatesPerLap: number): number[];
272
+ /**
273
+ * Elementwise delta of a cumulative split book against a `reference` book (a personal best or par lap):
274
+ * positive means behind the reference at that checkpoint. Compared up to the shorter length — the
275
+ * `+0.3s` / `−1.2s` gap every racing HUD shows against its ghost.
276
+ *
277
+ * @capability lap-splits delta of splits against a personal-best or par reference
278
+ */
279
+ export declare function parDelta(splits: readonly number[], reference: readonly number[]): number[];