@zylem/game-lib 0.9.9 → 0.9.11

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 (60) hide show
  1. package/README.md +4 -0
  2. package/dist/actions.d.ts +2 -2
  3. package/dist/api/game-lib.api.json +1150 -187
  4. package/dist/api/game-lib.api.md +65 -9
  5. package/dist/api/game-lib.d.ts +100 -11
  6. package/dist/api/game-lib.typedoc.json +63710 -72679
  7. package/dist/bake-IARN2D5W.js +1 -0
  8. package/dist/bridge.d.ts +3 -1
  9. package/dist/bridge.js +1 -1
  10. package/dist/catalog.js +1 -1
  11. package/dist/chunk-2I76JHSN.js +1 -0
  12. package/dist/{chunk-CI7A5N6G.js → chunk-3XIJCDII.js} +1 -1
  13. package/dist/{chunk-BJYXY2FB.js → chunk-DLIQ7RKB.js} +1 -1
  14. package/dist/{chunk-YW2GTHCV.js → chunk-HOLQZSW3.js} +1 -1
  15. package/dist/{chunk-3LXDHDJB.js → chunk-KGAXGWKQ.js} +1 -1
  16. package/dist/chunk-LUFSPEPZ.js +1 -0
  17. package/dist/{chunk-5NQGXW75.js → chunk-M47F6LKE.js} +1 -1
  18. package/dist/chunk-NA5SAMP2.js +1 -0
  19. package/dist/{chunk-YFXNZ2RS.js → chunk-O5N7VFYK.js} +1 -1
  20. package/dist/chunk-RPLJRBU3.js +1 -0
  21. package/dist/{chunk-JUA5KNND.js → chunk-RRYBT6NL.js} +2 -2
  22. package/dist/chunk-TLUGF3AS.js +1 -0
  23. package/dist/{chunk-273CUPEO.js → chunk-TRKPYAVB.js} +1 -1
  24. package/dist/{chunk-UNCP6V7I.js → chunk-VLGJAGMX.js} +1 -1
  25. package/dist/chunk-W6XV7CCC.js +1 -0
  26. package/dist/{chunk-JCGW5PIR.js → chunk-WM3NVEDX.js} +1 -1
  27. package/dist/{chunk-YWH5HQDT.js → chunk-X4TZ645S.js} +1 -1
  28. package/dist/{chunk-ICJ2E2OV.js → chunk-Y2NS4OJH.js} +1 -1
  29. package/dist/chunk-YETBTF6G.js +1 -0
  30. package/dist/cinematics.d.ts +5 -4
  31. package/dist/core.d.ts +8 -7
  32. package/dist/core.js +1 -1
  33. package/dist/{debug-state-JRneI6c2.d.ts → debug-state-CKrWEXUz.d.ts} +7 -1
  34. package/dist/debug.d.ts +2 -2
  35. package/dist/debug.js +1 -1
  36. package/dist/{entity-CY75JJSw.d.ts → entity-B8VygThO.d.ts} +7 -0
  37. package/dist/{entity-type-map-BMaPY8cd.d.ts → entity-type-map-CnxOtV01.d.ts} +1 -1
  38. package/dist/entity.d.ts +4 -4
  39. package/dist/entity.js +1 -1
  40. package/dist/{game-uQd7k6-m.d.ts → game-BqKsvmSH.d.ts} +2 -2
  41. package/dist/game-default-ENWXZSPB.js +1 -0
  42. package/dist/graphics.js +1 -1
  43. package/dist/nav-mesh-P7OR5WYX.js +1 -0
  44. package/dist/navigation-session-2rs6rHOw.d.ts +54 -0
  45. package/dist/navigation-worker.js +2 -0
  46. package/dist/navigation.d.ts +27 -0
  47. package/dist/navigation.js +1 -0
  48. package/dist/{placement-session-BNQoL7Jb.d.ts → placement-session-DfvCaGxX.d.ts} +1 -1
  49. package/dist/placement.d.ts +3 -3
  50. package/dist/placement.js +1 -1
  51. package/dist/public.d.ts +9 -6
  52. package/dist/public.js +1 -1
  53. package/dist/{stage-Dez16Gxm.d.ts → stage-DT8QQbGk.d.ts} +11 -14
  54. package/dist/web-components.d.ts +8 -7
  55. package/dist/web-components.js +1 -1
  56. package/package.json +12 -4
  57. package/dist/chunk-26EJFYDX.js +0 -1
  58. package/dist/chunk-UM5VNQPY.js +0 -1
  59. package/dist/chunk-VUTKEMIE.js +0 -1
  60. package/dist/game-default-FRKFJOJX.js +0 -1
