@zylem/game-lib 0.9.1 → 0.9.2

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.
@@ -40729,6 +40729,75 @@
40729
40729
  ],
40730
40730
  "name": "lerpVec3"
40731
40731
  },
40732
+ {
40733
+ "kind": "Interface",
40734
+ "canonicalReference": "@zylem/game-lib!LevelStage:interface",
40735
+ "docComment": "/**\n * The slice of a stage `streamLevelOnStage` needs.\n */\n",
40736
+ "excerptTokens": [
40737
+ {
40738
+ "kind": "Content",
40739
+ "text": "interface LevelStage "
40740
+ }
40741
+ ],
40742
+ "fileUrlPath": "dist/core.d.ts",
40743
+ "releaseTag": "Public",
40744
+ "name": "LevelStage",
40745
+ "preserveMemberOrder": false,
40746
+ "members": [
40747
+ {
40748
+ "kind": "MethodSignature",
40749
+ "canonicalReference": "@zylem/game-lib!LevelStage#spawnEntity:member(1)",
40750
+ "docComment": "",
40751
+ "excerptTokens": [
40752
+ {
40753
+ "kind": "Content",
40754
+ "text": "spawnEntity(node: "
40755
+ },
40756
+ {
40757
+ "kind": "Reference",
40758
+ "text": "BaseNode",
40759
+ "canonicalReference": "@zylem/game-lib!~BaseNode:class"
40760
+ },
40761
+ {
40762
+ "kind": "Content",
40763
+ "text": "): "
40764
+ },
40765
+ {
40766
+ "kind": "Reference",
40767
+ "text": "Promise",
40768
+ "canonicalReference": "!Promise:interface"
40769
+ },
40770
+ {
40771
+ "kind": "Content",
40772
+ "text": "<void> | void"
40773
+ },
40774
+ {
40775
+ "kind": "Content",
40776
+ "text": ";"
40777
+ }
40778
+ ],
40779
+ "isOptional": false,
40780
+ "returnTypeTokenRange": {
40781
+ "startIndex": 3,
40782
+ "endIndex": 5
40783
+ },
40784
+ "releaseTag": "Public",
40785
+ "overloadIndex": 1,
40786
+ "parameters": [
40787
+ {
40788
+ "parameterName": "node",
40789
+ "parameterTypeTokenRange": {
40790
+ "startIndex": 1,
40791
+ "endIndex": 2
40792
+ },
40793
+ "isOptional": false
40794
+ }
40795
+ ],
40796
+ "name": "spawnEntity"
40797
+ }
40798
+ ],
40799
+ "extendsTokenRanges": []
40800
+ },
40732
40801
  {
40733
40802
  "kind": "Variable",
40734
40803
  "canonicalReference": "@zylem/game-lib!LIGHT_TYPE:var",
@@ -60844,6 +60913,301 @@
60844
60913
  ],
60845
60914
  "extendsTokenRanges": []
60846
60915
  },
