@jgengine/core 0.11.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.
Files changed (219) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/ai/populationDirector.d.ts +103 -0
  3. package/dist/ai/populationDirector.js +190 -0
  4. package/dist/ai/pursuit.d.ts +56 -0
  5. package/dist/ai/pursuit.js +53 -0
  6. package/dist/authoring.d.ts +1 -1
  7. package/dist/authoring.js +1 -1
  8. package/dist/combat.d.ts +1 -0
  9. package/dist/combat.js +1 -0
  10. package/dist/devtools/controls.d.ts +38 -0
  11. package/dist/devtools/controls.js +181 -0
  12. package/dist/devtools/devtools.d.ts +5 -197
  13. package/dist/devtools/devtools.js +38 -774
  14. package/dist/devtools/discover.d.ts +32 -0
  15. package/dist/devtools/discover.js +240 -0
  16. package/dist/devtools/fallbackSeams.d.ts +50 -0
  17. package/dist/devtools/fallbackSeams.js +111 -0
  18. package/dist/devtools/frame.d.ts +15 -0
  19. package/dist/devtools/frame.js +247 -0
  20. package/dist/devtools/logs.d.ts +15 -0
  21. package/dist/devtools/logs.js +86 -0
  22. package/dist/devtools/overrides.d.ts +16 -0
  23. package/dist/devtools/overrides.js +66 -0
  24. package/dist/devtools/types.d.ts +212 -0
  25. package/dist/devtools/types.js +1 -0
  26. package/dist/economy/auctionBook.d.ts +122 -0
  27. package/dist/economy/auctionBook.js +213 -0
  28. package/dist/economy/priceHistory.d.ts +44 -0
  29. package/dist/economy/priceHistory.js +89 -0
  30. package/dist/economy/unlockPoints.d.ts +92 -0
  31. package/dist/economy/unlockPoints.js +103 -0
  32. package/dist/editor/commandApply.d.ts +5 -0
  33. package/dist/editor/commandApply.js +755 -0
  34. package/dist/editor/commands.d.ts +48 -3
  35. package/dist/editor/commands.js +40 -754
  36. package/dist/editor/directives.d.ts +94 -0
  37. package/dist/editor/directives.js +206 -0
  38. package/dist/editor/document.d.ts +37 -2
  39. package/dist/editor/document.js +422 -6
  40. package/dist/editor/entityCatalog.d.ts +42 -0
  41. package/dist/editor/entityCatalog.js +101 -0
  42. package/dist/editor/environment.d.ts +74 -0
  43. package/dist/editor/environment.js +169 -0
  44. package/dist/editor/index.d.ts +26 -1
  45. package/dist/editor/index.js +8 -1
  46. package/dist/editor/minimap.d.ts +31 -0
  47. package/dist/editor/minimap.js +73 -0
  48. package/dist/editor/streamer.d.ts +66 -0
  49. package/dist/editor/streamer.js +68 -0
  50. package/dist/editor/types.d.ts +143 -0
  51. package/dist/editor/world.d.ts +136 -0
  52. package/dist/editor/world.js +303 -0
  53. package/dist/game/breeding.d.ts +161 -0
  54. package/dist/game/breeding.js +181 -0
  55. package/dist/game/cameraConfig.d.ts +451 -0
  56. package/dist/game/cameraConfig.js +1 -0
  57. package/dist/game/defineGame.d.ts +16 -9
  58. package/dist/game/defineGame.js +14 -6
  59. package/dist/game/defineSystem.d.ts +2 -0
  60. package/dist/game/defineSystem.js +2 -0
  61. package/dist/game/events.d.ts +28 -0
  62. package/dist/game/playableGame.d.ts +34 -435
  63. package/dist/game/playableGame.js +1 -1
  64. package/dist/game/progression.d.ts +35 -0
  65. package/dist/game/progression.js +19 -0
  66. package/dist/game/quest.js +1 -3
  67. package/dist/game/tribe.d.ts +184 -0
  68. package/dist/game/tribe.js +432 -0
  69. package/dist/gameplay.d.ts +3 -1
  70. package/dist/gameplay.js +3 -1
  71. package/dist/inventory/encumbrance.d.ts +69 -0
  72. package/dist/inventory/encumbrance.js +68 -0
  73. package/dist/item/durability.js +1 -3
  74. package/dist/meta/changelog.d.ts +1 -1
  75. package/dist/meta/changelog.js +24 -1
  76. package/dist/movement/movementModel.d.ts +15 -1
  77. package/dist/movement/movementModel.js +33 -15
  78. package/dist/movement/playerMovement.js +102 -2
  79. package/dist/multiplayer/combatSnapshot.js +13 -8
  80. package/dist/multiplayer/presenceModel.d.ts +2 -0
  81. package/dist/multiplayer/presenceModel.js +8 -0
  82. package/dist/physics/drivableVehicle.d.ts +2 -0
  83. package/dist/physics/drivableVehicle.js +1 -1
  84. package/dist/physics/flightDynamics.d.ts +82 -0
  85. package/dist/physics/flightDynamics.js +165 -0
  86. package/dist/physics/gravityField.d.ts +25 -0
  87. package/dist/physics/gravityField.js +41 -0
  88. package/dist/physics/kinematicVehicle.d.ts +87 -0
  89. package/dist/physics/kinematicVehicle.js +193 -11
  90. package/dist/physics/physicsWorld.d.ts +26 -0
  91. package/dist/physics/physicsWorld.js +109 -117
  92. package/dist/physics/vehicleObstacles.d.ts +44 -0
  93. package/dist/physics/vehicleObstacles.js +115 -0
  94. package/dist/random/rng.d.ts +4 -1
  95. package/dist/random/rng.js +4 -1
  96. package/dist/runtime/adapter.d.ts +13 -0
  97. package/dist/runtime/adapter.js +13 -0
  98. package/dist/runtime/context/combat.d.ts +51 -0
  99. package/dist/runtime/context/combat.js +130 -0
  100. package/dist/runtime/context/deathLoot.d.ts +30 -0
  101. package/dist/runtime/context/deathLoot.js +39 -0
  102. package/dist/runtime/context/player.d.ts +48 -0
  103. package/dist/runtime/context/player.js +125 -0
  104. package/dist/runtime/context/scene.d.ts +59 -0
  105. package/dist/runtime/context/scene.js +291 -0
  106. package/dist/runtime/context/snapshotCodecs.d.ts +12 -0
  107. package/dist/runtime/context/snapshotCodecs.js +26 -0
  108. package/dist/runtime/descriptors/baseline.js +26 -3
  109. package/dist/runtime/descriptors/features.d.ts +5 -0
  110. package/dist/runtime/descriptors/features.js +20 -2
  111. package/dist/runtime/gameContext.d.ts +2 -428
  112. package/dist/runtime/gameContext.js +88 -501
  113. package/dist/runtime/gameContextTypes.d.ts +467 -0
  114. package/dist/runtime/gameContextTypes.js +1 -0
  115. package/dist/runtime/headlessRunner.d.ts +4 -2
  116. package/dist/runtime/headlessRunner.js +1 -0
  117. package/dist/runtime/hostPolicy.d.ts +51 -0
  118. package/dist/runtime/hostPolicy.js +68 -0
  119. package/dist/runtime/hostedGameRunner.d.ts +3 -1
  120. package/dist/runtime/hostedGameRunner.js +1 -0
  121. package/dist/runtime/hostedWorldSession.d.ts +3 -1
  122. package/dist/runtime/hostedWorldSession.js +1 -0
  123. package/dist/runtime/worldSnapshot.d.ts +13 -1
  124. package/dist/runtime/worldSnapshot.js +15 -3
  125. package/dist/scene/assetCatalog.d.ts +5 -0
  126. package/dist/scene/assetSpace.js +1 -3
  127. package/dist/scene/authoredTriggers.d.ts +50 -0
  128. package/dist/scene/authoredTriggers.js +114 -0
  129. package/dist/scene/builtinSceneKinds.js +8 -3
  130. package/dist/scene/colliders.d.ts +58 -0
  131. package/dist/scene/colliders.js +108 -0
  132. package/dist/scene/collisionMesh.d.ts +94 -0
  133. package/dist/scene/collisionMesh.js +699 -0
  134. package/dist/scene/companion.d.ts +147 -0
  135. package/dist/scene/companion.js +193 -0
  136. package/dist/scene/entityStats.d.ts +7 -9
  137. package/dist/scene/entityStats.js +10 -14
  138. package/dist/scene/sceneKinds.d.ts +16 -0
  139. package/dist/scene/sceneKinds.js +4 -0
  140. package/dist/scene/sceneRaycast.js +15 -0
  141. package/dist/stats/spawnLevelStats.d.ts +110 -0
  142. package/dist/stats/spawnLevelStats.js +140 -0
  143. package/dist/stats/statPool.d.ts +70 -0
  144. package/dist/stats/statPool.js +59 -0
  145. package/dist/store/changeSignal.d.ts +3 -0
  146. package/dist/store/changeSignal.js +2 -0
  147. package/dist/store/observableKeyedStore.d.ts +2 -0
  148. package/dist/store/observableKeyedStore.js +1 -0
  149. package/dist/survival/decayMeter.js +1 -3
  150. package/dist/survival/regionHealth.js +1 -3
  151. package/dist/ui/hudLayout.d.ts +5 -0
  152. package/dist/ui/hudLayout.js +17 -1
  153. package/dist/world/authoredEntities.d.ts +29 -0
  154. package/dist/world/authoredEntities.js +29 -0
  155. package/dist/world/authoredObjects.d.ts +15 -1
  156. package/dist/world/authoredObjects.js +13 -1
  157. package/dist/world/authoredSpawn.d.ts +39 -0
  158. package/dist/world/authoredSpawn.js +37 -0
  159. package/dist/world/buildSockets.d.ts +152 -0
  160. package/dist/world/buildSockets.js +188 -0
  161. package/dist/world/cityBlocks.d.ts +152 -0
  162. package/dist/world/cityBlocks.js +670 -0
  163. package/dist/world/cityContent.d.ts +77 -0
  164. package/dist/world/cityContent.js +261 -0
  165. package/dist/world/cityGeometry.d.ts +114 -0
  166. package/dist/world/cityGeometry.js +573 -0
  167. package/dist/world/cityKind.d.ts +314 -0
  168. package/dist/world/cityKind.js +1578 -0
  169. package/dist/world/features.d.ts +18 -3
  170. package/dist/world/features.js +10 -1
  171. package/dist/world/grassKind.js +2 -2
  172. package/dist/world/markers.d.ts +50 -4
  173. package/dist/world/markers.js +49 -0
  174. package/dist/world/massing.js +1 -1
  175. package/dist/world/minimapBake.d.ts +78 -0
  176. package/dist/world/minimapBake.js +208 -0
  177. package/dist/world/minimapTrack.d.ts +17 -0
  178. package/dist/world/minimapTrack.js +22 -0
  179. package/dist/world/pathNetwork.d.ts +159 -0
  180. package/dist/world/pathNetwork.js +684 -0
  181. package/dist/world/place.d.ts +166 -0
  182. package/dist/world/place.js +96 -0
  183. package/dist/world/placeAsset.js +3 -1
  184. package/dist/world/poleLineKind.d.ts +40 -0
  185. package/dist/world/poleLineKind.js +97 -0
  186. package/dist/world/polyline.js +9 -2
  187. package/dist/world/resourceNode.d.ts +109 -0
  188. package/dist/world/resourceNode.js +140 -0
  189. package/dist/world/scatter.js +2 -20
  190. package/dist/world/streets.d.ts +29 -0
  191. package/dist/world/streets.js +55 -0
  192. package/dist/world/terraform.js +58 -88
  193. package/dist/world/terrain.d.ts +45 -0
  194. package/dist/world/terrain.js +78 -0
  195. package/dist/world.d.ts +14 -5
  196. package/dist/world.js +12 -3
  197. package/package.json +1 -1
  198. package/skills/game-design/SKILL.md +28 -0
  199. package/skills/game-design/agents/openai.yaml +4 -0
  200. package/skills/game-design/references/application-playbook.md +170 -0
  201. package/skills/game-design/references/field-guide.md +288 -0
  202. package/skills/jgengine/SKILL.md +7 -4
  203. package/skills/jgengine/api.md +172 -79
  204. package/skills/jgengine/capabilities.md +104 -2
  205. package/skills/jgengine/recipes/minimal-game.md +88 -0
  206. package/skills/jgengine-combat/SKILL.md +5 -1
  207. package/skills/jgengine-combat/api.md +36 -0
  208. package/skills/jgengine-combat/capabilities.md +44 -0
  209. package/skills/jgengine-combat/recipes/portable-stat-pools.md +122 -0
  210. package/skills/jgengine-combat/reference.md +12 -2
  211. package/skills/jgengine-gameplay/api.md +152 -26
  212. package/skills/jgengine-gameplay/capabilities.md +78 -2
  213. package/skills/jgengine-gameplay/reference-systems.md +1 -5
  214. package/skills/jgengine-world/SKILL.md +13 -0
  215. package/skills/jgengine-world/api.md +419 -15
  216. package/skills/jgengine-world/capabilities.md +108 -2
  217. package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
  218. package/skills/jgengine-world/reference.md +43 -4
  219. package/skills/jgengine/reference-cartridge.md +0 -72
