@typeonce/ritmo 0.7.0 → 0.9.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.
- package/README.md +3 -2
- package/dist/Clock.d.ts +19 -4
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +18 -2
- package/dist/Clock.js.map +1 -1
- package/dist/Command.d.ts +181 -40
- package/dist/Command.d.ts.map +1 -1
- package/dist/Command.js +31 -11
- package/dist/Command.js.map +1 -1
- package/dist/Condition.d.ts +12 -1
- package/dist/Condition.d.ts.map +1 -1
- package/dist/Condition.js.map +1 -1
- package/dist/Debug.d.ts +127 -13
- package/dist/Debug.d.ts.map +1 -1
- package/dist/Descriptor.d.ts +61 -10
- package/dist/Descriptor.d.ts.map +1 -1
- package/dist/Descriptor.js +22 -10
- package/dist/Descriptor.js.map +1 -1
- package/dist/Entity.d.ts +22 -7
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js.map +1 -1
- package/dist/EntityScope.d.ts +20 -1
- package/dist/EntityScope.d.ts.map +1 -1
- package/dist/EntityScope.js +8 -2
- package/dist/EntityScope.js.map +1 -1
- package/dist/FixedLoop.d.ts +106 -0
- package/dist/FixedLoop.d.ts.map +1 -0
- package/dist/FixedLoop.js +97 -0
- package/dist/FixedLoop.js.map +1 -0
- package/dist/HostClock.d.ts +1 -1
- package/dist/HostClock.d.ts.map +1 -1
- package/dist/HostClock.js +2 -1
- package/dist/HostClock.js.map +1 -1
- package/dist/Machine.d.ts +59 -34
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +10 -3
- package/dist/Machine.js.map +1 -1
- package/dist/Query.d.ts +100 -14
- package/dist/Query.d.ts.map +1 -1
- package/dist/Query.js +34 -5
- package/dist/Query.js.map +1 -1
- package/dist/Relation.d.ts +5 -14
- package/dist/Relation.d.ts.map +1 -1
- package/dist/Relation.js +0 -32
- package/dist/Relation.js.map +1 -1
- package/dist/Runtime.d.ts +61 -15
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +594 -70
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +24 -15
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +2 -1
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +233 -48
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +33 -7
- package/dist/Schema.js.map +1 -1
- package/dist/Snapshot.d.ts +90 -1
- package/dist/Snapshot.d.ts.map +1 -1
- package/dist/Snapshot.js +42 -1
- package/dist/Snapshot.js.map +1 -1
- package/dist/System.d.ts +132 -31
- package/dist/System.d.ts.map +1 -1
- package/dist/System.js +32 -0
- package/dist/System.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/cells.d.ts +2 -0
- package/dist/internal/cells.d.ts.map +1 -1
- package/dist/internal/cells.js +34 -8
- package/dist/internal/cells.js.map +1 -1
- package/dist/internal/debug.d.ts +10 -0
- package/dist/internal/debug.d.ts.map +1 -1
- package/dist/internal/debug.js +171 -12
- package/dist/internal/debug.js.map +1 -1
- package/dist/internal/equal.d.ts +8 -0
- package/dist/internal/equal.d.ts.map +1 -0
- package/dist/internal/equal.js +38 -0
- package/dist/internal/equal.js.map +1 -0
- package/dist/internal/fragments.d.ts +2 -6
- package/dist/internal/fragments.d.ts.map +1 -1
- package/dist/internal/fragments.js +36 -3
- package/dist/internal/fragments.js.map +1 -1
- package/dist/internal/game.d.ts +2 -0
- package/dist/internal/game.d.ts.map +1 -1
- package/dist/internal/game.js +48 -7
- package/dist/internal/game.js.map +1 -1
- package/dist/internal/order.d.ts.map +1 -1
- package/dist/internal/order.js +4 -2
- package/dist/internal/order.js.map +1 -1
- package/dist/internal/queries.d.ts.map +1 -1
- package/dist/internal/queries.js +57 -26
- package/dist/internal/queries.js.map +1 -1
- package/dist/internal/relations.d.ts +10 -0
- package/dist/internal/relations.d.ts.map +1 -0
- package/dist/internal/relations.js +32 -0
- package/dist/internal/relations.js.map +1 -0
- package/dist/internal/requirements.d.ts +26 -0
- package/dist/internal/requirements.d.ts.map +1 -0
- package/dist/internal/requirements.js +46 -0
- package/dist/internal/requirements.js.map +1 -0
- package/dist/internal/streams.d.ts +2 -0
- package/dist/internal/streams.d.ts.map +1 -1
- package/dist/internal/streams.js +10 -0
- package/dist/internal/streams.js.map +1 -1
- package/dist/internal/world.d.ts +7 -1
- package/dist/internal/world.d.ts.map +1 -1
- package/dist/internal/world.js +53 -3
- package/dist/internal/world.js.map +1 -1
- package/package.json +1 -1
- package/src/Clock.ts +29 -4
- package/src/Command.ts +281 -67
- package/src/Condition.ts +17 -1
- package/src/Debug.ts +124 -15
- package/src/Descriptor.ts +92 -21
- package/src/Entity.ts +23 -7
- package/src/EntityScope.ts +21 -2
- package/src/FixedLoop.ts +218 -0
- package/src/HostClock.ts +2 -1
- package/src/Machine.ts +72 -35
- package/src/Query.ts +118 -17
- package/src/Relation.ts +5 -67
- package/src/Runtime.ts +659 -85
- package/src/Schedule.ts +31 -19
- package/src/Schema.ts +297 -57
- package/src/Snapshot.ts +94 -2
- package/src/System.ts +151 -29
- package/src/index.ts +4 -0
- package/src/internal/cells.ts +42 -10
- package/src/internal/debug.ts +179 -14
- package/src/internal/equal.ts +31 -0
- package/src/internal/fragments.ts +35 -5
- package/src/internal/game.ts +69 -7
- package/src/internal/order.ts +8 -4
- package/src/internal/queries.ts +62 -12
- package/src/internal/relations.ts +52 -0
- package/src/internal/requirements.ts +71 -0
- package/src/internal/streams.ts +11 -0
- package/src/internal/world.ts +60 -4
package/dist/Descriptor.d.ts
CHANGED
|
@@ -133,6 +133,37 @@ type ConstructedFor<Kind extends DescriptorKind, Name extends string, Value, Raw
|
|
|
133
133
|
export interface TransientDescriptor<out Kind extends "component" | "resource", out Name extends string, in out Value> extends Descriptor<Kind, Name, Value> {
|
|
134
134
|
readonly transient: true;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Marks a component that is never edited in place: `Game.Query.write(...)`
|
|
138
|
+
* rejects it, and the only way to change its value is to replace it with
|
|
139
|
+
* `commands.insert(...)` (applied at `applyDeferred()`, seen by
|
|
140
|
+
* `Game.Query.changed(...)`).
|
|
141
|
+
*/
|
|
142
|
+
export interface Immutable {
|
|
143
|
+
readonly immutable: true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Options of the component descriptor constructors (`Component`,
|
|
147
|
+
* `ConstructedComponent`, `TransientComponent`).
|
|
148
|
+
*/
|
|
149
|
+
export interface ComponentOptions {
|
|
150
|
+
/**
|
|
151
|
+
* `true` for data that says what an entity is (a kind, a team, a tile) and
|
|
152
|
+
* is replaced, never edited: queries can only read it, and
|
|
153
|
+
* `commands.insert(...)` replaces it. Leave it out for state that systems
|
|
154
|
+
* update every frame.
|
|
155
|
+
*/
|
|
156
|
+
readonly immutable?: true;
|
|
157
|
+
}
|
|
158
|
+
/** The descriptor a component constructor returns for `Options`: `D`, plus `Immutable` when `immutable: true`. */
|
|
159
|
+
export type WithComponentOptions<D, Options extends ComponentOptions> = Options extends {
|
|
160
|
+
readonly immutable: true;
|
|
161
|
+
} ? D & Immutable : D;
|
|
162
|
+
/**
|
|
163
|
+
* Whether a component descriptor was declared `immutable: true` (readable by
|
|
164
|
+
* queries, replaced only with `commands.insert(...)`).
|
|
165
|
+
*/
|
|
166
|
+
export declare const isImmutable: (descriptor: Descriptor.Any) => descriptor is Descriptor.Any & Immutable;
|
|
136
167
|
/**
|
|
137
168
|
* Type-level helpers for working with descriptors.
|
|
138
169
|
*/
|
|
@@ -155,6 +186,15 @@ export declare namespace Descriptor {
|
|
|
155
186
|
type ConstructionError<T extends Any> = T extends ConstructedDescriptor<infer _Kind, infer _Name, infer _Value, infer _Raw, infer Error> ? Error : never;
|
|
156
187
|
type Constructor<T extends Any> = T extends ConstructedDescriptor<infer _Kind, infer _Name, infer Value, infer Raw, infer Error> ? ResultConstructor<Value, Raw, Error> : never;
|
|
157
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* The message naming why `Value` cannot be the value of a descriptor of
|
|
191
|
+
* `Kind`, or `never` when it can. `any` turns off every check on the
|
|
192
|
+
* descriptor's reads and writes, and `never` erases the fragment it is listed in.
|
|
193
|
+
*/
|
|
194
|
+
type Article<Kind extends string> = Kind extends "event" ? "an" : "a";
|
|
195
|
+
type ValueRejection<Kind extends string, Value> = 0 extends 1 & Value ? `${Article<Kind>} ${Kind} value cannot be \`any\`: give it a type (use \`unknown\` for a value you never read)` : [Value] extends [never] ? `${Article<Kind>} ${Kind} value cannot be \`never\`: give it a type (use \`{}\` for a marker)` : never;
|
|
196
|
+
/** `Make`, or, when `Value` is rejected, a function whose only parameter is the message. */
|
|
197
|
+
type CheckedValue<Kind extends string, Value, Make> = [ValueRejection<Kind, Value>] extends [never] ? Make : (name: ValueRejection<Kind, Value>) => never;
|
|
158
198
|
/**
|
|
159
199
|
* Defines a component descriptor.
|
|
160
200
|
*
|
|
@@ -164,12 +204,18 @@ export declare namespace Descriptor {
|
|
|
164
204
|
* Components are the only descriptor kind that can be queried directly with
|
|
165
205
|
* `Game.Query.read(...)`, `write(...)`, or `optional(...)`.
|
|
166
206
|
*
|
|
207
|
+
* The value is a real type: `any` and `never` do not compile (here and in
|
|
208
|
+
* every other descriptor constructor). Use `unknown` for a value no system
|
|
209
|
+
* reads, and `Descriptor.Tag` for a marker.
|
|
210
|
+
*
|
|
167
211
|
* @example
|
|
168
212
|
* ```ts
|
|
169
213
|
* const Position = Descriptor.Component<{ x: number; y: number }>()("Position")
|
|
214
|
+
* // What an entity is, replaced with commands.insert and never written by a query:
|
|
215
|
+
* const EnemyKind = Descriptor.Component<"grunt" | "boss">()("EnemyKind", { immutable: true })
|
|
170
216
|
* ```
|
|
171
217
|
*/
|
|
172
|
-
export declare const Component: <Value>() => <const Name extends string>(name: Name) => Descriptor<"component", Name, Value
|
|
218
|
+
export declare const Component: <Value>() => CheckedValue<"component", Value, <const Name extends string, const Options extends ComponentOptions = {}>(name: Name, options?: Options) => WithComponentOptions<Descriptor<"component", Name, Value>, Options>>;
|
|
173
219
|
/**
|
|
174
220
|
* Defines a component descriptor that also knows how to validate raw values.
|
|
175
221
|
*
|
|
@@ -183,7 +229,7 @@ export declare const Component: <Value>() => <const Name extends string>(name: N
|
|
|
183
229
|
* const Position = Descriptor.ConstructedComponent(Vector2)("Position")
|
|
184
230
|
* ```
|
|
185
231
|
*/
|
|
186
|
-
export declare const ConstructedComponent: <Value, Raw, Error, Constructor extends {} = {}>(constructor: ResultConstructor<Value, Raw, Error> & Constructor) => <const Name extends string>(name: Name) => ConstructedFor<"component", Name, Value, Raw, Error, Constructor>;
|
|
232
|
+
export declare const ConstructedComponent: <Value, Raw, Error, Constructor extends {} = {}>(constructor: ResultConstructor<Value, Raw, Error> & Constructor) => <const Name extends string, const Options extends ComponentOptions = {}>(name: Name, options?: Options) => WithComponentOptions<ConstructedFor<"component", Name, Value, Raw, Error, Constructor>, Options>;
|
|
187
233
|
/**
|
|
188
234
|
* Defines a component descriptor that snapshots skip.
|
|
189
235
|
*
|
|
@@ -195,7 +241,7 @@ export declare const ConstructedComponent: <Value, Raw, Error, Constructor exten
|
|
|
195
241
|
* const SpriteRef = Descriptor.TransientComponent<{ frame: number }>()("SpriteRef")
|
|
196
242
|
* ```
|
|
197
243
|
*/
|
|
198
|
-
export declare const TransientComponent: <Value>() => <const Name extends string>(name: Name) => TransientDescriptor<"component", Name, Value
|
|
244
|
+
export declare const TransientComponent: <Value>() => CheckedValue<"component", Value, <const Name extends string, const Options extends ComponentOptions = {}>(name: Name, options?: Options) => WithComponentOptions<TransientDescriptor<"component", Name, Value>, Options>>;
|
|
199
245
|
/**
|
|
200
246
|
* Defines a marker component: no data, only presence (`[Player, {}]`).
|
|
201
247
|
*
|
|
@@ -274,7 +320,7 @@ export declare const isEntityState: (descriptor: Descriptor.Any) => descriptor i
|
|
|
274
320
|
* const Score = Descriptor.Resource<number>()("Score")
|
|
275
321
|
* ```
|
|
276
322
|
*/
|
|
277
|
-
export declare const Resource: <Value>() => <const Name extends string>(name: Name) => Descriptor<"resource", Name, Value
|
|
323
|
+
export declare const Resource: <Value>() => CheckedValue<"resource", Value, <const Name extends string>(name: Name) => Descriptor<"resource", Name, Value>>;
|
|
278
324
|
/**
|
|
279
325
|
* Defines a resource descriptor that also knows how to validate raw values.
|
|
280
326
|
*/
|
|
@@ -288,7 +334,7 @@ export declare const ConstructedResource: <Value, Raw, Error, Constructor extend
|
|
|
288
334
|
* const DeltaTime = Descriptor.TransientResource<number>()("DeltaTime")
|
|
289
335
|
* ```
|
|
290
336
|
*/
|
|
291
|
-
export declare const TransientResource: <Value>() => <const Name extends string>(name: Name) => TransientDescriptor<"resource", Name, Value
|
|
337
|
+
export declare const TransientResource: <Value>() => CheckedValue<"resource", Value, <const Name extends string>(name: Name) => TransientDescriptor<"resource", Name, Value>>;
|
|
292
338
|
/**
|
|
293
339
|
* Defines an event descriptor.
|
|
294
340
|
*
|
|
@@ -307,7 +353,7 @@ export declare const TransientResource: <Value>() => <const Name extends string>
|
|
|
307
353
|
* const Hit = Descriptor.Event<{ target: number; amount: number }>()("Hit")
|
|
308
354
|
* ```
|
|
309
355
|
*/
|
|
310
|
-
export declare const Event: <Value>() => <const Name extends string>(name: Name) => Descriptor<"event", Name, Value
|
|
356
|
+
export declare const Event: <Value>() => CheckedValue<"event", Value, <const Name extends string>(name: Name) => Descriptor<"event", Name, Value>>;
|
|
311
357
|
/**
|
|
312
358
|
* Defines a service descriptor.
|
|
313
359
|
*
|
|
@@ -325,7 +371,7 @@ export declare const Event: <Value>() => <const Name extends string>(name: Name)
|
|
|
325
371
|
* const Logger = Descriptor.Service<{ log: (message: string) => void }>()("Logger")
|
|
326
372
|
* ```
|
|
327
373
|
*/
|
|
328
|
-
export declare const Service: <Value>() => <const Name extends string>(name: Name) => Descriptor<"service", Name, Value
|
|
374
|
+
export declare const Service: <Value>() => CheckedValue<"service", Value, <const Name extends string>(name: Name) => Descriptor<"service", Name, Value>>;
|
|
329
375
|
/**
|
|
330
376
|
* Checks whether one descriptor is transient (skipped by snapshots).
|
|
331
377
|
*/
|
|
@@ -403,7 +449,10 @@ export declare function constructorOf<D extends Descriptor.Any>(descriptor: D):
|
|
|
403
449
|
* `Game.EntityScope(...)` instead when entities only share a lifetime (a
|
|
404
450
|
* level, a menu) and need no tree, order, or traversal.
|
|
405
451
|
*/
|
|
406
|
-
export declare const Hierarchy:
|
|
452
|
+
export declare const Hierarchy: <const Name extends string, const RelatedName extends string>(name: Name, relatedName: RelatedName) => {
|
|
453
|
+
readonly relation: import("./Relation.ts").RelationDefinition<Name, RelatedName, "hierarchy", import("./Relation.ts").PairBrand<Name, RelatedName, "hierarchy">>;
|
|
454
|
+
readonly related: import("./Relation.ts").RelatedDefinition<RelatedName, Name, "hierarchy", import("./Relation.ts").PairBrand<Name, RelatedName, "hierarchy">>;
|
|
455
|
+
};
|
|
407
456
|
/**
|
|
408
457
|
* Defines a general relationship pair with direct edges and reverse lookups.
|
|
409
458
|
*
|
|
@@ -411,8 +460,10 @@ export declare const Hierarchy: typeof RelationModule.Hierarchy;
|
|
|
411
460
|
* reverse lookup, but not hierarchy-only behavior such as tree traversal or
|
|
412
461
|
* child reordering.
|
|
413
462
|
*/
|
|
414
|
-
export declare const Relation:
|
|
463
|
+
export declare const Relation: <const Name extends string, const RelatedName extends string>(name: Name, relatedName: RelatedName) => {
|
|
464
|
+
readonly relation: import("./Relation.ts").RelationDefinition<Name, RelatedName, "relation", import("./Relation.ts").PairBrand<Name, RelatedName, "relation">>;
|
|
465
|
+
readonly related: import("./Relation.ts").RelatedDefinition<RelatedName, Name, "relation", import("./Relation.ts").PairBrand<Name, RelatedName, "relation">>;
|
|
466
|
+
};
|
|
415
467
|
import * as DecodeModule from "./Decode.ts";
|
|
416
|
-
import * as RelationModule from "./Relation.ts";
|
|
417
468
|
export {};
|
|
418
469
|
//# sourceMappingURL=Descriptor.d.ts.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= "~ritmo/Descriptor";
|
|
|
5
5
|
const descriptorConstructionTypeId = "~ritmo/DescriptorConstruction";
|
|
6
6
|
const descriptorDecodeTypeId = "~ritmo/DescriptorDecode";
|
|
7
7
|
const descriptorConstruction = Symbol("ritmo/DescriptorConstruction");
|
|
8
|
+
const applyComponentOptions = (descriptor, options) => options?.immutable === true ? { ...descriptor, immutable: true } : descriptor;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a component descriptor was declared `immutable: true` (readable by
|
|
11
|
+
* queries, replaced only with `commands.insert(...)`).
|
|
12
|
+
*/
|
|
13
|
+
export const isImmutable = (descriptor) => "immutable" in descriptor && descriptor.immutable === true;
|
|
8
14
|
/**
|
|
9
15
|
* Internal descriptor constructor shared by all descriptor helpers.
|
|
10
16
|
*
|
|
@@ -37,12 +43,18 @@ const makeConstructedDescriptor = (kind, name, constructor) => ({
|
|
|
37
43
|
* Components are the only descriptor kind that can be queried directly with
|
|
38
44
|
* `Game.Query.read(...)`, `write(...)`, or `optional(...)`.
|
|
39
45
|
*
|
|
46
|
+
* The value is a real type: `any` and `never` do not compile (here and in
|
|
47
|
+
* every other descriptor constructor). Use `unknown` for a value no system
|
|
48
|
+
* reads, and `Descriptor.Tag` for a marker.
|
|
49
|
+
*
|
|
40
50
|
* @example
|
|
41
51
|
* ```ts
|
|
42
52
|
* const Position = Descriptor.Component<{ x: number; y: number }>()("Position")
|
|
53
|
+
* // What an entity is, replaced with commands.insert and never written by a query:
|
|
54
|
+
* const EnemyKind = Descriptor.Component<"grunt" | "boss">()("EnemyKind", { immutable: true })
|
|
43
55
|
* ```
|
|
44
56
|
*/
|
|
45
|
-
export const Component = () => (name) => makeDescriptor("component", name);
|
|
57
|
+
export const Component = () => ((name, options) => applyComponentOptions(makeDescriptor("component", name), options));
|
|
46
58
|
/**
|
|
47
59
|
* Defines a component descriptor that also knows how to validate raw values.
|
|
48
60
|
*
|
|
@@ -56,7 +68,7 @@ export const Component = () => (name) => makeDescriptor("component", name);
|
|
|
56
68
|
* const Position = Descriptor.ConstructedComponent(Vector2)("Position")
|
|
57
69
|
* ```
|
|
58
70
|
*/
|
|
59
|
-
export const ConstructedComponent = (constructor) => (name) => makeConstructedDescriptor("component", name, constructor);
|
|
71
|
+
export const ConstructedComponent = (constructor) => (name, options) => applyComponentOptions(makeConstructedDescriptor("component", name, constructor), options);
|
|
60
72
|
/**
|
|
61
73
|
* Defines a component descriptor that snapshots skip.
|
|
62
74
|
*
|
|
@@ -68,7 +80,7 @@ export const ConstructedComponent = (constructor) => (name) => makeConstructedDe
|
|
|
68
80
|
* const SpriteRef = Descriptor.TransientComponent<{ frame: number }>()("SpriteRef")
|
|
69
81
|
* ```
|
|
70
82
|
*/
|
|
71
|
-
export const TransientComponent = () => (name) => makeTransientDescriptor("component", name);
|
|
83
|
+
export const TransientComponent = () => ((name, options) => applyComponentOptions(makeTransientDescriptor("component", name), options));
|
|
72
84
|
/**
|
|
73
85
|
* Defines a marker component: no data, only presence (`[Player, {}]`).
|
|
74
86
|
*
|
|
@@ -132,7 +144,7 @@ export const isEntityState = (descriptor) => "states" in descriptor;
|
|
|
132
144
|
* const Score = Descriptor.Resource<number>()("Score")
|
|
133
145
|
* ```
|
|
134
146
|
*/
|
|
135
|
-
export const Resource = () => (name) => makeDescriptor("resource", name);
|
|
147
|
+
export const Resource = () => ((name) => makeDescriptor("resource", name));
|
|
136
148
|
/**
|
|
137
149
|
* Defines a resource descriptor that also knows how to validate raw values.
|
|
138
150
|
*/
|
|
@@ -146,7 +158,7 @@ export const ConstructedResource = (constructor) => (name) => makeConstructedDes
|
|
|
146
158
|
* const DeltaTime = Descriptor.TransientResource<number>()("DeltaTime")
|
|
147
159
|
* ```
|
|
148
160
|
*/
|
|
149
|
-
export const TransientResource = () => (name) => makeTransientDescriptor("resource", name);
|
|
161
|
+
export const TransientResource = () => ((name) => makeTransientDescriptor("resource", name));
|
|
150
162
|
/**
|
|
151
163
|
* Defines an event descriptor.
|
|
152
164
|
*
|
|
@@ -165,7 +177,7 @@ export const TransientResource = () => (name) => makeTransientDescriptor("resour
|
|
|
165
177
|
* const Hit = Descriptor.Event<{ target: number; amount: number }>()("Hit")
|
|
166
178
|
* ```
|
|
167
179
|
*/
|
|
168
|
-
export const Event = () => (name) => makeDescriptor("event", name);
|
|
180
|
+
export const Event = () => ((name) => makeDescriptor("event", name));
|
|
169
181
|
/**
|
|
170
182
|
* Defines a service descriptor.
|
|
171
183
|
*
|
|
@@ -183,7 +195,7 @@ export const Event = () => (name) => makeDescriptor("event", name);
|
|
|
183
195
|
* const Logger = Descriptor.Service<{ log: (message: string) => void }>()("Logger")
|
|
184
196
|
* ```
|
|
185
197
|
*/
|
|
186
|
-
export const Service = () => (name) => makeDescriptor("service", name);
|
|
198
|
+
export const Service = () => ((name) => makeDescriptor("service", name));
|
|
187
199
|
/**
|
|
188
200
|
* Checks whether one descriptor is transient (skipped by snapshots).
|
|
189
201
|
*/
|
|
@@ -246,7 +258,7 @@ export function constructorOf(descriptor) {
|
|
|
246
258
|
* `Game.EntityScope(...)` instead when entities only share a lifetime (a
|
|
247
259
|
* level, a menu) and need no tree, order, or traversal.
|
|
248
260
|
*/
|
|
249
|
-
export const Hierarchy =
|
|
261
|
+
export const Hierarchy = (name, relatedName) => makePair("hierarchy", name, relatedName);
|
|
250
262
|
/**
|
|
251
263
|
* Defines a general relationship pair with direct edges and reverse lookups.
|
|
252
264
|
*
|
|
@@ -254,8 +266,8 @@ export const Hierarchy = RelationModule.Hierarchy;
|
|
|
254
266
|
* reverse lookup, but not hierarchy-only behavior such as tree traversal or
|
|
255
267
|
* child reordering.
|
|
256
268
|
*/
|
|
257
|
-
export const Relation =
|
|
269
|
+
export const Relation = (name, relatedName) => makePair("relation", name, relatedName);
|
|
258
270
|
import * as DecodeModule from "./Decode.js";
|
|
259
|
-
import
|
|
271
|
+
import { makePair } from "./internal/relations.js";
|
|
260
272
|
import * as ResultModule from "./Result.js";
|
|
261
273
|
//# sourceMappingURL=Descriptor.js.map
|
package/dist/Descriptor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../src/Descriptor.ts"],"names":[],"mappings":"AA2DA;;GAEG;AACH,MAAM,gBAAgB,GAAqB,mBAAmB,CAAA;AAC9D,MAAM,4BAA4B,GAAiC,+BAA+B,CAAA;AAClG,MAAM,sBAAsB,GAA2B,yBAAyB,CAAA;AAChF,MAAM,sBAAsB,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../src/Descriptor.ts"],"names":[],"mappings":"AA2DA;;GAEG;AACH,MAAM,gBAAgB,GAAqB,mBAAmB,CAAA;AAC9D,MAAM,4BAA4B,GAAiC,+BAA+B,CAAA;AAClG,MAAM,sBAAsB,GAA2B,yBAAyB,CAAA;AAChF,MAAM,sBAAsB,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAA;AAmIrE,MAAM,qBAAqB,GAAG,CAAmB,UAAa,EAAE,OAAqC,EAAK,EAAE,CAC1G,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAA;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAA0B,EAA4C,EAAE,CAClG,WAAW,IAAI,UAAU,IAAI,UAAU,CAAC,SAAS,KAAK,IAAI,CAAA;AAiC5D;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CACrB,IAAU,EACV,IAAU,EACqB,EAAE,CACjC,CAAC;IACC,IAAI;IACJ,IAAI;IACJ,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC;CACzC,CAAkC,CAAA;AAErC,MAAM,uBAAuB,GAAG,CAC9B,IAAU,EACV,IAAU,EAC8B,EAAE,CAC1C,CAAC;IACC,IA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AEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAA0B,EAA2C,EAAE,CACpG,sBAAsB,IAAI,UAAU,CAAA;AAatC,MAAM,UAAU,aAAa,CAC3B,UAAa;IAEb,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,SAAS,CAA0C,CAAA;AAC/H,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAU,EACV,WAAwB,EACxB,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAU,EACV,WAAwB,EACxB,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAC5C,OAAO,KAAK,YAAY,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,YAAY,MAAM,aAAa,CAAA"}
|
package/dist/Entity.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export declare namespace Handle {
|
|
|
114
114
|
* Drafts exist before the command queue is flushed. This is the place where the
|
|
115
115
|
* API can safely carry exact structural information.
|
|
116
116
|
*/
|
|
117
|
-
export interface EntityDraft<S extends Schema.Any, out P extends ComponentProof, Root = unknown> {
|
|
117
|
+
export interface EntityDraft<S extends Schema.Any, out P extends ComponentProof, Root = unknown, out Relates = never> {
|
|
118
118
|
/**
|
|
119
119
|
* Runtime tag for debugging and pattern matching.
|
|
120
120
|
*/
|
|
@@ -139,6 +139,11 @@ export interface EntityDraft<S extends Schema.Any, out P extends ComponentProof,
|
|
|
139
139
|
* Staged relationship edges attached to the entity before spawn.
|
|
140
140
|
*/
|
|
141
141
|
readonly relations: ReadonlyArray<StagedRelation<S, Root>>;
|
|
142
|
+
/**
|
|
143
|
+
* The relations `Game.Command.relate(...)` staged on this draft: spawning
|
|
144
|
+
* it needs them in the system's `Game.System.relates(...)`. Type-level only.
|
|
145
|
+
*/
|
|
146
|
+
readonly __relates?: (_: never) => Relates;
|
|
142
147
|
}
|
|
143
148
|
/**
|
|
144
149
|
* One staged component value paired with the descriptor that owns it.
|
|
@@ -149,17 +154,25 @@ export type StagedComponent = readonly [Descriptor<"component", string, any>, un
|
|
|
149
154
|
*
|
|
150
155
|
* Query execution is the main source of `EntityRef` values.
|
|
151
156
|
*/
|
|
152
|
-
export interface EntityRef<S extends Schema.Any, out P extends ComponentProof, Root = unknown,
|
|
157
|
+
export interface EntityRef<S extends Schema.Any, out P extends ComponentProof, Root = unknown, in Proves = never, in Lacks = never> {
|
|
153
158
|
/**
|
|
154
159
|
* Runtime tag for debugging and pattern matching.
|
|
155
160
|
*/
|
|
156
161
|
readonly kind: "EntityRef";
|
|
157
162
|
/**
|
|
158
163
|
* The component descriptors the query that produced this ref proves (its
|
|
159
|
-
* required slots and `with`): what `commands.despawn`
|
|
160
|
-
*
|
|
164
|
+
* required slots and `with`): what `commands.despawn`, `insert`, and
|
|
165
|
+
* `remove` check. Type-level only. Contravariant on purpose: a ref proving
|
|
166
|
+
* more is a subtype, so a union of refs (`cond ? a.entity : b.entity`)
|
|
167
|
+
* keeps only what both prove.
|
|
168
|
+
*/
|
|
169
|
+
readonly __proves?: (_: Proves) => void;
|
|
170
|
+
/**
|
|
171
|
+
* The component descriptors the producing query proves absent (its
|
|
172
|
+
* `without`): what `commands.remove` checks against `Schema.requires`.
|
|
173
|
+
* Type-level only.
|
|
161
174
|
*/
|
|
162
|
-
readonly
|
|
175
|
+
readonly __lacks?: (_: Lacks) => void;
|
|
163
176
|
/**
|
|
164
177
|
* The schema-bound entity identity.
|
|
165
178
|
*/
|
|
@@ -176,13 +189,15 @@ export interface EntityRef<S extends Schema.Any, out P extends ComponentProof, R
|
|
|
176
189
|
* `P` tracks readable components and `W` tracks the writable subset. This keeps
|
|
177
190
|
* mutation capabilities explicit in query results.
|
|
178
191
|
*/
|
|
179
|
-
export interface EntityMut<S extends Schema.Any, out P extends ComponentProof, out W extends ComponentProof, Root = unknown,
|
|
192
|
+
export interface EntityMut<S extends Schema.Any, out P extends ComponentProof, out W extends ComponentProof, Root = unknown, in Proves = never, in Lacks = never> {
|
|
180
193
|
/**
|
|
181
194
|
* Runtime tag for debugging and pattern matching.
|
|
182
195
|
*/
|
|
183
196
|
readonly kind: "EntityMut";
|
|
184
197
|
/** The component descriptors the producing query proves; see `EntityRef`. */
|
|
185
|
-
readonly __proves?: (_:
|
|
198
|
+
readonly __proves?: (_: Proves) => void;
|
|
199
|
+
/** The component descriptors the producing query proves absent; see `EntityRef`. */
|
|
200
|
+
readonly __lacks?: (_: Lacks) => void;
|
|
186
201
|
/**
|
|
187
202
|
* The schema-bound entity identity.
|
|
188
203
|
*/
|
package/dist/Entity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../src/Entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,CAAA;AAE1C;;GAEG;AACH,QAAA,MAAM,YAAY,EAAE,YAA8B,CAAA;AAClD,QAAA,MAAM,kBAAkB,EAAG,qBAA8B,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,cAAc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SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAMxB,CAAA"}
|
package/dist/Entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.js","sourceRoot":"","sources":["../src/Entity.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAyBrC;;GAEG;AACH,MAAM,YAAY,GAAiB,eAAe,CAAA;AAClD,MAAM,kBAAkB,GAAG,qBAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"Entity.js","sourceRoot":"","sources":["../src/Entity.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAyBrC;;GAEG;AACH,MAAM,YAAY,GAAiB,eAAe,CAAA;AAClD,MAAM,kBAAkB,GAAG,qBAA8B,CAAA;AA6KzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAuC,KAAa,EAAqB,EAAE,CACrG,KAA0B,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAGxB,KAAa,EAAwB,EAAE,CACvC,KAA6B,CAAA;AAU/B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAKpB,MAA6B,EAC7B,OAAgB,EACM,EAAE,CACxB,UAAU,CAAe,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAU3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAI1B,KAAW,EACX,GAAY,EACZ,OAAgB,EACoC,EAAE;IACtD,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;QAChE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAe,GAAG,CAAC,CAAC;QAC/C,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,EAAqB,EACrB,KAAQ,EACR,UAAU,GAAmC,EAAE,EAC/C,SAAS,GAA2C,EAAE,EAC7B,EAAE,CAAC,CAAC;IAC7B,IAAI,EAAE,aAAa;IACnB,EAAE;IACF,YAAY,EAAE,SAA4B;IAC1C,KAAK;IACL,UAAU;IACV,SAAS;CACV,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,EAAqB,EACrB,KAAQ,EACe,EAAE,CAAC,CAAC;IAC3B,IAAI,EAAE,WAAW;IACjB,EAAE;IACF,YAAY,EAAE,SAA4B;IAC1C,KAAK;CACN,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,EAAqB,EACrB,KAAQ,EACR,QAAW,EACe,EAAE,CAAC,CAAC;IAC9B,IAAI,EAAE,WAAW;IACjB,EAAE;IACF,YAAY,EAAE,SAA4B;IAC1C,KAAK;IACL,QAAQ;CACT,CAAC,CAAA"}
|
package/dist/EntityScope.d.ts
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
* parent-child tree: ordered children, `lookup.parent` / `descendants`
|
|
14
14
|
* traversal, and children despawned with their parent.
|
|
15
15
|
*
|
|
16
|
+
* A scope whose lifetime is a game state declares it:
|
|
17
|
+
* `Game.EntityScope(name, { despawnOnExit: [Flow, "Playing"] })` despawns
|
|
18
|
+
* every member when `applyStateTransitions(...)` commits that state change,
|
|
19
|
+
* with no system, permission, or marker to place.
|
|
20
|
+
*
|
|
16
21
|
* @module EntityScope
|
|
17
22
|
* @docGroup core
|
|
18
23
|
*/
|
|
@@ -21,8 +26,22 @@ export interface EntityScope<out Name extends string = string, out Root = unknow
|
|
|
21
26
|
readonly kind: "entityScope";
|
|
22
27
|
readonly name: Name;
|
|
23
28
|
readonly key: symbol;
|
|
29
|
+
/** State changes that despawn every member, applied by `applyStateTransitions(...)`. */
|
|
30
|
+
readonly despawnOn: ReadonlyArray<Trigger>;
|
|
24
31
|
readonly __schemaRoot?: Root | undefined;
|
|
25
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* One state change that despawns a scope: leaving (`exit`) or entering
|
|
35
|
+
* (`enter`) `state` of `machine`.
|
|
36
|
+
*/
|
|
37
|
+
export interface Trigger {
|
|
38
|
+
readonly phase: "enter" | "exit";
|
|
39
|
+
readonly machine: {
|
|
40
|
+
readonly key: symbol;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
};
|
|
43
|
+
readonly state: string | number;
|
|
44
|
+
}
|
|
26
45
|
/** Type-level helpers for entity scopes. */
|
|
27
46
|
export declare namespace EntityScope {
|
|
28
47
|
type Any = EntityScope<string, any>;
|
|
@@ -35,7 +54,7 @@ export declare namespace EntityScope {
|
|
|
35
54
|
* Normal game code should use `Game.EntityScope(...)` so the returned token is
|
|
36
55
|
* branded to that game's root.
|
|
37
56
|
*/
|
|
38
|
-
export declare const make: <const Name extends string, Root = unknown>(name: Name) => EntityScope<Name, Root>;
|
|
57
|
+
export declare const make: <const Name extends string, Root = unknown>(name: Name, despawnOn?: ReadonlyArray<Trigger>) => EntityScope<Name, Root>;
|
|
39
58
|
/** The storage key of the scope named `name`: the same for every scope value of that name. */
|
|
40
59
|
export declare const keyOf: (name: string) => symbol;
|
|
41
60
|
/** The name of the scope behind a storage key made by {@link keyOf}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityScope.d.ts","sourceRoot":"","sources":["../src/EntityScope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"EntityScope.d.ts","sourceRoot":"","sources":["../src/EntityScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;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F,eAAO,MAAM,KAAK,SAAU,MAAM,KAAG,MAA2C,CAAA;AAEhF,wEAAwE;AACxE,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAAM,GAAG,SAG7C,CAAA"}
|
package/dist/EntityScope.js
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
* parent-child tree: ordered children, `lookup.parent` / `descendants`
|
|
14
14
|
* traversal, and children despawned with their parent.
|
|
15
15
|
*
|
|
16
|
+
* A scope whose lifetime is a game state declares it:
|
|
17
|
+
* `Game.EntityScope(name, { despawnOnExit: [Flow, "Playing"] })` despawns
|
|
18
|
+
* every member when `applyStateTransitions(...)` commits that state change,
|
|
19
|
+
* with no system, permission, or marker to place.
|
|
20
|
+
*
|
|
16
21
|
* @module EntityScope
|
|
17
22
|
* @docGroup core
|
|
18
23
|
*/
|
|
@@ -22,10 +27,11 @@
|
|
|
22
27
|
* Normal game code should use `Game.EntityScope(...)` so the returned token is
|
|
23
28
|
* branded to that game's root.
|
|
24
29
|
*/
|
|
25
|
-
export const make = (name) => ({
|
|
30
|
+
export const make = (name, despawnOn = []) => ({
|
|
26
31
|
kind: "entityScope",
|
|
27
32
|
name,
|
|
28
|
-
key: keyOf(name)
|
|
33
|
+
key: keyOf(name),
|
|
34
|
+
despawnOn
|
|
29
35
|
});
|
|
30
36
|
const keyPrefix = "ritmo/entityScope/";
|
|
31
37
|
/** The storage key of the scope named `name`: the same for every scope value of that name. */
|
package/dist/EntityScope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityScope.js","sourceRoot":"","sources":["../src/EntityScope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"EntityScope.js","sourceRoot":"","sources":["../src/EntityScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAgCH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAU,EACV,SAAS,GAA2B,EAAE,EACb,EAAE,CAAC,CAAC;IAC7B,IAAI,EAAE,aAAa;IACnB,IAAI;IACJ,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC;IAChB,SAAS;CACV,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,oBAAoB,CAAA;AAEtC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,CAAC,CAAA;AAEhF,wEAAwE;AACxE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAsB,EAAE;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACtC,OAAO,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7F,CAAC,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic fixed-step timing for any host: browsers, native shells,
|
|
3
|
+
* desktop runtimes, and headless tests.
|
|
4
|
+
*
|
|
5
|
+
* The loop owns the timing policy that is easy to get subtly wrong in every
|
|
6
|
+
* game: frame clamping, catch-up limits, interpolation, cancellation, and
|
|
7
|
+
* typed update failures. It does not know about an ECS runtime, a renderer,
|
|
8
|
+
* or a platform: frames arrive through a `TickSource` that the host supplies.
|
|
9
|
+
* Use a platform adapter such as `BrowserTickSource.make(window)` from
|
|
10
|
+
* `@typeonce/ritmo-browser`, or wrap a renderer's own ticker with `source`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const loop = FixedLoop.start({
|
|
15
|
+
* source: BrowserTickSource.make(window),
|
|
16
|
+
* step: Clock.hz(60),
|
|
17
|
+
* maxFrameSeconds: 0.25,
|
|
18
|
+
* maxStepsPerFrame: 5,
|
|
19
|
+
* update: () => runtime.tick(update),
|
|
20
|
+
* render: (frame) => draw(frame.alpha),
|
|
21
|
+
* onFailure: (failure) => console.error(failure)
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module FixedLoop
|
|
26
|
+
* @docGroup runtime
|
|
27
|
+
*/
|
|
28
|
+
import type * as Clock from "./Clock.ts";
|
|
29
|
+
import * as Result from "./Result.ts";
|
|
30
|
+
/** One host frame: milliseconds elapsed since the previous one. */
|
|
31
|
+
export interface Tick {
|
|
32
|
+
readonly deltaMS: number;
|
|
33
|
+
}
|
|
34
|
+
/** A stoppable host subscription. Calling `stop` more than once is safe. */
|
|
35
|
+
export interface Subscription {
|
|
36
|
+
stop(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Where host frames come from. Implemented by platform adapters
|
|
40
|
+
* (`BrowserTickSource.make(window)`), by `source` around a renderer's ticker,
|
|
41
|
+
* and by deterministic tests.
|
|
42
|
+
*/
|
|
43
|
+
export interface TickSource<TTick extends Tick = Tick> {
|
|
44
|
+
subscribe(onTick: (tick: TTick) => void): Subscription;
|
|
45
|
+
}
|
|
46
|
+
/** Validated fixed-step timing policy. */
|
|
47
|
+
export interface Options {
|
|
48
|
+
/**
|
|
49
|
+
* The fixed step every update advances (`Clock.hz(60)`): the same value
|
|
50
|
+
* the game's clock resource runs at, so the loop and the clock agree.
|
|
51
|
+
*/
|
|
52
|
+
readonly step: Clock.Step;
|
|
53
|
+
/** Maximum host-frame duration admitted into the accumulator. */
|
|
54
|
+
readonly maxFrameSeconds: number;
|
|
55
|
+
/** Maximum number of simulation updates performed for one host frame. */
|
|
56
|
+
readonly maxStepsPerFrame: number;
|
|
57
|
+
}
|
|
58
|
+
/** Configuration error returned before a loop subscribes to its host. */
|
|
59
|
+
export interface InvalidOptions {
|
|
60
|
+
readonly kind: "InvalidFixedLoopOptions";
|
|
61
|
+
readonly field: keyof Options;
|
|
62
|
+
readonly reason: "mustBeFiniteAndPositive" | "mustBePositiveInteger";
|
|
63
|
+
readonly value: number;
|
|
64
|
+
}
|
|
65
|
+
/** Data passed to the renderer after all fixed updates for one host frame. */
|
|
66
|
+
export interface Frame {
|
|
67
|
+
/** Clamped time admitted for this host frame. */
|
|
68
|
+
readonly elapsedSeconds: number;
|
|
69
|
+
/** Number of fixed updates completed for this host frame. */
|
|
70
|
+
readonly fixedSteps: number;
|
|
71
|
+
/** Remaining accumulator fraction in the range `[0, 1)`. */
|
|
72
|
+
readonly alpha: number;
|
|
73
|
+
/** Time discarded by frame clamping or the catch-up limit. */
|
|
74
|
+
readonly droppedSeconds: number;
|
|
75
|
+
}
|
|
76
|
+
/** Failure delivered by an active loop before it stops itself. */
|
|
77
|
+
export type Failure<UpdateError> = {
|
|
78
|
+
readonly kind: "InvalidTickDelta";
|
|
79
|
+
readonly deltaMS: number;
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "UpdateFailure";
|
|
82
|
+
readonly error: UpdateError;
|
|
83
|
+
};
|
|
84
|
+
/** A running fixed-step driver. */
|
|
85
|
+
export interface Driver extends Subscription {
|
|
86
|
+
/** Clears accumulated partial time without removing the host subscription. */
|
|
87
|
+
reset(): void;
|
|
88
|
+
}
|
|
89
|
+
/** Input for a fixed-step driver. */
|
|
90
|
+
export interface StartOptions<TTick extends Tick, UpdateError> extends Options {
|
|
91
|
+
readonly source: TickSource<TTick>;
|
|
92
|
+
readonly update: (stepSeconds: number) => Result.Result<void, UpdateError>;
|
|
93
|
+
readonly render: (frame: Frame) => void;
|
|
94
|
+
readonly onFailure: (failure: Failure<UpdateError>) => void;
|
|
95
|
+
}
|
|
96
|
+
/** Wraps a host-specific subscription function in the canonical source type. */
|
|
97
|
+
export declare const source: <TTick extends Tick>(subscribe: TickSource<TTick>["subscribe"]) => TickSource<TTick>;
|
|
98
|
+
/**
|
|
99
|
+
* Starts a fixed-step loop after validating its timing policy.
|
|
100
|
+
*
|
|
101
|
+
* Update failures and malformed host ticks are delivered to `onFailure`, then
|
|
102
|
+
* the driver stops. Render defects are deliberately not caught: they are
|
|
103
|
+
* programmer defects, not expected game outcomes.
|
|
104
|
+
*/
|
|
105
|
+
export declare const start: <TTick extends Tick, UpdateError>(options: StartOptions<TTick, UpdateError>) => Result.Result<Driver, InvalidOptions>;
|
|
106
|
+
//# sourceMappingURL=FixedLoop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedLoop.d.ts","sourceRoot":"","sources":["../src/FixedLoop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,mEAAmE;AACnE,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,IAAI,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,IAAI,GAAG,IAAI;IACnD,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,GAAG,YAAY,CAAA;CACvD;AAED,0CAA0C;AAC1C,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAA;IACzB,iEAAiE;IACjE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,yEAAyE;IACzE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;CAClC;AAED,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAA;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,uBAAuB,CAAA;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