@zylem/game-lib 0.6.4 → 0.8.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 (156) hide show
  1. package/README.md +18 -2
  2. package/dist/actions.d.ts +321 -11
  3. package/dist/actions.js +1 -936
  4. package/dist/api/game-lib.api.json +54074 -0
  5. package/dist/api/game-lib.api.md +4544 -0
  6. package/dist/api/game-lib.d.ts +8258 -0
  7. package/dist/api/game-lib.typedoc.json +345421 -0
  8. package/dist/audio.d.ts +13 -0
  9. package/dist/audio.js +1 -0
  10. package/dist/base-node-life-cycle-D2NuN1VB.d.ts +151 -0
  11. package/dist/behavior.d.ts +2 -0
  12. package/dist/behavior.js +1 -0
  13. package/dist/blueprints-TbGY-h53.d.ts +162 -0
  14. package/dist/chunk-4QLJUQSJ.js +1 -0
  15. package/dist/chunk-7FR5JSQ2.js +1 -0
  16. package/dist/chunk-7GYFZKK7.js +1 -0
  17. package/dist/chunk-7WRQ2UAN.js +1 -0
  18. package/dist/chunk-BH53MBAZ.js +1 -0
  19. package/dist/chunk-BIGH6D34.js +0 -0
  20. package/dist/chunk-CM5YRNBJ.js +19 -0
  21. package/dist/chunk-COM6HJ2L.js +1 -0
  22. package/dist/chunk-D2PATZCC.js +1 -0
  23. package/dist/chunk-DFLI7ICU.js +0 -0
  24. package/dist/chunk-E3UBSUPX.js +1 -0
  25. package/dist/chunk-FKIKN7RP.js +24 -0
  26. package/dist/chunk-G4HONLWC.js +1 -0
  27. package/dist/chunk-IKWE2W6L.js +1 -0
  28. package/dist/chunk-IPWUDOV5.js +1 -0
  29. package/dist/chunk-JEHFHUH4.js +0 -0
  30. package/dist/chunk-JNKPTL77.js +1 -0
  31. package/dist/chunk-JQKS42G4.js +1 -0
  32. package/dist/chunk-M3XNO56P.js +1 -0
  33. package/dist/chunk-MSC2BEO5.js +1 -0
  34. package/dist/chunk-ORIDWL3T.js +0 -0
  35. package/dist/chunk-QB3NL7VQ.js +1 -0
  36. package/dist/chunk-QXVH6POE.js +1 -0
  37. package/dist/chunk-RXDTAWI2.js +29 -0
  38. package/dist/chunk-TAUWDQZF.js +9 -0
  39. package/dist/chunk-VS2D4B3W.js +1 -0
  40. package/dist/chunk-WQ3WMMZD.js +1 -0
  41. package/dist/chunk-XK63E4SX.js +1 -0
  42. package/dist/chunk-XNDS4YFR.js +1 -0
  43. package/dist/chunk-XNHVRFAK.js +1 -0
  44. package/dist/chunk-XRP4JJXL.js +1 -0
  45. package/dist/chunk-YHEWKN7N.js +1 -0
  46. package/dist/chunk-ZRT3ZQVH.js +1 -0
  47. package/dist/collision-builder-jF-toPIl.d.ts +38 -0
  48. package/dist/core.d.ts +223 -16
  49. package/dist/core.js +1 -12424
  50. package/dist/debug-state-BPT6jEog.d.ts +17 -0
  51. package/dist/debug.d.ts +76 -0
  52. package/dist/debug.js +1 -0
  53. package/dist/default-controls-0-vCnli7.d.ts +111 -0
  54. package/dist/{entity-vj-HTjzU.d.ts → entity-BdSI8CL3.d.ts} +119 -626
  55. package/dist/{entity-Bq_eNEDI.d.ts → entity-DZbFQ1Wg.d.ts} +4 -4
  56. package/dist/entity-type-map-Bd69SpAS.d.ts +928 -0
  57. package/dist/entity.d.ts +268 -0
  58. package/dist/entity.js +1 -0
  59. package/dist/events.d.ts +181 -0
  60. package/dist/events.js +1 -0
  61. package/dist/game-C1FHVqXl.d.ts +1886 -0
  62. package/dist/game-default-QHROHW2O.js +1 -0
  63. package/dist/game-interfaces-mchNYSZE.d.ts +90 -0
  64. package/dist/globals.d.ts +115 -0
  65. package/dist/globals.js +1 -0
  66. package/dist/graphics.d.ts +53 -0
  67. package/dist/graphics.js +1 -0
  68. package/dist/input-ui.d.ts +35 -0
  69. package/dist/input-ui.js +1 -0
  70. package/dist/input.d.ts +73 -0
  71. package/dist/input.js +1 -0
  72. package/dist/material-9vJ6SZaI.d.ts +126 -0
  73. package/dist/public.d.ts +38 -0
  74. package/dist/public.js +1 -0
  75. package/dist/runtime.d.ts +59 -0
  76. package/dist/runtime.js +1 -0
  77. package/dist/schema/entity.schema.json +244 -0
  78. package/dist/schema/game-config.schema.json +625 -0
  79. package/dist/schema/input-config.schema.json +499 -0
  80. package/dist/schema/stage-config.schema.json +93 -0
  81. package/dist/schema/stage.schema.json +271 -0
  82. package/dist/schema.d.ts +538 -0
  83. package/dist/schema.js +1 -0
  84. package/dist/stage-transition-CmGpV4tc.d.ts +46 -0
  85. package/dist/vector-CiSHbivc.d.ts +133 -0
  86. package/dist/web-components.d.ts +70 -0
  87. package/dist/web-components.js +1 -0
  88. package/dist/zylem-camera-C3bn6BTI.d.ts +575 -0
  89. package/package.json +70 -73
  90. package/dist/actions.js.map +0 -1
  91. package/dist/behavior/jumper-2d.d.ts +0 -114
  92. package/dist/behavior/jumper-2d.js +0 -711
  93. package/dist/behavior/jumper-2d.js.map +0 -1
  94. package/dist/behavior/platformer-3d.d.ts +0 -296
  95. package/dist/behavior/platformer-3d.js +0 -761
  96. package/dist/behavior/platformer-3d.js.map +0 -1
  97. package/dist/behavior/ricochet-2d.d.ts +0 -275
  98. package/dist/behavior/ricochet-2d.js +0 -425
  99. package/dist/behavior/ricochet-2d.js.map +0 -1
  100. package/dist/behavior/ricochet-3d.d.ts +0 -117
  101. package/dist/behavior/ricochet-3d.js +0 -443
  102. package/dist/behavior/ricochet-3d.js.map +0 -1
  103. package/dist/behavior/screen-visibility.d.ts +0 -79
  104. package/dist/behavior/screen-visibility.js +0 -358
  105. package/dist/behavior/screen-visibility.js.map +0 -1
  106. package/dist/behavior/screen-wrap.d.ts +0 -87
  107. package/dist/behavior/screen-wrap.js +0 -246
  108. package/dist/behavior/screen-wrap.js.map +0 -1
  109. package/dist/behavior/shooter-2d.d.ts +0 -79
  110. package/dist/behavior/shooter-2d.js +0 -180
  111. package/dist/behavior/shooter-2d.js.map +0 -1
  112. package/dist/behavior/thruster.d.ts +0 -11
  113. package/dist/behavior/thruster.js +0 -292
  114. package/dist/behavior/thruster.js.map +0 -1
  115. package/dist/behavior/top-down-movement.d.ts +0 -56
  116. package/dist/behavior/top-down-movement.js +0 -125
  117. package/dist/behavior/top-down-movement.js.map +0 -1
  118. package/dist/behavior/world-boundary-2d.d.ts +0 -142
  119. package/dist/behavior/world-boundary-2d.js +0 -235
  120. package/dist/behavior/world-boundary-2d.js.map +0 -1
  121. package/dist/behavior/world-boundary-3d.d.ts +0 -76
  122. package/dist/behavior/world-boundary-3d.js +0 -274
  123. package/dist/behavior/world-boundary-3d.js.map +0 -1
  124. package/dist/behavior-descriptor-BXnVR8Ki.d.ts +0 -159
  125. package/dist/blueprints-DmbK2dki.d.ts +0 -26
  126. package/dist/camera-4XO5gbQH.d.ts +0 -905
  127. package/dist/camera.d.ts +0 -6
  128. package/dist/camera.js +0 -1993
  129. package/dist/camera.js.map +0 -1
  130. package/dist/composition-BASvMKrW.d.ts +0 -218
  131. package/dist/core-CARRaS55.d.ts +0 -541
  132. package/dist/core.js.map +0 -1
  133. package/dist/entities-ChFirVL9.d.ts +0 -410
  134. package/dist/entities.d.ts +0 -9
  135. package/dist/entities.js +0 -4986
  136. package/dist/entities.js.map +0 -1
  137. package/dist/entity-types-DAu8sGJH.d.ts +0 -26
  138. package/dist/global-change-2JvMaz44.d.ts +0 -25
  139. package/dist/main.d.ts +0 -1353
  140. package/dist/main.js +0 -19525
  141. package/dist/main.js.map +0 -1
  142. package/dist/physics-pose-DCc4oE44.d.ts +0 -25
  143. package/dist/physics-protocol-BDD3P5W2.d.ts +0 -200
  144. package/dist/physics-worker.d.ts +0 -21
  145. package/dist/physics-worker.js +0 -306
  146. package/dist/physics-worker.js.map +0 -1
  147. package/dist/physics.d.ts +0 -205
  148. package/dist/physics.js +0 -577
  149. package/dist/physics.js.map +0 -1
  150. package/dist/stage-types-C19IhuzA.d.ts +0 -731
  151. package/dist/stage.d.ts +0 -52
  152. package/dist/stage.js +0 -8479
  153. package/dist/stage.js.map +0 -1
  154. package/dist/sync-state-machine-CZyspBpj.d.ts +0 -16
  155. package/dist/thruster-23lzoPZd.d.ts +0 -180
  156. package/dist/world-DfgxoNMt.d.ts +0 -105
