@jgengine/core 0.10.0 → 0.12.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.
- package/CHANGELOG.md +39 -2
- package/LICENSE +203 -661
- package/README.md +1 -1
- package/dist/ai/crowd.d.ts +55 -0
- package/dist/ai/crowd.js +114 -0
- package/dist/ai/flock.d.ts +5 -2
- package/dist/ai/flock.js +5 -2
- package/dist/ai/groupAssist.d.ts +1 -0
- package/dist/ai/groupAssist.js +1 -0
- package/dist/ai/heatSystem.d.ts +76 -0
- package/dist/ai/heatSystem.js +97 -0
- package/dist/ai/interestScheduler.d.ts +107 -0
- package/dist/ai/interestScheduler.js +118 -0
- package/dist/ai/jobBoard.d.ts +1 -0
- package/dist/ai/jobBoard.js +1 -0
- package/dist/ai/laneSelect.d.ts +5 -2
- package/dist/ai/laneSelect.js +5 -2
- package/dist/ai/mobBrain.d.ts +1 -0
- package/dist/ai/mobBrain.js +1 -0
- package/dist/ai/populationDirector.d.ts +103 -0
- package/dist/ai/populationDirector.js +190 -0
- package/dist/ai/pursuit.d.ts +56 -0
- package/dist/ai/pursuit.js +53 -0
- package/dist/ai/spawnDirector.d.ts +7 -2
- package/dist/ai/spawnDirector.js +18 -15
- package/dist/ai/spawnPoint.d.ts +3 -1
- package/dist/ai/spawnPoint.js +3 -1
- package/dist/ai/targetAcquisition.d.ts +84 -0
- package/dist/ai/targetAcquisition.js +92 -0
- package/dist/anim/easing.d.ts +19 -0
- package/dist/anim/easing.js +19 -0
- package/dist/anim/oscillator.d.ts +12 -0
- package/dist/anim/oscillator.js +25 -0
- package/dist/area/areaEffectField.d.ts +127 -0
- package/dist/area/areaEffectField.js +175 -0
- package/dist/area/stackPolicy.d.ts +47 -0
- package/dist/area/stackPolicy.js +99 -0
- package/dist/authoring.d.ts +2 -1
- package/dist/authoring.js +2 -1
- package/dist/board/laneBoard.d.ts +13 -0
- package/dist/board/laneBoard.js +13 -0
- package/dist/board/timelineBoard.d.ts +10 -0
- package/dist/board/timelineBoard.js +10 -0
- package/dist/combat/abilityKit.d.ts +18 -0
- package/dist/combat/abilityKit.js +24 -9
- package/dist/combat/animationState.d.ts +5 -0
- package/dist/combat/animationState.js +5 -0
- package/dist/combat/breakMeters.d.ts +10 -0
- package/dist/combat/breakMeters.js +10 -0
- package/dist/combat/castRunner.d.ts +5 -0
- package/dist/combat/castRunner.js +5 -0
- package/dist/combat/comboPoints.d.ts +5 -0
- package/dist/combat/comboPoints.js +5 -0
- package/dist/combat/comboString.d.ts +5 -0
- package/dist/combat/comboString.js +5 -0
- package/dist/combat/damageInterceptors.d.ts +192 -0
- package/dist/combat/damageInterceptors.js +251 -0
- package/dist/combat/damageMatchup.d.ts +68 -0
- package/dist/combat/damageMatchup.js +42 -0
- package/dist/combat/damageResolution.d.ts +63 -0
- package/dist/combat/damageResolution.js +50 -0
- package/dist/combat/death.d.ts +7 -1
- package/dist/combat/death.js +5 -0
- package/dist/combat/deathReason.d.ts +14 -0
- package/dist/combat/deathReason.js +1 -0
- package/dist/combat/defensiveWindow.d.ts +5 -0
- package/dist/combat/defensiveWindow.js +5 -0
- package/dist/combat/dotField.d.ts +5 -1
- package/dist/combat/dotField.js +5 -1
- package/dist/combat/downed.d.ts +5 -0
- package/dist/combat/downed.js +5 -0
- package/dist/combat/effects.d.ts +5 -0
- package/dist/combat/effects.js +5 -0
- package/dist/combat/encounterSequence.d.ts +258 -0
- package/dist/combat/encounterSequence.js +426 -0
- package/dist/combat/hitReaction.d.ts +57 -1
- package/dist/combat/hitReaction.js +45 -5
- package/dist/combat/magazine.d.ts +54 -0
- package/dist/combat/magazine.js +96 -0
- package/dist/combat/projectiles.d.ts +5 -0
- package/dist/combat/projectiles.js +32 -14
- package/dist/combat/receivedDamage.d.ts +117 -0
- package/dist/combat/receivedDamage.js +92 -0
- package/dist/combat/regenShield.d.ts +5 -1
- package/dist/combat/regenShield.js +5 -1
- package/dist/combat/renderCues.d.ts +51 -0
- package/dist/combat/renderCues.js +44 -0
- package/dist/combat/resourcePool.d.ts +5 -0
- package/dist/combat/resourcePool.js +5 -0
- package/dist/combat/rewardAllocation.d.ts +121 -0
- package/dist/combat/rewardAllocation.js +251 -0
- package/dist/combat/shotOrigin.d.ts +18 -1
- package/dist/combat/shotOrigin.js +39 -0
- package/dist/combat/statusApplication.d.ts +96 -0
- package/dist/combat/statusApplication.js +81 -0
- package/dist/combat/telegraph.d.ts +11 -2
- package/dist/combat/telegraph.js +11 -2
- package/dist/combat/thresholdCrossings.d.ts +85 -0
- package/dist/combat/thresholdCrossings.js +116 -0
- package/dist/combat.d.ts +35 -0
- package/dist/combat.js +35 -0
- package/dist/commands/commandRegistry.d.ts +11 -0
- package/dist/commands/commandRegistry.js +9 -2
- package/dist/crafting/crop.d.ts +18 -0
- package/dist/crafting/crop.js +18 -0
- package/dist/crafting/production.d.ts +5 -0
- package/dist/crafting/production.js +5 -0
- package/dist/devtools/controls.d.ts +38 -0
- package/dist/devtools/controls.js +181 -0
- package/dist/devtools/devtools.d.ts +5 -197
- package/dist/devtools/devtools.js +38 -774
- package/dist/devtools/discover.d.ts +32 -0
- package/dist/devtools/discover.js +240 -0
- package/dist/devtools/fallbackSeams.d.ts +50 -0
- package/dist/devtools/fallbackSeams.js +111 -0
- package/dist/devtools/frame.d.ts +15 -0
- package/dist/devtools/frame.js +247 -0
- package/dist/devtools/logs.d.ts +15 -0
- package/dist/devtools/logs.js +86 -0
- package/dist/devtools/overrides.d.ts +16 -0
- package/dist/devtools/overrides.js +66 -0
- package/dist/devtools/rewriteTunables.d.ts +17 -0
- package/dist/devtools/rewriteTunables.js +276 -0
- package/dist/devtools/saveEndpoint.d.ts +46 -0
- package/dist/devtools/saveEndpoint.js +48 -0
- package/dist/devtools/transformTunables.d.ts +3 -0
- package/dist/devtools/transformTunables.js +3 -0
- package/dist/devtools/tunableSchema.d.ts +31 -0
- package/dist/devtools/tunableSchema.js +31 -0
- package/dist/devtools/types.d.ts +212 -0
- package/dist/devtools/types.js +1 -0
- package/dist/economy/auctionBook.d.ts +122 -0
- package/dist/economy/auctionBook.js +213 -0
- package/dist/economy/currency.d.ts +12 -1
- package/dist/economy/currency.js +12 -1
- package/dist/economy/listingBook.d.ts +91 -0
- package/dist/economy/listingBook.js +144 -0
- package/dist/economy/priceHistory.d.ts +44 -0
- package/dist/economy/priceHistory.js +89 -0
- package/dist/economy/resourceLedger.d.ts +222 -0
- package/dist/economy/resourceLedger.js +353 -0
- package/dist/economy/sharedWallet.d.ts +14 -0
- package/dist/economy/sharedWallet.js +14 -0
- package/dist/economy/techTree.d.ts +12 -0
- package/dist/economy/techTree.js +12 -0
- package/dist/economy/unlockPoints.d.ts +92 -0
- package/dist/economy/unlockPoints.js +103 -0
- package/dist/economy/wallet.d.ts +26 -2
- package/dist/economy/wallet.js +35 -6
- package/dist/editor/commandApply.d.ts +5 -0
- package/dist/editor/commandApply.js +755 -0
- package/dist/editor/commands.d.ts +235 -7
- package/dist/editor/commands.js +82 -124
- package/dist/editor/directives.d.ts +94 -0
- package/dist/editor/directives.js +206 -0
- package/dist/editor/document.d.ts +194 -13
- package/dist/editor/document.js +1166 -19
- package/dist/editor/entityCatalog.d.ts +42 -0
- package/dist/editor/entityCatalog.js +101 -0
- package/dist/editor/environment.d.ts +74 -0
- package/dist/editor/environment.js +169 -0
- package/dist/editor/grid.d.ts +229 -0
- package/dist/editor/grid.js +366 -0
- package/dist/editor/gridAdapters.d.ts +80 -0
- package/dist/editor/gridAdapters.js +134 -0
- package/dist/editor/index.d.ts +98 -6
- package/dist/editor/index.js +13 -2
- package/dist/editor/liveSync.d.ts +127 -0
- package/dist/editor/liveSync.js +249 -0
- package/dist/editor/minimap.d.ts +31 -0
- package/dist/editor/minimap.js +73 -0
- package/dist/editor/runtimeInspector.d.ts +88 -0
- package/dist/editor/runtimeInspector.js +239 -0
- package/dist/editor/streamer.d.ts +66 -0
- package/dist/editor/streamer.js +68 -0
- package/dist/editor/types.d.ts +250 -1
- package/dist/editor/world.d.ts +136 -0
- package/dist/editor/world.js +303 -0
- package/dist/faction/reputation.d.ts +5 -0
- package/dist/faction/reputation.js +5 -0
- package/dist/format/distance.d.ts +17 -0
- package/dist/format/distance.js +18 -0
- package/dist/format/duration.d.ts +27 -0
- package/dist/format/duration.js +45 -0
- package/dist/format/speed.d.ts +17 -0
- package/dist/format/speed.js +25 -0
- package/dist/game/breeding.d.ts +161 -0
- package/dist/game/breeding.js +181 -0
- package/dist/game/cameraConfig.d.ts +451 -0
- package/dist/game/cameraConfig.js +1 -0
- package/dist/game/connectedPlayers.d.ts +6 -4
- package/dist/game/connectedPlayers.js +2 -2
- package/dist/game/cosmetics.d.ts +9 -0
- package/dist/game/cosmetics.js +16 -0
- package/dist/game/defineGame.d.ts +110 -5
- package/dist/game/defineGame.js +49 -4
- package/dist/game/defineSystem.d.ts +90 -0
- package/dist/game/defineSystem.js +47 -0
- package/dist/game/dialogue.d.ts +33 -0
- package/dist/game/dialogue.js +21 -0
- package/dist/game/events.d.ts +63 -13
- package/dist/game/events.js +5 -0
- package/dist/game/feed.d.ts +33 -0
- package/dist/game/feed.js +35 -2
- package/dist/game/gamePhase.d.ts +11 -0
- package/dist/game/gamePhase.js +16 -0
- package/dist/game/leaderboard.d.ts +5 -0
- package/dist/game/leaderboard.js +5 -0
- package/dist/game/loadout.d.ts +5 -0
- package/dist/game/loadout.js +5 -0
- package/dist/game/lootFilter.d.ts +2 -0
- package/dist/game/lootFilter.js +2 -0
- package/dist/game/lootPipeline.d.ts +164 -0
- package/dist/game/lootPipeline.js +216 -0
- package/dist/game/lootTable.d.ts +19 -2
- package/dist/game/lootTable.js +15 -5
- package/dist/game/objectives.d.ts +43 -0
- package/dist/game/objectives.js +36 -0
- package/dist/game/paramLayers.d.ts +148 -0
- package/dist/game/paramLayers.js +185 -0
- package/dist/game/ping.d.ts +5 -0
- package/dist/game/ping.js +5 -0
- package/dist/game/playableGame.d.ts +116 -432
- package/dist/game/playableGame.js +1 -1
- package/dist/game/progression.d.ts +35 -0
- package/dist/game/progression.js +19 -0
- package/dist/game/quest.d.ts +8 -0
- package/dist/game/quest.js +30 -3
- package/dist/game/race.d.ts +141 -0
- package/dist/game/race.js +169 -0
- package/dist/game/recordBook.d.ts +3 -1
- package/dist/game/recordBook.js +4 -1
- package/dist/game/ruleSelection.d.ts +75 -0
- package/dist/game/ruleSelection.js +127 -0
- package/dist/game/runDraft.d.ts +5 -0
- package/dist/game/runDraft.js +5 -0
- package/dist/game/saveStore.d.ts +111 -0
- package/dist/game/saveStore.js +312 -0
- package/dist/game/snapshotHistory.d.ts +67 -0
- package/dist/game/snapshotHistory.js +95 -0
- package/dist/game/social.d.ts +38 -1
- package/dist/game/social.js +71 -0
- package/dist/game/spawnPoints.d.ts +5 -0
- package/dist/game/spawnPoints.js +5 -0
- package/dist/game/systemRuntime.d.ts +50 -0
- package/dist/game/systemRuntime.js +157 -0
- package/dist/game/systemSchedule.d.ts +72 -0
- package/dist/game/systemSchedule.js +242 -0
- package/dist/game/toasts.d.ts +43 -0
- package/dist/game/toasts.js +44 -0
- package/dist/game/trade.d.ts +10 -0
- package/dist/game/trade.js +10 -0
- package/dist/game/tribe.d.ts +184 -0
- package/dist/game/tribe.js +432 -0
- package/dist/game/unlocks.d.ts +8 -0
- package/dist/game/unlocks.js +16 -0
- package/dist/game/vfxInstance.d.ts +138 -0
- package/dist/game/vfxInstance.js +96 -0
- package/dist/game/worldItem.d.ts +17 -4
- package/dist/game/worldItem.js +17 -4
- package/dist/gameplay.d.ts +93 -0
- package/dist/gameplay.js +93 -0
- package/dist/index.d.ts +5 -14
- package/dist/index.js +5 -14
- package/dist/input/actionBindings.d.ts +23 -6
- package/dist/input/actionBindings.js +23 -6
- package/dist/input/axisInput.d.ts +7 -2
- package/dist/input/axisInput.js +7 -2
- package/dist/input/controlGroups.d.ts +67 -0
- package/dist/input/controlGroups.js +41 -0
- package/dist/input/touchScheme.d.ts +82 -6
- package/dist/input/touchScheme.js +123 -10
- package/dist/interaction/lockpick.d.ts +61 -0
- package/dist/interaction/lockpick.js +168 -0
- package/dist/interaction/proximityPrompt.d.ts +2 -0
- package/dist/interaction/proximityPrompt.js +2 -0
- package/dist/interaction/qte.d.ts +5 -0
- package/dist/interaction/qte.js +5 -0
- package/dist/interaction/skillCheck.d.ts +5 -0
- package/dist/interaction/skillCheck.js +5 -0
- package/dist/inventory/encumbrance.d.ts +69 -0
- package/dist/inventory/encumbrance.js +68 -0
- package/dist/inventory/inventoryModel.d.ts +12 -0
- package/dist/inventory/inventoryModel.js +12 -0
- package/dist/inventory/shapedGrid.d.ts +16 -0
- package/dist/inventory/shapedGrid.js +16 -0
- package/dist/inventory/slotModel.d.ts +10 -0
- package/dist/inventory/slotModel.js +10 -0
- package/dist/item/durability.d.ts +5 -0
- package/dist/item/durability.js +6 -3
- package/dist/item/itemIdentity.d.ts +171 -0
- package/dist/item/itemIdentity.js +138 -0
- package/dist/item/itemInstanceRegistry.d.ts +32 -0
- package/dist/item/itemInstanceRegistry.js +34 -0
- package/dist/item/itemgen.d.ts +163 -0
- package/dist/item/itemgen.js +151 -0
- package/dist/item/modularItem.d.ts +5 -0
- package/dist/item/modularItem.js +5 -0
- package/dist/item/use.d.ts +5 -0
- package/dist/item/use.js +5 -0
- package/dist/item/useBehavior.d.ts +142 -0
- package/dist/item/useBehavior.js +105 -0
- package/dist/item/weapon.d.ts +5 -0
- package/dist/item/weapon.js +5 -0
- package/dist/math/scalar.d.ts +25 -0
- package/dist/math/scalar.js +47 -0
- package/dist/meta/changelog.d.ts +4 -1
- package/dist/meta/changelog.js +39 -2
- package/dist/movement/avoidance.d.ts +45 -0
- package/dist/movement/avoidance.js +123 -0
- package/dist/movement/cameraRig.d.ts +8 -0
- package/dist/movement/cameraRig.js +8 -0
- package/dist/movement/dash.d.ts +11 -0
- package/dist/movement/dash.js +11 -0
- package/dist/movement/formation.d.ts +135 -0
- package/dist/movement/formation.js +194 -0
- package/dist/movement/glideModel.d.ts +5 -0
- package/dist/movement/glideModel.js +5 -0
- package/dist/movement/grappleSwing.d.ts +5 -0
- package/dist/movement/grappleSwing.js +5 -0
- package/dist/movement/leaderTrail.d.ts +5 -0
- package/dist/movement/leaderTrail.js +5 -0
- package/dist/movement/movementModel.d.ts +50 -9
- package/dist/movement/movementModel.js +75 -29
- package/dist/movement/playerMovement.js +167 -12
- package/dist/movement/poseState.d.ts +13 -0
- package/dist/movement/poseState.js +16 -0
- package/dist/movement/steering.d.ts +8 -0
- package/dist/movement/steering.js +18 -0
- package/dist/multiplayer/combatSnapshot.d.ts +3 -0
- package/dist/multiplayer/combatSnapshot.js +16 -8
- package/dist/multiplayer/lagCompensation.d.ts +5 -0
- package/dist/multiplayer/lagCompensation.js +5 -0
- package/dist/multiplayer/presenceModel.d.ts +11 -1
- package/dist/multiplayer/presenceModel.js +17 -1
- package/dist/multiplayer/simultaneousCommit.d.ts +3 -0
- package/dist/multiplayer/simultaneousCommit.js +3 -0
- package/dist/multiplayer.d.ts +11 -0
- package/dist/multiplayer.js +11 -0
- package/dist/nav/pathFollow.d.ts +57 -0
- package/dist/nav/pathFollow.js +109 -0
- package/dist/orders/orderKinds.d.ts +156 -0
- package/dist/orders/orderKinds.js +197 -0
- package/dist/orders/orderQueue.d.ts +208 -0
- package/dist/orders/orderQueue.js +211 -0
- package/dist/physics/drivableVehicle.d.ts +31 -0
- package/dist/physics/drivableVehicle.js +16 -0
- package/dist/physics/flightDynamics.d.ts +82 -0
- package/dist/physics/flightDynamics.js +165 -0
- package/dist/physics/gravityField.d.ts +25 -0
- package/dist/physics/gravityField.js +41 -0
- package/dist/physics/kinematicVehicle.d.ts +108 -1
- package/dist/physics/kinematicVehicle.js +212 -15
- package/dist/physics/physicsWorld.d.ts +50 -12
- package/dist/physics/physicsWorld.js +120 -122
- package/dist/physics/radialImpulse.d.ts +25 -0
- package/dist/physics/radialImpulse.js +27 -0
- package/dist/physics/vehicleObstacles.d.ts +44 -0
- package/dist/physics/vehicleObstacles.js +115 -0
- package/dist/procedural.d.ts +3 -0
- package/dist/procedural.js +3 -0
- package/dist/progression/statGraph.d.ts +116 -0
- package/dist/progression/statGraph.js +318 -0
- package/dist/puzzle/cellGrid.d.ts +9 -0
- package/dist/puzzle/cellGrid.js +9 -0
- package/dist/puzzle/fallingPiece.d.ts +9 -0
- package/dist/puzzle/fallingPiece.js +9 -0
- package/dist/puzzle/nonogram.d.ts +39 -0
- package/dist/puzzle/nonogram.js +136 -0
- package/dist/random/nameGen.d.ts +5 -0
- package/dist/random/nameGen.js +5 -0
- package/dist/random/pick.d.ts +8 -0
- package/dist/random/pick.js +31 -0
- package/dist/random/rng.d.ts +26 -1
- package/dist/random/rng.js +32 -9
- package/dist/random/seedLink.d.ts +4 -0
- package/dist/random/seedLink.js +4 -0
- package/dist/relation/keyedValues.d.ts +54 -0
- package/dist/relation/keyedValues.js +115 -0
- package/dist/relation/thresholds.d.ts +62 -0
- package/dist/relation/thresholds.js +62 -0
- package/dist/render/color.d.ts +12 -0
- package/dist/render/color.js +26 -0
- package/dist/render/lookPreset.d.ts +41 -0
- package/dist/render/lookPreset.js +29 -0
- package/dist/render/postProcessing.d.ts +20 -0
- package/dist/render/postProcessing.js +21 -1
- package/dist/rules/predicate.d.ts +53 -0
- package/dist/rules/predicate.js +64 -0
- package/dist/rules/ruleEffects.d.ts +38 -0
- package/dist/rules/ruleEffects.js +37 -0
- package/dist/rules/triggeredRules.d.ts +160 -0
- package/dist/rules/triggeredRules.js +241 -0
- package/dist/runtime/adapter.d.ts +55 -3
- package/dist/runtime/adapter.js +57 -1
- package/dist/runtime/cameraDirector.d.ts +1 -0
- package/dist/runtime/cameraDirector.js +1 -0
- package/dist/runtime/commandRunner.d.ts +1 -0
- package/dist/runtime/commandRunner.js +1 -0
- package/dist/runtime/context/combat.d.ts +51 -0
- package/dist/runtime/context/combat.js +130 -0
- package/dist/runtime/context/combatFx.d.ts +23 -0
- package/dist/runtime/context/combatFx.js +161 -0
- package/dist/runtime/context/deathLoot.d.ts +30 -0
- package/dist/runtime/context/deathLoot.js +39 -0
- package/dist/runtime/context/player.d.ts +48 -0
- package/dist/runtime/context/player.js +125 -0
- package/dist/runtime/context/registries.d.ts +13 -0
- package/dist/runtime/context/registries.js +84 -0
- package/dist/runtime/context/scene.d.ts +59 -0
- package/dist/runtime/context/scene.js +291 -0
- package/dist/runtime/context/snapshotCodecs.d.ts +12 -0
- package/dist/runtime/context/snapshotCodecs.js +26 -0
- package/dist/runtime/context/worldItems.d.ts +21 -0
- package/dist/runtime/context/worldItems.js +37 -0
- package/dist/runtime/descriptors/baseline.d.ts +48 -0
- package/dist/runtime/descriptors/baseline.js +157 -0
- package/dist/runtime/descriptors/features.d.ts +79 -0
- package/dist/runtime/descriptors/features.js +299 -0
- package/dist/runtime/gameContext.d.ts +2 -327
- package/dist/runtime/gameContext.js +273 -778
- package/dist/runtime/gameContextTypes.d.ts +467 -0
- package/dist/runtime/gameContextTypes.js +1 -0
- package/dist/runtime/gameRuntime.d.ts +1 -0
- package/dist/runtime/gameRuntime.js +1 -0
- package/dist/runtime/headlessRunner.d.ts +62 -0
- package/dist/runtime/headlessRunner.js +45 -0
- package/dist/runtime/hostPersistence.d.ts +12 -0
- package/dist/runtime/hostPersistence.js +12 -0
- package/dist/runtime/hostPolicy.d.ts +51 -0
- package/dist/runtime/hostPolicy.js +68 -0
- package/dist/runtime/hostedGameRunner.d.ts +11 -4
- package/dist/runtime/hostedGameRunner.js +27 -3
- package/dist/runtime/hostedWorldSession.d.ts +15 -5
- package/dist/runtime/hostedWorldSession.js +12 -4
- package/dist/runtime/inputSnapshot.d.ts +8 -3
- package/dist/runtime/inputSnapshot.js +6 -2
- package/dist/runtime/motionIntents.d.ts +11 -2
- package/dist/runtime/motionIntents.js +16 -2
- package/dist/runtime/perContext.d.ts +15 -0
- package/dist/runtime/perContext.js +21 -0
- package/dist/runtime/runtimeSave.d.ts +79 -0
- package/dist/runtime/runtimeSave.js +105 -0
- package/dist/runtime/save.d.ts +4 -0
- package/dist/runtime/save.js +4 -0
- package/dist/runtime/snapshot.d.ts +7 -0
- package/dist/runtime/snapshot.js +7 -0
- package/dist/runtime/visibility.d.ts +2 -1
- package/dist/runtime/visibility.js +2 -1
- package/dist/runtime/worldChannel.d.ts +7 -3
- package/dist/runtime/worldChannel.js +51 -6
- package/dist/runtime/worldMirror.d.ts +14 -2
- package/dist/runtime/worldMirror.js +15 -2
- package/dist/runtime/worldProjection.d.ts +47 -0
- package/dist/runtime/worldProjection.js +52 -0
- package/dist/runtime/worldReplication.d.ts +30 -7
- package/dist/runtime/worldReplication.js +41 -9
- package/dist/runtime/worldSnapshot.d.ts +42 -3
- package/dist/runtime/worldSnapshot.js +34 -7
- package/dist/scene/assetCatalog.d.ts +26 -0
- package/dist/scene/assetCatalog.js +4 -0
- package/dist/scene/assetDiagnostics.d.ts +69 -0
- package/dist/scene/assetDiagnostics.js +110 -0
- package/dist/scene/assetGenerator.d.ts +65 -0
- package/dist/scene/assetGenerator.js +64 -0
- package/dist/scene/assetSpace.d.ts +137 -0
- package/dist/scene/assetSpace.js +257 -0
- package/dist/scene/authoredTriggers.d.ts +219 -0
- package/dist/scene/authoredTriggers.js +454 -0
- package/dist/scene/behaviorRuntime.d.ts +75 -0
- package/dist/scene/behaviorRuntime.js +217 -0
- package/dist/scene/behaviors.d.ts +14 -2
- package/dist/scene/behaviors.js +7 -2
- package/dist/scene/bodyBind.d.ts +60 -0
- package/dist/scene/bodyBind.js +51 -0
- package/dist/scene/builtinSceneKinds.d.ts +5 -0
- package/dist/scene/builtinSceneKinds.js +67 -0
- package/dist/scene/colliders.d.ts +71 -1
- package/dist/scene/colliders.js +145 -1
- package/dist/scene/collisionMesh.d.ts +94 -0
- package/dist/scene/collisionMesh.js +699 -0
- package/dist/scene/companion.d.ts +147 -0
- package/dist/scene/companion.js +193 -0
- package/dist/scene/entityStats.d.ts +18 -11
- package/dist/scene/entityStats.js +21 -16
- package/dist/scene/entityStore.d.ts +12 -1
- package/dist/scene/entityStore.js +15 -0
- package/dist/scene/facing.d.ts +18 -0
- package/dist/scene/facing.js +26 -0
- package/dist/scene/modelSockets.d.ts +33 -0
- package/dist/scene/modelSockets.js +29 -0
- package/dist/scene/objectQuery.d.ts +2 -0
- package/dist/scene/objectQuery.js +2 -0
- package/dist/scene/objectStore.d.ts +4 -0
- package/dist/scene/objectStore.js +6 -0
- package/dist/scene/possession.d.ts +8 -0
- package/dist/scene/possession.js +14 -0
- package/dist/scene/roster.d.ts +3 -0
- package/dist/scene/roster.js +12 -0
- package/dist/scene/sceneKinds.d.ts +256 -0
- package/dist/scene/sceneKinds.js +218 -0
- package/dist/scene/sceneOwnership.d.ts +169 -0
- package/dist/scene/sceneOwnership.js +179 -0
- package/dist/scene/sceneRaycast.js +15 -0
- package/dist/scene/selectionBookmarks.d.ts +93 -0
- package/dist/scene/selectionBookmarks.js +122 -0
- package/dist/scene/vehicleSeat.d.ts +68 -0
- package/dist/scene/vehicleSeat.js +59 -0
- package/dist/sensor/concealment.d.ts +3 -0
- package/dist/sensor/concealment.js +3 -0
- package/dist/sensor/freezeMonitor.d.ts +1 -0
- package/dist/sensor/freezeMonitor.js +1 -0
- package/dist/sensor/frustumSensor.d.ts +7 -3
- package/dist/sensor/frustumSensor.js +7 -3
- package/dist/sensor/hiddenStateProbe.d.ts +5 -2
- package/dist/sensor/hiddenStateProbe.js +5 -2
- package/dist/sensor/recordingBuffer.d.ts +2 -1
- package/dist/sensor/recordingBuffer.js +2 -1
- package/dist/sensor/replayLoop.d.ts +6 -2
- package/dist/sensor/replayLoop.js +6 -2
- package/dist/sensor/revealQuery.d.ts +2 -1
- package/dist/sensor/revealQuery.js +2 -1
- package/dist/sensor/visionCone.d.ts +10 -3
- package/dist/sensor/visionCone.js +10 -3
- package/dist/session/contestedChannel.d.ts +1 -0
- package/dist/session/contestedChannel.js +1 -0
- package/dist/session/extraction.d.ts +1 -0
- package/dist/session/extraction.js +1 -0
- package/dist/session/roles.d.ts +6 -0
- package/dist/session/roles.js +6 -0
- package/dist/session/roundState.d.ts +8 -0
- package/dist/session/roundState.js +2 -0
- package/dist/settings/settingsModel.d.ts +1 -0
- package/dist/settings/settingsModel.js +1 -0
- package/dist/stats/accumulatorMeter.d.ts +6 -0
- package/dist/stats/accumulatorMeter.js +6 -0
- package/dist/stats/eventMeter.d.ts +5 -0
- package/dist/stats/eventMeter.js +5 -0
- package/dist/stats/rollCheck.d.ts +5 -0
- package/dist/stats/rollCheck.js +5 -0
- package/dist/stats/spawnLevelStats.d.ts +110 -0
- package/dist/stats/spawnLevelStats.js +140 -0
- package/dist/stats/statModifiers.d.ts +5 -0
- package/dist/stats/statModifiers.js +5 -0
- package/dist/stats/statPool.d.ts +70 -0
- package/dist/stats/statPool.js +59 -0
- package/dist/store/changeSignal.d.ts +3 -0
- package/dist/store/changeSignal.js +2 -0
- package/dist/store/defineKeyedStore.d.ts +38 -0
- package/dist/store/defineKeyedStore.js +42 -0
- package/dist/store/defineStore.d.ts +33 -0
- package/dist/store/defineStore.js +35 -0
- package/dist/store/observableKeyedStore.d.ts +7 -0
- package/dist/store/observableKeyedStore.js +35 -2
- package/dist/survival/decayMeter.d.ts +55 -0
- package/dist/survival/decayMeter.js +130 -57
- package/dist/survival/moodle.d.ts +2 -0
- package/dist/survival/regionHealth.d.ts +6 -0
- package/dist/survival/regionHealth.js +6 -3
- package/dist/tactics/fallingGrid.d.ts +4 -2
- package/dist/tactics/fallingGrid.js +4 -2
- package/dist/tactics/predictiveQuery.d.ts +3 -0
- package/dist/tactics/predictiveQuery.js +3 -0
- package/dist/tactics/snapshot.d.ts +2 -0
- package/dist/tactics/snapshot.js +2 -0
- package/dist/tactics/surface.d.ts +1 -0
- package/dist/tactics/surface.js +1 -0
- package/dist/tactics/tacticalGrid.d.ts +1 -0
- package/dist/tactics/tacticalGrid.js +1 -0
- package/dist/time/beatClock.d.ts +14 -4
- package/dist/time/beatClock.js +14 -4
- package/dist/time/calendarClock.d.ts +3 -0
- package/dist/time/calendarClock.js +3 -0
- package/dist/time/idleProgress.d.ts +4 -0
- package/dist/time/idleProgress.js +4 -0
- package/dist/time/simClock.d.ts +2 -0
- package/dist/time/simClock.js +20 -5
- package/dist/ui/actionModel.d.ts +110 -0
- package/dist/ui/actionModel.js +159 -0
- package/dist/ui/gameLayout.d.ts +30 -11
- package/dist/ui/gameLayout.js +30 -11
- package/dist/ui/hudDocument.d.ts +114 -0
- package/dist/ui/hudDocument.js +220 -0
- package/dist/ui/hudLayout.d.ts +38 -1
- package/dist/ui/hudLayout.js +220 -17
- package/dist/ui/selectionModel.d.ts +92 -0
- package/dist/ui/selectionModel.js +88 -0
- package/dist/ui/tooltipModel.d.ts +63 -0
- package/dist/ui/tooltipModel.js +82 -0
- package/dist/ui.d.ts +15 -0
- package/dist/ui.js +15 -0
- package/dist/visibility/bounds.d.ts +8 -1
- package/dist/visibility/bounds.js +8 -1
- package/dist/visibility/frustum.d.ts +12 -3
- package/dist/visibility/frustum.js +12 -3
- package/dist/work/jobQueue.d.ts +201 -0
- package/dist/work/jobQueue.js +253 -0
- package/dist/work/unitTraining.d.ts +58 -0
- package/dist/work/unitTraining.js +52 -0
- package/dist/world/authoredEntities.d.ts +29 -0
- package/dist/world/authoredEntities.js +29 -0
- package/dist/world/authoredObjects.d.ts +72 -0
- package/dist/world/authoredObjects.js +81 -0
- package/dist/world/authoredSpawn.d.ts +39 -0
- package/dist/world/authoredSpawn.js +37 -0
- package/dist/world/buildSockets.d.ts +152 -0
- package/dist/world/buildSockets.js +188 -0
- package/dist/world/buildingGenerator.d.ts +18 -0
- package/dist/world/buildingGenerator.js +62 -0
- package/dist/world/buildings.d.ts +5 -0
- package/dist/world/buildings.js +5 -0
- package/dist/world/catenary.d.ts +22 -0
- package/dist/world/catenary.js +69 -0
- package/dist/world/cityBlocks.d.ts +152 -0
- package/dist/world/cityBlocks.js +670 -0
- package/dist/world/cityContent.d.ts +77 -0
- package/dist/world/cityContent.js +261 -0
- package/dist/world/cityGeometry.d.ts +114 -0
- package/dist/world/cityGeometry.js +573 -0
- package/dist/world/cityKind.d.ts +314 -0
- package/dist/world/cityKind.js +1578 -0
- package/dist/world/features.d.ts +133 -10
- package/dist/world/features.js +66 -6
- package/dist/world/footprintGrid.d.ts +59 -0
- package/dist/world/footprintGrid.js +141 -0
- package/dist/world/geometry.d.ts +64 -0
- package/dist/world/geometry.js +94 -0
- package/dist/world/grassKind.d.ts +51 -0
- package/dist/world/grassKind.js +101 -0
- package/dist/world/markers.d.ts +50 -4
- package/dist/world/markers.js +49 -0
- package/dist/world/massing.js +1 -1
- package/dist/world/minimapBake.d.ts +78 -0
- package/dist/world/minimapBake.js +208 -0
- package/dist/world/minimapTrack.d.ts +17 -0
- package/dist/world/minimapTrack.js +22 -0
- package/dist/world/pathInstances.d.ts +27 -0
- package/dist/world/pathInstances.js +27 -0
- package/dist/world/pathNetwork.d.ts +159 -0
- package/dist/world/pathNetwork.js +684 -0
- package/dist/world/pathTerrain.d.ts +80 -0
- package/dist/world/pathTerrain.js +142 -0
- package/dist/world/place.d.ts +166 -0
- package/dist/world/place.js +96 -0
- package/dist/world/placeAsset.d.ts +81 -0
- package/dist/world/placeAsset.js +79 -0
- package/dist/world/placement.d.ts +4 -0
- package/dist/world/placement.js +4 -0
- package/dist/world/placementController.d.ts +6 -0
- package/dist/world/placementController.js +6 -0
- package/dist/world/poleLineKind.d.ts +40 -0
- package/dist/world/poleLineKind.js +97 -0
- package/dist/world/polyline.d.ts +34 -0
- package/dist/world/polyline.js +88 -0
- package/dist/world/resourceNode.d.ts +109 -0
- package/dist/world/resourceNode.js +140 -0
- package/dist/world/roads.d.ts +8 -0
- package/dist/world/roads.js +38 -0
- package/dist/world/scatter.js +2 -20
- package/dist/world/scatterRegion.d.ts +164 -0
- package/dist/world/scatterRegion.js +409 -0
- package/dist/world/sceneShapes.d.ts +43 -0
- package/dist/world/sceneShapes.js +1 -0
- package/dist/world/segment.d.ts +27 -0
- package/dist/world/segment.js +43 -0
- package/dist/world/soilKind.d.ts +48 -0
- package/dist/world/soilKind.js +92 -0
- package/dist/world/spatialSample.d.ts +241 -0
- package/dist/world/spatialSample.js +465 -0
- package/dist/world/streets.d.ts +29 -0
- package/dist/world/streets.js +55 -0
- package/dist/world/terraform.d.ts +213 -1
- package/dist/world/terraform.js +627 -22
- package/dist/world/terrain.d.ts +164 -20
- package/dist/world/terrain.js +325 -41
- package/dist/world/terrainGuides.d.ts +182 -0
- package/dist/world/terrainGuides.js +343 -0
- package/dist/world/vec2.d.ts +81 -0
- package/dist/world/vec2.js +128 -0
- package/dist/world/vec3.d.ts +49 -0
- package/dist/world/vec3.js +76 -0
- package/dist/world/vegetation.d.ts +71 -0
- package/dist/world/vegetation.js +151 -0
- package/dist/world/visibilityField.d.ts +154 -0
- package/dist/world/visibilityField.js +271 -0
- package/dist/world/volumetricClouds.d.ts +52 -0
- package/dist/world/volumetricClouds.js +43 -0
- package/dist/world/walls.d.ts +9 -0
- package/dist/world/walls.js +9 -0
- package/dist/world/waterKind.d.ts +55 -0
- package/dist/world/waterKind.js +99 -0
- package/dist/world.d.ts +141 -0
- package/dist/world.js +141 -0
- package/package.json +32 -8
- package/skills/game-design/SKILL.md +28 -0
- package/skills/game-design/agents/openai.yaml +4 -0
- package/skills/game-design/references/application-playbook.md +170 -0
- package/skills/game-design/references/field-guide.md +288 -0
- package/skills/jgengine/SKILL.md +54 -0
- package/skills/jgengine/api.md +527 -0
- package/skills/jgengine/capabilities.md +131 -0
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-combat/SKILL.md +38 -0
- package/skills/jgengine-combat/api.md +585 -0
- package/skills/jgengine-combat/capabilities.md +213 -0
- package/skills/jgengine-combat/recipes/portable-stat-pools.md +122 -0
- package/skills/jgengine-combat/reference.md +108 -0
- package/skills/jgengine-gameplay/SKILL.md +39 -0
- package/skills/jgengine-gameplay/api.md +1920 -0
- package/skills/jgengine-gameplay/capabilities.md +454 -0
- package/skills/jgengine-gameplay/reference-systems.md +56 -0
- package/skills/jgengine-world/SKILL.md +51 -0
- package/skills/jgengine-world/api.md +3056 -0
- package/skills/jgengine-world/capabilities.md +476 -0
- package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
- package/skills/jgengine-world/reference.md +261 -0
- package/dist/cartridge/runtime.d.ts +0 -15
- package/dist/cartridge/runtime.js +0 -556
- package/dist/cartridge/spec.d.ts +0 -188
- package/dist/cartridge/spec.js +0 -19
- package/dist/cartridge/validate.d.ts +0 -2
- package/dist/cartridge/validate.js +0 -78
- package/dist/store/engineStore.d.ts +0 -22
- package/dist/store/engineStore.js +0 -50
- package/dist/store/features.d.ts +0 -10
- package/dist/store/features.js +0 -23
- package/llms.txt +0 -5389
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { pickUniform, pickWeighted } from "../random/pick.js";
|
|
2
|
+
function makeChoicesView(chosen) {
|
|
3
|
+
const find = (step) => {
|
|
4
|
+
for (const c of chosen)
|
|
5
|
+
if (c.step === step && !c.skipped)
|
|
6
|
+
return c;
|
|
7
|
+
return undefined;
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
has: (step) => find(step) !== undefined,
|
|
11
|
+
optionId: (step) => find(step)?.optionId,
|
|
12
|
+
value: (step) => find(step)?.value,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function poolFor(pool, choices) {
|
|
16
|
+
return typeof pool === "function" ? pool(choices) : pool;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Run a caller-defined {@link GenSchema} against an injected `rng` into a deterministic, serializable
|
|
20
|
+
* {@link GenResult} with full provenance. Composes weighted/uniform choice, dependent choice,
|
|
21
|
+
* constraints with bounded backtracking, field transforms, and validation reroll over plain data —
|
|
22
|
+
* the generic seam procedural loot, affix, and modular-part rollers assemble on. Identical schema,
|
|
23
|
+
* seed, and pins reproduce an identical result across server/client and save/load.
|
|
24
|
+
*
|
|
25
|
+
* @capability item-generation compose constraints, weighted pools, transforms, and provenance into a deterministic generated item
|
|
26
|
+
*/
|
|
27
|
+
export function generate(schema, rng, options = {}) {
|
|
28
|
+
const maxAttempts = schema.maxAttempts ?? 24;
|
|
29
|
+
const maxPicks = schema.maxPicks ?? 1024;
|
|
30
|
+
const pin = options.pin;
|
|
31
|
+
let lastReason = "unsatisfiable";
|
|
32
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
33
|
+
const chosen = [];
|
|
34
|
+
const view = makeChoicesView(chosen);
|
|
35
|
+
let picks = 0;
|
|
36
|
+
const weightGetter = (step) => (option) => step.weightOf !== undefined ? step.weightOf(option, view) : option.weight ?? 1;
|
|
37
|
+
const solve = (index) => {
|
|
38
|
+
if (index >= schema.steps.length)
|
|
39
|
+
return true;
|
|
40
|
+
const step = schema.steps[index];
|
|
41
|
+
const pinId = pin?.[step.id];
|
|
42
|
+
if (pinId !== undefined) {
|
|
43
|
+
const option = poolFor(step.pool, view).find((candidate) => candidate.id === pinId);
|
|
44
|
+
if (option === undefined)
|
|
45
|
+
return false;
|
|
46
|
+
chosen.push({
|
|
47
|
+
step: step.id,
|
|
48
|
+
optionId: option.id,
|
|
49
|
+
value: option.value,
|
|
50
|
+
weight: weightGetter(step)(option),
|
|
51
|
+
eligible: 1,
|
|
52
|
+
rerolls: 0,
|
|
53
|
+
skipped: false,
|
|
54
|
+
});
|
|
55
|
+
if (solve(index + 1))
|
|
56
|
+
return true;
|
|
57
|
+
chosen.pop();
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const accept = step.accept;
|
|
61
|
+
let remaining = poolFor(step.pool, view).filter((option) => accept === undefined || accept(option, view));
|
|
62
|
+
const eligibleCount = remaining.length;
|
|
63
|
+
if (eligibleCount === 0) {
|
|
64
|
+
if (step.optional !== true)
|
|
65
|
+
return false;
|
|
66
|
+
chosen.push({ step: step.id, optionId: "", value: undefined, weight: 0, eligible: 0, rerolls: 0, skipped: true });
|
|
67
|
+
if (solve(index + 1))
|
|
68
|
+
return true;
|
|
69
|
+
chosen.pop();
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
let tried = 0;
|
|
73
|
+
while (remaining.length > 0) {
|
|
74
|
+
if (picks >= maxPicks)
|
|
75
|
+
return false;
|
|
76
|
+
picks += 1;
|
|
77
|
+
const picked = step.select === "uniform"
|
|
78
|
+
? pickUniform(rng, remaining)
|
|
79
|
+
: pickWeighted(rng, remaining, weightGetter(step));
|
|
80
|
+
if (picked === undefined)
|
|
81
|
+
return false;
|
|
82
|
+
chosen.push({
|
|
83
|
+
step: step.id,
|
|
84
|
+
optionId: picked.id,
|
|
85
|
+
value: picked.value,
|
|
86
|
+
weight: weightGetter(step)(picked),
|
|
87
|
+
eligible: eligibleCount,
|
|
88
|
+
rerolls: tried,
|
|
89
|
+
skipped: false,
|
|
90
|
+
});
|
|
91
|
+
if (solve(index + 1))
|
|
92
|
+
return true;
|
|
93
|
+
chosen.pop();
|
|
94
|
+
remaining = remaining.filter((option) => option !== picked);
|
|
95
|
+
tried += 1;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
if (!solve(0)) {
|
|
100
|
+
lastReason = "unsatisfiable";
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const choices = {};
|
|
104
|
+
const values = {};
|
|
105
|
+
const choiceRecords = [];
|
|
106
|
+
for (const entry of chosen) {
|
|
107
|
+
choiceRecords.push({
|
|
108
|
+
step: entry.step,
|
|
109
|
+
optionId: entry.optionId,
|
|
110
|
+
weight: entry.weight,
|
|
111
|
+
eligible: entry.eligible,
|
|
112
|
+
rerolls: entry.rerolls,
|
|
113
|
+
});
|
|
114
|
+
if (entry.skipped)
|
|
115
|
+
continue;
|
|
116
|
+
choices[entry.step] = entry.optionId;
|
|
117
|
+
values[entry.step] = entry.value;
|
|
118
|
+
}
|
|
119
|
+
const fields = {};
|
|
120
|
+
const fieldRecords = [];
|
|
121
|
+
const record = (transform, op, field, from, to, note) => {
|
|
122
|
+
fields[field] = to;
|
|
123
|
+
const entry = { transform, field, op, from, to };
|
|
124
|
+
if (note !== undefined)
|
|
125
|
+
entry.note = note;
|
|
126
|
+
fieldRecords.push(entry);
|
|
127
|
+
};
|
|
128
|
+
for (const transform of schema.transforms ?? []) {
|
|
129
|
+
const api = {
|
|
130
|
+
choices: view,
|
|
131
|
+
rng,
|
|
132
|
+
get: (field) => fields[field] ?? 0,
|
|
133
|
+
set: (field, value, note) => record(transform.id, "set", field, fields[field] ?? 0, value, note),
|
|
134
|
+
add: (field, amount, note) => record(transform.id, "add", field, fields[field] ?? 0, (fields[field] ?? 0) + amount, note),
|
|
135
|
+
mul: (field, factor, note) => record(transform.id, "mul", field, fields[field] ?? 0, (fields[field] ?? 0) * factor, note),
|
|
136
|
+
};
|
|
137
|
+
transform.apply(api);
|
|
138
|
+
}
|
|
139
|
+
const draft = { choices, values, fields };
|
|
140
|
+
const validators = schema.validate ?? [];
|
|
141
|
+
if (!validators.every((validate) => validate(draft))) {
|
|
142
|
+
lastReason = "rejected";
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
ok: true,
|
|
147
|
+
result: { choices, values, fields, provenance: { attempts: attempt, choices: choiceRecords, fields: fieldRecords } },
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return { ok: false, reason: lastReason, attempts: maxAttempts };
|
|
151
|
+
}
|
|
@@ -26,6 +26,11 @@ export type InstallResult = {
|
|
|
26
26
|
reason: "unknown-slot" | "wrong-category" | "slot-occupied";
|
|
27
27
|
};
|
|
28
28
|
export declare function slotById(def: ModularItemDef, slotId: string): MountSlotDef | null;
|
|
29
|
+
/**
|
|
30
|
+
* Attach parts into an item's mount slots and resolve the combined stats.
|
|
31
|
+
*
|
|
32
|
+
* @capability modular-item attach parts into item mount slots to compute combined stats
|
|
33
|
+
*/
|
|
29
34
|
export declare function slotAccepts(slot: MountSlotDef, category: string): boolean;
|
|
30
35
|
export declare function install(def: ModularItemDef, installed: readonly InstalledPart[], slotId: string, part: PartDef): InstallResult;
|
|
31
36
|
export declare function uninstall(installed: readonly InstalledPart[], slotId: string): readonly InstalledPart[];
|
package/dist/item/modularItem.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export function slotById(def, slotId) {
|
|
2
2
|
return def.slots.find((s) => s.id === slotId) ?? null;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Attach parts into an item's mount slots and resolve the combined stats.
|
|
6
|
+
*
|
|
7
|
+
* @capability modular-item attach parts into item mount slots to compute combined stats
|
|
8
|
+
*/
|
|
4
9
|
export function slotAccepts(slot, category) {
|
|
5
10
|
return typeof slot.accepts === "string" ? slot.accepts === category : slot.accepts.includes(category);
|
|
6
11
|
}
|
package/dist/item/use.d.ts
CHANGED
|
@@ -22,4 +22,9 @@ export interface ItemUse<TState> {
|
|
|
22
22
|
can(state: TState, input: ItemUseInput): ItemUseRejection | null;
|
|
23
23
|
use(state: TState, input: ItemUseInput): ItemUseResult<TState>;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Use or consume items, applying their effects and per-item cooldowns.
|
|
27
|
+
*
|
|
28
|
+
* @capability consumables use/consume items with cooldowns and effects
|
|
29
|
+
*/
|
|
25
30
|
export declare function createItemUse<TState>(resolveUse: (itemId: string) => string | null | undefined): ItemUse<TState>;
|
package/dist/item/use.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use or consume items, applying their effects and per-item cooldowns.
|
|
3
|
+
*
|
|
4
|
+
* @capability consumables use/consume items with cooldowns and effects
|
|
5
|
+
*/
|
|
1
6
|
export function createItemUse(resolveUse) {
|
|
2
7
|
const handlers = new Map();
|
|
3
8
|
function resolveHandler(itemId) {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { ItemUseInput } from "./use.js";
|
|
2
|
+
/**
|
|
3
|
+
* Per-behavior configuration stored on an item as plain data (e.g. charge time,
|
|
4
|
+
* projectile id). Kept opaque here so no game noun leaks into item core.
|
|
5
|
+
*/
|
|
6
|
+
export type BehaviorConfig = Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* A single behavior's mutable, serializable runtime state (e.g. current charge,
|
|
9
|
+
* rounds queued). Composed state is a map of these keyed by behavior id.
|
|
10
|
+
*/
|
|
11
|
+
export type BehaviorState = Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* A serialized snapshot of every behavior's state on one item, keyed by
|
|
14
|
+
* behavior id. Round-trips through JSON so it can live in a saved game.
|
|
15
|
+
*/
|
|
16
|
+
export type SerializedBehaviorState = Record<string, BehaviorState>;
|
|
17
|
+
/**
|
|
18
|
+
* The reference an item stores for one composed behavior: a stable behavior id,
|
|
19
|
+
* optional config, and an optional order override. Pure data — the item core
|
|
20
|
+
* never holds the implementation, only this reference.
|
|
21
|
+
*/
|
|
22
|
+
export interface UseBehaviorRef {
|
|
23
|
+
id: string;
|
|
24
|
+
config?: BehaviorConfig;
|
|
25
|
+
order?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The context handed to each behavior hook: the shared folded `world`, this
|
|
29
|
+
* behavior's own `config` and `state` slice, and the triggering use input.
|
|
30
|
+
*/
|
|
31
|
+
export interface UseBehaviorContext<TWorld> {
|
|
32
|
+
world: TWorld;
|
|
33
|
+
config: BehaviorConfig;
|
|
34
|
+
state: BehaviorState;
|
|
35
|
+
input: ItemUseInput;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The result of applying one behavior: the (possibly advanced) world, this
|
|
39
|
+
* behavior's updated state, an optional error that aborts the chain, and an
|
|
40
|
+
* optional `stop` that ends the chain after a successful apply.
|
|
41
|
+
*/
|
|
42
|
+
export interface UseBehaviorOutcome<TWorld> {
|
|
43
|
+
world: TWorld;
|
|
44
|
+
state?: BehaviorState;
|
|
45
|
+
error?: string;
|
|
46
|
+
stop?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** A reason a behavior refused a use, surfaced from `can`. */
|
|
49
|
+
export interface UseBehaviorRejection {
|
|
50
|
+
reason: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A registered behavior implementation. The combat/game side registers these
|
|
54
|
+
* (charge, thrown-reload, projectile-replacement, …); the item core only ever
|
|
55
|
+
* stores a {@link UseBehaviorRef} to one by id. Hooks are the lifecycle: `init`
|
|
56
|
+
* builds serializable state, `can` gates, `apply` folds the world.
|
|
57
|
+
*/
|
|
58
|
+
export interface UseBehaviorDef<TWorld> {
|
|
59
|
+
id: string;
|
|
60
|
+
/** Lower runs first; ties break on the item's ref order. Default 0. */
|
|
61
|
+
order?: number;
|
|
62
|
+
/** Capability tokens the host must supply at compose time for this behavior. */
|
|
63
|
+
requires?: readonly string[];
|
|
64
|
+
/** Behavior ids that cannot coexist with this one on the same item. */
|
|
65
|
+
conflicts?: readonly string[];
|
|
66
|
+
/** Build initial serializable state from config; defaults to an empty object. */
|
|
67
|
+
init?(config: BehaviorConfig): BehaviorState;
|
|
68
|
+
/** Gate the use before applying; return a rejection or null to allow. */
|
|
69
|
+
can?(ctx: UseBehaviorContext<TWorld>): UseBehaviorRejection | null;
|
|
70
|
+
/** Apply the behavior, folding the shared world and this behavior's state. */
|
|
71
|
+
apply(ctx: UseBehaviorContext<TWorld>): UseBehaviorOutcome<TWorld>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A resolved, ordered composition of behaviors for one item. Dispatch is
|
|
75
|
+
* transactional: `apply` commits the folded world only if every behavior in the
|
|
76
|
+
* chain succeeds, otherwise it returns the original world and state plus the
|
|
77
|
+
* first error.
|
|
78
|
+
*/
|
|
79
|
+
export interface ComposedUse<TWorld> {
|
|
80
|
+
/** The resolved run order as behavior ids. */
|
|
81
|
+
order(): readonly string[];
|
|
82
|
+
/** Fresh per-behavior state for a new item instance, keyed by behavior id. */
|
|
83
|
+
initialState(): SerializedBehaviorState;
|
|
84
|
+
/** First rejection across behaviors (in order), or null if all allow the use. */
|
|
85
|
+
can(world: TWorld, state: SerializedBehaviorState, input: ItemUseInput): UseBehaviorRejection | null;
|
|
86
|
+
/** Run the chain in order; commit folded world+state only on full success. */
|
|
87
|
+
apply(world: TWorld, state: SerializedBehaviorState, input: ItemUseInput): {
|
|
88
|
+
world: TWorld;
|
|
89
|
+
state: SerializedBehaviorState;
|
|
90
|
+
error?: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The outcome of composing an item's behavior refs: either a ready
|
|
95
|
+
* {@link ComposedUse} or a structured error naming the offending behavior.
|
|
96
|
+
*/
|
|
97
|
+
export type CompositionResult<TWorld> = {
|
|
98
|
+
status: "ok";
|
|
99
|
+
composed: ComposedUse<TWorld>;
|
|
100
|
+
} | {
|
|
101
|
+
status: "error";
|
|
102
|
+
reason: "unknown-behavior";
|
|
103
|
+
id: string;
|
|
104
|
+
} | {
|
|
105
|
+
status: "error";
|
|
106
|
+
reason: "duplicate-behavior";
|
|
107
|
+
id: string;
|
|
108
|
+
} | {
|
|
109
|
+
status: "error";
|
|
110
|
+
reason: "missing-capability";
|
|
111
|
+
id: string;
|
|
112
|
+
capability: string;
|
|
113
|
+
} | {
|
|
114
|
+
status: "error";
|
|
115
|
+
reason: "conflict";
|
|
116
|
+
id: string;
|
|
117
|
+
conflictsWith: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* A registry of use-behavior implementations plus a composer that turns an
|
|
121
|
+
* item's stored refs into an ordered, conflict-checked {@link ComposedUse}.
|
|
122
|
+
*/
|
|
123
|
+
export interface UseBehaviorRegistry<TWorld> {
|
|
124
|
+
/** Register behavior implementations; throws on a duplicate id. */
|
|
125
|
+
register(defs: readonly UseBehaviorDef<TWorld>[]): void;
|
|
126
|
+
has(id: string): boolean;
|
|
127
|
+
get(id: string): UseBehaviorDef<TWorld> | null;
|
|
128
|
+
/** All registered behavior ids, in registration order. */
|
|
129
|
+
ids(): string[];
|
|
130
|
+
/** Resolve an item's refs into a composed dispatcher, or a structured error. */
|
|
131
|
+
compose(refs: readonly UseBehaviorRef[], options?: {
|
|
132
|
+
capabilities?: readonly string[];
|
|
133
|
+
}): CompositionResult<TWorld>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create an empty use-behavior registry. Games register their behaviors, then
|
|
137
|
+
* compose each item's stored refs into a dispatcher whose serializable state
|
|
138
|
+
* lives with the item.
|
|
139
|
+
*
|
|
140
|
+
* @capability item-use-composition compose pluggable, ordered item use-behaviors from serializable references
|
|
141
|
+
*/
|
|
142
|
+
export declare function createUseBehaviorRegistry<TWorld>(): UseBehaviorRegistry<TWorld>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
function orderOf(entry) {
|
|
2
|
+
return entry.ref.order ?? entry.def.order ?? 0;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Create an empty use-behavior registry. Games register their behaviors, then
|
|
6
|
+
* compose each item's stored refs into a dispatcher whose serializable state
|
|
7
|
+
* lives with the item.
|
|
8
|
+
*
|
|
9
|
+
* @capability item-use-composition compose pluggable, ordered item use-behaviors from serializable references
|
|
10
|
+
*/
|
|
11
|
+
export function createUseBehaviorRegistry() {
|
|
12
|
+
const defs = new Map();
|
|
13
|
+
function compose(refs, options) {
|
|
14
|
+
const capabilities = new Set(options?.capabilities ?? []);
|
|
15
|
+
const seen = new Set();
|
|
16
|
+
const resolved = [];
|
|
17
|
+
for (const ref of refs) {
|
|
18
|
+
if (seen.has(ref.id))
|
|
19
|
+
return { status: "error", reason: "duplicate-behavior", id: ref.id };
|
|
20
|
+
seen.add(ref.id);
|
|
21
|
+
const def = defs.get(ref.id);
|
|
22
|
+
if (def === undefined)
|
|
23
|
+
return { status: "error", reason: "unknown-behavior", id: ref.id };
|
|
24
|
+
for (const capability of def.requires ?? []) {
|
|
25
|
+
if (!capabilities.has(capability))
|
|
26
|
+
return { status: "error", reason: "missing-capability", id: ref.id, capability };
|
|
27
|
+
}
|
|
28
|
+
resolved.push({ ref, def });
|
|
29
|
+
}
|
|
30
|
+
for (const { def } of resolved) {
|
|
31
|
+
for (const conflict of def.conflicts ?? []) {
|
|
32
|
+
if (seen.has(conflict))
|
|
33
|
+
return { status: "error", reason: "conflict", id: def.id, conflictsWith: conflict };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const ordered = resolved
|
|
37
|
+
.map((entry, index) => ({ entry, index }))
|
|
38
|
+
.sort((a, b) => orderOf(a.entry) - orderOf(b.entry) || a.index - b.index)
|
|
39
|
+
.map(({ entry }) => entry);
|
|
40
|
+
const composed = {
|
|
41
|
+
order() {
|
|
42
|
+
return ordered.map((entry) => entry.def.id);
|
|
43
|
+
},
|
|
44
|
+
initialState() {
|
|
45
|
+
const state = {};
|
|
46
|
+
for (const entry of ordered)
|
|
47
|
+
state[entry.def.id] = entry.def.init?.(entry.ref.config ?? {}) ?? {};
|
|
48
|
+
return state;
|
|
49
|
+
},
|
|
50
|
+
can(world, state, input) {
|
|
51
|
+
for (const entry of ordered) {
|
|
52
|
+
const rejection = entry.def.can?.({
|
|
53
|
+
world,
|
|
54
|
+
config: entry.ref.config ?? {},
|
|
55
|
+
state: state[entry.def.id] ?? {},
|
|
56
|
+
input,
|
|
57
|
+
});
|
|
58
|
+
if (rejection)
|
|
59
|
+
return rejection;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
},
|
|
63
|
+
apply(world, state, input) {
|
|
64
|
+
let nextWorld = world;
|
|
65
|
+
const nextState = { ...state };
|
|
66
|
+
for (const entry of ordered) {
|
|
67
|
+
const config = entry.ref.config ?? {};
|
|
68
|
+
const ctx = { world: nextWorld, config, state: nextState[entry.def.id] ?? {}, input };
|
|
69
|
+
const rejection = entry.def.can?.(ctx);
|
|
70
|
+
if (rejection)
|
|
71
|
+
return { world, state, error: rejection.reason };
|
|
72
|
+
const outcome = entry.def.apply(ctx);
|
|
73
|
+
if (outcome.error !== undefined)
|
|
74
|
+
return { world, state, error: outcome.error };
|
|
75
|
+
nextWorld = outcome.world;
|
|
76
|
+
if (outcome.state !== undefined)
|
|
77
|
+
nextState[entry.def.id] = outcome.state;
|
|
78
|
+
if (outcome.stop === true)
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
return { world: nextWorld, state: nextState };
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
return { status: "ok", composed };
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
register(newDefs) {
|
|
88
|
+
for (const def of newDefs) {
|
|
89
|
+
if (defs.has(def.id))
|
|
90
|
+
throw new Error(`Use behavior "${def.id}" is already registered.`);
|
|
91
|
+
defs.set(def.id, def);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
has(id) {
|
|
95
|
+
return defs.has(id);
|
|
96
|
+
},
|
|
97
|
+
get(id) {
|
|
98
|
+
return defs.get(id) ?? null;
|
|
99
|
+
},
|
|
100
|
+
ids() {
|
|
101
|
+
return [...defs.keys()];
|
|
102
|
+
},
|
|
103
|
+
compose,
|
|
104
|
+
};
|
|
105
|
+
}
|
package/dist/item/weapon.d.ts
CHANGED
|
@@ -5,4 +5,9 @@ export declare function getWeaponStat(entry: WeaponEntry | null | undefined, sta
|
|
|
5
5
|
export interface WeaponStats {
|
|
6
6
|
getStat(itemId: string, stat: string): number | null;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolve per-weapon stat values — damage, fire rate, spread — for combat math.
|
|
10
|
+
*
|
|
11
|
+
* @capability weapon-stats resolve per-weapon stat values for combat math
|
|
12
|
+
*/
|
|
8
13
|
export declare function createWeaponStats(resolveEntry: (itemId: string) => WeaponEntry | null | undefined): WeaponStats;
|
package/dist/item/weapon.js
CHANGED
|
@@ -9,6 +9,11 @@ export function getWeaponStat(entry, stat) {
|
|
|
9
9
|
}
|
|
10
10
|
return typeof value === "number" ? value : null;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve per-weapon stat values — damage, fire rate, spread — for combat math.
|
|
14
|
+
*
|
|
15
|
+
* @capability weapon-stats resolve per-weapon stat values for combat math
|
|
16
|
+
*/
|
|
12
17
|
export function createWeaponStats(resolveEntry) {
|
|
13
18
|
return {
|
|
14
19
|
getStat(itemId, stat) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { lerp, clamp01, smoothstep } from "../anim/easing.js";
|
|
2
|
+
/** Constrain a value to the inclusive `[min, max]` range.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
6
|
+
/** Fraction of the way `value` sits between `from` and `to`; inverse of `lerp`. Returns 0 when the span is empty.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function inverseLerp(from: number, to: number, value: number): number;
|
|
10
|
+
/** Map `value` from the `[inMin, inMax]` range onto `[outMin, outMax]`, optionally clamped to the output range.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number, clamped?: boolean): number;
|
|
14
|
+
/** Euclidean modulo that always returns a non-negative result in `[0, modulus)`, unlike the `%` operator.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function mod(value: number, modulus: number): number;
|
|
18
|
+
/** Step `current` toward `target` by at most `maxDelta`, without overshooting.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function moveTowards(current: number, target: number, maxDelta: number): number;
|
|
22
|
+
/** Wrap `value` into the half-open range `[min, max)`, cycling past either edge.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare function wrap(value: number, min: number, max: number): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export { lerp, clamp01, smoothstep } from "../anim/easing.js";
|
|
2
|
+
/** Constrain a value to the inclusive `[min, max]` range.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export function clamp(value, min, max) {
|
|
6
|
+
return value < min ? min : value > max ? max : value;
|
|
7
|
+
}
|
|
8
|
+
/** Fraction of the way `value` sits between `from` and `to`; inverse of `lerp`. Returns 0 when the span is empty.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function inverseLerp(from, to, value) {
|
|
12
|
+
return from === to ? 0 : (value - from) / (to - from);
|
|
13
|
+
}
|
|
14
|
+
/** Map `value` from the `[inMin, inMax]` range onto `[outMin, outMax]`, optionally clamped to the output range.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export function remap(value, inMin, inMax, outMin, outMax, clamped = false) {
|
|
18
|
+
const t = inMin === inMax ? 0 : (value - inMin) / (inMax - inMin);
|
|
19
|
+
const mapped = outMin + (outMax - outMin) * t;
|
|
20
|
+
if (!clamped)
|
|
21
|
+
return mapped;
|
|
22
|
+
const lo = Math.min(outMin, outMax);
|
|
23
|
+
const hi = Math.max(outMin, outMax);
|
|
24
|
+
return mapped < lo ? lo : mapped > hi ? hi : mapped;
|
|
25
|
+
}
|
|
26
|
+
/** Euclidean modulo that always returns a non-negative result in `[0, modulus)`, unlike the `%` operator.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export function mod(value, modulus) {
|
|
30
|
+
return ((value % modulus) + modulus) % modulus;
|
|
31
|
+
}
|
|
32
|
+
/** Step `current` toward `target` by at most `maxDelta`, without overshooting.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export function moveTowards(current, target, maxDelta) {
|
|
36
|
+
const diff = target - current;
|
|
37
|
+
if (Math.abs(diff) <= maxDelta)
|
|
38
|
+
return target;
|
|
39
|
+
return current + Math.sign(diff) * maxDelta;
|
|
40
|
+
}
|
|
41
|
+
/** Wrap `value` into the half-open range `[min, max)`, cycling past either edge.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function wrap(value, min, max) {
|
|
45
|
+
const span = max - min;
|
|
46
|
+
return span <= 0 ? min : min + mod(value - min, span);
|
|
47
|
+
}
|
package/dist/meta/changelog.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/** Installed `@jgengine/core` semver — compare against {@link CHANGELOG} keys when migrating. */
|
|
2
|
+
export declare const VERSION = "0.12.0";
|
|
3
|
+
/** One release's migrate steps plus added/changed/removed notes (typed mirror of CHANGELOG.md). */
|
|
2
4
|
export interface ChangelogEntry {
|
|
3
5
|
migrate: readonly string[];
|
|
4
6
|
added: readonly string[];
|
|
5
7
|
changed: readonly string[];
|
|
6
8
|
removed: readonly string[];
|
|
7
9
|
}
|
|
10
|
+
/** Per-version engine changelog keyed by semver string (e.g. `"0.10.0"`). */
|
|
8
11
|
export declare const CHANGELOG: Record<string, ChangelogEntry>;
|
package/dist/meta/changelog.js
CHANGED
|
@@ -1,14 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
/** Installed `@jgengine/core` semver — compare against {@link CHANGELOG} keys when migrating. */
|
|
2
|
+
export const VERSION = "0.12.0";
|
|
3
|
+
/** Per-version engine changelog keyed by semver string (e.g. `"0.10.0"`). */
|
|
2
4
|
export const CHANGELOG = {
|
|
5
|
+
"0.12.0": {
|
|
6
|
+
migrate: [
|
|
7
|
+
"Bump lockstep SDK packages to ^0.12.0: @jgengine/{core,react,ws,node,sql,convex,shell,editor,assets}. CLI jgengine is 0.9.0; @jgengine/github is unchanged.",
|
|
8
|
+
"Author games through defineGame from @jgengine/shell — the single public authoring entry. Core's constructor was renamed defineGame → defineGameDefinition (@jgengine/core/game/defineGame); only hosts and tooling call it. GamePlayer/GamePlayerShell are @internal; GameHost is the documented mount and owns the editor summon (?mode=editor, F2+E, dev save endpoint) — delete per-game editor bootstraps.",
|
|
9
|
+
"Declare worlds with world({ id, ground: { mode, size, surface? }, physics? }) from @jgengine/core/world/place (flat/round/voxel/board). environment() still works as the legacy consumption path for editor-written scene data — nothing required for existing games; author dressing in the editor.",
|
|
10
|
+
],
|
|
11
|
+
added: [
|
|
12
|
+
"world() place API (#1178) — @jgengine/core/world/place: ground mode/size discriminated at type and runtime (flat {x,z} with Infinity, round {radius}, voxel generator domain, board {x,y} cells); ground.surface matter/feel laws; per-place physics over the game default; multiple worlds per game; shell PlaceScene substrate rendering; seeds via seedForPlace.",
|
|
13
|
+
"@jgengine/shell/gameKit — happy-path authoring surface: authoring, mount, stores, systems, authored-scene helpers, HUD primitives, seeded rng.",
|
|
14
|
+
"Portable generic stat pools — @jgengine/core/stats/statPool (bounded named pools: health, energy, heat, ammo…); entity stats rebuilt on them; recipe in skill jgengine-combat.",
|
|
15
|
+
"Auction-house economy primitives (#1086) — @jgengine/core/economy/auctionBook: timed bid auctions, escrowed bids, outbid refunds, optional buyout, anti-snipe extension, settlement with house cut; plus market price history.",
|
|
16
|
+
"Portable minimap marker sources — core world seam for game minimaps; recipe in skill jgengine-ui.",
|
|
17
|
+
"Unified seed-driven path network + city generation v2 (#1103, #1106) — street/block/building dials, zone bands, presets, junction geometry, road-derived parcels; shell renders real intersections, curbs, lane lines, tunnels, bridge decks.",
|
|
18
|
+
"Mesh-accurate hitboxes (#1075), auto-fit colliders from model bounds (#1072), movement obstruction from fitted boxes + compound-box openings (#1077).",
|
|
19
|
+
"Editor overhaul (#1110) — materials/lighting/scripting/animation/multiplayer workspaces, command palette, minimap bake (#1036), GLB thumbnails, hierarchy DnD/keys/context/visibility-lock, multi-select inspector, console RPC, asset drag-place, ortho projection, pivot modes, play chrome.",
|
|
20
|
+
"Editor authoring pipeline — entity definitions and starter catalogs (#1012), Data-tab catalogs/schema fields (#1043), promote authored scene folder to runnable game (#1011), shared trigger primitive with goal/win rules (#1013), asset import rewrites game/assets.ts (#1042).",
|
|
21
|
+
],
|
|
22
|
+
changed: [
|
|
23
|
+
"npx jgengine create scaffolds a thin infinite flat world() place (no more 96m meadow); editor blankWorld drops pre-baked seeded grass — dressing belongs in editor.scene.json.",
|
|
24
|
+
"Environment studio visual-quality pass; grass fields no longer rebuild geometry per frame (#1090).",
|
|
25
|
+
],
|
|
26
|
+
removed: [],
|
|
27
|
+
},
|
|
28
|
+
"0.11.0": {
|
|
29
|
+
migrate: [
|
|
30
|
+
"Bump lockstep SDK packages to ^0.11.0: @jgengine/{core,react,ws,node,sql,convex,shell,editor,assets}. CLI jgengine and @jgengine/github may lag on their own version lines.",
|
|
31
|
+
"Nothing required — classic loop.onTick fan-out still runs after systems. Prefer moving per-frame work into defineGame({ systems: [...] }) with defineSystem (@jgengine/core/game/defineSystem); install a system with feature: \"quest\" (etc.) instead of a redundant features flag.",
|
|
32
|
+
],
|
|
33
|
+
added: [
|
|
34
|
+
"Composable game systems (#842) — defineSystem / compileSystemSchedule / composeGameLoop / installSystems. defineGame({ systems }) is the single authoring path: fixed / frame / interval / event-only / manual ticks, multi-subscribe channels, deterministic stage order + optional before/after/dependsOn, system-owned save / replicate / reset / dispose. Installing a system activates its feature without a separate flag. GameLoop gains optional onReset / onDispose. ctx.game.registerSave / registerReplicate for system modules. Adopters: tower-guard, claudecraft (runtime without a giant tick fan-out).",
|
|
35
|
+
],
|
|
36
|
+
changed: [],
|
|
37
|
+
removed: [],
|
|
38
|
+
},
|
|
3
39
|
"0.10.0": {
|
|
4
40
|
migrate: [
|
|
5
|
-
"Bump
|
|
41
|
+
"Bump lockstep SDK packages to ^0.10.0: @jgengine/{core,react,ws,node,sql,convex,shell,editor,assets}. CLI jgengine and @jgengine/github may lag on their own version lines.",
|
|
6
42
|
"Nothing to change for existing games — the shared mobile-composition system (viewport allocation, region collision, --jg-* viewport vars) is wired automatically by the shell; HudPanels inside a HudCanvas register themselves. Legacy orientation: \"landscape\" | \"portrait\" keeps its advisory dismissible-hint behavior.",
|
|
7
43
|
"Opt a driving/landscape game into the strict gate: replace advisory orientation with the contract form orientation: { mobile: \"landscape-required\" } (rules: any · portrait/landscape advisory · portrait-required/landscape-required · unsupported). In portrait the engine shows a polished RotateDeviceScreen, suppresses input, freezes the sim, and unmounts the HUD/controls until the device is landscape.",
|
|
8
44
|
"Declare HUD intent where useful: HudPanel gains priority (critical/secondary/tertiary), mobileBehavior (hidden unmounts on phones, transient softens collision), allowOverlapWith, and collisionGroup — all optional; omitting them keeps prior behavior.",
|
|
9
45
|
"Mobile validation now also fails on overlap: bun run shoot <game> --device mobile|mobile-landscape|both exits non-zero on forbidden inter-element collisions, naming both regions.",
|
|
10
46
|
],
|
|
11
47
|
added: [
|
|
48
|
+
"Authored behavior triggers — schema'd `on`/`action` meta vocabulary on editor volumes and markers (`registerTriggerAction`, `collectAuthoredTriggers`, `createAuthoredTriggerRuntime`, `pointInVolume` in `@jgengine/core/scene/authoredTriggers` / `@jgengine/core/world`). Games declare typed actions via ParamSchema; the editor inspector renders trigger fields; runtime watches enter/exit/interact and dispatches to handlers. studio-showcase adopts with an announce zone.",
|
|
12
49
|
"Shared mobile layout composition — @jgengine/core/ui/gameLayout (resolveLayoutMode, intersects, overlapArea, detectLayoutCollisions, computeGameplayRect, LayoutRegion, GameViewportLayout) and @jgengine/core/ui/orientation (resolveOrientationRequirement, orientationGateActive, MobileOrientationRule); @jgengine/react adds GameViewportProvider (mounted by the shell), hooks (useGameViewportLayout, useGameLayoutMode, useGameOrientation, useReservedControlZones, useLayoutCollisions, useRegisterLayoutRegion), and a headless RotateDeviceScreen. The provider tracks window.visualViewport, publishes --jg-viewport-*/--jg-visual-viewport-*/--jg-safe-* CSS vars, resolves the explicit layout mode, and detects forbidden region overlaps.",
|
|
13
50
|
"Mandatory orientation contract — PlayableGame.orientation accepts { mobile: <rule> }; landscape-required/portrait-required render an engine-owned rotate gate that blocks gameplay (input suppressed, simulation frozen, HUD/controls unmounted), self-correcting when the device is turned. Reduced-motion and safe-area respected; visualViewport-sized for mobile Safari/PWA.",
|
|
14
51
|
"Reserved touch-control zones — the touch dock registers its joystick / action-cluster / utility rectangles (runtime-measured) as control regions, so HUD placement and collision validation know exactly where controls sit.",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local collision avoidance: nudge a set of circular agents apart so they stop
|
|
3
|
+
* overlapping, kept deliberately separate from route planning so a game can
|
|
4
|
+
* pair it with nav paths, flow fields, direct seek, or vehicle steering. It is a
|
|
5
|
+
* short symmetric relaxation (Jacobi position correction) over a bounded uniform
|
|
6
|
+
* hash grid — each agent only tests the 3×3 cells around it, so cost scales with
|
|
7
|
+
* local density, never O(n²) across the whole world. Corrections are summed per
|
|
8
|
+
* agent and applied after each pass, so the result is order-independent and
|
|
9
|
+
* deterministic for a given agent list. Different radii and per-agent weights
|
|
10
|
+
* (inverse mass; `0` = immovable anchor/obstacle) are honored.
|
|
11
|
+
*/
|
|
12
|
+
import type { Vec2 } from "./formation.js";
|
|
13
|
+
/** A circular agent that avoidance may push on the XZ plane. */
|
|
14
|
+
export interface AvoidanceAgent {
|
|
15
|
+
/** Current XZ position; reassigned in place by {@link resolveLocalAvoidance}. */
|
|
16
|
+
position: Vec2;
|
|
17
|
+
/** Collision radius (world units). */
|
|
18
|
+
radius: number;
|
|
19
|
+
}
|
|
20
|
+
/** Tuning for {@link resolveLocalAvoidance}. */
|
|
21
|
+
export interface LocalAvoidanceOptions {
|
|
22
|
+
/** Relaxation passes; more converges denser packs. Default `2`. */
|
|
23
|
+
iterations?: number;
|
|
24
|
+
/** Fraction of each overlap resolved per pass, `0..1`. Lower is softer/less jittery. Default `1`. */
|
|
25
|
+
strength?: number;
|
|
26
|
+
/** Extra gap enforced beyond the two radii (world units). Default `0`. */
|
|
27
|
+
padding?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Per-agent inverse mass, parallel to the agent list. `0` pins an agent
|
|
30
|
+
* (obstacle/leader); a heavier agent (smaller value) yields less. Omitted or
|
|
31
|
+
* negative entries default to `1`. Two pinned agents never push each other.
|
|
32
|
+
*/
|
|
33
|
+
weights?: readonly number[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve overlaps in `agents` in place and return how many overlapping pairs
|
|
37
|
+
* remained on the final pass (`0` = fully separated). Uses a bounded uniform
|
|
38
|
+
* hash grid sized to the largest agent, so only nearby agents are ever compared.
|
|
39
|
+
* Deterministic: corrections are accumulated then applied per pass, independent
|
|
40
|
+
* of agent order. Pass `weights` to pin or differentially push agents.
|
|
41
|
+
*
|
|
42
|
+
* @capability local-avoidance bounded deterministic local collision avoidance for moving agents
|
|
43
|
+
* @consumer squad/crowd movement — keep grouped agents from overlapping without a whole-world scan
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveLocalAvoidance(agents: AvoidanceAgent[], options?: LocalAvoidanceOptions): number;
|