iris-ecs 0.0.1
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/LICENSE +21 -0
- package/README.md +721 -0
- package/dist/actions.d.ts +43 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +35 -0
- package/dist/actions.js.map +1 -0
- package/dist/archetype.d.ts +194 -0
- package/dist/archetype.d.ts.map +1 -0
- package/dist/archetype.js +412 -0
- package/dist/archetype.js.map +1 -0
- package/dist/component.d.ts +89 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +237 -0
- package/dist/component.js.map +1 -0
- package/dist/encoding.d.ts +204 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +215 -0
- package/dist/encoding.js.map +1 -0
- package/dist/entity.d.ts +129 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/entity.js +243 -0
- package/dist/entity.js.map +1 -0
- package/dist/event.d.ts +237 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +293 -0
- package/dist/event.js.map +1 -0
- package/dist/filters.d.ts +121 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +202 -0
- package/dist/filters.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/name.d.ts +70 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +172 -0
- package/dist/name.js.map +1 -0
- package/dist/observer.d.ts +83 -0
- package/dist/observer.d.ts.map +1 -0
- package/dist/observer.js +62 -0
- package/dist/observer.js.map +1 -0
- package/dist/query.d.ts +198 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +299 -0
- package/dist/query.js.map +1 -0
- package/dist/registry.d.ts +118 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +112 -0
- package/dist/registry.js.map +1 -0
- package/dist/relation.d.ts +60 -0
- package/dist/relation.d.ts.map +1 -0
- package/dist/relation.js +171 -0
- package/dist/relation.js.map +1 -0
- package/dist/removal.d.ts +27 -0
- package/dist/removal.d.ts.map +1 -0
- package/dist/removal.js +66 -0
- package/dist/removal.js.map +1 -0
- package/dist/resource.d.ts +78 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +86 -0
- package/dist/resource.js.map +1 -0
- package/dist/scheduler.d.ts +106 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +204 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/schema.d.ts +117 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +113 -0
- package/dist/schema.js.map +1 -0
- package/dist/world.d.ts +172 -0
- package/dist/world.d.ts.map +1 -0
- package/dist/world.js +127 -0
- package/dist/world.js.map +1 -0
- package/package.json +52 -0
package/dist/encoding.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Type Constants
|
|
3
|
+
// ============================================================================
|
|
4
|
+
/**
|
|
5
|
+
* Entity type constant (0x1).
|
|
6
|
+
*/
|
|
7
|
+
export const ENTITY_TYPE = 0x1;
|
|
8
|
+
/**
|
|
9
|
+
* Tag type constant (0x2).
|
|
10
|
+
*/
|
|
11
|
+
export const TAG_TYPE = 0x2;
|
|
12
|
+
/**
|
|
13
|
+
* Component type constant (0x3).
|
|
14
|
+
*/
|
|
15
|
+
export const COMPONENT_TYPE = 0x3;
|
|
16
|
+
/**
|
|
17
|
+
* Relationship type constant (0x4).
|
|
18
|
+
*/
|
|
19
|
+
export const RELATIONSHIP_TYPE = 0x4;
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// ID Limits
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Maximum raw ID for entities, components, and tags (20-bit).
|
|
25
|
+
*/
|
|
26
|
+
export const ID_MASK_20 = 0xfffff;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum raw ID for relationships (8-bit).
|
|
29
|
+
*/
|
|
30
|
+
export const ID_MASK_8 = 0xff;
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Common Bit Positions
|
|
33
|
+
// ============================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Pair flag bit position (bit 31).
|
|
36
|
+
*/
|
|
37
|
+
export const PAIR_FLAG_SHIFT = 31;
|
|
38
|
+
/**
|
|
39
|
+
* Type bits position (bits 30-28).
|
|
40
|
+
*/
|
|
41
|
+
export const TYPE_SHIFT = 28;
|
|
42
|
+
/**
|
|
43
|
+
* Type mask (3 bits).
|
|
44
|
+
*/
|
|
45
|
+
export const TYPE_MASK = 0x7;
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Bit Field Constants (Internal)
|
|
48
|
+
// ============================================================================
|
|
49
|
+
const ID_SHIFT_20 = 0;
|
|
50
|
+
const ID_SHIFT_8 = 0;
|
|
51
|
+
const META_SHIFT_8 = 20;
|
|
52
|
+
const META_MASK_8 = 0xff;
|
|
53
|
+
const META_SHIFT_20 = 8;
|
|
54
|
+
const META_MASK_20 = 0xfffff;
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Encoding Functions
|
|
57
|
+
// ============================================================================
|
|
58
|
+
/**
|
|
59
|
+
* Type-aware encoding using type-specific bit layouts.
|
|
60
|
+
*/
|
|
61
|
+
function encode(type, rawId, meta) {
|
|
62
|
+
switch (type) {
|
|
63
|
+
case RELATIONSHIP_TYPE:
|
|
64
|
+
// Relationship: [0][TYPE][META_20][ID_8]
|
|
65
|
+
return (0 << PAIR_FLAG_SHIFT) | (type << TYPE_SHIFT) | (meta << META_SHIFT_20) | (rawId << ID_SHIFT_8);
|
|
66
|
+
case ENTITY_TYPE:
|
|
67
|
+
case TAG_TYPE:
|
|
68
|
+
case COMPONENT_TYPE:
|
|
69
|
+
default:
|
|
70
|
+
// Entity/Component/Tag: [0][TYPE][META_8][ID_20]
|
|
71
|
+
return (0 << PAIR_FLAG_SHIFT) | (type << TYPE_SHIFT) | (meta << META_SHIFT_8) | (rawId << ID_SHIFT_20);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Encode entity ID from raw ID and generation.
|
|
76
|
+
*
|
|
77
|
+
* @param rawId - Raw entity ID (0 to 1,048,575)
|
|
78
|
+
* @param generation - Generation number (0 to 255)
|
|
79
|
+
* @returns Encoded 32-bit entity ID
|
|
80
|
+
*/
|
|
81
|
+
export function encodeEntity(rawId, generation) {
|
|
82
|
+
return encode(ENTITY_TYPE, rawId, generation);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Encode component ID from raw ID.
|
|
86
|
+
*
|
|
87
|
+
* @param rawId - Raw component ID (0 to 1,048,575)
|
|
88
|
+
* @returns Encoded 32-bit component ID
|
|
89
|
+
*/
|
|
90
|
+
export function encodeComponent(rawId) {
|
|
91
|
+
return encode(COMPONENT_TYPE, rawId, 0);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Encode tag ID from raw ID.
|
|
95
|
+
*
|
|
96
|
+
* @param rawId - Raw tag ID (0 to 1,048,575)
|
|
97
|
+
* @returns Encoded 32-bit tag ID
|
|
98
|
+
*/
|
|
99
|
+
export function encodeTag(rawId) {
|
|
100
|
+
return encode(TAG_TYPE, rawId, 0);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Encode relation ID from raw ID.
|
|
104
|
+
*
|
|
105
|
+
* @param rawId - Raw relation ID (0 to 255)
|
|
106
|
+
* @returns Encoded 32-bit relation ID
|
|
107
|
+
*/
|
|
108
|
+
export function encodeRelation(rawId) {
|
|
109
|
+
return encode(RELATIONSHIP_TYPE, rawId, 0);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Encode a pair from relation and target.
|
|
113
|
+
*
|
|
114
|
+
* @param relation - Relation ID
|
|
115
|
+
* @param target - Target ID (entity, tag, component, or relation)
|
|
116
|
+
* @returns Encoded pair ID
|
|
117
|
+
*/
|
|
118
|
+
export function encodePair(relation, target) {
|
|
119
|
+
const relationRawId = extractId(relation);
|
|
120
|
+
const targetType = extractType(target);
|
|
121
|
+
const targetRawId = extractId(target);
|
|
122
|
+
return ((1 << PAIR_FLAG_SHIFT) |
|
|
123
|
+
(targetType << TYPE_SHIFT) |
|
|
124
|
+
(targetRawId << META_SHIFT_20) |
|
|
125
|
+
relationRawId);
|
|
126
|
+
}
|
|
127
|
+
// ============================================================================
|
|
128
|
+
// Decoding Functions
|
|
129
|
+
// ============================================================================
|
|
130
|
+
/**
|
|
131
|
+
* Extract type bits from encoded ID.
|
|
132
|
+
*
|
|
133
|
+
* @param id - Encoded ID
|
|
134
|
+
* @returns Type bits (0x0 - 0x7)
|
|
135
|
+
*/
|
|
136
|
+
export function extractType(id) {
|
|
137
|
+
return (id >>> TYPE_SHIFT) & TYPE_MASK;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Extract raw ID from encoded ID (type-aware).
|
|
141
|
+
*
|
|
142
|
+
* @param id - Encoded ID (any non-pair type)
|
|
143
|
+
* @returns Raw ID (20-bit for entities/components/tags, 8-bit for relationships)
|
|
144
|
+
*/
|
|
145
|
+
export function extractId(id) {
|
|
146
|
+
const type = extractType(id);
|
|
147
|
+
switch (type) {
|
|
148
|
+
case RELATIONSHIP_TYPE:
|
|
149
|
+
// Relationship: 8-bit ID at bits 7-0
|
|
150
|
+
return (id >>> ID_SHIFT_8) & ID_MASK_8;
|
|
151
|
+
case ENTITY_TYPE:
|
|
152
|
+
case TAG_TYPE:
|
|
153
|
+
case COMPONENT_TYPE:
|
|
154
|
+
default:
|
|
155
|
+
// Entity/Component/Tag: 20-bit ID at bits 19-0
|
|
156
|
+
return (id >>> ID_SHIFT_20) & ID_MASK_20;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Extract meta field from encoded ID (type-aware).
|
|
161
|
+
*
|
|
162
|
+
* @param id - Encoded ID (any non-pair type)
|
|
163
|
+
* @returns Meta value (generation for entities, 0 for components/tags/relationships)
|
|
164
|
+
*/
|
|
165
|
+
export function extractMeta(id) {
|
|
166
|
+
const type = extractType(id);
|
|
167
|
+
switch (type) {
|
|
168
|
+
case RELATIONSHIP_TYPE:
|
|
169
|
+
// Relationship: 20-bit meta at bits 27-8 (unused, always 0)
|
|
170
|
+
return (id >>> META_SHIFT_20) & META_MASK_20;
|
|
171
|
+
case ENTITY_TYPE:
|
|
172
|
+
case TAG_TYPE:
|
|
173
|
+
case COMPONENT_TYPE:
|
|
174
|
+
default:
|
|
175
|
+
// Entity/Component/Tag: 8-bit meta at bits 27-20
|
|
176
|
+
return (id >>> META_SHIFT_8) & META_MASK_8;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Check if ID is a pair.
|
|
181
|
+
*
|
|
182
|
+
* @param id - Encoded ID
|
|
183
|
+
* @returns True if bit 31 is set, false otherwise
|
|
184
|
+
*/
|
|
185
|
+
export function isPair(id) {
|
|
186
|
+
return id >>> PAIR_FLAG_SHIFT === 1;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Extract relation raw ID from pair.
|
|
190
|
+
*
|
|
191
|
+
* @param pairId - Encoded pair ID
|
|
192
|
+
* @returns Relation raw ID (8-bit)
|
|
193
|
+
*/
|
|
194
|
+
export function extractPairRelationId(pairId) {
|
|
195
|
+
return pairId & ID_MASK_8;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Extract target raw ID from pair.
|
|
199
|
+
*
|
|
200
|
+
* @param pairId - Encoded pair ID
|
|
201
|
+
* @returns Target raw ID (20-bit)
|
|
202
|
+
*/
|
|
203
|
+
export function extractPairTargetId(pairId) {
|
|
204
|
+
return (pairId >>> META_SHIFT_20) & ID_MASK_20;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Extract target type from pair.
|
|
208
|
+
*
|
|
209
|
+
* @param pairId - Encoded pair ID
|
|
210
|
+
* @returns Target type bits (3-bit)
|
|
211
|
+
*/
|
|
212
|
+
export function extractPairTargetType(pairId) {
|
|
213
|
+
return (pairId >>> TYPE_SHIFT) & TYPE_MASK;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AA8F9B,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAE7B,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,YAAY,GAAG,OAAO,CAAC;AAE7B,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;GAEG;AACH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AAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,EAAU;IAC/B,OAAO,EAAE,KAAK,eAAe,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,MAAM,GAAG,SAAS,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO,CAAC,MAAM,KAAK,aAAa,CAAC,GAAG,UAAU,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,GAAG,SAAS,CAAC;AAC7C,CAAC"}
|
package/dist/entity.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Archetype } from "./archetype.js";
|
|
2
|
+
import type { Entity, EntityId } from "./encoding.js";
|
|
3
|
+
import type { SchemaRecord } from "./schema.js";
|
|
4
|
+
import type { World } from "./world.js";
|
|
5
|
+
/**
|
|
6
|
+
* Entity metadata.
|
|
7
|
+
*
|
|
8
|
+
* Stores entity's current location (archetype + row) and component records.
|
|
9
|
+
*/
|
|
10
|
+
export type EntityMeta = {
|
|
11
|
+
/**
|
|
12
|
+
* Current archetype (direct reference).
|
|
13
|
+
*/
|
|
14
|
+
archetype: Archetype;
|
|
15
|
+
/**
|
|
16
|
+
* Row index in archetype.entities.
|
|
17
|
+
*/
|
|
18
|
+
row: number;
|
|
19
|
+
/**
|
|
20
|
+
* Component records: which archetypes contain this entity as a component.
|
|
21
|
+
*/
|
|
22
|
+
records: Archetype[];
|
|
23
|
+
/**
|
|
24
|
+
* Schema when this entity is used as a component (undefined for regular entities).
|
|
25
|
+
*/
|
|
26
|
+
schema?: SchemaRecord;
|
|
27
|
+
/**
|
|
28
|
+
* Cycle protection flag during cascade delete.
|
|
29
|
+
*/
|
|
30
|
+
destroying?: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Ensures entity exists in world, auto-registering components/tags/relations if needed.
|
|
34
|
+
*
|
|
35
|
+
* @param world - World instance
|
|
36
|
+
* @param entityId - Entity or component ID
|
|
37
|
+
* @returns Entity metadata
|
|
38
|
+
* @throws {Error} If entity not registered (ENTITY_TYPE) or unknown type
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const meta = ensureEntity(world, Position);
|
|
43
|
+
* console.log(meta.archetype);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function ensureEntity(world: World, entityId: EntityId): EntityMeta;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new entity in the world.
|
|
49
|
+
*
|
|
50
|
+
* @param world - World instance
|
|
51
|
+
* @returns Encoded entity ID
|
|
52
|
+
* @throws {RangeError} If entity limit (1,048,576) exceeded
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const entity = createEntity(world);
|
|
57
|
+
* addComponent(world, entity, Position, { x: 0, y: 0 });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function createEntity(world: World): Entity;
|
|
61
|
+
/**
|
|
62
|
+
* Destroys an entity and recycles its ID for reuse.
|
|
63
|
+
*
|
|
64
|
+
* @param world - World instance
|
|
65
|
+
* @param entityId - Entity to destroy
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* destroyEntity(world, entity);
|
|
70
|
+
* isEntityAlive(world, entity); // false
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function destroyEntity(world: World, entityId: EntityId): void;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if an entity is currently alive in the world.
|
|
76
|
+
*
|
|
77
|
+
* @param world - World instance
|
|
78
|
+
* @param entity - Entity ID to check
|
|
79
|
+
* @returns True if entity exists and is alive
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* isEntityAlive(world, entity); // true
|
|
84
|
+
* destroyEntity(world, entity);
|
|
85
|
+
* isEntityAlive(world, entity); // false
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function isEntityAlive(world: World, entity: EntityId): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Moves entity to a different archetype, transferring component data.
|
|
91
|
+
*
|
|
92
|
+
* @param world - World instance
|
|
93
|
+
* @param entityId - Entity to move
|
|
94
|
+
* @param toArchetype - Target archetype
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const archetype = getOrCreateArchetype(world, [Position, Velocity]);
|
|
99
|
+
* moveEntityToArchetype(world, entity, archetype);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function moveEntityToArchetype(world: World, entityId: EntityId, toArchetype: Archetype): void;
|
|
103
|
+
/**
|
|
104
|
+
* Registers archetype in entity records for all its component types.
|
|
105
|
+
*
|
|
106
|
+
* @param world - World instance
|
|
107
|
+
* @param archetype - Archetype to register
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const archetype = createArchetype([Position, Velocity]);
|
|
112
|
+
* addEntityRecord(world, archetype);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function addEntityRecord(world: World, archetype: Archetype): void;
|
|
116
|
+
/**
|
|
117
|
+
* Removes archetype from entity records for all its component types.
|
|
118
|
+
*
|
|
119
|
+
* @param world - World instance
|
|
120
|
+
* @param archetype - Archetype to unregister
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* removeEntityRecord(world, archetype);
|
|
125
|
+
* destroyArchetype(archetype);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function removeEntityRecord(world: World, archetype: Archetype): void;
|
|
129
|
+
//# sourceMappingURL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H,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAOxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAU3E"}
|
package/dist/entity.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { addEntityToArchetype, removeEntityFromArchetypeByRow, transferEntityToArchetypeByRow } from "./archetype.js";
|
|
2
|
+
import { addComponent, cascadeRemoveComponent } from "./component.js";
|
|
3
|
+
import { COMPONENT_TYPE, ENTITY_TYPE, encodeEntity, extractId, extractMeta, extractType, ID_MASK_8, ID_MASK_20, isPair, RELATIONSHIP_TYPE, TAG_TYPE, } from "./encoding.js";
|
|
4
|
+
import { fireObserverEvent } from "./observer.js";
|
|
5
|
+
import { Exclusive, OnDeleteTarget } from "./registry.js";
|
|
6
|
+
import { cleanupPairsTargetingEntity, getPairRelation } from "./relation.js";
|
|
7
|
+
/**
|
|
8
|
+
* Allocates entity ID, preferring recycled IDs from freelist.
|
|
9
|
+
* Recycled IDs retain their generation for stale reference detection.
|
|
10
|
+
*/
|
|
11
|
+
function allocateEntityId(world) {
|
|
12
|
+
const rawId = world.entities.freeIds.pop();
|
|
13
|
+
if (rawId !== undefined) {
|
|
14
|
+
// Reuse recycled ID with its current generation
|
|
15
|
+
const generation = world.entities.generations.get(rawId);
|
|
16
|
+
return encodeEntity(rawId, generation);
|
|
17
|
+
}
|
|
18
|
+
const newRawId = world.entities.nextId++;
|
|
19
|
+
if (newRawId > ID_MASK_20) {
|
|
20
|
+
throw new RangeError(`Entity ID limit exceeded: cannot allocate ID ${newRawId} (max ${ID_MASK_20})`);
|
|
21
|
+
}
|
|
22
|
+
world.entities.generations.set(newRawId, 0);
|
|
23
|
+
return encodeEntity(newRawId, 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registers entity in root archetype and creates its metadata.
|
|
27
|
+
* Schema is stored when entity is used as a component type.
|
|
28
|
+
*/
|
|
29
|
+
function registerEntity(world, entityId, schema) {
|
|
30
|
+
const rootArchetype = world.archetypes.root;
|
|
31
|
+
const row = addEntityToArchetype(rootArchetype, entityId);
|
|
32
|
+
const meta = {
|
|
33
|
+
archetype: rootArchetype,
|
|
34
|
+
row,
|
|
35
|
+
records: [],
|
|
36
|
+
schema,
|
|
37
|
+
};
|
|
38
|
+
world.entities.byId.set(entityId, meta);
|
|
39
|
+
return meta;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Ensures entity exists in world, auto-registering components/tags/relations if needed.
|
|
43
|
+
*
|
|
44
|
+
* @param world - World instance
|
|
45
|
+
* @param entityId - Entity or component ID
|
|
46
|
+
* @returns Entity metadata
|
|
47
|
+
* @throws {Error} If entity not registered (ENTITY_TYPE) or unknown type
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const meta = ensureEntity(world, Position);
|
|
52
|
+
* console.log(meta.archetype);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function ensureEntity(world, entityId) {
|
|
56
|
+
const meta = world.entities.byId.get(entityId);
|
|
57
|
+
if (meta) {
|
|
58
|
+
return meta;
|
|
59
|
+
}
|
|
60
|
+
// Pairs inherit schema from their relation component
|
|
61
|
+
if (isPair(entityId)) {
|
|
62
|
+
const relation = getPairRelation(entityId);
|
|
63
|
+
const relationMeta = ensureEntity(world, relation);
|
|
64
|
+
return registerEntity(world, entityId, relationMeta.schema);
|
|
65
|
+
}
|
|
66
|
+
const type = extractType(entityId);
|
|
67
|
+
switch (type) {
|
|
68
|
+
case TAG_TYPE: {
|
|
69
|
+
return registerEntity(world, entityId);
|
|
70
|
+
}
|
|
71
|
+
case COMPONENT_TYPE: {
|
|
72
|
+
const componentMeta = world.components.byId.get(entityId);
|
|
73
|
+
return registerEntity(world, entityId, componentMeta?.schema);
|
|
74
|
+
}
|
|
75
|
+
case RELATIONSHIP_TYPE: {
|
|
76
|
+
const relationMeta = world.components.byId.get(entityId);
|
|
77
|
+
const meta = registerEntity(world, entityId, relationMeta?.schema);
|
|
78
|
+
// Materialize relation traits as queryable components
|
|
79
|
+
if (relationMeta?.exclusive) {
|
|
80
|
+
addComponent(world, entityId, Exclusive);
|
|
81
|
+
}
|
|
82
|
+
if (relationMeta?.onDeleteTarget === "delete") {
|
|
83
|
+
addComponent(world, entityId, OnDeleteTarget);
|
|
84
|
+
}
|
|
85
|
+
return meta;
|
|
86
|
+
}
|
|
87
|
+
case ENTITY_TYPE: {
|
|
88
|
+
throw new Error(`Entity ${entityId} not registered in world`);
|
|
89
|
+
}
|
|
90
|
+
default: {
|
|
91
|
+
throw new Error(`Invalid entity type: ${type}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new entity in the world.
|
|
97
|
+
*
|
|
98
|
+
* @param world - World instance
|
|
99
|
+
* @returns Encoded entity ID
|
|
100
|
+
* @throws {RangeError} If entity limit (1,048,576) exceeded
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const entity = createEntity(world);
|
|
105
|
+
* addComponent(world, entity, Position, { x: 0, y: 0 });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function createEntity(world) {
|
|
109
|
+
const entityId = allocateEntityId(world);
|
|
110
|
+
registerEntity(world, entityId);
|
|
111
|
+
fireObserverEvent(world, "entityCreated", entityId);
|
|
112
|
+
return entityId;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Destroys an entity and recycles its ID for reuse.
|
|
116
|
+
*
|
|
117
|
+
* @param world - World instance
|
|
118
|
+
* @param entityId - Entity to destroy
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* destroyEntity(world, entity);
|
|
123
|
+
* isEntityAlive(world, entity); // false
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export function destroyEntity(world, entityId) {
|
|
127
|
+
// Idempotent - already destroyed entities are no-ops
|
|
128
|
+
if (!isEntityAlive(world, entityId)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const meta = ensureEntity(world, entityId);
|
|
132
|
+
// Cycle protection - prevent infinite loops from cascade deletes
|
|
133
|
+
if (meta.destroying) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
meta.destroying = true;
|
|
137
|
+
// Clean up pairs targeting this entity (handles cascade delete)
|
|
138
|
+
cleanupPairsTargetingEntity(world, entityId);
|
|
139
|
+
// Remove this entity from any entities that have it as a component
|
|
140
|
+
cascadeRemoveComponent(world, entityId);
|
|
141
|
+
const swappedEntityId = removeEntityFromArchetypeByRow(meta.archetype, meta.row);
|
|
142
|
+
// Swap-remove updates: entity swapped into our slot needs row update
|
|
143
|
+
if (swappedEntityId !== undefined) {
|
|
144
|
+
const swappedMeta = ensureEntity(world, swappedEntityId);
|
|
145
|
+
swappedMeta.row = meta.row;
|
|
146
|
+
}
|
|
147
|
+
fireObserverEvent(world, "entityDestroyed", entityId);
|
|
148
|
+
world.entities.byId.delete(entityId);
|
|
149
|
+
// Only entity IDs are recycled; component/tag/relation IDs are permanent
|
|
150
|
+
if (extractType(entityId) === ENTITY_TYPE) {
|
|
151
|
+
const rawId = extractId(entityId);
|
|
152
|
+
const oldGeneration = extractMeta(entityId);
|
|
153
|
+
// Increment generation so stale references become detectable
|
|
154
|
+
const newGeneration = (oldGeneration + 1) & ID_MASK_8;
|
|
155
|
+
world.entities.generations.set(rawId, newGeneration);
|
|
156
|
+
world.entities.freeIds.push(rawId);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Checks if an entity is currently alive in the world.
|
|
161
|
+
*
|
|
162
|
+
* @param world - World instance
|
|
163
|
+
* @param entity - Entity ID to check
|
|
164
|
+
* @returns True if entity exists and is alive
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* isEntityAlive(world, entity); // true
|
|
169
|
+
* destroyEntity(world, entity);
|
|
170
|
+
* isEntityAlive(world, entity); // false
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export function isEntityAlive(world, entity) {
|
|
174
|
+
return world.entities.byId.has(entity);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Moves entity to a different archetype, transferring component data.
|
|
178
|
+
*
|
|
179
|
+
* @param world - World instance
|
|
180
|
+
* @param entityId - Entity to move
|
|
181
|
+
* @param toArchetype - Target archetype
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const archetype = getOrCreateArchetype(world, [Position, Velocity]);
|
|
186
|
+
* moveEntityToArchetype(world, entity, archetype);
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export function moveEntityToArchetype(world, entityId, toArchetype) {
|
|
190
|
+
const meta = ensureEntity(world, entityId);
|
|
191
|
+
const fromRow = meta.row;
|
|
192
|
+
const { toRow, swappedEntityId } = transferEntityToArchetypeByRow(meta.archetype, meta.row, toArchetype, world.execution.tick);
|
|
193
|
+
meta.archetype = toArchetype;
|
|
194
|
+
meta.row = toRow;
|
|
195
|
+
// Swap-remove updates: entity swapped into our old slot needs row update
|
|
196
|
+
if (swappedEntityId !== undefined) {
|
|
197
|
+
const swappedMeta = ensureEntity(world, swappedEntityId);
|
|
198
|
+
swappedMeta.row = fromRow;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Registers archetype in entity records for all its component types.
|
|
203
|
+
*
|
|
204
|
+
* @param world - World instance
|
|
205
|
+
* @param archetype - Archetype to register
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const archetype = createArchetype([Position, Velocity]);
|
|
210
|
+
* addEntityRecord(world, archetype);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
export function addEntityRecord(world, archetype) {
|
|
214
|
+
// Each component type tracks which archetypes contain it for query matching
|
|
215
|
+
for (let i = 0; i < archetype.types.length; i++) {
|
|
216
|
+
const typeId = archetype.types[i];
|
|
217
|
+
const meta = ensureEntity(world, typeId);
|
|
218
|
+
meta.records.push(archetype);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Removes archetype from entity records for all its component types.
|
|
223
|
+
*
|
|
224
|
+
* @param world - World instance
|
|
225
|
+
* @param archetype - Archetype to unregister
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* removeEntityRecord(world, archetype);
|
|
230
|
+
* destroyArchetype(archetype);
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export function removeEntityRecord(world, archetype) {
|
|
234
|
+
for (let i = 0; i < archetype.types.length; i++) {
|
|
235
|
+
const typeId = archetype.types[i];
|
|
236
|
+
const meta = ensureEntity(world, typeId);
|
|
237
|
+
const idx = meta.records.indexOf(archetype);
|
|
238
|
+
if (idx !== -1) {
|
|
239
|
+
meta.records.splice(idx, 1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AACtH,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,O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