@forgeax/engine-ecs 0.1.26 → 0.1.28
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 +94 -35
- package/dist/__tests__/world-read.unit.test.d.ts +2 -0
- package/dist/__tests__/world-read.unit.test.d.ts.map +1 -0
- package/dist/commands.d.ts +2 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/index.mjs +3471 -4263
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +2 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.mjs +3 -333
- package/dist/internal.mjs.map +1 -1
- package/dist/projection/index.mjs.map +1 -1
- package/dist/shared.mjs.map +1 -1
- package/dist/world-entity-lifecycle.d.ts +3 -14
- package/dist/world-entity-lifecycle.d.ts.map +1 -1
- package/dist/world-internal.d.ts +65 -5
- package/dist/world-internal.d.ts.map +1 -1
- package/dist/world-read.d.ts +16 -0
- package/dist/world-read.d.ts.map +1 -0
- package/dist/world-read.mjs +8 -0
- package/dist/world-read.mjs.map +1 -0
- package/dist/world-scheduling.d.ts +0 -4
- package/dist/world-scheduling.d.ts.map +1 -1
- package/dist/world-storage-primitives.d.ts +26 -0
- package/dist/world-storage-primitives.d.ts.map +1 -0
- package/dist/world.d.ts +352 -157
- package/dist/world.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/__tests__/command-buffer.test.ts +29 -3
- package/src/__tests__/hierarchy.unit.test.ts +3 -3
- package/src/__tests__/world-health.contract.test.ts +195 -2
- package/src/__tests__/world-read.unit.test.ts +30 -0
- package/src/commands.ts +22 -9
- package/src/internal.ts +5 -3
- package/src/world-entity-lifecycle.ts +23 -252
- package/src/world-internal-augmentation.d.ts +11 -0
- package/src/world-internal.ts +114 -63
- package/src/world-read.ts +38 -0
- package/src/world-scheduling.ts +0 -26
- package/src/world-storage-primitives.ts +179 -0
- package/src/world.ts +2590 -509
- package/dist/world-component-access.d.ts +0 -311
- package/dist/world-component-access.d.ts.map +0 -1
- package/dist/world-component-storage.d.ts +0 -298
- package/dist/world-component-storage.d.ts.map +0 -1
- package/dist/world-core.d.ts +0 -39
- package/dist/world-core.d.ts.map +0 -1
- package/src/world-component-access.ts +0 -1769
- package/src/world-component-storage.ts +0 -1264
- package/src/world-core.ts +0 -74
package/src/world-core.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { BufferPool } from './buffer-pool';
|
|
2
|
-
import { createWorldIdentity } from './execution/shared-kernel';
|
|
3
|
-
import type { RelationshipIndex } from './relationship-index';
|
|
4
|
-
import type { SharedRefStore } from './shared-ref-store';
|
|
5
|
-
import { SharedRefStore as SharedRefStoreImpl } from './shared-ref-store';
|
|
6
|
-
import { type ArchetypeGraph, createArchetypeGraph } from './storage/archetype-graph';
|
|
7
|
-
import { StructuralEvidenceRing } from './storage/structural-evidence';
|
|
8
|
-
import type { UniqueRefStore } from './unique-ref-store';
|
|
9
|
-
import { UniqueRefStore as UniqueRefStoreImpl } from './unique-ref-store';
|
|
10
|
-
import type { EntityRecord } from './world';
|
|
11
|
-
|
|
12
|
-
interface WorldStorageCore {
|
|
13
|
-
readonly graph: ArchetypeGraph;
|
|
14
|
-
readonly records: EntityRecord[];
|
|
15
|
-
readonly freeIndices: number[];
|
|
16
|
-
readonly bufferPool: BufferPool;
|
|
17
|
-
readonly uniqueRefs: UniqueRefStore;
|
|
18
|
-
readonly sharedRefs: SharedRefStore;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function createWorldStorageCore(
|
|
22
|
-
shared: boolean,
|
|
23
|
-
refs: { readonly uniqueRefs: UniqueRefStore; readonly sharedRefs: SharedRefStore },
|
|
24
|
-
): WorldStorageCore {
|
|
25
|
-
return {
|
|
26
|
-
graph: createArchetypeGraph(shared),
|
|
27
|
-
records: [],
|
|
28
|
-
freeIndices: [],
|
|
29
|
-
bufferPool: new BufferPool(),
|
|
30
|
-
uniqueRefs: refs.uniqueRefs,
|
|
31
|
-
sharedRefs: refs.sharedRefs,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Package-private state authority for World. A World is the public facade;
|
|
37
|
-
* this object is the only owner of archetype storage, entity records, managed
|
|
38
|
-
* stores, epochs, and bounded change evidence.
|
|
39
|
-
*/
|
|
40
|
-
export class WorldCore {
|
|
41
|
-
readonly identity: string = createWorldIdentity();
|
|
42
|
-
readonly uniqueRefs: UniqueRefStore = new UniqueRefStoreImpl();
|
|
43
|
-
readonly sharedRefs: SharedRefStore = new SharedRefStoreImpl();
|
|
44
|
-
readonly storage: WorldStorageCore;
|
|
45
|
-
readonly componentMutationEpochs: number[] = [];
|
|
46
|
-
readonly structuralEvidence = new StructuralEvidenceRing();
|
|
47
|
-
/** One packed reverse index per relationship source component. */
|
|
48
|
-
readonly relationshipIndexes = new Map<number, RelationshipIndex>();
|
|
49
|
-
mutationEpoch = 0;
|
|
50
|
-
structureEpoch = 0;
|
|
51
|
-
|
|
52
|
-
constructor(sharedStorage: boolean) {
|
|
53
|
-
this.storage = createWorldStorageCore(sharedStorage, {
|
|
54
|
-
uniqueRefs: this.uniqueRefs,
|
|
55
|
-
sharedRefs: this.sharedRefs,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get graph() {
|
|
60
|
-
return this.storage.graph;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get records() {
|
|
64
|
-
return this.storage.records;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get freeIndices() {
|
|
68
|
-
return this.storage.freeIndices;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get bufferPool() {
|
|
72
|
-
return this.storage.bufferPool;
|
|
73
|
-
}
|
|
74
|
-
}
|