@jgengine/core 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +130 -2
- package/dist/ai/decisionGraph.d.ts +52 -0
- package/dist/ai/decisionGraph.js +82 -0
- package/dist/ai/mobBrainGraph.d.ts +3 -0
- package/dist/ai/mobBrainGraph.js +25 -0
- package/dist/ai/tacticalQueries.d.ts +30 -0
- package/dist/ai/tacticalQueries.js +45 -0
- package/dist/anim/animGraph.d.ts +144 -0
- package/dist/anim/animGraph.js +286 -0
- package/dist/anim/ikSolver.d.ts +51 -0
- package/dist/anim/ikSolver.js +124 -0
- package/dist/anim/locomotionGraph.d.ts +26 -0
- package/dist/anim/locomotionGraph.js +33 -0
- package/dist/assets/spriteAtlas.d.ts +21 -0
- package/dist/assets/spriteAtlas.js +103 -0
- package/dist/audio/audioFalloff.d.ts +10 -0
- package/dist/economy/currency.d.ts +16 -2
- package/dist/economy/currency.js +55 -14
- package/dist/economy/wallet.d.ts +5 -4
- package/dist/economy/wallet.js +8 -4
- package/dist/editor/commandApply.js +1 -0
- package/dist/editor/commands.d.ts +4 -1
- package/dist/editor/document.d.ts +2 -1
- package/dist/editor/document.js +89 -0
- package/dist/editor/environment.d.ts +3 -0
- package/dist/editor/environment.js +16 -0
- package/dist/editor/index.d.ts +4 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/types.d.ts +16 -0
- package/dist/game/cameraConfig.d.ts +8 -0
- package/dist/game/chat.d.ts +22 -1
- package/dist/game/chat.js +48 -19
- package/dist/game/controlGate.d.ts +6 -0
- package/dist/game/controlGate.js +30 -1
- package/dist/game/defineGame.d.ts +10 -1
- package/dist/game/events.d.ts +8 -1
- package/dist/game/pixelPerfect.d.ts +25 -0
- package/dist/game/pixelPerfect.js +29 -0
- package/dist/game/playableGame.d.ts +97 -3
- package/dist/game/systemRuntime.js +6 -1
- package/dist/input/actionBindings.d.ts +2 -1
- package/dist/input/actionBindings.js +10 -8
- package/dist/input/actionContexts.d.ts +21 -0
- package/dist/input/actionContexts.js +56 -0
- package/dist/input/gamepadModel.d.ts +45 -0
- package/dist/input/gamepadModel.js +69 -0
- package/dist/meta/changelog.d.ts +1 -1
- package/dist/meta/changelog.js +103 -1
- package/dist/movement/characterController.d.ts +76 -0
- package/dist/movement/characterController.js +216 -0
- package/dist/movement/freeFlight.d.ts +119 -0
- package/dist/movement/freeFlight.js +294 -0
- package/dist/movement/playerMovement.d.ts +10 -2
- package/dist/movement/playerMovement.js +218 -4
- package/dist/movement/serverStep.d.ts +5 -0
- package/dist/movement/serverStep.js +6 -0
- package/dist/movement/solidObstacles.d.ts +30 -7
- package/dist/movement/solidObstacles.js +27 -4
- package/dist/multiplayer/poseSyncGate.d.ts +3 -1
- package/dist/multiplayer/poseSyncGate.js +9 -1
- package/dist/multiplayer/presenceContract.d.ts +6 -0
- package/dist/multiplayer/presenceModel.d.ts +2 -0
- package/dist/multiplayer/presenceModel.js +11 -0
- package/dist/nav/navMesh.d.ts +33 -0
- package/dist/nav/navMesh.js +164 -0
- package/dist/physics/flightDynamics.d.ts +8 -0
- package/dist/physics/kinematicVehicle.d.ts +6 -1
- package/dist/physics/physicsBackend.d.ts +191 -0
- package/dist/physics/physicsBackend.js +49 -0
- package/dist/physics/physicsBackendConformance.d.ts +27 -0
- package/dist/physics/physicsBackendConformance.js +117 -0
- package/dist/physics/physicsWorldBackend.d.ts +44 -0
- package/dist/physics/physicsWorldBackend.js +485 -0
- package/dist/physics/worldColliders.d.ts +13 -0
- package/dist/physics/worldColliders.js +96 -0
- package/dist/random/rng.d.ts +12 -1
- package/dist/random/rng.js +20 -3
- package/dist/render/environment.d.ts +23 -0
- package/dist/render/environment.js +1 -0
- package/dist/render/lookPreset.d.ts +11 -5
- package/dist/render/lookPreset.js +29 -4
- package/dist/render/postProcessing.d.ts +10 -1
- package/dist/render/sprite2d.d.ts +38 -0
- package/dist/render/sprite2d.js +40 -0
- package/dist/runtime/adapter.d.ts +20 -1
- package/dist/runtime/adapter.js +8 -1
- package/dist/runtime/commandInput.d.ts +15 -0
- package/dist/runtime/commandInput.js +13 -0
- package/dist/runtime/commandRunner.d.ts +44 -3
- package/dist/runtime/commandRunner.js +41 -3
- package/dist/runtime/gameContext.js +11 -1
- package/dist/runtime/gameContextTypes.d.ts +14 -4
- package/dist/runtime/gameRuntime.d.ts +33 -4
- package/dist/runtime/gameRuntime.js +26 -5
- package/dist/runtime/headlessRunner.d.ts +10 -0
- package/dist/runtime/headlessRunner.js +26 -8
- package/dist/runtime/hostPolicy.d.ts +3 -2
- package/dist/runtime/hostPolicy.js +8 -10
- package/dist/runtime/hostedGameRunner.js +34 -6
- package/dist/runtime/hostedWorldSession.d.ts +12 -16
- package/dist/runtime/hostedWorldSession.js +29 -6
- package/dist/runtime/hostedWorldStore.d.ts +20 -0
- package/dist/runtime/hostedWorldStore.js +1 -0
- package/dist/runtime/inputRecorder.d.ts +30 -0
- package/dist/runtime/inputRecorder.js +59 -0
- package/dist/runtime/inputSnapshot.d.ts +8 -0
- package/dist/runtime/inputSnapshot.js +1 -0
- package/dist/runtime/poseInterpolation.d.ts +36 -0
- package/dist/runtime/poseInterpolation.js +91 -0
- package/dist/runtime/prediction.d.ts +45 -0
- package/dist/runtime/prediction.js +62 -0
- package/dist/runtime/simContext.d.ts +45 -0
- package/dist/runtime/simContext.js +65 -0
- package/dist/runtime/simLoop.d.ts +52 -0
- package/dist/runtime/simLoop.js +72 -0
- package/dist/runtime/simSnapshot.d.ts +32 -0
- package/dist/runtime/simSnapshot.js +60 -0
- package/dist/runtime/snapshot.d.ts +8 -0
- package/dist/runtime/snapshotBuffer.d.ts +33 -0
- package/dist/runtime/snapshotBuffer.js +58 -0
- package/dist/runtime/transport.d.ts +38 -2
- package/dist/runtime/worldChunks.d.ts +2 -0
- package/dist/runtime/worldChunks.js +14 -0
- package/dist/runtime/worldProjection.d.ts +9 -0
- package/dist/runtime/worldProjection.js +17 -1
- package/dist/runtime/worldSnapshot.d.ts +6 -0
- package/dist/runtime/worldSnapshot.js +3 -0
- package/dist/scene/behaviorRuntime.d.ts +19 -1
- package/dist/scene/behaviorRuntime.js +55 -4
- package/dist/scene/behaviors.d.ts +8 -1
- package/dist/scene/builtinSceneKinds.js +10 -0
- package/dist/sensor/perception.d.ts +60 -0
- package/dist/sensor/perception.js +142 -0
- package/dist/settings/graphicsProfile.d.ts +19 -0
- package/dist/settings/graphicsProfile.js +36 -0
- package/dist/time/accrueSince.d.ts +10 -0
- package/dist/time/accrueSince.js +9 -0
- package/dist/time/rateWindow.d.ts +16 -0
- package/dist/time/rateWindow.js +14 -0
- package/dist/time/serverTick.d.ts +21 -3
- package/dist/time/serverTick.js +14 -13
- package/dist/vfx/particleDirector.d.ts +68 -0
- package/dist/vfx/particleDirector.js +81 -0
- package/dist/world/buildings.d.ts +12 -0
- package/dist/world/buildings.js +43 -3
- package/dist/world/cityContent.js +103 -25
- package/dist/world/cityKind.d.ts +132 -0
- package/dist/world/cityKind.js +315 -15
- package/dist/world/features.d.ts +27 -1
- package/dist/world/features.js +7 -2
- package/dist/world/placement.d.ts +7 -0
- package/dist/world/placement.js +2 -0
- package/dist/world/placementController.d.ts +1 -1
- package/dist/world/placementController.js +7 -0
- package/dist/world/raceCircuit.d.ts +168 -0
- package/dist/world/raceCircuit.js +797 -0
- package/dist/world/terrain.d.ts +5 -1
- package/dist/world/terrain.js +5 -0
- package/dist/world/territory.d.ts +97 -0
- package/dist/world/territory.js +182 -0
- package/dist/world.d.ts +5 -3
- package/dist/world.js +4 -2
- package/package.json +1 -1
- package/skills/ce-handoff/SKILL.md +1 -1
- package/skills/game-design/SKILL.md +11 -1
- package/skills/jgengine/SKILL.md +2 -0
- package/skills/jgengine/api.md +98 -22
- package/skills/jgengine/capabilities.md +28 -0
- package/skills/jgengine-gameplay/SKILL.md +10 -0
- package/skills/jgengine-gameplay/api.md +40 -18
- package/skills/jgengine-gameplay/capabilities.md +12 -0
- package/skills/jgengine-world/SKILL.md +6 -0
- package/skills/jgengine-world/api.md +312 -12
- package/skills/jgengine-world/capabilities.md +102 -0
package/dist/world/cityKind.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ParamSchema, type SceneKindObject, type SceneKindResolveContext, type WeightedParamEntry } from "../scene/sceneKinds.js";
|
|
2
2
|
import { type BuildingStyle } from "./buildings.js";
|
|
3
3
|
import { type CityLotClass, type CityLotPiece, type CityTreeSpecies, type CityZoneBand, type CityZoneProfile } from "./cityContent.js";
|
|
4
|
+
import { type CircuitCorner, type CircuitGate, type CircuitSealKind } from "./raceCircuit.js";
|
|
4
5
|
import type { RoadPoint } from "./roads.js";
|
|
5
6
|
import { type StreetFeatureKind } from "./streetGenerator.js";
|
|
6
7
|
import { type CityBlockKind } from "./cityBlocks.js";
|
|
@@ -29,6 +30,17 @@ export interface CityRules {
|
|
|
29
30
|
minTurnAngle: number;
|
|
30
31
|
/** Sharpest corner (degrees) a street may take — tighter ones are beveled away. */
|
|
31
32
|
maxTurnAngle: number;
|
|
33
|
+
/** Organic boundary clipping, 0..1. 0 fills the volume's rectangle; higher grows lobes and bays. */
|
|
34
|
+
outline: number;
|
|
35
|
+
/** Share of branch lanes grown as winding residential side streets, 0..1. */
|
|
36
|
+
residentialBranches: number;
|
|
37
|
+
/** Road-surface relief, 0..1. 0 is dead flat; 1 is ~22 m of rise and fall across a ~520 m district. */
|
|
38
|
+
elevation: number;
|
|
39
|
+
/** Steepest road grade (rise/run) the elevation pass allows on any street. */
|
|
40
|
+
maxGrade: number;
|
|
41
|
+
/** Circuit space-filling, 0..1. 0 is a flowing loop around an empty middle; higher folds the lap
|
|
42
|
+
* back through its own interior (switchbacks, hairpins, parallel runs). Circuit mode only. */
|
|
43
|
+
compactness: number;
|
|
32
44
|
/** Lay parcels + buildings against the streets (city fabric). Off = bare roads/track, no plots. */
|
|
33
45
|
fabric: boolean;
|
|
34
46
|
/** Streets bore through ridges on tunnel decks instead of climbing over them. */
|
|
@@ -84,6 +96,10 @@ export interface CityRules {
|
|
|
84
96
|
treeMix: WeightedParamEntry[];
|
|
85
97
|
/** Street-light density along non-lane streets, 0..1. */
|
|
86
98
|
lightDensity: number;
|
|
99
|
+
/** Parked-vehicle density along street curbs and inside parking pads, 0..1. */
|
|
100
|
+
parkedCars: number;
|
|
101
|
+
/** Junction control density, 0..1: mast-arm signals on arterial crossings, sign posts below them. */
|
|
102
|
+
signals: number;
|
|
87
103
|
/** Ring estate lots (mansions) with perimeter hedges and a gated gap. */
|
|
88
104
|
hedges: boolean;
|
|
89
105
|
/** Connect houses/estates/farms to their street with driveways. */
|
|
@@ -104,6 +120,22 @@ export interface CityRules {
|
|
|
104
120
|
sidewalks: boolean;
|
|
105
121
|
/** Sidewalk band width in meters at "street" hierarchy (boulevards scale up, lanes down). */
|
|
106
122
|
sidewalkWidth: number;
|
|
123
|
+
/** Lift an instanced street race out of the district's own streets (see {@link ResolvedRace}). */
|
|
124
|
+
race: boolean;
|
|
125
|
+
/** Target race lap length in meters — the search keeps the cycle closest to this. */
|
|
126
|
+
raceLapLength: number;
|
|
127
|
+
/** 0 races any street; 1 keeps the lap on avenues and boulevards only. */
|
|
128
|
+
raceArterial: number;
|
|
129
|
+
/** Ordered checkpoint gates placed around the lap. */
|
|
130
|
+
raceCheckpoints: number;
|
|
131
|
+
/** Laps the race runs. */
|
|
132
|
+
raceLaps: number;
|
|
133
|
+
/** Close every side street leaving the lap with barriers — what makes it an instanced event. */
|
|
134
|
+
raceSeals: boolean;
|
|
135
|
+
/** Starting grid slots behind the line (0 = no grid). */
|
|
136
|
+
raceGridSlots: number;
|
|
137
|
+
/** Radius (m) the racing line is worked toward at the lap's junction corners. */
|
|
138
|
+
raceCornerRadius: number;
|
|
107
139
|
/** Building style palette id (see {@link BUILDING_STYLE_PALETTES}). */
|
|
108
140
|
style: BuildingStyle;
|
|
109
141
|
/**
|
|
@@ -132,6 +164,9 @@ export interface CityStreet {
|
|
|
132
164
|
surface: "asphalt" | "gravel";
|
|
133
165
|
/** Whether sidewalk ribbons flank this street. */
|
|
134
166
|
sidewalk: boolean;
|
|
167
|
+
/** Grade-limited road-surface height per point, present only when `elevation` is above 0. This is
|
|
168
|
+
* ROAD relief, not the terrain the district stands on. */
|
|
169
|
+
heights?: readonly number[];
|
|
135
170
|
/** Cul-de-sac turning bulb at a dangling end, when the lane never reconnected. */
|
|
136
171
|
bulb?: RoadPoint;
|
|
137
172
|
/** Bridge/tunnel spans along this street as `[from, to]` index windows into `points`. */
|
|
@@ -277,6 +312,97 @@ export interface CityParking {
|
|
|
277
312
|
size: readonly [number, number];
|
|
278
313
|
rotationY: number;
|
|
279
314
|
}
|
|
315
|
+
/** Silhouette class of a parked vehicle — sizes the body the renderer instances. */
|
|
316
|
+
export type CityVehicleKind = "car" | "van" | "truck";
|
|
317
|
+
/** One parked vehicle standing at a curb or nose-in inside a parking pad. */
|
|
318
|
+
export interface CityVehicle {
|
|
319
|
+
x: number;
|
|
320
|
+
z: number;
|
|
321
|
+
/** Yaw the body points down (engine rotationY convention). */
|
|
322
|
+
rotationY: number;
|
|
323
|
+
kind: CityVehicleKind;
|
|
324
|
+
/** Seeded body-paint index; the renderer maps it into its own palette. */
|
|
325
|
+
paint: number;
|
|
326
|
+
/** Where it stands, so the renderer drapes it onto carriageway or pad height. */
|
|
327
|
+
stall: "curb" | "lot";
|
|
328
|
+
}
|
|
329
|
+
/** One junction control on an approach arm: an arterial mast-arm signal, or a plain sign post. */
|
|
330
|
+
export interface CitySignal {
|
|
331
|
+
x: number;
|
|
332
|
+
z: number;
|
|
333
|
+
/** Yaw the head faces — into the traffic approaching down this arm. */
|
|
334
|
+
heading: number;
|
|
335
|
+
kind: "signal" | "sign";
|
|
336
|
+
/** How far the mast arm reaches over the carriageway, to the right of {@link CitySignal.heading}. */
|
|
337
|
+
reach: number;
|
|
338
|
+
}
|
|
339
|
+
/** One street closed off where it leaves the race lap: world XZ, the yaw down the sealed street, and
|
|
340
|
+
* the width the barrier run spans. */
|
|
341
|
+
export interface CityRaceSeal {
|
|
342
|
+
x: number;
|
|
343
|
+
z: number;
|
|
344
|
+
heading: number;
|
|
345
|
+
width: number;
|
|
346
|
+
kind: CircuitSealKind;
|
|
347
|
+
}
|
|
348
|
+
/** One kerb strip hugging a corner's road edge, as a world-space polyline to stripe. */
|
|
349
|
+
export interface CityRaceKerb {
|
|
350
|
+
points: readonly RoadPoint[];
|
|
351
|
+
/** Strip width across, meters. */
|
|
352
|
+
width: number;
|
|
353
|
+
/** Which side of travel the strip sits on: -1 left, 1 right. */
|
|
354
|
+
side: -1 | 1;
|
|
355
|
+
/** Alternating stripe length along the run, meters. */
|
|
356
|
+
stripe: number;
|
|
357
|
+
/** Corner this kerb belongs to (index into {@link ResolvedRace.corners}). */
|
|
358
|
+
corner: number;
|
|
359
|
+
}
|
|
360
|
+
/** The start/finish line: where it is, which way cars face, and the painted line across the road. */
|
|
361
|
+
export interface CityRaceStart {
|
|
362
|
+
x: number;
|
|
363
|
+
z: number;
|
|
364
|
+
/** Yaw cars face on the grid (direction of travel). */
|
|
365
|
+
heading: number;
|
|
366
|
+
/** The two road-edge ends of the painted line. */
|
|
367
|
+
line: readonly [RoadPoint, RoadPoint];
|
|
368
|
+
/** Arc-length position of the line along the lap, meters. */
|
|
369
|
+
distance: number;
|
|
370
|
+
width: number;
|
|
371
|
+
}
|
|
372
|
+
/** One staggered spawn behind the start line. */
|
|
373
|
+
export interface CityRaceGridSlot {
|
|
374
|
+
x: number;
|
|
375
|
+
z: number;
|
|
376
|
+
heading: number;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* An instanced street race lifted out of the district's OWN streets: a closed lap through the city,
|
|
380
|
+
* with every side street leaving it sealed off. World space, like the rest of {@link ResolvedCity}.
|
|
381
|
+
*/
|
|
382
|
+
export interface ResolvedRace {
|
|
383
|
+
/** Closed lap centerline — the last point joins the first. */
|
|
384
|
+
centerline: readonly RoadPoint[];
|
|
385
|
+
/** Road width at each centerline point, inherited from the streets the lap follows. */
|
|
386
|
+
widths: readonly number[];
|
|
387
|
+
/** Road-surface height per point, present only when the district carries `elevation`. */
|
|
388
|
+
heights?: readonly number[];
|
|
389
|
+
/** Lap length, meters. */
|
|
390
|
+
length: number;
|
|
391
|
+
/** Ids of the district streets the lap runs on — style exactly these as track surface. */
|
|
392
|
+
streets: readonly string[];
|
|
393
|
+
seals: readonly CityRaceSeal[];
|
|
394
|
+
corners: readonly CircuitCorner[];
|
|
395
|
+
kerbs: readonly CityRaceKerb[];
|
|
396
|
+
/** Ordered gates, finish last — ready for `raceTrack({ checkpoints, laps })`. */
|
|
397
|
+
checkpoints: readonly CircuitGate[];
|
|
398
|
+
laps: number;
|
|
399
|
+
start: CityRaceStart;
|
|
400
|
+
grid: readonly CityRaceGridSlot[];
|
|
401
|
+
/** Arc-length fractions (0..1) where each timing sector begins; the first is always 0. */
|
|
402
|
+
sectors: readonly number[];
|
|
403
|
+
/** Tightest radius (m) the finished racing line actually holds. */
|
|
404
|
+
tightestRadius: number;
|
|
405
|
+
}
|
|
280
406
|
/** A resolved city district: world-space network, zoned lots, parks, and furniture. */
|
|
281
407
|
export interface ResolvedCity {
|
|
282
408
|
center: readonly [number, number, number];
|
|
@@ -299,6 +425,12 @@ export interface ResolvedCity {
|
|
|
299
425
|
hedges: readonly CityHedge[];
|
|
300
426
|
driveways: readonly CityDriveway[];
|
|
301
427
|
parkingLots: readonly CityParking[];
|
|
428
|
+
/** Parked vehicles along the curbs and inside the parking pads. */
|
|
429
|
+
vehicles: readonly CityVehicle[];
|
|
430
|
+
/** Traffic signals and sign posts, one per controlled junction approach. */
|
|
431
|
+
signals: readonly CitySignal[];
|
|
432
|
+
/** The instanced street race through these streets, when `race` is on and a lap could be found. */
|
|
433
|
+
race?: ResolvedRace;
|
|
302
434
|
}
|
|
303
435
|
/** Extended resolve context: sibling `cityzone` volumes that override the band/mix locally. */
|
|
304
436
|
export interface CityResolveContext extends SceneKindResolveContext {
|