@zylem/game-lib 0.9.10 → 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 (54) hide show
  1. package/README.md +4 -0
  2. package/dist/api/game-lib.api.json +1013 -68
  3. package/dist/api/game-lib.api.md +56 -2
  4. package/dist/api/game-lib.d.ts +89 -11
  5. package/dist/api/game-lib.typedoc.json +60619 -69662
  6. package/dist/bake-IARN2D5W.js +1 -0
  7. package/dist/bridge.d.ts +2 -0
  8. package/dist/bridge.js +1 -1
  9. package/dist/catalog.js +1 -1
  10. package/dist/chunk-2I76JHSN.js +1 -0
  11. package/dist/{chunk-CI7A5N6G.js → chunk-3XIJCDII.js} +1 -1
  12. package/dist/{chunk-BJYXY2FB.js → chunk-DLIQ7RKB.js} +1 -1
  13. package/dist/{chunk-YW2GTHCV.js → chunk-HOLQZSW3.js} +1 -1
  14. package/dist/{chunk-3LXDHDJB.js → chunk-KGAXGWKQ.js} +1 -1
  15. package/dist/chunk-LUFSPEPZ.js +1 -0
  16. package/dist/{chunk-5NQGXW75.js → chunk-M47F6LKE.js} +1 -1
  17. package/dist/chunk-NA5SAMP2.js +1 -0
  18. package/dist/{chunk-YFXNZ2RS.js → chunk-O5N7VFYK.js} +1 -1
  19. package/dist/chunk-RPLJRBU3.js +1 -0
  20. package/dist/{chunk-KFI5UDI6.js → chunk-RRYBT6NL.js} +2 -2
  21. package/dist/chunk-TLUGF3AS.js +1 -0
  22. package/dist/{chunk-273CUPEO.js → chunk-TRKPYAVB.js} +1 -1
  23. package/dist/{chunk-UNCP6V7I.js → chunk-VLGJAGMX.js} +1 -1
  24. package/dist/chunk-W6XV7CCC.js +1 -0
  25. package/dist/{chunk-JCGW5PIR.js → chunk-WM3NVEDX.js} +1 -1
  26. package/dist/{chunk-YWH5HQDT.js → chunk-X4TZ645S.js} +1 -1
  27. package/dist/{chunk-ICJ2E2OV.js → chunk-Y2NS4OJH.js} +1 -1
  28. package/dist/chunk-YETBTF6G.js +1 -0
  29. package/dist/cinematics.d.ts +2 -1
  30. package/dist/core.d.ts +5 -4
  31. package/dist/core.js +1 -1
  32. package/dist/{debug-state-zLtbTVix.d.ts → debug-state-CKrWEXUz.d.ts} +6 -0
  33. package/dist/debug.d.ts +1 -1
  34. package/dist/debug.js +1 -1
  35. package/dist/entity.js +1 -1
  36. package/dist/{game-CoNlUzGO.d.ts → game-BqKsvmSH.d.ts} +1 -1
  37. package/dist/game-default-ENWXZSPB.js +1 -0
  38. package/dist/graphics.js +1 -1
  39. package/dist/nav-mesh-P7OR5WYX.js +1 -0
  40. package/dist/navigation-session-2rs6rHOw.d.ts +54 -0
  41. package/dist/navigation-worker.js +2 -0
  42. package/dist/navigation.d.ts +27 -0
  43. package/dist/navigation.js +1 -0
  44. package/dist/placement.js +1 -1
  45. package/dist/public.d.ts +6 -3
  46. package/dist/public.js +1 -1
  47. package/dist/{stage-BO-E42In.d.ts → stage-DT8QQbGk.d.ts} +4 -11
  48. package/dist/web-components.d.ts +5 -4
  49. package/dist/web-components.js +1 -1
  50. package/package.json +12 -4
  51. package/dist/chunk-BZEZIHM7.js +0 -1
  52. package/dist/chunk-HDOXKVQA.js +0 -1
  53. package/dist/chunk-UM5VNQPY.js +0 -1
  54. package/dist/game-default-Y7TULWXQ.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;