@@ -64,6 +64,7 @@ import { length as length_2 } from 'three/tsl';
64
64
  import { LevelBuffer } from '@zylem/bridge';
65
65
  import { LevelDocument } from '@zylem/bridge';
66
66
  import { LevelEntry } from '@zylem/bridge';
67
+ import { LevelNavigation } from '@zylem/bridge';
67
68
  import { LevelSyncPayload } from '@zylem/bridge';
68
69
  import { Light } from 'three';
69
70
  import { Line2 } from 'three/addons/lines/webgpu/Line2.js';
@@ -75,6 +76,12 @@ import { min } from 'three/tsl';
75
76
  import * as mitt from 'mitt';
76
77
  import { mix } from 'three/tsl';
77
78
  import { mod } from 'three/tsl';
79
+ import { NavigationAsset } from '@zylem/bridge';
80
+ import { NavigationEdit } from '@zylem/bridge';
81
+ import { NavigationPath } from '@zylem/bridge';
82
+ import { NavigationStatus } from '@zylem/bridge';
83
+ import { NavigationToolPayload } from '@zylem/bridge';
84
+ import { NavMeshHelper } from '@recast-navigation/three';
78
85
  import { normalize } from 'three/tsl';
79
86
  import { Object3D } from 'three';
80
87
  import { positionWorld } from 'three/tsl';