60916
+ {
60917
+ "kind": "Function",
60918
+ "canonicalReference": "@zylem/game-lib!streamLevel:function(1)",
60919
+ "docComment": "/**\n * Hand each buffer entry to `spawn`, in order, yielding between batches.\n *\n * @returns How many entries were handed off. A spawn that no-ops for an unknown catalog type still counts: the entry was delivered.\n */\n",
60920
+ "excerptTokens": [
60921
+ {
60922
+ "kind": "Content",
60923
+ "text": "declare function streamLevel(buffer: "
60924
+ },
60925
+ {
60926
+ "kind": "Reference",
60927
+ "text": "LevelBuffer",
60928
+ "canonicalReference": "@zylem/bridge!LevelBuffer:interface"
60929
+ },
60930
+ {
60931
+ "kind": "Content",
60932
+ "text": ", spawn: "
60933
+ },
60934
+ {
60935
+ "kind": "Content",
60936
+ "text": "(entry: "
60937
+ },
60938
+ {
60939
+ "kind": "Reference",
60940
+ "text": "LevelEntry",
60941
+ "canonicalReference": "@zylem/bridge!LevelEntry:interface"
60942
+ },
60943
+ {
60944
+ "kind": "Content",
60945
+ "text": ") => void | "
60946
+ },
60947
+ {
60948
+ "kind": "Reference",
60949
+ "text": "Promise",
60950
+ "canonicalReference": "!Promise:interface"
60951
+ },
60952
+ {
60953
+ "kind": "Content",
60954
+ "text": "<void>"
60955
+ },
60956
+ {
60957
+ "kind": "Content",
60958
+ "text": ", options?: "
60959
+ },
60960
+ {
60961
+ "kind": "Reference",
60962
+ "text": "StreamLevelOptions",
60963
+ "canonicalReference": "@zylem/game-lib!StreamLevelOptions:interface"
60964
+ },
60965
+ {
60966
+ "kind": "Content",
60967
+ "text": "): "
60968
+ },
60969
+ {
60970
+ "kind": "Reference",
60971
+ "text": "Promise",
60972
+ "canonicalReference": "!Promise:interface"
60973
+ },
60974
+ {
60975
+ "kind": "Content",
60976
+ "text": "<"
60977
+ },
60978
+ {
60979
+ "kind": "Reference",
60980
+ "text": "StreamLevelResult",
60981
+ "canonicalReference": "@zylem/game-lib!StreamLevelResult:interface"
60982
+ },
60983
+ {
60984
+ "kind": "Content",
60985
+ "text": ">"
60986
+ },
60987
+ {
60988
+ "kind": "Content",
60989
+ "text": ";"
60990
+ }
60991
+ ],
60992
+ "fileUrlPath": "dist/core.d.ts",
60993
+ "returnTypeTokenRange": {
60994
+ "startIndex": 11,
60995
+ "endIndex": 15
60996
+ },
60997
+ "releaseTag": "Public",
60998
+ "overloadIndex": 1,
60999
+ "parameters": [
61000
+ {
61001
+ "parameterName": "buffer",
61002
+ "parameterTypeTokenRange": {
61003
+ "startIndex": 1,
61004
+ "endIndex": 2
61005
+ },
61006
+ "isOptional": false
61007
+ },
61008
+ {
61009
+ "parameterName": "spawn",
61010
+ "parameterTypeTokenRange": {
61011
+ "startIndex": 3,
61012
+ "endIndex": 8
61013
+ },
61014
+ "isOptional": false
61015
+ },
61016
+ {
61017
+ "parameterName": "options",
61018
+ "parameterTypeTokenRange": {
61019
+ "startIndex": 9,
61020
+ "endIndex": 10
61021
+ },
61022
+ "isOptional": true
61023
+ }
61024
+ ],
61025
+ "name": "streamLevel"
61026
+ },
61027
+ {
61028
+ "kind": "Function",
61029
+ "canonicalReference": "@zylem/game-lib!streamLevelOnStage:function(1)",
61030
+ "docComment": "/**\n * Spawn every catalog entry in `buffer` onto `stage`.\n *\n * Position is handed to the type's factory. Rotation and scale are applied after spawn, and a scale change rebuilds colliders. An entry whose catalog id is not registered is skipped.\n */\n",
61031
+ "excerptTokens": [
61032
+ {
61033
+ "kind": "Content",
61034
+ "text": "declare function streamLevelOnStage(stage: "
61035
+ },
61036
+ {
61037
+ "kind": "Reference",
61038
+ "text": "LevelStage",
61039
+ "canonicalReference": "@zylem/game-lib!LevelStage:interface"
61040
+ },
61041
+ {
61042
+ "kind": "Content",
61043
+ "text": ", buffer: "
61044
+ },
61045
+ {
61046
+ "kind": "Reference",
61047
+ "text": "LevelBuffer",
61048
+ "canonicalReference": "@zylem/bridge!LevelBuffer:interface"
61049
+ },
61050
+ {
61051
+ "kind": "Content",
61052
+ "text": ", options?: "
61053
+ },
61054
+ {
61055
+ "kind": "Reference",
61056
+ "text": "StreamLevelOptions",
61057
+ "canonicalReference": "@zylem/game-lib!StreamLevelOptions:interface"
61058
+ },
61059
+ {
61060
+ "kind": "Content",
61061
+ "text": "): "
61062
+ },
61063
+ {
61064
+ "kind": "Reference",
61065
+ "text": "Promise",
61066
+ "canonicalReference": "!Promise:interface"
61067
+ },
61068
+ {
61069
+ "kind": "Content",
61070
+ "text": "<"
61071
+ },
61072
+ {
61073
+ "kind": "Reference",
61074
+ "text": "StreamLevelResult",
61075
+ "canonicalReference": "@zylem/game-lib!StreamLevelResult:interface"
61076
+ },
61077
+ {
61078
+ "kind": "Content",
61079
+ "text": ">"
61080
+ },
61081
+ {
61082
+ "kind": "Content",
61083
+ "text": ";"
61084
+ }
61085
+ ],
61086
+ "fileUrlPath": "dist/core.d.ts",
61087
+ "returnTypeTokenRange": {
61088
+ "startIndex": 7,
61089
+ "endIndex": 11
61090
+ },
61091
+ "releaseTag": "Public",
61092
+ "overloadIndex": 1,
61093
+ "parameters": [
61094
+ {
61095
+ "parameterName": "stage",
61096
+ "parameterTypeTokenRange": {
61097
+ "startIndex": 1,
61098
+ "endIndex": 2
61099
+ },
61100
+ "isOptional": false
61101
+ },
61102
+ {
61103
+ "parameterName": "buffer",
61104
+ "parameterTypeTokenRange": {
61105
+ "startIndex": 3,
61106
+ "endIndex": 4
61107
+ },
61108
+ "isOptional": false
61109
+ },
61110
+ {
61111
+ "parameterName": "options",
61112
+ "parameterTypeTokenRange": {
61113
+ "startIndex": 5,
61114
+ "endIndex": 6
61115
+ },
61116
+ "isOptional": true
61117
+ }
61118
+ ],
61119
+ "name": "streamLevelOnStage"
61120
+ },
61121
+ {
61122
+ "kind": "Interface",
61123
+ "canonicalReference": "@zylem/game-lib!StreamLevelOptions:interface",
61124
+ "docComment": "/**\n * Stream a level buffer into a stage.\n *\n * The streamer does not know the catalog. `spawn` is the host's existing create path, which resolves a catalog id and no-ops when the type is unknown. Entries are handed off in batches, yielding to the event loop between them so a large level does not stall the frame the way a single synchronous spawn loop would.\n */\n",
61125
+ "excerptTokens": [
61126
+ {
61127
+ "kind": "Content",
61128
+ "text": "interface StreamLevelOptions "
61129
+ }
61130
+ ],
61131
+ "fileUrlPath": "dist/core.d.ts",
61132
+ "releaseTag": "Public",
61133
+ "name": "StreamLevelOptions",
61134
+ "preserveMemberOrder": false,
61135
+ "members": [
61136
+ {
61137
+ "kind": "PropertySignature",
61138
+ "canonicalReference": "@zylem/game-lib!StreamLevelOptions#batchSize:member",
61139
+ "docComment": "/**\n * @default 5\n */\n",
61140
+ "excerptTokens": [
61141
+ {
61142
+ "kind": "Content",
61143
+ "text": "batchSize?: "
61144
+ },
61145
+ {
61146
+ "kind": "Content",
61147
+ "text": "number"
61148
+ },
61149
+ {
61150
+ "kind": "Content",
61151
+ "text": ";"
61152
+ }
61153
+ ],
61154
+ "isReadonly": false,
61155
+ "isOptional": true,
61156
+ "releaseTag": "Public",
61157
+ "name": "batchSize",
61158
+ "propertyTypeTokenRange": {
61159
+ "startIndex": 1,
61160
+ "endIndex": 2
61161
+ }
61162
+ }
61163
+ ],
61164
+ "extendsTokenRanges": []
61165
+ },
61166
+ {
61167
+ "kind": "Interface",
61168
+ "canonicalReference": "@zylem/game-lib!StreamLevelResult:interface",
61169
+ "docComment": "",
61170
+ "excerptTokens": [
61171
+ {
61172
+ "kind": "Content",
61173
+ "text": "interface StreamLevelResult "
61174
+ }
61175
+ ],
61176
+ "fileUrlPath": "dist/core.d.ts",
61177
+ "releaseTag": "Public",
61178
+ "name": "StreamLevelResult",
61179
+ "preserveMemberOrder": false,
61180
+ "members": [
61181
+ {
61182
+ "kind": "PropertySignature",
61183
+ "canonicalReference": "@zylem/game-lib!StreamLevelResult#spawned:member",
61184
+ "docComment": "/**\n * Entries handed to `spawn`, in buffer order.\n */\n",
61185
+ "excerptTokens": [
61186
+ {
61187
+ "kind": "Content",
61188
+ "text": "spawned: "
61189
+ },
61190
+ {
61191
+ "kind": "Content",
61192
+ "text": "number"
61193
+ },
61194
+ {
61195
+ "kind": "Content",
61196
+ "text": ";"
61197
+ }
61198
+ ],
61199
+ "isReadonly": false,
61200
+ "isOptional": false,
61201
+ "releaseTag": "Public",
61202
+ "name": "spawned",
61203
+ "propertyTypeTokenRange": {
61204
+ "startIndex": 1,
61205
+ "endIndex": 2
61206
+ }
61207
+ }
61208
+ ],
61209
+ "extendsTokenRanges": []
61210
+ },
60847
61211
  {
60848
61212
  "kind": "Interface",
60849
61213
  "canonicalReference": "@zylem/game-lib!SwatchApplyOutcome:interface",
@@ -169,6 +169,8 @@ import { JumpInput3D } from '@zylem/behaviors';
169
169
  import { JumpState2D } from '@zylem/behaviors';
170
170
  import { JumpState3D } from '@zylem/behaviors';
171
171
  import { length as length_2 } from 'three/tsl';
172
+ import { LevelBuffer } from '@zylem/bridge';
173
+ import { LevelEntry } from '@zylem/bridge';
172
174
  import { Light } from 'three';
173
175
  import { Line2 } from 'three/addons/lines/webgpu/Line2.js';
174
176
  import { Material } from 'three';
@@ -3173,6 +3175,14 @@ export function lerpPose(a: EvaluatedPose, b: EvaluatedPose, t: number): Evaluat
3173
3175
  // @public (undocumented)
3174
3176
  export function lerpVec3(a: Vec3Def, b: Vec3Def, t: number): Vec3Def;
3175
3177
 
3178
+ export { LevelBuffer }
3179
+
3180
+ // @public
3181
+ export interface LevelStage {
3182
+ // (undocumented)
3183
+ spawnEntity(node: BaseNode): Promise<void> | void;
3184
+ }
3185
+
3176
3186
  // @public (undocumented)
3177
3187
  export const LIGHT_TYPE: unique symbol;
3178
3188
 
@@ -4942,6 +4952,23 @@ export interface StrategyPointer {
4942
4952
  y: number;
4943
4953
  }
4944
4954
 
4955
+ // @public
4956
+ export function streamLevel(buffer: LevelBuffer, spawn: (entry: LevelEntry) => void | Promise<void>, options?: StreamLevelOptions): Promise<StreamLevelResult>;
4957
+
4958
+ // @public
4959
+ export function streamLevelOnStage(stage: LevelStage, buffer: LevelBuffer, options?: StreamLevelOptions): Promise<StreamLevelResult>;
4960
+
4961
+ // @public
4962
+ export interface StreamLevelOptions {
4963
+ // (undocumented)
4964
+ batchSize?: number;
4965
+ }
4966
+
4967
+ // @public (undocumented)
4968
+ export interface StreamLevelResult {
4969
+ spawned: number;
4970
+ }
4971
+
4945
4972
  export { SwatchApplyFailureReason }
4946
4973
 
4947
4974
  // @public
@@ -163,6 +163,8 @@ import { JumpInput3D } from '@zylem/behaviors';
163
163
  import { JumpState2D } from '@zylem/behaviors';
164
164
  import { JumpState3D } from '@zylem/behaviors';
165
165
  import { length as length_2 } from 'three/tsl';
166
+ import { LevelBuffer } from '@zylem/bridge';
167
+ import { LevelEntry } from '@zylem/bridge';
166
168
  import { Light } from 'three';
167
169
  import { Line2 } from 'three/addons/lines/webgpu/Line2.js';
168
170
  import { Material } from 'three';
@@ -3555,6 +3557,13 @@ export declare class GameBridge {
3555
3557
  * variable's update would never reach the editor.
3556
3558
  */
3557
3559
  publishVariable(payload: GameVariablePayload): void;
3560
+ /**
3561
+ * Stream a level buffer through the host's catalog spawn.
3562
+ *
3563
+ * Each entry is handed to `createEntity`, which no-ops for an unknown
3564
+ * type. The notice counts entries handed off, not bodies that appeared.
3565
+ */
3566
+ private loadLevel;
3558
3567
  /** Surface a diagnostic message in the editor console. */
3559
3568
  publishNotice(level: GameNoticePayload['level'], message: string): void;
3560
3569
  publishStageSnapshot(snapshot: StageSnapshotPayload): void;
@@ -4986,6 +4995,21 @@ export declare function lerpPose(a: EvaluatedPose, b: EvaluatedPose, t: number):
4986
4995
 
4987
4996
  export declare function lerpVec3(a: Vec3Def, b: Vec3Def, t: number): Vec3Def;
4988
4997
 
4998
+ export { LevelBuffer }
4999
+
5000
+ /**
5001
+ * Stream a level buffer into a stage through the catalog.
5002
+ *
5003
+ * `streamLevel` only walks entries. This is the call gameplay code makes:
5004
+ * each entry is created from its catalog id, spawned, then posed. Unknown
5005
+ * catalog ids are skipped. Batching stays in `streamLevel`.
5006
+ */
5007
+
5008
+ /** The slice of a stage `streamLevelOnStage` needs. */
5009
+ export declare interface LevelStage {
5010
+ spawnEntity(node: BaseNode): Promise<void> | void;
5011
+ }
5012
+
4989
5013
  /**
4990
5014
  * Provides BaseNode-like lifecycle without ECS/children. Consumers implement
4991
5015
  * the protected hooks and may assign public setup/update/destroy callbacks.
@@ -8345,6 +8369,43 @@ export declare interface StrategyPointer {
8345
8369
  centered?: boolean;
8346
8370
  }
8347
8371
 
8372
+ /**
8373
+ * Hand each buffer entry to `spawn`, in order, yielding between batches.
8374
+ *
8375
+ * @returns How many entries were handed off. A spawn that no-ops for an
8376
+ * unknown catalog type still counts: the entry was delivered.
8377
+ */
8378
+ export declare function streamLevel(buffer: LevelBuffer, spawn: (entry: LevelEntry) => void | Promise<void>, options?: StreamLevelOptions): Promise<StreamLevelResult>;
8379
+
8380
+ /**
8381
+ * Spawn every catalog entry in `buffer` onto `stage`.
8382
+ *
8383
+ * Position is handed to the type's factory. Rotation and scale are applied
8384
+ * after spawn, and a scale change rebuilds colliders. An entry whose catalog
8385
+ * id is not registered is skipped.
8386
+ */
8387
+ export declare function streamLevelOnStage(stage: LevelStage, buffer: LevelBuffer, options?: StreamLevelOptions): Promise<StreamLevelResult>;
8388
+
8389
+ /**
8390
+ * Stream a level buffer into a stage.
8391
+ *
8392
+ * The streamer does not know the catalog. `spawn` is the host's existing
8393
+ * create path, which resolves a catalog id and no-ops when the type is
8394
+ * unknown. Entries are handed off in batches, yielding to the event loop
8395
+ * between them so a large level does not stall the frame the way a single
8396
+ * synchronous spawn loop would.
8397
+ */
8398
+
8399
+ export declare interface StreamLevelOptions {
8400
+ /** @default 5 */
8401
+ batchSize?: number;
8402
+ }
8403
+
8404
+ export declare interface StreamLevelResult {
8405
+ /** Entries handed to `spawn`, in buffer order. */
8406
+ spawned: number;
8407
+ }
8408
+
8348
8409
  export { SwatchApplyFailureReason }
8349
8410
 
8350
8411
  /** What a host reports back from a swatch batch. */