@@ -4252,6 +4266,46 @@ export interface MultidirectionalSpaceShooterInput extends Shooter2DAimFireInput
4252
4266
  moveY: number;
4253
4267
  }
4254
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
+
4255
4309
  export { normalize }
4256
4310
 
4257
4311
  // @public (undocumented)
@@ -9356,8 +9410,8 @@ export class ZylemZone extends GameEntity<ZylemZoneOptions> implements Collision
9356
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
9357
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
9358
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
9359
- // dist/game-CoNlUzGO.d.ts:258:5 - (ae-forgotten-export) The symbol "StageInterface" needs to be exported by the entry point public.d.ts
9360
- // dist/stage-BO-E42In.d.ts:1196:5 - (ae-forgotten-export) The symbol "StageAssetLoaderConfig" 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
9361
9415
 
9362
9416
  // (No @packageDocumentation comment for this package)
9363
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
  *
@@ -3408,6 +3418,12 @@ declare interface DebugState {
3408
3418
  * the Select tool is not armed, and keeps the hover highlight painted.
3409
3419
  */
3410
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;
3411
3427
  flags: Set<string>;
3412
3428
  }
3413
3429
 
@@ -5458,6 +5474,7 @@ export declare class GameBridge {
5458
5474
  * live stage state without the bridge importing game internals.
5459
5475
  */
5460
5476
  export declare interface GameBridgeHost {
5477
+ navigation?(): NavigationSession | null;
5461
5478
  /** Resolve a live entity by UUID from the current stage. */
5462
5479
  resolveEntity(uuid: string): GameEntity<any> | null;
5463
5480
  /** Write a stage variable (editor `stage:variable:set`). */
@@ -8229,6 +8246,75 @@ export declare interface MultidirectionalSpaceShooterInput extends Shooter2DAimF
8229
8246
 
8230
8247
  declare function nature(options?: Omit<ParticleMagicModifierOptions, 'alignment'>): ParticleMagicModifierOptions;
8231
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
+
8232
8318
  declare interface NodeInterface {
8233
8319
  uuid: string;
8234
8320
  name: string;
@@ -8255,17 +8341,6 @@ declare type NodeLike$1 = {
8255
8341
  create: Function;
8256
8342
  };
8257
8343
 
8258
- /**
8259
- * The user-facing stage handle and its fluent authoring API.
8260
- *
8261
- * `Stage` is the durable, author-time wrapper game code holds onto: it stores
8262
- * options, pending entities, and lifecycle/loading callbacks, then constructs
8263
- * and drives a fresh internal `ZylemStage` on each `load()`. Exists to give a
8264
- * stable, ergonomic surface (`add`, `onSetup/onUpdate/onDestroy`, camera, input,
8265
- * and event helpers) that survives stage reloads, while `ZylemStage` owns the
8266
- * disposable per-load runtime. `createStage(...)` is the entry point.
8267
- */
8268
-
8269
8344
  declare type NodeLike = {
8270
8345
  create: Function;
8271
8346
  };
@@ -13623,6 +13698,8 @@ declare interface SquadWorker {
13623
13698
 
13624
13699
  declare class Stage {
13625
13700
  wrappedStage: ZylemStage | null;
13701
+ /** Navigation for the loaded stage. Null before load or after teardown. */
13702
+ get navigation(): NavigationSession | null;
13626
13703
  options: StageOptionItem[];
13627
13704
  private _pendingEntities;
13628
13705
  private setupCallbacks;
@@ -18903,6 +18980,7 @@ declare type ZylemSpriteOptions = GameEntityOptions & {
18903
18980
  */
18904
18981
  declare class ZylemStage extends LifeCycleBase<ZylemStage> {
18905
18982
  type: string;
18983
+ readonly navigation: NavigationSession;
18906
18984
  state: StageState;
18907
18985
  gravity: Vector3 | Vec3Components;
18908
18986
  world: ZylemWorld | null;