@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
@@ -0,0 +1,159 @@
1
+ /** A path vertex in the volume-local XZ frame. */
2
+ export type PathVec2 = readonly [number, number];
3
+ /** Road hierarchy, widest to narrowest — shared by the city fabric and the renderer. */
4
+ export type PathLevel = "boulevard" | "avenue" | "street" | "lane";
5
+ /** A path feature spanning part of an edge/street: a bridge deck over a gap or a tunnel bore under a ridge. */
6
+ export type PathFeatureKind = "bridge" | "tunnel";
7
+ /** The generator's chosen topology family: an open street `net`, or a closed `circuit` loop. */
8
+ export type PathNetworkMode = "net" | "circuit";
9
+ /** One graph node: a junction, a dead end, or a mid-street bend, with its connection count. */
10
+ export interface PathNode {
11
+ id: number;
12
+ x: number;
13
+ z: number;
14
+ degree: number;
15
+ }
16
+ /** One atomic node-to-node edge — the fabric graph consumes these (welds at shared node coords). */
17
+ export interface PathEdge {
18
+ id: number;
19
+ /** Endpoint node ids. */
20
+ a: number;
21
+ b: number;
22
+ /** Sampled centerline; `points[0]` sits exactly on node `a`, the last on node `b`. */
23
+ points: PathVec2[];
24
+ width: number;
25
+ level: PathLevel;
26
+ /** True when this edge belongs to the main closed loop (circuit mode). */
27
+ loop: boolean;
28
+ }
29
+ /** A feature span carried by a street: a `[from, to]` index window into the street's `points`. */
30
+ export interface PathFeatureSpan {
31
+ kind: PathFeatureKind;
32
+ from: number;
33
+ to: number;
34
+ /** Ground height at each bank/portal — the deck/floor reference the renderer drapes to. */
35
+ bankHeight: number;
36
+ }
37
+ /** One chained through-street: a maximal run of edges through degree-2 nodes, for rendering + furniture. */
38
+ export interface PathStreet {
39
+ id: number;
40
+ /** Ordered node ids the chain visits; first === last when `loop`. */
41
+ nodes: number[];
42
+ /** Smoothed, turn-clamped centerline. */
43
+ points: PathVec2[];
44
+ width: number;
45
+ level: PathLevel;
46
+ /** Closed chain (a circuit lap or an inner ring). */
47
+ loop: boolean;
48
+ /** Cul-de-sac turning bulb when the street ends at a dangling node. */
49
+ bulb?: PathVec2;
50
+ /** Bridge/tunnel spans along this street, if any. */
51
+ features: PathFeatureSpan[];
52
+ }
53
+ /** One crossing of three or more streets: patch center/radius plus outgoing arm directions. */
54
+ export interface PathJunction {
55
+ x: number;
56
+ z: number;
57
+ radius: number;
58
+ level: PathLevel;
59
+ /** Outgoing arm directions (radians) with the crossing street width, for crosswalks/patches. */
60
+ arms: {
61
+ angle: number;
62
+ width: number;
63
+ }[];
64
+ }
65
+ /** One dangling street end kept as a cul-de-sac: node position plus the heading pointing off the road. */
66
+ export interface PathDeadEnd {
67
+ node: number;
68
+ x: number;
69
+ z: number;
70
+ /** Yaw (radians) facing outward, away from the network. */
71
+ heading: number;
72
+ width: number;
73
+ }
74
+ /** A resolved path feature in world-of-the-volume space: a bridge deck or tunnel bore centerline. */
75
+ export interface PathFeature {
76
+ kind: PathFeatureKind;
77
+ points: PathVec2[];
78
+ width: number;
79
+ bankHeight: number;
80
+ }
81
+ /** The fully-resolved network in volume-local coords. */
82
+ export interface PathNetwork {
83
+ mode: PathNetworkMode;
84
+ nodes: PathNode[];
85
+ /** Atomic edges — feed to the block/parcel fabric. */
86
+ edges: PathEdge[];
87
+ /** Chained through-streets — feed to the renderer, furniture, and analysis. */
88
+ streets: PathStreet[];
89
+ junctions: PathJunction[];
90
+ deadEnds: PathDeadEnd[];
91
+ bridges: PathFeature[];
92
+ tunnels: PathFeature[];
93
+ /** Independent cycle count (E − V + components): 0 = pure tree, ≥1 = has loops. */
94
+ loops: number;
95
+ }
96
+ /** Fully-defaulted slider set the generator reads. */
97
+ export interface PathNetworkRules {
98
+ seed: string;
99
+ /** 1 = regular lattice nodes; 0 = organic scatter. */
100
+ gridness: number;
101
+ /** 0 = tree (dead-ends); 1 = a single closed circuit. */
102
+ loopiness: number;
103
+ /** Extra chord edges between neighbors → mesh density. */
104
+ connectivity: number;
105
+ /** Spur-lane density forking off the mains. */
106
+ branching: number;
107
+ /** Fraction of dangling ends kept as cul-de-sacs (vs reconnected). */
108
+ deadEnds: number;
109
+ /** Target node spacing / block size, world units. */
110
+ segmentLength: number;
111
+ /** Cross-axis spacing multiplier (≥1 = long skinny Manhattan blocks). */
112
+ aspect: number;
113
+ /** Sideways wander amplitude, 0..1. */
114
+ winding: number;
115
+ /** Minimum curve radius (m) — caps wander curvature and corner tightness. */
116
+ minCurveRadius: number;
117
+ /** Shallowest corner (degrees) a street keeps — gentler bends are straightened. */
118
+ minTurnAngle: number;
119
+ /** Sharpest corner (degrees) a street may take — tighter ones are beveled away. */
120
+ maxTurnAngle: number;
121
+ /** Base street width; the hierarchy scales off it. */
122
+ width: number;
123
+ /** Share of avenues upgraded to boulevards, 0..1. */
124
+ boulevards: number;
125
+ }
126
+ /** Ground sampler + feature toggles enabling bridges/tunnels; omit for a flat, feature-free network. */
127
+ export interface PathNetworkContext {
128
+ /** Volume-local ground height sampler. */
129
+ heightAt?: (x: number, z: number) => number;
130
+ /** Ground below this (local) height is a gap streets bridge over. */
131
+ minElevation?: number;
132
+ /** Emit bridge decks over sub-`minElevation` gaps. */
133
+ bridges?: boolean;
134
+ /** Emit tunnel bores where the ground rises this far above a span's banks. */
135
+ tunnels?: boolean;
136
+ /** Ridge height above the banks that triggers a tunnel. Default 6. */
137
+ tunnelClearance?: number;
138
+ }
139
+ /**
140
+ * Hard turn-angle clamp on a polyline with fixed endpoints: interior corners gentler than `minRad`
141
+ * are straightened away (deliberate winding only, no micro-wiggle) and corners sharper than `maxRad`
142
+ * are beveled — the corner vertex is replaced by two points pulled back along each leg, which
143
+ * strictly reduces the angle. Endpoints never move, so a graph node stays welded.
144
+ * @internal
145
+ */
146
+ export declare function clampTurns(points: readonly PathVec2[], minRad: number, maxRad: number): PathVec2[];
147
+ /** Decide which topology family the sliders call for. Circuit wins when loops dominate and both
148
+ * branching and mesh connectivity are low — exactly the "race track" corner of the slider space.
149
+ * @internal */
150
+ export declare function pathNetworkMode(rules: PathNetworkRules): PathNetworkMode;
151
+ /**
152
+ * Resolve a full path network from its rules inside a volume of half-extents `hx`×`hz`. Deterministic
153
+ * per `(rules.seed, hx, hz, context)`. Pass a {@link PathNetworkContext} with a ground sampler to turn
154
+ * water gaps into bridges and ridges into tunnels. Coordinates are volume-local; the caller maps to
155
+ * world space.
156
+ *
157
+ * @capability path-network build a deterministic road/track graph (nodes, edges, streets, junctions, bridges, tunnels) from sliders
158
+ */
159
+ export declare function buildPathNetwork(rules: PathNetworkRules, hx: number, hz: number, context?: PathNetworkContext): PathNetwork;