@@ -0,0 +1,133 @@
1
+ import { EntityHandle, Simulation } from '@zylem/behaviors/core';
2
+ import { Vector3, Vector2 } from 'three';
3
+
4
+ interface PhysicsVector3 {
5
+ x: number;
6
+ y: number;
7
+ z: number;
8
+ }
9
+ interface PhysicsQuaternion {
10
+ x: number;
11
+ y: number;
12
+ z: number;
13
+ w: number;
14
+ }
15
+ interface PhysicsPose {
16
+ position: PhysicsVector3;
17
+ rotation: PhysicsQuaternion;
18
+ }
19
+ interface PhysicsPoseHistory {
20
+ previous: PhysicsPose;
21
+ current: PhysicsPose;
22
+ }
23
+ interface PhysicsRenderPoseProvider {
24
+ getPoseHistory(): PhysicsPoseHistory;
25
+ getRenderPose(alpha: number): PhysicsPose;
26
+ }
27
+
28
+ /** Shared step counter owned by the world; lets bodies know a step has run. */
29
+ interface SimulationStepClock {
30
+ steps: number;
31
+ }
32
+ declare class SimulationBody implements PhysicsRenderPoseProvider {
33
+ private readonly simulation;
34
+ readonly handle: EntityHandle;
35
+ private readonly clock;
36
+ private readonly poseScratch;
37
+ private readonly renderScratch;
38
+ private readonly previousScratch;
39
+ constructor(simulation: Simulation, handle: EntityHandle, clock: SimulationStepClock);
40
+ translation(): PhysicsVector3;
41
+ rotation(): PhysicsQuaternion;
42
+ linvel(): PhysicsVector3;
43
+ angvel(): PhysicsVector3;
44
+ setTranslation(translation: PhysicsVector3, _wakeUp?: boolean): void;
45
+ setRotation(rotation: PhysicsQuaternion, _wakeUp?: boolean): void;
46
+ setLinvel(velocity: PhysicsVector3, _wakeUp?: boolean): void;
47
+ setAngvel(velocity: PhysicsVector3, _wakeUp?: boolean): void;
48
+ applyImpulse(impulse: PhysicsVector3, _wakeUp?: boolean): void;
49
+ /**
50
+ * Damping is fixed at body-creation time in the wasm runtime; there is no
51
+ * live setter FFI yet, so this is accepted (for `MoveableBodyLike`
52
+ * compatibility) but has no effect.
53
+ */
54
+ setLinearDamping(_damping: number): void;
55
+ /**
56
+ * Gravity scale is fixed at body-creation time in the wasm runtime; there is
57
+ * no live setter FFI yet, so this is accepted for Rapier compat but has no
58
+ * effect. Prefer `gravityScale` on the body definition at spawn time when
59
+ * possible.
60
+ */
61
+ setGravityScale(_scale: number, _wakeUp?: boolean): void;
62
+ private bodyInfo;
63
+ bodyType(): number;
64
+ mass(): number;
65
+ isSleeping(): boolean;
66
+ isEnabled(): boolean;
67
+ private livePose;
68
+ private static slotToPose;
69
+ getPoseHistory(): PhysicsPoseHistory;
70
+ getRenderPose(alpha: number): PhysicsPose;
71
+ /**
72
+ * True when the latest render buffer marks this body as sleeping.
73
+ * Used by instancing to skip matrix writes for settled piles.
74
+ */
75
+ isRenderSleeping(): boolean;
76
+ /**
77
+ * Zero-allocation render-pose read for hot paths (instanced rendering of
78
+ * thousands of bodies). Interpolates the previous → current fixed-step
79
+ * poses straight from the shared render buffer into the provided
80
+ * out-parameters — no intermediate pose objects.
81
+ */
82
+ writeRenderPose(alpha: number, outPosition: {
83
+ x: number;
84
+ y: number;
85
+ z: number;
86
+ }, outRotation: {
87
+ x: number;
88
+ y: number;
89
+ z: number;
90
+ w: number;
91
+ }): void;
92
+ private writeLivePose;
93
+ }
94
+
95
+ type Vec2 = Vector2;
96
+ type Vec3 = Vector3 | Vec3Components;
97
+ type Vec2Components = {
98
+ x: number;
99
+ y: number;
100
+ };
101
+ type Vec3Components = {
102
+ x: number;
103
+ y: number;
104
+ z: number;
105
+ };
106
+ type Vec2Tuple = readonly [number?, number?] & {
107
+ x?: number;
108
+ y?: number;
109
+ };
110
+ type Vec3Tuple = readonly [number?, number?, number?] & {
111
+ x?: number;
112
+ y?: number;
113
+ z?: number;
114
+ };
115
+ type Vec2Input = Vec2 | {
116
+ x?: number;
117
+ y?: number;
118
+ } | Vec2Tuple;
119
+ type Vec3Input = Vec3 | {
120
+ x?: number;
121
+ y?: number;
122
+ z?: number;
123
+ } | Vec3Tuple;
124
+ declare const VEC2_ZERO: Readonly<Vec2Components>;
125
+ declare const VEC2_ONE: Readonly<Vec2Components>;
126
+ declare const VEC3_ZERO: Readonly<Vec3Components>;
127
+ declare const VEC3_ONE: Readonly<Vec3Components>;
128
+ declare function normalizeVec2(input?: Vec2Input | null, defaults?: Vec2Input | Partial<Vec2Components>): Vec2Components;
129
+ declare function normalizeVec3(input?: Vec3Input | null, defaults?: Vec3Input | Partial<Vec3Components>): Vec3Components;
130
+ declare function toThreeVector2(input?: Vec2Input | null, defaults?: Vec2Input | Partial<Vec2Components>): Vector2;
131
+ declare function toThreeVector3(input?: Vec3Input | null, defaults?: Vec3Input | Partial<Vec3Components>): Vector3;
132
+
133
+ export { type SimulationStepClock as S, type Vec2 as V, type Vec2Components as a, type Vec2Input as b, type Vec3 as c, type Vec3Components as d, type Vec3Input as e, VEC2_ONE as f, VEC2_ZERO as g, VEC3_ONE as h, VEC3_ZERO as i, normalizeVec3 as j, toThreeVector3 as k, SimulationBody as l, normalizeVec2 as n, toThreeVector2 as t };
@@ -0,0 +1,70 @@
1
+ import { G as Game, D as DeviceProfile } from './game-C1FHVqXl.js';
2
+ import { D as DebugTools } from './debug-state-BPT6jEog.js';
3
+ import './base-node-life-cycle-D2NuN1VB.js';
4
+ import 'three';
5
+ import './stage-transition-CmGpV4tc.js';
6
+ import './game-interfaces-mchNYSZE.js';
7
+ import './entity-BdSI8CL3.js';
8
+ import '@zylem/behaviors/core';
9
+ import './vector-CiSHbivc.js';
10
+ import './material-9vJ6SZaI.js';
11
+ import 'three/webgpu';
12
+ import './collision-builder-jF-toPIl.js';
13
+ import './events.js';
14
+ import 'mitt';
15
+ import './entity-type-map-Bd69SpAS.js';
16
+ import './entity-DZbFQ1Wg.js';
17
+ import '@zylem/behaviors/particle-emitter';
18
+ import 'three/addons/lines/webgpu/Line2.js';
19
+ import './zylem-camera-C3bn6BTI.js';
20
+ import './default-controls-0-vCnli7.js';
21
+
22
+ /**
23
+ * State interface for editor-to-game communication
24
+ */
25
+ interface ZylemGameState {
26
+ gameState?: {
27
+ debugFlag?: boolean;
28
+ [key: string]: unknown;
29
+ };
30
+ toolbarState?: {
31
+ tool?: DebugTools;
32
+ paused?: boolean;
33
+ };
34
+ [key: string]: unknown;
35
+ }
36
+ declare class ZylemGameElement extends HTMLElement {
37
+ private _game;
38
+ private _state;
39
+ private container;
40
+ private resizeObserver;
41
+ private _viewportProfile;
42
+ private static readonly HOST_CONFIG_MARKER;
43
+ constructor();
44
+ /**
45
+ * Focus the game container for keyboard input
46
+ */
47
+ focus(): void;
48
+ connectedCallback(): void;
49
+ set game(game: Game<any>);
50
+ get game(): Game<any> | null;
51
+ set state(value: ZylemGameState);
52
+ get state(): ZylemGameState;
53
+ set viewportProfile(value: DeviceProfile);
54
+ get viewportProfile(): DeviceProfile;
55
+ static get observedAttributes(): string[];
56
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
57
+ /**
58
+ * Sync the web component's state with the game-lib's internal debug state
59
+ */
60
+ private syncDebugState;
61
+ /**
62
+ * Sync toolbar state with game-lib's debug state
63
+ */
64
+ private syncToolbarState;
65
+ disconnectedCallback(): void;
66
+ private attachHostContainer;
67
+ private syncDisplayRuntime;
68
+ }
69
+
70
+ export { ZylemGameElement, type ZylemGameState };
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-TAUWDQZF.js";import"./chunk-JQKS42G4.js";export{a as ZylemGameElement};