@oasys/oecs 0.5.3 → 0.5.4
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/CHANGELOG.md +194 -28
- package/README.md +198 -145
- package/dist/core/ecs/access_check.d.cts +3 -3
- package/dist/core/ecs/access_check.d.ts +3 -3
- package/dist/core/ecs/archetype.d.cts +103 -43
- package/dist/core/ecs/archetype.d.ts +103 -43
- package/dist/core/ecs/archetype.d.ts.map +1 -1
- package/dist/core/ecs/archetype_graph.d.cts +8 -8
- package/dist/core/ecs/archetype_graph.d.ts +8 -8
- package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
- package/dist/core/ecs/builtin_relations.d.cts +1 -1
- package/dist/core/ecs/builtin_relations.d.ts +1 -1
- package/dist/core/ecs/command_log.d.cts +4 -4
- package/dist/core/ecs/command_log.d.ts +4 -4
- package/dist/core/ecs/command_log.d.ts.map +1 -1
- package/dist/core/ecs/component.d.cts +4 -4
- package/dist/core/ecs/component.d.ts +4 -4
- package/dist/core/ecs/deferred_commands.d.cts +1 -1
- package/dist/core/ecs/deferred_commands.d.ts +1 -1
- package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
- package/dist/core/ecs/ecs.d.cts +85 -43
- package/dist/core/ecs/ecs.d.ts +85 -43
- package/dist/core/ecs/ecs.d.ts.map +1 -1
- package/dist/core/ecs/ecs_memory.d.cts +10 -10
- package/dist/core/ecs/ecs_memory.d.ts +10 -10
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
- package/dist/core/ecs/entity_allocator.d.cts +6 -6
- package/dist/core/ecs/entity_allocator.d.ts +6 -6
- package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
- package/dist/core/ecs/event.d.cts +2 -2
- package/dist/core/ecs/event.d.ts +2 -2
- package/dist/core/ecs/event_registry.d.cts +1 -1
- package/dist/core/ecs/event_registry.d.ts +1 -1
- package/dist/core/ecs/event_registry.d.ts.map +1 -1
- package/dist/core/ecs/facades.d.cts +15 -15
- package/dist/core/ecs/facades.d.ts +15 -15
- package/dist/core/ecs/facades.d.ts.map +1 -1
- package/dist/core/ecs/frame_trace.d.cts +2 -2
- package/dist/core/ecs/frame_trace.d.ts +2 -2
- package/dist/core/ecs/host_commands.d.cts +12 -12
- package/dist/core/ecs/host_commands.d.ts +12 -12
- package/dist/core/ecs/host_commands.d.ts.map +1 -1
- package/dist/core/ecs/index.d.cts +1 -1
- package/dist/core/ecs/index.d.ts +1 -1
- package/dist/core/ecs/index.d.ts.map +1 -1
- package/dist/core/ecs/observer.d.cts +9 -9
- package/dist/core/ecs/observer.d.ts +9 -9
- package/dist/core/ecs/observer.d.ts.map +1 -1
- package/dist/core/ecs/query.d.cts +91 -70
- package/dist/core/ecs/query.d.ts +91 -70
- package/dist/core/ecs/query.d.ts.map +1 -1
- package/dist/core/ecs/ref.d.cts +53 -1
- package/dist/core/ecs/ref.d.ts +53 -1
- package/dist/core/ecs/ref.d.ts.map +1 -1
- package/dist/core/ecs/relation.d.cts +15 -15
- package/dist/core/ecs/relation.d.ts +15 -15
- package/dist/core/ecs/relation.d.ts.map +1 -1
- package/dist/core/ecs/relation_service.d.cts +14 -14
- package/dist/core/ecs/relation_service.d.ts +14 -14
- package/dist/core/ecs/relation_service.d.ts.map +1 -1
- package/dist/core/ecs/resource.d.cts +1 -1
- package/dist/core/ecs/resource.d.ts +1 -1
- package/dist/core/ecs/resource_registry.d.cts +2 -2
- package/dist/core/ecs/resource_registry.d.ts +2 -2
- package/dist/core/ecs/resume.d.cts +3 -3
- package/dist/core/ecs/resume.d.ts +3 -3
- package/dist/core/ecs/resume.d.ts.map +1 -1
- package/dist/core/ecs/schedule.d.cts +22 -9
- package/dist/core/ecs/schedule.d.ts +22 -9
- package/dist/core/ecs/schedule.d.ts.map +1 -1
- package/dist/core/ecs/snapshot_service.d.cts +3 -3
- package/dist/core/ecs/snapshot_service.d.ts +3 -3
- package/dist/core/ecs/sparse_store.d.cts +6 -6
- package/dist/core/ecs/sparse_store.d.ts +6 -6
- package/dist/core/ecs/sparse_store.d.ts.map +1 -1
- package/dist/core/ecs/store.d.cts +189 -110
- package/dist/core/ecs/store.d.ts +189 -110
- package/dist/core/ecs/store.d.ts.map +1 -1
- package/dist/core/ecs/store_layout_listener.d.cts +2 -2
- package/dist/core/ecs/store_layout_listener.d.ts +2 -2
- package/dist/core/ecs/system.d.cts +8 -8
- package/dist/core/ecs/system.d.ts +8 -8
- package/dist/core/ecs/system.d.ts.map +1 -1
- package/dist/core/ecs/utils/error.d.cts +7 -0
- package/dist/core/ecs/utils/error.d.ts +7 -0
- package/dist/core/ecs/utils/error.d.ts.map +1 -1
- package/dist/core/store/action_ring.d.cts +7 -8
- package/dist/core/store/action_ring.d.ts +7 -8
- package/dist/core/store/action_ring.d.ts.map +1 -1
- package/dist/core/store/allocator.d.cts +26 -28
- package/dist/core/store/allocator.d.ts +26 -28
- package/dist/core/store/allocator.d.ts.map +1 -1
- package/dist/core/store/buffer_backed_column.d.cts +5 -6
- package/dist/core/store/buffer_backed_column.d.ts +5 -6
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
- package/dist/core/store/column_store.d.cts +22 -22
- package/dist/core/store/column_store.d.ts +22 -22
- package/dist/core/store/column_store.d.ts.map +1 -1
- package/dist/core/store/command_dispatch.d.cts +1 -1
- package/dist/core/store/command_dispatch.d.ts +1 -1
- package/dist/core/store/command_ring.d.cts +6 -7
- package/dist/core/store/command_ring.d.ts +6 -7
- package/dist/core/store/command_ring.d.ts.map +1 -1
- package/dist/core/store/descriptor.d.cts +2 -2
- package/dist/core/store/descriptor.d.ts +2 -2
- package/dist/core/store/entity_index.d.cts +3 -3
- package/dist/core/store/entity_index.d.ts +3 -3
- package/dist/core/store/event_ring.d.cts +7 -7
- package/dist/core/store/event_ring.d.ts +7 -7
- package/dist/core/store/extend.d.cts +2 -2
- package/dist/core/store/extend.d.ts +2 -2
- package/dist/core/store/grow.d.cts +1 -1
- package/dist/core/store/grow.d.ts +1 -1
- package/dist/core/store/grow.d.ts.map +1 -1
- package/dist/core/store/header.d.cts +9 -9
- package/dist/core/store/header.d.ts +9 -9
- package/dist/core/store/header.d.ts.map +1 -1
- package/dist/core/store/layout_ops.d.cts +7 -7
- package/dist/core/store/layout_ops.d.ts +7 -7
- package/dist/core/store/state_hash.d.cts +3 -3
- package/dist/core/store/state_hash.d.ts +3 -3
- package/dist/extensions/editor/editor.d.cts +4 -4
- package/dist/extensions/editor/editor.d.ts +4 -4
- package/dist/extensions/editor/editor.d.ts.map +1 -1
- package/dist/extensions/editor/field_handle.d.cts +1 -1
- package/dist/extensions/editor/field_handle.d.ts +1 -1
- package/dist/extensions/editor/index.d.cts +2 -2
- package/dist/extensions/editor/index.d.ts +2 -2
- package/dist/extensions/editor/index.development.js +4 -4
- package/dist/extensions/editor/index.js +4 -4
- package/dist/extensions/reactive/ecs_sync.d.cts +4 -4
- package/dist/extensions/reactive/ecs_sync.d.ts +4 -4
- package/dist/extensions/reactive/index.d.cts +4 -4
- package/dist/extensions/reactive/index.d.ts +4 -4
- package/dist/extensions/reactive/index.development.js +3 -3
- package/dist/extensions/reactive/index.js +3 -3
- package/dist/extensions/solid/index.d.cts +1 -1
- package/dist/extensions/solid/index.d.ts +1 -1
- package/dist/extensions/solid/index.development.js +1 -1
- package/dist/extensions/solid/index.js +1 -1
- package/dist/extensions/solid/kernel_solid.d.cts +1 -1
- package/dist/extensions/solid/kernel_solid.d.ts +1 -1
- package/dist/extensions/solid/kernel_solid.d.ts.map +1 -1
- package/dist/{host_commands-3jyFfWNg.js → host_commands-BlR3oZ3x.js} +472 -392
- package/dist/host_commands-C2cpU3yC.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.development.cjs +1 -1
- package/dist/index.development.js +3344 -2965
- package/dist/index.js +1494 -1132
- package/dist/{internal-C9jjL90H.js → internal-BoxWl4dG.js} +409 -329
- package/dist/internal-CGBEwfeB.cjs +2 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.development.cjs +1 -1
- package/dist/internal.development.js +1 -1
- package/dist/internal.js +1 -1
- package/dist/primitives.development.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/reactive/index.d.cts +2 -2
- package/dist/reactive/index.d.ts +2 -2
- package/dist/reactive/index.development.js +1 -1
- package/dist/reactive/index.js +1 -1
- package/dist/reactive/kernel.d.cts +5 -5
- package/dist/reactive/kernel.d.ts +5 -5
- package/dist/reactive/shallow.d.cts +1 -1
- package/dist/reactive/shallow.d.ts +1 -1
- package/dist/{shallow-DfnAm9vG.js → shallow-Bs39EPh1.js} +1 -1
- package/dist/{shallow-9S1pY_Iw.js → shallow-CiFC70Dz.js} +1 -1
- package/dist/{shared-DQKK0i-E.js → shared-B4v0L1cw.js} +4 -4
- package/dist/shared-DU78k0pU.cjs +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.development.cjs +1 -1
- package/dist/shared.development.js +1 -1
- package/dist/shared.js +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +2 -2
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +2 -2
- package/dist/{typed_arrays-BcXcnzB4.js → typed_arrays-DIVwVy5_.js} +1 -1
- package/dist/version.d.cts +2 -2
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
- package/dist/host_commands-DNf0f6ko.cjs +0 -1
- package/dist/internal-RZN14uMw.cjs +0 -2
- package/dist/shared-BMXh9hxm.cjs +0 -1
|
@@ -16,7 +16,7 @@ export interface ArchetypeEdge {
|
|
|
16
16
|
* Cached resolution of a *multi*-component add out of this archetype: the
|
|
17
17
|
* target archetype the union lands in, plus the pre-built src→target batch
|
|
18
18
|
* transition map. Keyed (on the source archetype) by an exact N-tagged pack of
|
|
19
|
-
* the added component ids — see `Store.addComponents
|
|
19
|
+
* the added component ids — see `Store.addComponents`.
|
|
20
20
|
*
|
|
21
21
|
* Where `ArchetypeEdge` is the per-*component* edge the single-add path indexes
|
|
22
22
|
* by `edges[component_id]`, this is the per-*set* edge the plural-add path looks
|
|
@@ -53,7 +53,7 @@ export type ColumnFactory = (componentId: ComponentID, fieldIdx: number, tag: Ty
|
|
|
53
53
|
* across every SAB-backed archetype; after the handler returns,
|
|
54
54
|
* `arch._flatColumns[i].buf.length` is guaranteed to be `>= arch.length +
|
|
55
55
|
* additional`. Heap-backed archetypes leave this unset — their
|
|
56
|
-
* `GrowableTypedArray` grows in place.
|
|
56
|
+
* `GrowableTypedArray` grows in place.
|
|
57
57
|
*/
|
|
58
58
|
export type ArchetypeGrowHandler = (arch: Archetype, additional: number) => void;
|
|
59
59
|
/**
|
|
@@ -63,8 +63,7 @@ export type ArchetypeGrowHandler = (arch: Archetype, additional: number) => void
|
|
|
63
63
|
* `removeEntity`, `moveEntityFrom`, `writeFields`, `setEdge`, and the
|
|
64
64
|
* mutable `getColumn`) stays internal so query iteration can't bypass the
|
|
65
65
|
* deferred-flush path that prevents iterator invalidation. This is the same
|
|
66
|
-
* back door
|
|
67
|
-
* `Query`.
|
|
66
|
+
* back door that is closed for `Store` and closed again for `Query`.
|
|
68
67
|
*
|
|
69
68
|
* `id` is the archetype's opaque identity (not a mutator) — exposed so the
|
|
70
69
|
* public `ECS.batchAddComponent`/`batchRemoveComponent` API can target an
|
|
@@ -73,16 +72,16 @@ export type ArchetypeGrowHandler = (arch: Archetype, additional: number) => void
|
|
|
73
72
|
export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = readonly ComponentDef<any>[]> {
|
|
74
73
|
/** Opaque archetype identity. Pass to `ECS.batch_*_component`. */
|
|
75
74
|
readonly id: ArchetypeID;
|
|
76
|
-
/** Number of **enabled** entities — the default-iteration bound
|
|
75
|
+
/** Number of **enabled** entities — the default-iteration bound. Rows
|
|
77
76
|
* `0..entityCount-1` are enabled; disabled rows (if any) sit contiguously at
|
|
78
77
|
* `entityCount..totalCount-1`. `forEach` SoA loops read this, so they skip
|
|
79
78
|
* disabled rows for free. Use `totalCount` to span disabled rows too. */
|
|
80
79
|
readonly entityCount: number;
|
|
81
|
-
/** Total live rows, enabled + disabled
|
|
80
|
+
/** Total live rows, enabled + disabled. Equal to `entityCount` unless
|
|
82
81
|
* some rows are disabled. Use for full-state work (serialization, snapshot,
|
|
83
82
|
* determinism) that must see every entity regardless of enabled state. */
|
|
84
83
|
readonly totalCount: number;
|
|
85
|
-
/** Number of disabled rows = `totalCount - entityCount
|
|
84
|
+
/** Number of disabled rows = `totalCount - entityCount`. */
|
|
86
85
|
readonly disabledCount: number;
|
|
87
86
|
/** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
|
|
88
87
|
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
@@ -91,7 +90,7 @@ export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = r
|
|
|
91
90
|
hasComponent(id: ComponentID): boolean;
|
|
92
91
|
/** Get a single field's column (read-only). Valid data: indices
|
|
93
92
|
* 0..entityCount-1. `def` must be a term of the iterating query
|
|
94
|
-
|
|
93
|
+
*; the bare-`ArchetypeView` default stays permissive. */
|
|
95
94
|
getColumnRead<D extends ComponentDef<any>, K extends string & keyof SchemaOf<D>>(def: D & DeclaredQueryTerm<Defs, D>, field: K): ReadonlyColumn;
|
|
96
95
|
/** Tuple fetch of several of one component's columns —
|
|
97
96
|
* `const [q, r] = arch.getColumnsRead(HexPos, "q", "r")`. One small
|
|
@@ -100,7 +99,7 @@ export interface ArchetypeView<out Defs extends readonly ComponentDef<any>[] = r
|
|
|
100
99
|
[I in keyof K]: ReadonlyColumn;
|
|
101
100
|
};
|
|
102
101
|
/** Get a single field's column **if this archetype has the component**,
|
|
103
|
-
* else `undefined` — the optional-query fetch-if-present accessor
|
|
102
|
+
* else `undefined` — the optional-query fetch-if-present accessor.
|
|
104
103
|
* The absent branch is expected (resolve the column pointer per archetype
|
|
105
104
|
* span: present ⇒ column, absent ⇒ `undefined`), not an error. Same
|
|
106
105
|
* advisory-readonly view and `reads`-access-check as `getColumnRead`. */
|
|
@@ -125,7 +124,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
125
124
|
private readonly _entityIds;
|
|
126
125
|
length: number;
|
|
127
126
|
/**
|
|
128
|
-
* Enabled/disabled row partition (
|
|
127
|
+
* Enabled/disabled row partition (entity enable/disable). Rows
|
|
129
128
|
* `[0, enabled_count)` are enabled, `[enabled_count, length)` are disabled.
|
|
130
129
|
* `enabled_count === length` (no disabled rows) is the common case — every
|
|
131
130
|
* fast path below short-circuits on it, so an archetype that never disables
|
|
@@ -139,14 +138,14 @@ export declare class Archetype implements ArchetypeView {
|
|
|
139
138
|
enabledCount: number;
|
|
140
139
|
/**
|
|
141
140
|
* Flush-epoch stamp + captured pre-counts for the Store's per-entity flush
|
|
142
|
-
* 0-crossing detector
|
|
141
|
+
* 0-crossing detector: `_flushAdds`/`_flushRemoves` stamp each
|
|
143
142
|
* archetype on first sight per flush (a few field accesses) instead of probing
|
|
144
143
|
* a `Map<archetype_id, pre_count>` per entity — the same per-entity Map
|
|
145
|
-
* cost the destroy drain
|
|
144
|
+
* cost the destroy drain also avoids. Both `_flushPreLen` and
|
|
146
145
|
* `_flushPreEnabled` are recorded so the settle pass can detect a 0-crossing
|
|
147
146
|
* on either the total (`length`) or the enabled partition (`enabledCount`) —
|
|
148
|
-
* an enabled append into an all-disabled archetype crosses only the latter
|
|
149
|
-
*
|
|
147
|
+
* an enabled append into an all-disabled archetype crosses only the latter.
|
|
148
|
+
* Owned by Store; pure scheduling bookkeeping, never folded into
|
|
150
149
|
* `stateHash`/snapshot.
|
|
151
150
|
*/
|
|
152
151
|
_flushSeenEpoch: number;
|
|
@@ -171,13 +170,17 @@ export declare class Archetype implements ArchetypeView {
|
|
|
171
170
|
*/
|
|
172
171
|
private readonly batchTransitionMaps;
|
|
173
172
|
/**
|
|
174
|
-
* Per-set add-edge cache for `Store.addComponents
|
|
173
|
+
* Per-set add-edge cache for `Store.addComponents`, keyed by an
|
|
175
174
|
* exact pack of the added component ids. Lazily allocated: most archetypes
|
|
176
175
|
* never originate a plural add, so the Map stays `null` until the first one
|
|
177
176
|
* is resolved — the single-add `edges[]` path never touches it.
|
|
178
177
|
*/
|
|
179
178
|
private compositeAddEdges;
|
|
180
179
|
readonly _flatColumns: ColumnBacking<AnyTypedArray>[];
|
|
180
|
+
_bufs: AnyTypedArray[];
|
|
181
|
+
private _eids;
|
|
182
|
+
private _rowCap;
|
|
183
|
+
private _colCap;
|
|
181
184
|
/** Set by `fromColumnStore` to record which SAB archetype this Archetype
|
|
182
185
|
* draws its column views from. `null` for the default heap-backed path
|
|
183
186
|
* (no SAB linkage; `refreshViews` would be a no-op there and so
|
|
@@ -196,9 +199,66 @@ export declare class Archetype implements ArchetypeView {
|
|
|
196
199
|
* archetype during construction; `null` on heap-backed archetypes (the
|
|
197
200
|
* default `GrowableTypedArray` grows in place). Insertion methods call
|
|
198
201
|
* `_invoke_grow(...)` below before any push that would overflow the
|
|
199
|
-
* current SAB row capacity.
|
|
202
|
+
* current SAB row capacity. */
|
|
200
203
|
growHandler: ArchetypeGrowHandler | null;
|
|
201
204
|
constructor(id: ArchetypeID, mask: BitSet, layouts?: ArchetypeColumnLayout[], initialCapacity?: number, columnFactory?: ColumnFactory);
|
|
205
|
+
/** Re-derive the `_bufs` / `_eids` / `_rowCap` row plane from the backing
|
|
206
|
+
* columns. The sole writer of all three — see the `_bufs` field doc for the
|
|
207
|
+
* invariant it restores. Cold: construction, `refreshViews`, tail of a grow. */
|
|
208
|
+
private _syncRowPlane;
|
|
209
|
+
/** Re-point every cached `eachChunk` column group at the current `_bufs`.
|
|
210
|
+
*
|
|
211
|
+
* Called only from `_syncRowPlane`, which is the only thing that can change a
|
|
212
|
+
* column's buffer identity — so after this runs, a cached group is correct by
|
|
213
|
+
* construction and `columnGroupMut` / `columnGroupRead` need no staleness test
|
|
214
|
+
* at all. That absence is the point: those two run once per archetype per
|
|
215
|
+
* `eachChunk` pass, which for a fragmented query is once per chunk, and this
|
|
216
|
+
* file already carries one hard-won lesson (`_onArchLenChange`): one more
|
|
217
|
+
* statement pushed that per-mutation function past V8's inlining budget, and
|
|
218
|
+
* it became much slower. We measured two earlier forms of this optimisation
|
|
219
|
+
* and rejected both for the same cause. A fill through a shared helper made
|
|
220
|
+
* fragmented iteration slower, and an inline test for a stale buffer also made
|
|
221
|
+
* it slower. Each loss was larger than the gain in system dispatch. Move the
|
|
222
|
+
* work to the cold path, and the gain stays with no loss.
|
|
223
|
+
*
|
|
224
|
+
* Refreshes in place, preserving object identity, for the same reason
|
|
225
|
+
* `_syncRowPlane` refills `_bufs` in place: a caller that captured the group
|
|
226
|
+
* sees fresh buffers rather than silently stale ones. */
|
|
227
|
+
private _refreshGroupCaches;
|
|
228
|
+
/** DEV-only: assert the row plane still addresses the live buffers.
|
|
229
|
+
*
|
|
230
|
+
* `_bufs`/`_eids` and `_flatColumns[i].buf`/`_entityIds.buf` are two paths to
|
|
231
|
+
* one buffer, and only the first is cached — the row ops index the cache while
|
|
232
|
+
* `getColumnRead` / `writeFields` read `.buf` fresh. Anything that changes a
|
|
233
|
+
* buffer's identity owes a `_syncRowPlane`; miss one and the two paths split
|
|
234
|
+
* silently, with row writes landing in an orphan that later reads never see.
|
|
235
|
+
*
|
|
236
|
+
* Checked at the boundaries that read `.buf` directly, and O(1): index 0 alone
|
|
237
|
+
* is enough, because `_syncRowPlane` rewrites every entry together — there is
|
|
238
|
+
* no way to desync one column and not the first. */
|
|
239
|
+
private _assertRowPlaneFresh;
|
|
240
|
+
/** Make room for `additional` more rows, growing if the append would
|
|
241
|
+
* overflow. Replaces the `this.length >= cols[0].buf.length` probe the append
|
|
242
|
+
* paths each open-coded — that read a column object and its buffer's length
|
|
243
|
+
* on every single-row append; this is one compare against a cached number.
|
|
244
|
+
*
|
|
245
|
+
* Both backings are handled by `_growRows` so callers don't branch: a
|
|
246
|
+
* SAB-backed archetype delegates to the store's `growHandler` (realloc +
|
|
247
|
+
* republish, which re-enters `refreshViews`), a heap-backed one
|
|
248
|
+
* (`growHandler === null`, the unit-test factory) grows each column in place.
|
|
249
|
+
* Either way the buffers may have moved, so the row plane is re-synced before
|
|
250
|
+
* returning — including when the grow throws. */
|
|
251
|
+
private _reserveRows;
|
|
252
|
+
/** Cold half of `_reserveRows`: the append genuinely doesn't fit, so grow.
|
|
253
|
+
* Never called on the fast path — see the caller. */
|
|
254
|
+
private _growRows;
|
|
255
|
+
/** Push `Archetype.length` down into each column's own logical length (and
|
|
256
|
+
* the entity-id array's). The row plane keeps `length` authoritative and never
|
|
257
|
+
* touches `_len`, so the columns' view of it goes stale between publishes.
|
|
258
|
+
* Nothing on the ECS hot paths reads it; the boundaries that DO — a
|
|
259
|
+
* reallocating `ensureCapacity`, `refreshView`'s shrink check, `view()` —
|
|
260
|
+
* publish first. */
|
|
261
|
+
private _publishRowCounts;
|
|
202
262
|
/**
|
|
203
263
|
* Build an Archetype whose columns are TypedArray views into a single
|
|
204
264
|
* `ColumnStore`-managed `SharedArrayBuffer`. The store must contain an
|
|
@@ -208,7 +268,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
208
268
|
* The resulting archetype is fixed-capacity at the SAB row capacity —
|
|
209
269
|
* any operation that would push past it throws `StoreColumnOverflowError`.
|
|
210
270
|
* To grow capacity, call `growColumnStore(...)` between ticks and then
|
|
211
|
-
* `refreshViews(newStore)` on this archetype
|
|
271
|
+
* `refreshViews(newStore)` on this archetype.
|
|
212
272
|
*/
|
|
213
273
|
static fromColumnStore(id: ArchetypeID, mask: BitSet, layouts: ArchetypeColumnLayout[], columnStore: ColumnStore, storeArchetypeId: number): Archetype;
|
|
214
274
|
/** True iff this archetype was constructed via `fromColumnStore` and its
|
|
@@ -228,7 +288,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
228
288
|
* expects.
|
|
229
289
|
*/
|
|
230
290
|
refreshViews(newColumnStore: ColumnStore): void;
|
|
231
|
-
/** Enabled-row count — the default iteration bound
|
|
291
|
+
/** Enabled-row count — the default iteration bound. See `enabled_count`.
|
|
232
292
|
* Equals `length` whenever no entity is disabled (the common case).
|
|
233
293
|
*
|
|
234
294
|
* During an `includeDisabled()` query's `forEach`, the module flag
|
|
@@ -237,9 +297,9 @@ export declare class Archetype implements ArchetypeView {
|
|
|
237
297
|
* transparently, with no change to the loop. Outside such iteration the flag is
|
|
238
298
|
* false and this is `enabled_count`. */
|
|
239
299
|
get entityCount(): number;
|
|
240
|
-
/** Total live rows incl. disabled
|
|
300
|
+
/** Total live rows incl. disabled. */
|
|
241
301
|
get totalCount(): number;
|
|
242
|
-
/** Disabled-row count
|
|
302
|
+
/** Disabled-row count. */
|
|
243
303
|
get disabledCount(): number;
|
|
244
304
|
/** Raw entity ID buffer (packed `EntityID`s). Valid data at indices
|
|
245
305
|
* 0..totalCount-1 (enabled rows first, then disabled). */
|
|
@@ -250,7 +310,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
250
310
|
* cares about (it knows the two `entityIds` after the swap). The partition
|
|
251
311
|
* primitives (`disableRow`/`enableRow`/`removeRow`/`_placeTail`) build on
|
|
252
312
|
* this. Writes through each column's live backing buffer (`buf`), so it works
|
|
253
|
-
* for both heap- and SAB-backed columns. No-op when `a === b`.
|
|
313
|
+
* for both heap- and SAB-backed columns. No-op when `a === b`. */
|
|
254
314
|
swapRows(a: number, b: number): void;
|
|
255
315
|
/**
|
|
256
316
|
* Place a freshly-appended ENABLED entity (currently at the tail row `tail`,
|
|
@@ -259,11 +319,11 @@ export declare class Archetype implements ArchetypeView {
|
|
|
259
319
|
*
|
|
260
320
|
* Common case — no disabled rows (`enabled_count === tail`): the tail row IS
|
|
261
321
|
* the next enabled slot, so this is just `enabled_count++` and returns `tail`
|
|
262
|
-
* (byte-for-byte the
|
|
322
|
+
* (byte-for-byte the earlier behaviour, `entityRow` untouched). Rare case —
|
|
263
323
|
* disabled rows occupy `[enabled_count, tail)`: swap the appended row into the
|
|
264
324
|
* first disabled slot and push that disabled occupant to the tail, updating
|
|
265
325
|
* its `entityRow`. Requires `entityRow` in that case (a `DEV` guard fires
|
|
266
|
-
* if a caller appends into a disabled-bearing archetype without passing it).
|
|
326
|
+
* if a caller appends into a disabled-bearing archetype without passing it). */
|
|
267
327
|
private _placeTail;
|
|
268
328
|
/**
|
|
269
329
|
* Bulk analog of `_placeTail` for `count` freshly-appended enabled rows at
|
|
@@ -271,21 +331,21 @@ export declare class Archetype implements ArchetypeView {
|
|
|
271
331
|
* start`): `enabled_count += count`, return `start`. The bulk callers
|
|
272
332
|
* (`spawnMany`, batch ops) fall back to a per-entity append loop when the
|
|
273
333
|
* target already has disabled rows, so the rare branch is a `DEV` guard
|
|
274
|
-
* rather than a block-rotation.
|
|
334
|
+
* rather than a block-rotation. */
|
|
275
335
|
private _placeTailBulk;
|
|
276
336
|
/**
|
|
277
337
|
* Disable the entity at `row` (precondition: enabled, `row < enabled_count`).
|
|
278
338
|
* Swaps it to the end of the enabled region and shrinks the region, so it
|
|
279
339
|
* lands in the disabled tail with its data intact — no archetype transition,
|
|
280
|
-
* O(1)+one row swap. Updates `entityRow` for both rows touched.
|
|
340
|
+
* O(1)+one row swap. Updates `entityRow` for both rows touched. */
|
|
281
341
|
disableRow(row: number, entityRow: Int32Array): void;
|
|
282
342
|
/**
|
|
283
343
|
* Enable the entity at `row` (precondition: disabled, `row >= enabled_count`).
|
|
284
344
|
* Swaps it to the front of the disabled region and grows the enabled region.
|
|
285
|
-
* Updates `entityRow` for both rows touched.
|
|
345
|
+
* Updates `entityRow` for both rows touched. */
|
|
286
346
|
enableRow(row: number, entityRow: Int32Array): void;
|
|
287
347
|
/**
|
|
288
|
-
* Partition-aware swap-remove that owns its `entityRow` updates
|
|
348
|
+
* Partition-aware swap-remove that owns its `entityRow` updates. The
|
|
289
349
|
* Store's destroy/move paths call this instead of `removeEntity`; it keeps the
|
|
290
350
|
* enabled prefix contiguous in every case:
|
|
291
351
|
* - disabled row (`row >= enabled_count`): swap-remove within the disabled
|
|
@@ -297,9 +357,9 @@ export declare class Archetype implements ArchetypeView {
|
|
|
297
357
|
* Updates `entityRow` for every relocated entity (never for the removed one —
|
|
298
358
|
* the caller frees/repoints it). */
|
|
299
359
|
removeRow(row: number, entityRow: Int32Array): void;
|
|
300
|
-
/** @internal — cold partition-aware tail of `removeRow
|
|
360
|
+
/** @internal — cold partition-aware tail of `removeRow`: the
|
|
301
361
|
* disabled-bearing archetype case. Split out so the no-disabled fast path
|
|
302
|
-
* above stays small enough to inline
|
|
362
|
+
* above stays small enough to inline; see the doc on `removeRow`. */
|
|
303
363
|
private _removeRowPartitioned;
|
|
304
364
|
get entityList(): Uint32Array;
|
|
305
365
|
hasComponent(id: ComponentID): boolean;
|
|
@@ -309,7 +369,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
309
369
|
* data: indices 0..entityCount-1. The `ReadonlyColumn` return is an
|
|
310
370
|
* *advisory* compile-time barrier: it is the live mutable backing buffer,
|
|
311
371
|
* so the `readonly` index signature blocks writes at the type layer only
|
|
312
|
-
* (a
|
|
372
|
+
* (a deliberate cast can still write through). For writes use the
|
|
313
373
|
* mutable `getColumn` (tick-bumping) below.
|
|
314
374
|
*/
|
|
315
375
|
getColumnRead<S extends ComponentSchema, K extends string & keyof S>(def: ComponentDef<S>, field: K): ReadonlyColumn;
|
|
@@ -326,8 +386,8 @@ export declare class Archetype implements ArchetypeView {
|
|
|
326
386
|
};
|
|
327
387
|
/**
|
|
328
388
|
* Get a single field's column **if this archetype has the component**, else
|
|
329
|
-
* `undefined` — the fetch-if-present accessor for optional query terms
|
|
330
|
-
* Bevy `Option<&T>` / flecs `?`). An optional query (`q.optional(T)`) spans
|
|
389
|
+
* `undefined` — the fetch-if-present accessor for optional query terms
|
|
390
|
+
* (Bevy `Option<&T>` / flecs `?`). An optional query (`q.optional(T)`) spans
|
|
331
391
|
* archetypes both with and without `T`; the caller branches once per
|
|
332
392
|
* archetype span on the return:
|
|
333
393
|
*
|
|
@@ -344,7 +404,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
344
404
|
* depend on whether the current span happens to hold `T`. Two checks fire:
|
|
345
405
|
* (1) `accessCheck.checkRead` — an optional read needs `reads:[T]` coverage
|
|
346
406
|
* exactly as a required read does; (2) `accessCheck.checkOptionalFetch` —
|
|
347
|
-
* the iterating query must have declared `.optional(T)
|
|
407
|
+
* the iterating query must have declared `.optional(T)`, the read-side
|
|
348
408
|
* analog that makes the query term the fetch's authorization rather than inert
|
|
349
409
|
* decoration. The return is the same advisory-readonly view `getColumnRead`
|
|
350
410
|
* hands back.
|
|
@@ -389,9 +449,9 @@ export declare class Archetype implements ArchetypeView {
|
|
|
389
449
|
* starting dstRow for the batch. Caller is responsible for tracking
|
|
390
450
|
* entityIndex → row for every entity in the batch.
|
|
391
451
|
*
|
|
392
|
-
* Collapses the N×C
|
|
393
|
-
*
|
|
394
|
-
*
|
|
452
|
+
* Collapses the N×C per-element cost of N sequential `addEntity` calls into
|
|
453
|
+
* C `fill` calls, one for each column — the same pattern `bulkMoveAllFrom`
|
|
454
|
+
* uses for the move-with-data case.
|
|
395
455
|
*/
|
|
396
456
|
addEntities(entityIds: Uint32Array, count?: number): number;
|
|
397
457
|
/** Tag-optimized bulk add: skip the per-column zero-fill entirely. */
|
|
@@ -401,8 +461,8 @@ export declare class Archetype implements ArchetypeView {
|
|
|
401
461
|
* `addEntitiesWithValues` appends run internally, lifted out so the spawn
|
|
402
462
|
* path can pre-reserve capacity BEFORE it commits an entity slot. A SAB-cap
|
|
403
463
|
* grow throws here (with the world untouched) instead of mid-append after the
|
|
404
|
-
* slot is already live — see `Store.spawn`/`spawnMany
|
|
405
|
-
*
|
|
464
|
+
* slot is already live — see `Store.spawn`/`spawnMany`. Now just the
|
|
465
|
+
* public name for `_reserveRows`, which every append path shares. */
|
|
406
466
|
ensureRowCapacity(additional: number): void;
|
|
407
467
|
/** Append one entity, writing `flatValues[i]` straight into column `i`
|
|
408
468
|
* (in `_flatColumns` order) — no zero-fill-then-overwrite. Bumps every
|
|
@@ -424,7 +484,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
424
484
|
/**
|
|
425
485
|
* Move an entity from src into this archetype (tag-only: no columns to copy).
|
|
426
486
|
* Writes dstRow to _moveResult[0]; _moveResult[1] is always NO_SWAP (the
|
|
427
|
-
* partition-aware src/dst updates are owned internally
|
|
487
|
+
* partition-aware src/dst updates are owned internally).
|
|
428
488
|
*/
|
|
429
489
|
moveEntityFromTag(src: Archetype, srcRow: number, entityId: EntityID, entityRow: Int32Array): void;
|
|
430
490
|
/**
|
|
@@ -444,7 +504,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
444
504
|
clearRows(): void;
|
|
445
505
|
/**
|
|
446
506
|
* Re-derive the host-side row bookkeeping after a snapshot is mounted onto a
|
|
447
|
-
* live world (
|
|
507
|
+
* live world (`Store.restoreInto`). A snapshot reloads the column bytes
|
|
448
508
|
* (dense SAB) but NOT the host-side `length` / `enabledCount` / `_entityIds`
|
|
449
509
|
* back-reference — those are reconstructed here. `refreshViews` must have
|
|
450
510
|
* already repointed the columns at the restored SAB.
|
|
@@ -452,7 +512,7 @@ export declare class Archetype implements ArchetypeView {
|
|
|
452
512
|
* The caller scans the restored entity-index region to learn which entity
|
|
453
513
|
* occupies each row and passes them in row order (`rowEntityIds[r]` is the
|
|
454
514
|
* packed `EntityID` at row `r`; rows `[0, length)` are dense, enabled rows
|
|
455
|
-
* first then disabled per the
|
|
515
|
+
* first then disabled per the partition). `enabledCount` is the restored
|
|
456
516
|
* partition boundary. This is the inverse of the per-row `addEntity` /
|
|
457
517
|
* `disableRow` bookkeeping the live run accumulated.
|
|
458
518
|
*/
|
|
@@ -465,12 +525,12 @@ export declare class Archetype implements ArchetypeView {
|
|
|
465
525
|
* cache only covers single-component steps.
|
|
466
526
|
*/
|
|
467
527
|
getBatchTransitionMap(target: Archetype): Int16Array;
|
|
468
|
-
/** Look up a cached plural-add transition by its packed key
|
|
528
|
+
/** Look up a cached plural-add transition by its packed key. Returns
|
|
469
529
|
* `undefined` until the first composite add out of this archetype plants the
|
|
470
530
|
* lazy Map — the common case for archetypes that only ever see single adds. */
|
|
471
531
|
getCompositeAddEdge(key: number): CompositeAddEdge | undefined;
|
|
472
532
|
/** Cache a resolved plural-add transition (target + src→target map) under its
|
|
473
|
-
* packed key
|
|
533
|
+
* packed key, allocating the backing Map on first use. */
|
|
474
534
|
cacheCompositeAddEdge(key: number, target: ArchetypeID, map: Int16Array): void;
|
|
475
535
|
}
|
|
476
536
|
/** Reusable result buffer for move_entity_from/move_entity_from_tag. [dstRow, swapped_index] */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archetype.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/archetype.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;KAmBK;AAEL,OAAO,EACN,KAAK,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"archetype.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/archetype.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;KAmBK;AAEL,OAAO,EACN,KAAK,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAa,KAA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EAAE,UAAU,GACnB,IAAI;IAsDP;;;;OAIG;IACI,iBAAiB,CACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,UAAU,GACnB,IAAI;IAwBP;;;;OAIG;IACI,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAgDvF;;;;;;;OAOG;IACI,SAAS,IAAI,IAAI;IAQxB;;;;;;;;;;;;;OAaG;IACI,eAAe,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IA6B5E,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS;IAI5D,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IAInE;;;;OAIG;IACI,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU;IAQ3D;;mFAE+E;IACxE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIrE;8DAC0D;IACnD,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;CAGrF;AAED,gGAAgG;AAChG,eAAO,MAAM,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAgB,CAAC;AAY1D,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIvD;AAiDD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,UAAU,CA6B7E"}
|
|
@@ -14,7 +14,7 @@ export interface ArchetypeGraphHost {
|
|
|
14
14
|
/** Row capacity for a new archetype's column region. */
|
|
15
15
|
readonly initialCapacity: () => number;
|
|
16
16
|
/** Extend the SAB with the new archetypes' column regions (one call for
|
|
17
|
-
* the whole batch — the bulk path's O(N²)→O(N) win
|
|
17
|
+
* the whole batch — the bulk path's O(N²)→O(N) win). */
|
|
18
18
|
readonly extendStore: (specs: ArchetypeSpec[]) => void;
|
|
19
19
|
/** Materialise the `Archetype` over the live column store and attach the
|
|
20
20
|
* store's grow handler. */
|
|
@@ -34,7 +34,7 @@ export declare class ArchetypeGraph {
|
|
|
34
34
|
* superset scan from the smallest bucket. Each bucket is a plain push-only
|
|
35
35
|
* array — NOT a Set — and deliberately does NOT dedup: a (component,
|
|
36
36
|
* archetype) pair can be inserted here at most once (see the "no duplicate
|
|
37
|
-
* pair" invariant on `install`
|
|
37
|
+
* pair" invariant on `install`), so there is nothing for a Set
|
|
38
38
|
* to collapse. Archetypes are never removed from a Store, so buckets only
|
|
39
39
|
* grow, in ascending archetype-id order — which is canonical order,
|
|
40
40
|
* exploited by `_forEachChangedArchetype` to skip a sort. */
|
|
@@ -48,21 +48,21 @@ export declare class ArchetypeGraph {
|
|
|
48
48
|
* Find or create an archetype for the given component mask.
|
|
49
49
|
* Also updates the componentIndex and pushes into matching registered queries.
|
|
50
50
|
*
|
|
51
|
-
* Hot single-mask path. The bulk batched variant — used by
|
|
52
|
-
*
|
|
53
|
-
* see
|
|
51
|
+
* Hot single-mask path. The bulk batched variant — used by the prewarm
|
|
52
|
+
* pass at `ecs.startup()` — is `createManyFromMasks`;
|
|
53
|
+
* see `ECS.startup()` for how it gets called and why.
|
|
54
54
|
*/
|
|
55
55
|
getOrCreateFromMask(mask: BitSet): ArchetypeID;
|
|
56
56
|
/**
|
|
57
|
-
* Bulk variant of `getOrCreateFromMask` —
|
|
57
|
+
* Bulk variant of `getOrCreateFromMask` — the archetype prewarm pass.
|
|
58
58
|
*
|
|
59
59
|
* Given a set of masks, creates Archetypes for the ones not already
|
|
60
60
|
* planted, in a SINGLE `extendColumnStore` call (instead of one per
|
|
61
61
|
* archetype). Single-mask creation is O(N) in archetypes-so-far because
|
|
62
62
|
* the extend has to copy every existing archetype's live rows forward;
|
|
63
63
|
* N such calls compound to O(N²). Batching collapses the per-archetype
|
|
64
|
-
* setup-and-copy down to one pass — the per-startup cost
|
|
65
|
-
*
|
|
64
|
+
* setup-and-copy down to one pass — the per-startup cost goes from
|
|
65
|
+
* O(N²) to O(N) for in-tree systems whose archetype
|
|
66
66
|
* set is known at registration time via `spawns` + `transitions`.
|
|
67
67
|
*
|
|
68
68
|
* Masks already in the map are skipped. Returns the resolved
|
|
@@ -14,7 +14,7 @@ export interface ArchetypeGraphHost {
|
|
|
14
14
|
/** Row capacity for a new archetype's column region. */
|
|
15
15
|
readonly initialCapacity: () => number;
|
|
16
16
|
/** Extend the SAB with the new archetypes' column regions (one call for
|
|
17
|
-
* the whole batch — the bulk path's O(N²)→O(N) win
|
|
17
|
+
* the whole batch — the bulk path's O(N²)→O(N) win). */
|
|
18
18
|
readonly extendStore: (specs: ArchetypeSpec[]) => void;
|
|
19
19
|
/** Materialise the `Archetype` over the live column store and attach the
|
|
20
20
|
* store's grow handler. */
|
|
@@ -34,7 +34,7 @@ export declare class ArchetypeGraph {
|
|
|
34
34
|
* superset scan from the smallest bucket. Each bucket is a plain push-only
|
|
35
35
|
* array — NOT a Set — and deliberately does NOT dedup: a (component,
|
|
36
36
|
* archetype) pair can be inserted here at most once (see the "no duplicate
|
|
37
|
-
* pair" invariant on `install`
|
|
37
|
+
* pair" invariant on `install`), so there is nothing for a Set
|
|
38
38
|
* to collapse. Archetypes are never removed from a Store, so buckets only
|
|
39
39
|
* grow, in ascending archetype-id order — which is canonical order,
|
|
40
40
|
* exploited by `_forEachChangedArchetype` to skip a sort. */
|
|
@@ -48,21 +48,21 @@ export declare class ArchetypeGraph {
|
|
|
48
48
|
* Find or create an archetype for the given component mask.
|
|
49
49
|
* Also updates the componentIndex and pushes into matching registered queries.
|
|
50
50
|
*
|
|
51
|
-
* Hot single-mask path. The bulk batched variant — used by
|
|
52
|
-
*
|
|
53
|
-
* see
|
|
51
|
+
* Hot single-mask path. The bulk batched variant — used by the prewarm
|
|
52
|
+
* pass at `ecs.startup()` — is `createManyFromMasks`;
|
|
53
|
+
* see `ECS.startup()` for how it gets called and why.
|
|
54
54
|
*/
|
|
55
55
|
getOrCreateFromMask(mask: BitSet): ArchetypeID;
|
|
56
56
|
/**
|
|
57
|
-
* Bulk variant of `getOrCreateFromMask` —
|
|
57
|
+
* Bulk variant of `getOrCreateFromMask` — the archetype prewarm pass.
|
|
58
58
|
*
|
|
59
59
|
* Given a set of masks, creates Archetypes for the ones not already
|
|
60
60
|
* planted, in a SINGLE `extendColumnStore` call (instead of one per
|
|
61
61
|
* archetype). Single-mask creation is O(N) in archetypes-so-far because
|
|
62
62
|
* the extend has to copy every existing archetype's live rows forward;
|
|
63
63
|
* N such calls compound to O(N²). Batching collapses the per-archetype
|
|
64
|
-
* setup-and-copy down to one pass — the per-startup cost
|
|
65
|
-
*
|
|
64
|
+
* setup-and-copy down to one pass — the per-startup cost goes from
|
|
65
|
+
* O(N²) to O(N) for in-tree systems whose archetype
|
|
66
66
|
* set is known at registration time via `spawns` + `transitions`.
|
|
67
67
|
*
|
|
68
68
|
* Masks already in the map are skipped. Returns the resolved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archetype_graph.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/archetype_graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAsB,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,SAAS,EAGT,KAAK,qBAAqB,EAE1B,KAAK,WAAW,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,EAGN,KAAK,aAAa,EAElB,MAAM,UAAU,CAAC;AAGlB;;;4EAG4E;AAC5E,MAAM,WAAW,kBAAkB;I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,EAAE,CAAM;IAErD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IACtE,OAAO,CAAC,eAAe,CAAK;IAE5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;gBAE9B,IAAI,EAAE,kBAAkB;IAI7B,GAAG,CAAC,EAAE,EAAE,WAAW,GAAG,SAAS;IAStC;;;;;;;OAOG;IACI,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAkBrD;;;;;;;;;;;;;;;OAeG;IACI,mBAAmB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,EAAE;IA4DnE,iFAAiF;IACjF,OAAO,CAAC,MAAM;IASd;sEACkE;IAClE,OAAO,CAAC,YAAY;IAkBpB;;;;;;;;;yEASqE;IACrE,OAAO,CAAC,OAAO;IA0Df,wFAAwF;IACjF,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,WAAW;IAYlF,6FAA6F;IACtF,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,WAAW;IAYrF,oEAAoE;IACpE,OAAO,CAAC,SAAS;CAuBjB"}
|
|
@@ -16,7 +16,7 @@ export interface BuiltinRelationOptions {
|
|
|
16
16
|
* `ecs.relations.ancestorsOf(instance, IsA)` / `rootOf` / `cascadeOf(exemplar, IsA)`.
|
|
17
17
|
* - **No component inheritance** — IsA records the link only; materialization of
|
|
18
18
|
* an instance from its exemplar stays a spawn-time copy (the template path,
|
|
19
|
-
*
|
|
19
|
+
* deliberately decoupled. An exemplar is a real entity,
|
|
20
20
|
* not a `Template` (a non-entity template can't be a relation target).
|
|
21
21
|
*
|
|
22
22
|
* Default `onDeleteTarget: "clear"` — destroying an exemplar drops its
|
|
@@ -16,7 +16,7 @@ export interface BuiltinRelationOptions {
|
|
|
16
16
|
* `ecs.relations.ancestorsOf(instance, IsA)` / `rootOf` / `cascadeOf(exemplar, IsA)`.
|
|
17
17
|
* - **No component inheritance** — IsA records the link only; materialization of
|
|
18
18
|
* an instance from its exemplar stays a spawn-time copy (the template path,
|
|
19
|
-
*
|
|
19
|
+
* deliberately decoupled. An exemplar is a real entity,
|
|
20
20
|
* not a `Template` (a non-entity template can't be a relation target).
|
|
21
21
|
*
|
|
22
22
|
* Default `onDeleteTarget: "clear"` — destroying an exemplar drops its
|
|
@@ -85,14 +85,14 @@ export interface ReplayResult {
|
|
|
85
85
|
readonly ticks: number;
|
|
86
86
|
/** Per-tick `stateHash` captured after each `update`, in tick order — empty
|
|
87
87
|
* unless the world is deterministic (or `hash` was forced). Compare against
|
|
88
|
-
* the original run's per-tick hashes to prove the replay matched
|
|
88
|
+
* the original run's per-tick hashes to prove the replay matched. */
|
|
89
89
|
readonly stateHashes: readonly number[];
|
|
90
90
|
}
|
|
91
91
|
/** Options for {@link replayCommandLog}. */
|
|
92
92
|
export interface ReplayOptions {
|
|
93
93
|
/** Capture `ecs.snapshots.stateHash()` after each tick. Defaults to the world's
|
|
94
94
|
* `deterministic` flag — a deterministic world is hashed, a non-deterministic
|
|
95
|
-
* one is not (its `stateHash` would throw
|
|
95
|
+
* one is not (its `stateHash` would throw). Force `true` only on a
|
|
96
96
|
* deterministic world. */
|
|
97
97
|
readonly hash?: boolean;
|
|
98
98
|
}
|
|
@@ -106,9 +106,9 @@ export interface ReplayOptions {
|
|
|
106
106
|
* (which drains them at PRE_STARTUP), then for each recorded tick enqueues that
|
|
107
107
|
* tick's commands and calls `ecs.update(dt)` with the recorded `dt`.
|
|
108
108
|
*
|
|
109
|
-
* Determinism
|
|
109
|
+
* Determinism: with `{ deterministic: true }` the per-tick
|
|
110
110
|
* `stateHashes` this returns must equal the original run's — that equality is
|
|
111
|
-
* replay fidelity. Identity caveat
|
|
111
|
+
* replay fidelity. Identity caveat: a despawned-then-respawned entity gets
|
|
112
112
|
* a fresh id, but because spawn order is reproduced, every recorded id still
|
|
113
113
|
* resolves to the same entity on replay.
|
|
114
114
|
*/
|
|
@@ -85,14 +85,14 @@ export interface ReplayResult {
|
|
|
85
85
|
readonly ticks: number;
|
|
86
86
|
/** Per-tick `stateHash` captured after each `update`, in tick order — empty
|
|
87
87
|
* unless the world is deterministic (or `hash` was forced). Compare against
|
|
88
|
-
* the original run's per-tick hashes to prove the replay matched
|
|
88
|
+
* the original run's per-tick hashes to prove the replay matched. */
|
|
89
89
|
readonly stateHashes: readonly number[];
|
|
90
90
|
}
|
|
91
91
|
/** Options for {@link replayCommandLog}. */
|
|
92
92
|
export interface ReplayOptions {
|
|
93
93
|
/** Capture `ecs.snapshots.stateHash()` after each tick. Defaults to the world's
|
|
94
94
|
* `deterministic` flag — a deterministic world is hashed, a non-deterministic
|
|
95
|
-
* one is not (its `stateHash` would throw
|
|
95
|
+
* one is not (its `stateHash` would throw). Force `true` only on a
|
|
96
96
|
* deterministic world. */
|
|
97
97
|
readonly hash?: boolean;
|
|
98
98
|
}
|
|
@@ -106,9 +106,9 @@ export interface ReplayOptions {
|
|
|
106
106
|
* (which drains them at PRE_STARTUP), then for each recorded tick enqueues that
|
|
107
107
|
* tick's commands and calls `ecs.update(dt)` with the recorded `dt`.
|
|
108
108
|
*
|
|
109
|
-
* Determinism
|
|
109
|
+
* Determinism: with `{ deterministic: true }` the per-tick
|
|
110
110
|
* `stateHashes` this returns must equal the original run's — that equality is
|
|
111
|
-
* replay fidelity. Identity caveat
|
|
111
|
+
* replay fidelity. Identity caveat: a despawned-then-respawned entity gets
|
|
112
112
|
* a fresh id, but because spawn order is reproduced, every recorded id still
|
|
113
113
|
* resolves to the same entity on replay.
|
|
114
114
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command_log.d.ts","sourceRoot":"","sources":["../../../src/core/ecs/command_log.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;A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,UAAU;IAIjB;mFAC+E;IAC/E,WAAW,IAAI,UAAU;CAOzB;AAYD;;;;;;;;;gFASgF;AAChF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAqB3D;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAW9D;AAED,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;yEAEqE;IACrE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC7B;;;8BAG0B;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,UAAU,EACf,IAAI,CAAC,EAAE,aAAa,GAClB,YAAY,CAcd"}
|
|
@@ -99,8 +99,8 @@ export interface ComponentDef<S extends ComponentSchema = ComponentSchema> {
|
|
|
99
99
|
export type SchemaOf<D> = D extends ComponentDef<infer S extends ComponentSchema> ? S : never;
|
|
100
100
|
/**
|
|
101
101
|
* `unknown` if `D` is one of the query's declared terms, else an error tuple —
|
|
102
|
-
* the query-seam sibling of system.ts's `DeclaredRead` (§typestate
|
|
103
|
-
*
|
|
102
|
+
* the query-seam sibling of system.ts's `DeclaredRead` (§typestate).
|
|
103
|
+
* `Query.eachChunk`'s cursor and `ArchetypeView`'s column
|
|
104
104
|
* accessors intersect this into their `def` parameter so fetching a component
|
|
105
105
|
* that is NOT a term of the iterating query fails to compile (previously
|
|
106
106
|
* caught only by the dev-mode access check, and only when the system's
|
|
@@ -133,7 +133,7 @@ export type ComponentHandle = {
|
|
|
133
133
|
* returned function produces a `Bundle` when called (`Pos({x,y})`) and carries
|
|
134
134
|
* its numeric id on a non-enumerable `.id` (invisible to spreads / `JSON`).
|
|
135
135
|
* The single cast bridges the function value to the branded handle type — the
|
|
136
|
-
* `.id` is installed at runtime by `defineProperty` (
|
|
136
|
+
* `.id` is installed at runtime by `defineProperty` (the branded-ID boundary).
|
|
137
137
|
*/
|
|
138
138
|
export declare function makeComponentDef<S extends ComponentSchema>(id: ComponentID): ComponentDef<S>;
|
|
139
139
|
export interface Bundle<S extends ComponentSchema = ComponentSchema> {
|
|
@@ -180,7 +180,7 @@ export declare function bundleValues(item: BundleOrDef): Readonly<Record<string,
|
|
|
180
180
|
*
|
|
181
181
|
* **Advisory, not a runtime barrier:** the value behind this type is the live
|
|
182
182
|
* mutable backing `TypedArray` (`Archetype.getColumnRead` returns
|
|
183
|
-
* `.buf as unknown as ReadonlyColumn`), so a
|
|
183
|
+
* `.buf as unknown as ReadonlyColumn`), so a deliberate cast can still write
|
|
184
184
|
* through. For mutation use the mutable `Archetype.getColumn` (tick-bumping).
|
|
185
185
|
* Enforced by the escape-hatch lint, not the runtime.
|
|
186
186
|
*/
|