package/dist/world.d.ts CHANGED
@@ -22,7 +22,7 @@ export { assignFormationSlots, boxFormation, circleFormation, facingYaw, lineFor
22
22
  export { createGlideModel } from "./movement/glideModel.js";
23
23
  export { createGrappleSwing } from "./movement/grappleSwing.js";
24
24
  export { createLeaderTrail } from "./movement/leaderTrail.js";
25
- export { MOVEMENT_TUNING } from "./movement/movementModel.js";
25
+ export { MOVEMENT_TUNING, type CollisionObstacle } from "./movement/movementModel.js";
26
26
  export { resolvePlayerMovementTuning, stepPlayerMovement } from "./movement/playerMovement.js";
27
27
  export { POSE_HITBOX, createPoseState, type MovementPose } from "./movement/poseState.js";
28
28
  export { steerYaw } from "./movement/steering.js";
@@ -37,14 +37,17 @@ export { createBuoyantBody } from "./physics/buoyancy.js";
37
37
  export { Carryable, carrySpeedMultiplier } from "./physics/carryable.js";
38
38
  export { createDamageModel } from "./physics/damageZones.js";
39
39
  export { tickDrivableVehicle } from "./physics/drivableVehicle.js";
40
+ export { createAircraftDynamics, type AircraftDynamics, type AircraftKind, type AircraftOptions, type AircraftStep, type AircraftTuning, type FlightControlInput, type FlightControlRates, type FlightVector, } from "./physics/flightDynamics.js";
40
41
  export { ForceVolume, PlatformCarry } from "./physics/forceVolume.js";
41
- export { createKinematicVehicle, type KinematicVehicle, type KinematicVehicleStep, type KinematicVehicleTuning, } from "./physics/kinematicVehicle.js";
42
+ export { combineGravity, pointGravity, uniformGravity, type GravityField, type GravityVector, type PointGravityOptions, } from "./physics/gravityField.js";
43
+ export { createKinematicVehicle, type KinematicChassisTuning, type KinematicDynamicsTuning, type KinematicPowertrainTuning, type KinematicSteeringTuning, type KinematicVehicle, type KinematicVehicleStep, type KinematicVehicleTuning, } from "./physics/kinematicVehicle.js";
42
44
  export { PhysicsWorld, SHAPE_BOX, SHAPE_SPHERE, type AddBodyOptions, type CollisionEvent, type PhysicsStats, } from "./physics/physicsWorld.js";
43
45
  export { createRagdoll } from "./physics/ragdoll.js";
44
46
  export { SpatialGrid } from "./physics/spatialGrid.js";
45
47
  export { StructureGraph, type CollapseEvent, type StructureMaterial } from "./physics/structure.js";
46
48
  export { Glide, Grapple } from "./physics/traversal.js";
47
49
  export { DEFAULT_GRIP_CURVE, createVehicleBody, sampleGripCurve, type GripCurve } from "./physics/vehicleBody.js";
50
+ export { createVehicleObstacleClamp, type VehicleImpact, type VehicleObstacleClamp, } from "./physics/vehicleObstacles.js";
48
51
  export { createAssetCatalog, type AssetCatalog, type ModelAssetRef, type ModelDims } from "./scene/assetCatalog.js";
49
52
  export { partsBounds, registerAssetGenerator, type GeneratedAsset, type GeneratedPart } from "./scene/assetGenerator.js";
50
53
  export { applyRotationPolicy, headingToRotationY, normalizeDegrees, parseAssetSpace, parseRotationPolicy, resolveAnchorOffset, resolveFacingRotationY, rotatedFootprint, rotationYToHeading, snapHeading, toEngineUnits, validateAssetSpace, type AssetAnchor, type AssetSpace, type AssetSpaceIssue, type PlacementRotationPolicy, } from "./scene/assetSpace.js";
@@ -62,7 +65,7 @@ export { MountController, createMountController } from "./scene/mount.js";
62
65
  export { objectVisualScale, type ObjectVisual, type SceneObject } from "./scene/objectStore.js";
63
66
  export { type PaintStroke } from "./scene/paintLayer.js";
64
67
  export { type RosterEntry } from "./scene/roster.js";
65
- export { parseParams, registerSceneKind, type ParamField, type ParamSchema, type ParsedParams, type SceneKindObject, type SceneKindResolveContext, type WeightedParamEntry, } from "./scene/sceneKinds.js";
68
+ export { findSchemaPreset, parseParams, registerSceneKind, type ParamField, type ParamPreset, type ParamSchema, type ParsedParams, type SceneKindObject, type SceneKindResolveContext, type WeightedParamEntry, } from "./scene/sceneKinds.js";
66
69
  export { firstImpact, hitsUntilBlocked, type SceneRaycastApi, type SceneRaycastHit } from "./scene/sceneRaycast.js";
67
70
  export { createSelectionSet, isMarquee, screenRect, selectWithinRect, type ScreenRect, type SelectionSet, } from "./scene/selection.js";
68
71
  export { createSelectionBookmarks, recallSelectionBookmark, type BookmarkRecallMode, type RecallBookmarkOptions, type SelectionBookmarkSnapshot, type SelectionBookmarks, type SelectionPruneResult, } from "./scene/selectionBookmarks.js";
@@ -89,6 +92,9 @@ export { buildingIndex, type BuildingIndex } from "./world/buildingIndex.js";
89
92
  export { type BuildingPaletteOverrides, type BuildingStyle } from "./world/buildings.js";
90
93
  export { CarvableField, VoxelVolume, carvableTerrain, type VoxelMaterial } from "./world/carve.js";
91
94
  export { catenaryCurve, sagCurve } from "./world/catenary.js";
95
+ export { type CityBlockKind } from "./world/cityBlocks.js";
96
+ export { CITY_LOT_CLASSES, CITY_TREE_SPECIES, type CityLotClass, type CityLotPiece, type CityPieceRole, type CityPieceShape, type CityTreeSpecies, type CityZoneBand, type CityZoneProfile, } from "./world/cityContent.js";
97
+ export { CITY_DEFAULTS, CITY_KIND, CITY_SCHEMA, CITY_ZONE_KIND, CITY_ZONE_SCHEMA, resolveCityObject, type CityBlock, type CityBridge, type CityDriveway, type CityHedge, type CityIntersection, type CityLight, type CityLot, type CityParcel, type CityParcelFrontageOut, type CityPark, type CityParking, type CityResolveContext, type CityRules, type CityStreet, type CityTree, type ResolvedCity, } from "./world/cityKind.js";
92
98
  export { snapToNearest, socketWorldPosition, socketsCompatible, worldSockets } from "./world/connectors.js";
93
99
  export { createEnvironmentField, type EnvironmentField, type HeatSource } from "./world/envField.js";
94
100
  export { resolveStructureBuildings, summarizeEnvironment } from "./world/environmentSummary.js";
@@ -100,14 +106,17 @@ export { GRASS_SCHEMA } from "./world/grassKind.js";
100
106
  export { resolveGridInstances } from "./world/gridInstances.js";
101
107
  export { createLodScheduler } from "./world/lod.js";
102
108
  export { mapLayerColor, type MapCellStates, type MapRoute, type MapZone } from "./world/mapLayers.js";
103
- export { DEFAULT_MARKER_KINDS, createMarkerSet, markerKindStyle, type MapMarker, type MarkerKindStyle, type MarkerSet, } from "./world/markers.js";
109
+ export { DEFAULT_MARKER_KINDS, createMarkerSet, createMarkerSource, markerKindStyle, type MapMarker, type MarkerCollection, type MarkerKindStyle, type MarkerSet, type MarkerSource, type MarkerSourceOptions, type MarkerView, } from "./world/markers.js";
104
110
  export { bearingToCardinal, clampToMinimapEdge, compassBearing, headingToBearing, projectToMinimap, relativeBearing, unprojectFromMinimap, type Cardinal, type MinimapView, type WorldXZ, } from "./world/minimap.js";
111
+ export { DEFAULT_MINIMAP_PALETTE, bakeMinimapBackground, bakeMinimapImage, encodeBakePng, minimapBakeToPngDataUri, type MinimapBake, type MinimapBakeBounds, type MinimapBakeOptions, type MinimapBakePalette, type MinimapBakeSource, type MinimapBakeZone, } from "./world/minimapBake.js";
105
112
  export { placeAlongPath } from "./world/pathInstances.js";
106
113
  export { withPathProfiles, type PathHeightPolicy, type PathRetaining, type TerrainPathProfile, } from "./world/pathTerrain.js";
114
+ export { isPlaceWorld, resolveWorldPhysics, seedForPlace, world, type BoardGround, type BoardGroundSize, type FlatGround, type FlatGroundSize, type GroundConfig, type GroundGenerator, type GroundMode, type PlaceConfig, type PlaceWorldFeature, type ResolvedGround, type RoundGround, type RoundGroundSize, type SurfaceLaws, type VoxelGround, type VoxelGroundSize, } from "./world/place.js";
107
115
  export { placeAssetFromCommit, resolvePlaceAsset, toEditorMarker, toStructureInput, type PlaceAssetResult, } from "./world/placeAsset.js";
108
116
  export { createPlacedStructureStore, type PlacedStructure } from "./world/placedStructureStore.js";
109
117
  export { validatePlacement, type PlacementRules } from "./world/placement.js";
110
118
  export { createPlacementController, quarterTurnsToRotationY, type PlacementCommit, type PlacementController, type PlacementPreview, type SnapMode, } from "./world/placementController.js";
119
+ export { POLE_LINE_SCHEMA, resolvePoleLine, type ResolvedPoleLine } from "./world/poleLineKind.js";
111
120
  export { composeRealm } from "./world/realm.js";
112
121
  export { createRegionField, isRegionField, type RegionField } from "./world/regions.js";
113
122
  export { buildRoadRibbon, dashSegments } from "./world/roads.js";
@@ -116,7 +125,7 @@ export { pickWeighted, scatterItems, type ScatterInstance } from "./world/scatte
116
125
  export { SCATTER_PATH_KIND, clearanceZonesFrom, distanceToPolygonEdge, isScatterPath, pointInPolygon, polygonArea, polygonBounds, readScatterPalette, readScatterRules, resolveScatter, resolveScatterRegion, scatterRegionEstimate, scatterRegionFromPath, type ScatterTerrain, } from "./world/scatterRegion.js";
117
126
  export { SOIL_KIND, SOIL_SCHEMA, type SoilRules } from "./world/soilKind.js";
118
127
  export { annulusRegion, boxRegion, customRegion, discRegion, pointSetRegion, polygonRegion, rectRegion, sampleBatch, samplePoint, sampleStratified, shellRegion, sphereRegion, weightedRegion, type AreaDistribution, type FallbackPolicy, type Point3, type RadialDistribution, type SampleBatchOptions, type SampleBatchResult, type SampleConstraints, type SamplePoint, type SamplePointOptions, type SampleReason, type SampleRegion, type SampleResult, type StratifiedOptions, type VolumeDistribution, type WeightedRegionEntry, } from "./world/spatialSample.js";
119
- export { furnitureSpots, laneCenters, offsetPath, parkingSpots, sidewalkPoint, sidewalkWidthOf, } from "./world/streets.js";
128
+ export { distanceToRoadEdge, furnitureSpots, laneCenters, offsetPath, parkingSpots, roadSurfaceSampler, sidewalkPoint, sidewalkWidthOf, type RoadSurfaceOptions, } from "./world/streets.js";
120
129
  export { solveSupport, toDebrisBodies, type SupportResult } from "./world/support.js";
121
130
  export { applyDeltaToSnapshot, applySurfaceDeltaToSnapshot, beginSurfaceStroke, beginTerraformStroke, createEditableTerrain, createTerraformBrush, createTerrainSnapshot, editableTerrainFromSnapshot, migrateTerrainSnapshot, revertDeltaFromSnapshot, revertSurfaceDeltaFromSnapshot, type EditableTerrain, type SurfaceDelta, type SurfaceStroke, type TerraformDelta, type TerraformEdit, type TerraformFalloff, type TerraformMode, type TerraformShape, type TerraformSnapshot, type TerraformStroke, type TerrainMaterialLayer, type TerrainSurfaceRule, } from "./world/terraform.js";
122
131
  export { TERRAIN_MATERIAL_PALETTES, applyPathProfiles, type NoiseFieldConfig, type ResolvedTerrainDetail, type TerrainField, type TerrainPalette, } from "./world/terrain.js";
package/dist/world.js CHANGED
@@ -37,7 +37,9 @@ export { createBuoyantBody } from "./physics/buoyancy.js";
37
37
  export { Carryable, carrySpeedMultiplier } from "./physics/carryable.js";
38
38
  export { createDamageModel } from "./physics/damageZones.js";
39
39
  export { tickDrivableVehicle } from "./physics/drivableVehicle.js";
40
+ export { createAircraftDynamics, } from "./physics/flightDynamics.js";
40
41
  export { ForceVolume, PlatformCarry } from "./physics/forceVolume.js";
42
+ export { combineGravity, pointGravity, uniformGravity, } from "./physics/gravityField.js";
41
43
  export { createKinematicVehicle, } from "./physics/kinematicVehicle.js";
42
44
  export { PhysicsWorld, SHAPE_BOX, SHAPE_SPHERE, } from "./physics/physicsWorld.js";
43
45
  export { createRagdoll } from "./physics/ragdoll.js";
@@ -45,6 +47,7 @@ export { SpatialGrid } from "./physics/spatialGrid.js";
45
47
  export { StructureGraph } from "./physics/structure.js";
46
48
  export { Glide, Grapple } from "./physics/traversal.js";
47
49
  export { DEFAULT_GRIP_CURVE, createVehicleBody, sampleGripCurve } from "./physics/vehicleBody.js";
50
+ export { createVehicleObstacleClamp, } from "./physics/vehicleObstacles.js";
48
51
  export { createAssetCatalog } from "./scene/assetCatalog.js";
49
52
  export { partsBounds, registerAssetGenerator } from "./scene/assetGenerator.js";
50
53
  export { applyRotationPolicy, headingToRotationY, normalizeDegrees, parseAssetSpace, parseRotationPolicy, resolveAnchorOffset, resolveFacingRotationY, rotatedFootprint, rotationYToHeading, snapHeading, toEngineUnits, validateAssetSpace, } from "./scene/assetSpace.js";
@@ -62,7 +65,7 @@ export { MountController, createMountController } from "./scene/mount.js";
62
65
  export { objectVisualScale } from "./scene/objectStore.js";
63
66
  export {} from "./scene/paintLayer.js";
64
67
  export {} from "./scene/roster.js";
65
- export { parseParams, registerSceneKind, } from "./scene/sceneKinds.js";
68
+ export { findSchemaPreset, parseParams, registerSceneKind, } from "./scene/sceneKinds.js";
66
69
  export { firstImpact, hitsUntilBlocked } from "./scene/sceneRaycast.js";
67
70
  export { createSelectionSet, isMarquee, screenRect, selectWithinRect, } from "./scene/selection.js";
68
71
  export { createSelectionBookmarks, recallSelectionBookmark, } from "./scene/selectionBookmarks.js";
@@ -89,6 +92,9 @@ export { buildingIndex } from "./world/buildingIndex.js";
89
92
  export {} from "./world/buildings.js";
90
93
  export { CarvableField, VoxelVolume, carvableTerrain } from "./world/carve.js";
91
94
  export { catenaryCurve, sagCurve } from "./world/catenary.js";
95
+ export {} from "./world/cityBlocks.js";
96
+ export { CITY_LOT_CLASSES, CITY_TREE_SPECIES, } from "./world/cityContent.js";
97
+ export { CITY_DEFAULTS, CITY_KIND, CITY_SCHEMA, CITY_ZONE_KIND, CITY_ZONE_SCHEMA, resolveCityObject, } from "./world/cityKind.js";
92
98
  export { snapToNearest, socketWorldPosition, socketsCompatible, worldSockets } from "./world/connectors.js";
93
99
  export { createEnvironmentField } from "./world/envField.js";
94
100
  export { resolveStructureBuildings, summarizeEnvironment } from "./world/environmentSummary.js";
@@ -100,14 +106,17 @@ export { GRASS_SCHEMA } from "./world/grassKind.js";
100
106
  export { resolveGridInstances } from "./world/gridInstances.js";
101
107
  export { createLodScheduler } from "./world/lod.js";
102
108
  export { mapLayerColor } from "./world/mapLayers.js";
103
- export { DEFAULT_MARKER_KINDS, createMarkerSet, markerKindStyle, } from "./world/markers.js";
109
+ export { DEFAULT_MARKER_KINDS, createMarkerSet, createMarkerSource, markerKindStyle, } from "./world/markers.js";
104
110
  export { bearingToCardinal, clampToMinimapEdge, compassBearing, headingToBearing, projectToMinimap, relativeBearing, unprojectFromMinimap, } from "./world/minimap.js";
111
+ export { DEFAULT_MINIMAP_PALETTE, bakeMinimapBackground, bakeMinimapImage, encodeBakePng, minimapBakeToPngDataUri, } from "./world/minimapBake.js";
105
112
  export { placeAlongPath } from "./world/pathInstances.js";
106
113
  export { withPathProfiles, } from "./world/pathTerrain.js";
114
+ export { isPlaceWorld, resolveWorldPhysics, seedForPlace, world, } from "./world/place.js";
107
115
  export { placeAssetFromCommit, resolvePlaceAsset, toEditorMarker, toStructureInput, } from "./world/placeAsset.js";
108
116
  export { createPlacedStructureStore } from "./world/placedStructureStore.js";
109
117
  export { validatePlacement } from "./world/placement.js";
110
118
  export { createPlacementController, quarterTurnsToRotationY, } from "./world/placementController.js";
119
+ export { POLE_LINE_SCHEMA, resolvePoleLine } from "./world/poleLineKind.js";
111
120
  export { composeRealm } from "./world/realm.js";
112
121
  export { createRegionField, isRegionField } from "./world/regions.js";
113
122
  export { buildRoadRibbon, dashSegments } from "./world/roads.js";
@@ -116,7 +125,7 @@ export { pickWeighted, scatterItems } from "./world/scatterItems.js";
116
125
  export { SCATTER_PATH_KIND, clearanceZonesFrom, distanceToPolygonEdge, isScatterPath, pointInPolygon, polygonArea, polygonBounds, readScatterPalette, readScatterRules, resolveScatter, resolveScatterRegion, scatterRegionEstimate, scatterRegionFromPath, } from "./world/scatterRegion.js";
117
126
  export { SOIL_KIND, SOIL_SCHEMA } from "./world/soilKind.js";
118
127
  export { annulusRegion, boxRegion, customRegion, discRegion, pointSetRegion, polygonRegion, rectRegion, sampleBatch, samplePoint, sampleStratified, shellRegion, sphereRegion, weightedRegion, } from "./world/spatialSample.js";
119
- export { furnitureSpots, laneCenters, offsetPath, parkingSpots, sidewalkPoint, sidewalkWidthOf, } from "./world/streets.js";
128
+ export { distanceToRoadEdge, furnitureSpots, laneCenters, offsetPath, parkingSpots, roadSurfaceSampler, sidewalkPoint, sidewalkWidthOf, } from "./world/streets.js";
120
129
  export { solveSupport, toDebrisBodies } from "./world/support.js";
121
130
  export { applyDeltaToSnapshot, applySurfaceDeltaToSnapshot, beginSurfaceStroke, beginTerraformStroke, createEditableTerrain, createTerraformBrush, createTerrainSnapshot, editableTerrainFromSnapshot, migrateTerrainSnapshot, revertDeltaFromSnapshot, revertSurfaceDeltaFromSnapshot, } from "./world/terraform.js";
122
131
  export { TERRAIN_MATERIAL_PALETTES, applyPathProfiles, } from "./world/terrain.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jgengine/core",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "jgengine core — agent-first game framework SDK (npm @jgengine/core). Entity stores, commands, combat, inventory, multiplayer seams. Zero dependencies. Not an ECS. https://jgengine.com",
5
5
  "keywords": [
6
6
  "jgengine",
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: game-design
3
+ description: Design, audit, implement, and validate player experience, loops, systems, progression, and balance.
4
+ ---
5
+
6
+ # Game design
7
+
8
+ ## Ownership
9
+
10
+ Own the intended player experience and the rules that produce it: fantasy, pillars, verbs, decisions, feedback, loops, resources, progression, challenge, failure, onboarding, and social dynamics. Treat design claims as hypotheses proved by play, not a feature inventory or genre imitation — no genre kits, presets, or archetypes; every game is a custom composition of needs (see [AGENTS.md](../../../AGENTS.md)).
11
+
12
+ Use `level-design` for spatial realization; route implementation to `jgengine-gameplay`, `jgengine-world`, `jgengine-combat`, `jgengine-ui`, `jgengine-multiplayer` once intent is coherent.
13
+
14
+ Read [references/application-playbook.md](references/application-playbook.md) only when the task explicitly calls for design depth — a design brief, a redesign, or "make this fun/better" work; it is not a mandatory step of creating a game. Read [references/field-guide.md](references/field-guide.md) when the task needs deeper loop, economy, progression, genre, accessibility, or research guidance.
15
+
16
+ ## Choose the mode
17
+
18
+ Greenfield: produce a vertical-slice contract (promise, pillars, core decision, loops, progression, failure/recovery) and build the smallest slice testing the riskiest assumption — see playbook §1. Existing game: reconstruct what it actually does from code and play, rank root problems by impact/confidence/reach/effort — see playbook §2.
19
+
20
+ “Improve with game design” is an implementation request, not just an audit: select the highest-leverage intervention, implement it through shared engine seams, and prove the changed player behavior.
21
+
22
+ ## Required output contract
23
+
24
+ Every design pass yields an observed journey, a north star (promise, pillars, anti-pillars, core decision), a loop/flow model, a ranked bottleneck list with cited evidence, an intervention stack, a chosen design slice, and acceptance evidence. See [references/application-playbook.md](references/application-playbook.md) for the full contract and execution rules (verb->feedback->consequence chains, loop/progression/challenge discipline, upstream ownership).
25
+
26
+ ## Completion
27
+
28
+ An audit is not completion for a build/improve request. Finish when the slice is playable, a fresh player can state goal/choice/consequence, failure/recovery behave as intended, and evidence supports the pillars. Use `jgengine-verify` and `workflow` to ship.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Game Design"
3
+ short_description: "Design coherent game loops and systems"
4
+ default_prompt: "Use $game-design to audit or design this game, implement its highest-leverage design slice, and prove the changed player behavior."
@@ -0,0 +1,170 @@
1
+ # Applying game design
2
+
3
+ Use this playbook to turn a pitch or an existing game into implemented, testable change. Its purpose is to prevent “design work” from ending as generic advice.
4
+
5
+ ## Contents
6
+
7
+ 1. Greenfield procedure
8
+ 2. Existing-game audit
9
+ 3. Mandatory models
10
+ 4. Ranking interventions
11
+ 5. Design-slice specification
12
+ 6. Implementation and proof
13
+ 7. Failure modes
14
+
15
+ ## 1. Greenfield procedure
16
+
17
+ ### Frame the bet
18
+
19
+ Write a compact contract before broad code or content:
20
+
21
+ | Field | Required form |
22
+ | --- | --- |
23
+ | audience/context | prior skills, player count, platform/input, session length, accessibility assumptions |
24
+ | player promise | “The player repeatedly [verb/decision] so they feel [specific experience]” |
25
+ | pillars | two or three observable behaviors or feelings |
26
+ | anti-pillars | experiences the game must not drift toward |
27
+ | core decision | situation, known information, viable options, tradeoff, consequence, recurrence |
28
+ | completion proof | one end-to-end scenario a target player can perform and explain |
29
+ | falsifier | observation that would show the design does not work |
30
+
31
+ ### Build the minimum design
32
+
33
+ 1. Model each core verb from cue through future consequence.
34
+ 2. Draw moment, encounter, session, and meta loops.
35
+ 3. Draw resources and feedback structures.
36
+ 4. Map player skills and progression channels.
37
+ 5. Define failure, recovery, stopping, and replay.
38
+ 6. Create a content grammar: a small set of mechanics crossed with contexts and constraints.
39
+ 7. Select the riskiest assumption and build one vertical design slice around it.
40
+
41
+ Do not build the entire feature list first. A vertical slice contains real input, meaningful state, feedback, one decision that recurs, failure/recovery, and a downstream consequence.
42
+
43
+ ## 2. Existing-game audit
44
+
45
+ ### Reconstruct reality
46
+
47
+ Inspect actual code, catalogs, scene documents, UI, tests, captures, and live play. Do not infer the game from its title or README.
48
+
49
+ Trace four journeys when applicable:
50
+
51
+ - **first minute:** first input, goal, threat, reward, confusion, and reason to continue
52
+ - **first objective:** learning sequence, decisions, failure, recovery, payoff, and next goal
53
+ - **representative session:** loop renewal, variety, resource pressure, build choices, pacing, and stopping point
54
+ - **campaign/meta:** unlock cadence, content reuse, escalation, economy stability, mastery, and ending/replay
55
+
56
+ For each journey, record timestamps or event order:
57
+
58
+ `cue -> player belief -> action -> system response -> feedback -> state change -> next choice`
59
+
60
+ Mark dead time, repeated decisions, forced actions, hidden consequences, false affordances, unexplained failure, and rewards that do not alter later play.
61
+
62
+ ### Build a system-coupling map
63
+
64
+ Inventory verbs, enemies/problems, items/tools, progression, economy, quests/objectives, world states, social systems, and failure. For each system ask:
65
+
66
+ - Which pillar does it serve?
67
+ - Which loop consumes its output?
68
+ - What player decision does it create or transform?
69
+ - Where is it taught, tested, combined, and mastered?
70
+ - What happens if it is removed?
71
+
72
+ Flag systems that are present but disconnected, content whose only variation is numbers or nouns, and rewards that bypass the core play.
73
+
74
+ ### Diagnose decision density
75
+
76
+ Do not maximize decisions per second. Find long spans where the player executes an already-solved action without new information, tradeoffs, expression, pressure, or mastery. Measure:
77
+
78
+ - time to first meaningful decision
79
+ - meaningful decisions per encounter/objective
80
+ - time between new information and commitment
81
+ - percentage of objectives using each verb or decision type
82
+ - repeated content before context changes
83
+ - time from failure to a useful retry
84
+
85
+ ## 3. Mandatory models
86
+
87
+ ### Loop table
88
+
89
+ | Horizon | Cue/goal | Decision/action | Feedback | State changed | Why repeat? | Failure risk |
90
+ | --- | --- | --- | --- | --- | --- | --- |
91
+
92
+ Reject any row whose “state changed” or “why repeat” is empty.
93
+
94
+ ### Resource-flow table
95
+
96
+ | Resource | Source | Store/cap | Spend/convert | Sink | Player decision | Feedback/runaway risk |
97
+ | --- | --- | --- | --- | --- | --- | --- |
98
+
99
+ Include time, health, space, information, attention, action opportunities, and social trust when relevant.
100
+
101
+ ### Progression table
102
+
103
+ | Unlock/reward | Channel | New decision or capability | Content it recontextualizes | Risk of invalidation/grind | Proof |
104
+ | --- | --- | --- | --- | --- | --- |
105
+
106
+ Channels are mastery, access, breadth, power, and expression/status. Passive percentages without a changed decision must justify their place.
107
+
108
+ ### Objective/encounter variety matrix
109
+
110
+ Cross objective verbs with information state, constraints, enemy/problem behavior, topology, resource pressure, failure condition, and consequence. This exposes campaigns where every mission is the same verb with different nouns.
111
+
112
+ ## 4. Ranking interventions
113
+
114
+ Separate symptoms from root causes. “Quests are boring” is a symptom. “Every quest uses the same kill-count transition and no objective changes space, resources, or strategy” is a testable cause.
115
+
116
+ Rank each candidate:
117
+
118
+ | Candidate | Player behavior changed | Pillar impact | Reach | Evidence/confidence | Effort/risk | Dependencies | Shared owner |
119
+ | --- | --- | --- | --- | --- | --- | --- | --- |
120
+
121
+ Use three horizons:
122
+
123
+ - **Minimum correction:** remove the largest contradiction or unblock the loop.
124
+ - **Strong target:** make one representative slice deliver the promise end to end.
125
+ - **Multiplier:** expand the proven grammar across content, progression, social play, or replay.
126
+
127
+ Choose by leverage, not novelty. Prefer a change that improves many encounters or future games over bespoke content with the same underlying decision.
128
+
129
+ ## 5. Design-slice specification
130
+
131
+ The selected slice must state:
132
+
133
+ - before behavior and evidence
134
+ - target behavior and player belief
135
+ - mechanics/dynamics expected to cause the change
136
+ - objective/encounter sequence and pacing beats
137
+ - resources, rewards, failure, recovery, and downstream consequence
138
+ - affected catalogs/config, shared package seams, scene semantics, UI feedback, and tests
139
+ - tuning variables with starting hypotheses and safe bounds
140
+ - explicit non-goals and content held constant
141
+ - acceptance scenario and falsifiers
142
+
143
+ If another game could use the mechanic, define the package primitive first and adopt it here. Keep game-local code for content and feel.
144
+
145
+ ## 6. Implementation and proof
146
+
147
+ When the user asks to build or improve:
148
+
149
+ 1. Implement the shared primitive or use an existing capability.
150
+ 2. Adopt it in one complete game slice.
151
+ 3. Author spatial content through `level-design` and the editor.
152
+ 4. Add deterministic tests for transitions, resources, failure, and progression.
153
+ 5. Exercise the observable scenario with representative input.
154
+ 6. Capture before/after evidence for behavior, not only appearance.
155
+ 7. Evaluate the falsifier honestly; revise or remove a failed intervention.
156
+
157
+ Useful evidence includes time to first decision, objective completion, route choice, build choice, resource state, failure cause, retry time, objective-verb distribution, and a player’s ability to explain goal/action/consequence. Metrics need a named hypothesis; do not optimize them in isolation.
158
+
159
+ ## 7. Failure modes
160
+
161
+ - producing a long GDD instead of a playable slice
162
+ - listing features without naming changed decisions
163
+ - adding content to a shallow objective grammar
164
+ - using passive progression to disguise unchanged play
165
+ - copying a genre’s surface without its causal dynamics
166
+ - treating more rewards as more motivation
167
+ - fixing comprehension only with text or HUD
168
+ - reporting a diagnosis after the user asked for improvement
169
+ - calling deterministic tests proof that the experience works
170
+ - calling a prettier screenshot proof that the loop works