Struct EntityId
64-bit entity identifier: 48-bit monotonic EntityKey (upper) + 16-bit per-DB archetype routing id (lower). Routes to the correct per-archetype LinearHash and uniquely identifies an entity within the engine.
public readonly struct EntityId : IEquatable<EntityId>
- Implements
- Inherited Members
Remarks
EntityKey is monotonic per-archetype, never recycled — no ABA problem, no version field needed. 2^48 ≈ 281 T allocations per archetype.
ArchetypeId is the low 16 bits: the per-DB, engine-assigned archetype routing id (persisted in ArchetypeR1.RoutingId,
re-matched by name on reopen). Up to 65,536 archetypes composable into one database. The word-aligned 48/16 split needs no mask constant — the routing id
is (ushort)value and the key is value >> 16.
Fields
Null
The null entity sentinel.
public static readonly EntityId Null
Field Value
Properties
ArchetypeId
16-bit per-DB archetype routing id (low bits). Routes to the correct per-archetype storage instance for the owning engine.
public ushort ArchetypeId { get; }
Property Value
EntityKey
48-bit monotonic key, unique within the archetype's LinearHash.
public long EntityKey { get; }
Property Value
IsNull
True if this is the null/default entity (no entity).
public bool IsNull { get; }
Property Value
Methods
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
Equals(EntityId)
Returns true when other has the same packed identifier value.
public bool Equals(EntityId other)
Parameters
otherEntityId
Returns
GetHashCode()
Hash of the packed 64-bit identifier value.
public override int GetHashCode()
Returns
ToString()
Human-readable form, e.g. Entity(Key=42, Arch=3), or Entity(Null) for the null entity.
public override string ToString()
Returns
Operators
operator ==(EntityId, EntityId)
Value equality of two EntityId values.
public static bool operator ==(EntityId left, EntityId right)
Parameters
Returns
operator !=(EntityId, EntityId)
Value inequality of two EntityId values.
public static bool operator !=(EntityId left, EntityId right)