@@ -233,6 +240,11 @@ export const AudioItemSchema: _sinclair_typebox.TObject<{
233
240
  // @public (undocumented)
234
241
  export type AudioTrack = Static<typeof AudioTrackSchema>;
235
242
 
243
+ // Warning: (ae-forgotten-export) The symbol "NavigationBakeInput" needs to be exported by the entry point public.d.ts
244
+ //
245
+ // @public
246
+ export function bakeNavigationData(input: NavigationBakeInput): Promise<Uint8Array>;
247
+
236
248
  // @public
237
249
  export function beatsPerBar(signature: TimeSignature): number;
238
250
 
@@ -2785,6 +2797,8 @@ export interface GameBridgeHost {
2785
2797
  levelClose?(): void;
2786
2798
  levelPlay?(document: LevelDocument): void;
2787
2799
  levelSync?(payload: LevelSyncPayload): void;
2800
+ // (undocumented)
2801
+ navigation?(): NavigationSession | null;
2788
2802
  pickEntity?(ndc: BridgeNdc): EntitySummaryPayload | null;
2789
2803
  resolveEntity(uuid: string): GameEntity<any> | null;
2790
2804
  setStageVariable?(key: string, value: unknown): void;
@@ -3156,6 +3170,8 @@ export type GameEntityOptions = {
3156
3170
  color?: Color;
3157
3171
  size?: Vec3Input;
3158
3172
  position?: Vec3Input;
3173
+ rotation?: Vec3Input;
3174
+ scale?: Vec3Input;
3159
3175
  hideUntilPositioned?: boolean;
3160
3176
  visible?: boolean;
3161
3177
  editorOwned?: boolean;
@@ -4250,6 +4266,46 @@ export interface MultidirectionalSpaceShooterInput extends Shooter2DAimFireInput
4250
4266
  moveY: number;
4251
4267
  }
4252
4268
 
4269
+ // @public
4270
+ export class NavigationMesh {
4271
+ // (undocumented)
4272
+ createHelper(): NavMeshHelper;
4273
+ // (undocumented)
4274
+ dispose(): void;
4275
+ // (undocumented)
4276
+ findPath(start: BridgeVec3, end: BridgeVec3, halfExtents?: BridgeVec3): NavigationPath;
4277
+ // (undocumented)
4278
+ static load(bytes: Uint8Array): Promise<NavigationMesh>;
4279
+ }
4280
+
4281
+ // @public
4282
+ export class NavigationSession {
4283
+ // Warning: (ae-forgotten-export) The symbol "NavigationSessionHost" needs to be exported by the entry point public.d.ts
4284
+ constructor(host: NavigationSessionHost);
4285
+ // (undocumented)
4286
+ bake(requestId?: string): Promise<NavigationAsset | null>;
4287
+ // (undocumented)
4288
+ clear(): void;
4289
+ // (undocumented)
4290
+ dispose(): void;
4291
+ // (undocumented)
4292
+ findPath(start: BridgeVec3, end: BridgeVec3): NavigationPath;
4293
+ load(asset: NavigationAsset): Promise<void>;
4294
+ pointerDown(ray: {
4295
+ origin: Vector3;
4296
+ direction: Vector3;
4297
+ }): boolean;
4298
+ // (undocumented)
4299
+ query(start: BridgeVec3, end: BridgeVec3, requestId?: string): NavigationPath;
4300
+ // (undocumented)
4301
+ setPreview(visible: boolean): void;
4302
+ // (undocumented)
4303
+ setTool(tool: NavigationToolPayload): void;
4304
+ // (undocumented)
4305
+ get status(): NavigationStatus;
4306
+ sync(document: LevelDocument): void;
4307
+ }
4308
+
4253
4309
  export { normalize }
4254
4310
 
4255
4311
  // @public (undocumented)
@@ -9347,15 +9403,15 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
9347
9403
  // /Users/timothycool/Projects/zylem-projects/simulation/packages/behaviors/dist/particle-emitter.d.ts:60:9 - (ae-forgotten-export) The symbol "voidMagic" needs to be exported by the entry point public.d.ts
9348
9404
  // /Users/timothycool/Projects/zylem-projects/simulation/packages/behaviors/dist/particle-emitter.d.ts:61:9 - (ae-forgotten-export) The symbol "psychic" needs to be exported by the entry point public.d.ts
9349
9405
  // /Users/timothycool/Projects/zylem-projects/simulation/packages/behaviors/dist/payload-WEzfgjSL.d.ts:48:5 - (ae-forgotten-export) The symbol "PlainWorkerFragmentPayload" needs to be exported by the entry point public.d.ts
9350
- // dist/entity-CY75JJSw.d.ts:399:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
9351
- // dist/entity-CY75JJSw.d.ts:400:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
9352
- // dist/entity-CY75JJSw.d.ts:401:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
9353
- // dist/entity-CY75JJSw.d.ts:410:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
9354
- // dist/entity-CY75JJSw.d.ts:410:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
9355
- // dist/entity-CY75JJSw.d.ts:411:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
9356
- // dist/entity-CY75JJSw.d.ts:412:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
9357
- // dist/game-uQd7k6-m.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
9358
- // dist/stage-Dez16Gxm.d.ts:1194:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
9406
+ // dist/entity-B8VygThO.d.ts:406:5 - (ae-forgotten-export) The symbol "RenderCategory_2" needs to be exported by the entry point public.d.ts
9407
+ // dist/entity-B8VygThO.d.ts:407:5 - (ae-forgotten-export) The symbol "RuntimeEntityOptions" needs to be exported by the entry point public.d.ts
9408
+ // dist/entity-B8VygThO.d.ts:408:5 - (ae-forgotten-export) The symbol "CollisionOptions" needs to be exported by the entry point public.d.ts
9409
+ // dist/entity-B8VygThO.d.ts:417:9 - (ae-forgotten-export) The symbol "IBuilder" needs to be exported by the entry point public.d.ts
9410
+ // dist/entity-B8VygThO.d.ts:417:9 - (ae-forgotten-export) The symbol "EntityMeshBuilder" needs to be exported by the entry point public.d.ts
9411
+ // dist/entity-B8VygThO.d.ts:418:9 - (ae-forgotten-export) The symbol "EntityCollisionBuilder" needs to be exported by the entry point public.d.ts
9412
+ // dist/entity-B8VygThO.d.ts:419:9 - (ae-forgotten-export) The symbol "MaterialBuilder" needs to be exported by the entry point public.d.ts
9413
+ // dist/game-BqKsvmSH.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
9414
+ // dist/stage-DT8QQbGk.d.ts:1197:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" needs to be exported by the entry point public.d.ts
9359
9415
 
9360
9416
  // (No @packageDocumentation comment for this package)
9361
9417
 
@@ -58,6 +58,7 @@ import { length as length_2 } from 'three/tsl';
58
58
  import { LevelBuffer } from '@zylem/bridge';
59
59
  import { LevelDocument } from '@zylem/bridge';
60
60
  import { LevelEntry } from '@zylem/bridge';
61
+ import { LevelNavigation } from '@zylem/bridge';
61
62
  import { LevelSyncPayload } from '@zylem/bridge';
62
63
  import { Light } from 'three';
63
64
  import { Line2 } from 'three/addons/lines/webgpu/Line2.js';
@@ -69,6 +70,12 @@ import { min } from 'three/tsl';
69
70
  import * as mitt from 'mitt';
70
71
  import { mix } from 'three/tsl';
71
72
  import { mod } from 'three/tsl';
73
+ import { NavigationAsset } from '@zylem/bridge';
74
+ import { NavigationEdit } from '@zylem/bridge';
75
+ import { NavigationPath } from '@zylem/bridge';
76
+ import { NavigationStatus } from '@zylem/bridge';
77
+ import { NavigationToolPayload } from '@zylem/bridge';
78
+ import { NavMeshHelper } from '@recast-navigation/three';
72
79
  import { normalize } from 'three/tsl';
73
80
  import { Object3D } from 'three';
74
81
  import { positionWorld } from 'three/tsl';
@@ -481,6 +488,9 @@ declare const AudioTrackSchema: _sinclair_typebox.TObject<{
481
488
  }>>;
482
489
  }>;
483
490
 
491
+ /** Pure geometry input, suitable for a worker. Returned bytes own their memory. */
492
+ export declare function bakeNavigationData(input: NavigationBakeInput): Promise<Uint8Array>;
493
+
484
494
  /**
485
495
  * BehaviorDescriptor
486
496
  *
@@ -1505,6 +1515,8 @@ export declare class CameraManager implements EditorCameraHost {
1505
1515
  private _screenSpacePanIds;
1506
1516
  /** Side, top, and isometric views that have already been placed on the gameplay camera. */
1507
1517
  private _framedEditorViews;
1518
+ /** True after the free camera has copied the gameplay pose once. */
1519
+ private _freePoseCaptured;
1508
1520
  /** World boxes of stage entities, read when an orthographic view is first shown. */
1509
1521
  private _entityBounds;
1510
1522
  /** Game camera to restore when the editor releases the main view. */
@@ -3406,6 +3418,12 @@ declare interface DebugState {
3406
3418
  * the Select tool is not armed, and keeps the hover highlight painted.
3407
3419
  */
3408
3420
  pickMode: boolean;
3421
+ /**
3422
+ * A Map Navigation tool (path test, obstacle, traversal link) is armed.
3423
+ * Those tools live on the stage's navigation session, outside `tool`, and
3424
+ * still need the canvas listeners and the game's own pointer input parked.
3425
+ */
3426
+ navigationTool: boolean;
3409
3427
  flags: Set<string>;
3410
3428
  }
3411
3429
 
@@ -5456,6 +5474,7 @@ export declare class GameBridge {
5456
5474
  * live stage state without the bridge importing game internals.
5457
5475
  */
5458
5476
  export declare interface GameBridgeHost {
5477
+ navigation?(): NavigationSession | null;
5459
5478
  /** Resolve a live entity by UUID from the current stage. */
5460
5479
  resolveEntity(uuid: string): GameEntity<any> | null;
5461
5480
  /** Write a stage variable (editor `stage:variable:set`). */
@@ -6130,6 +6149,13 @@ export declare type GameEntityOptions = {
6130
6149
  color?: Color;
6131
6150
  size?: Vec3Input;
6132
6151
  position?: Vec3Input;
6152
+ /** Spawn orientation as Euler angles in radians, applied in XYZ order. */
6153
+ rotation?: Vec3Input;
6154
+ /**
6155
+ * Spawn scale. Colliders are scaled with the render object. An actor
6156
+ * sizes its model from this instead.
6157
+ */
6158
+ scale?: Vec3Input;
6133
6159
  /**
6134
6160
  * Spawn visibility behavior:
6135
6161
  * - `undefined` (default): hidden while `spawnEntity` runs, revealed once
@@ -8220,6 +8246,75 @@ export declare interface MultidirectionalSpaceShooterInput extends Shooter2DAimF
8220
8246
 
8221
8247
  declare function nature(options?: Omit<ParticleMagicModifierOptions, 'alignment'>): ParticleMagicModifierOptions;
8222
8248
 
8249
+ declare interface NavigationBakeInput {
8250
+ positions: Float32Array;
8251
+ indices: Uint32Array;
8252
+ navigation: LevelNavigation;
8253
+ }
8254
+
8255
+ /** Owns Detour resources. A path supplies waypoints; movement and link traversal belong to gameplay. */
8256
+ export declare class NavigationMesh {
8257
+ private mesh;
8258
+ private query;
8259
+ private disposed;
8260
+ private constructor();
8261
+ static load(bytes: Uint8Array): Promise<NavigationMesh>;
8262
+ createHelper(): NavMeshHelper;
8263
+ findPath(start: BridgeVec3, end: BridgeVec3, halfExtents?: BridgeVec3): NavigationPath;
8264
+ dispose(): void;
8265
+ }
8266
+
8267
+ /** Per-stage navigation, lazily loading Recast only on bake or asset load. */
8268
+ export declare class NavigationSession {
8269
+ private host;
8270
+ private document;
8271
+ private sourceHash;
8272
+ private generation;
8273
+ private cancelWork;
8274
+ private mesh;
8275
+ private helper;
8276
+ private overlay;
8277
+ private annotations;
8278
+ private route;
8279
+ private visible;
8280
+ private tool;
8281
+ private firstPoint;
8282
+ private state;
8283
+ constructor(host: NavigationSessionHost);
8284
+ get status(): NavigationStatus;
8285
+ private publish;
8286
+ private cancel;
8287
+ private releaseMesh;
8288
+ /** Selection and visibility syncs preserve the current bake. */
8289
+ sync(document: LevelDocument): void;
8290
+ setPreview(visible: boolean): void;
8291
+ setTool(tool: NavigationToolPayload): void;
8292
+ /** Import a saved asset without running the generator. */
8293
+ load(asset: NavigationAsset): Promise<void>;
8294
+ private generate;
8295
+ bake(requestId?: string): Promise<NavigationAsset | null>;
8296
+ findPath(start: BridgeVec3, end: BridgeVec3): NavigationPath;
8297
+ query(start: BridgeVec3, end: BridgeVec3, requestId?: string): NavigationPath;
8298
+ private line;
8299
+ private drawAnnotations;
8300
+ /** Two clicks on the level surface test a path, draw an obstacle, or create a link. */
8301
+ pointerDown(ray: {
8302
+ origin: Vector3;
8303
+ direction: Vector3;
8304
+ }): boolean;
8305
+ clear(): void;
8306
+ dispose(): void;
8307
+ }
8308
+
8309
+ declare interface NavigationSessionHost {
8310
+ stageId: string;
8311
+ scene(): Object3D | null;
8312
+ status?(status: NavigationStatus): void;
8313
+ baked?(requestId: string, asset: NavigationAsset): void;
8314
+ path?(result: NavigationPath, requestId?: string): void;
8315
+ edit?(edit: NavigationEdit): void;
8316
+ }
8317
+
8223
8318
  declare interface NodeInterface {
8224
8319
  uuid: string;
8225
8320
  name: string;
@@ -8246,17 +8341,6 @@ declare type NodeLike$1 = {
8246
8341
  create: Function;
8247
8342
  };
8248
8343
 
8249
- /**
8250
- * The user-facing stage handle and its fluent authoring API.
8251
- *
8252
- * `Stage` is the durable, author-time wrapper game code holds onto: it stores
8253
- * options, pending entities, and lifecycle/loading callbacks, then constructs
8254
- * and drives a fresh internal `ZylemStage` on each `load()`. Exists to give a
8255
- * stable, ergonomic surface (`add`, `onSetup/onUpdate/onDestroy`, camera, input,
8256
- * and event helpers) that survives stage reloads, while `ZylemStage` owns the
8257
- * disposable per-load runtime. `createStage(...)` is the entry point.
8258
- */
8259
-
8260
8344
  declare type NodeLike = {
8261
8345
  create: Function;
8262
8346
  };
@@ -13614,6 +13698,8 @@ declare interface SquadWorker {
13614
13698
 
13615
13699
  declare class Stage {
13616
13700
  wrappedStage: ZylemStage | null;
13701
+ /** Navigation for the loaded stage. Null before load or after teardown. */
13702
+ get navigation(): NavigationSession | null;
13617
13703
  options: StageOptionItem[];
13618
13704
  private _pendingEntities;
13619
13705
  private setupCallbacks;
@@ -14196,6 +14282,8 @@ declare class StageEntityDelegate {
14196
14282
  */
14197
14283
  spawnEntity(child: BaseNode): Promise<void>;
14198
14284
  handleLateModelReady(entity: GameEntity<any>): void;
14285
+ /** Apply the `rotation` and `scale` options before the body is spawned. */
14286
+ private applySpawnTransform;
14199
14287
  /**
14200
14288
  * Register an entity for bundle or instanced rendering when opted in via
14201
14289
  * `category: 'environment'` or `category: 'pack'`.
@@ -18892,6 +18980,7 @@ declare type ZylemSpriteOptions = GameEntityOptions & {
18892
18980
  */
18893
18981
  declare class ZylemStage extends LifeCycleBase<ZylemStage> {
18894
18982
  type: string;
18983
+ readonly navigation: NavigationSession;
18895
18984
  state: StageState;
18896
18985
  gravity: Vector3 | Vec3Components;
18897
18986
  world: ZylemWorld | null;