Entities class

Manages entity allocation, deallocation, and location tracking.

The Entities manager handles:

  • Allocating new entity IDs with generation tracking
  • Recycling despawned entity IDs
  • Tracking where each entity's components are stored

Generational Indices

When an entity is despawned, its ID is added to a free list for reuse. The generation counter is incremented to distinguish new entities from stale references to despawned entities.

Entity Locations

Each live entity has a location pointing to its archetype table and row. This allows O(1) component access and efficient archetype transitions.

Constructors

Entities()

Properties

allAlive → Iterable<Entity>
Returns an iterable of all alive entities.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Returns true if no entities are alive.
no setter
isNotEmpty → bool
Returns true if at least one entity is alive.
no setter
length → int
The number of currently alive entities.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clears all entities.
despawn(Entity entity) → bool
Despawns an entity, making its ID available for reuse.
getLocation(Entity entity) → EntityLocation?
Gets the location of an entity.
getLocationUnchecked(Entity entity) → EntityLocation
Gets the location of an entity, assuming it is alive.
isAlive(Entity entity) → bool
Returns true if the entity is currently alive.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reserve(int count) → void
Reserves capacity for count additional entities.
setLocation(Entity entity, EntityLocation location) → void
Sets the location of an entity.
spawn() → Entity
Allocates a new entity.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited