EasyEcs

Glossary

Every Entity Component System term the EasyEcs docs use, from entity and archetype to change tick, structural gate and collectible AssemblyLoadContext.

The terms of the EasyEcs docs, each in a few sentences with a link to the page that explains it. General ECS terms come first, then the ones specific to EasyEcs. For the pattern itself, start with What is an ECS?.

Entity

An identity and nothing else: no fields, no methods. In EasyEcs an Entity is a 16-byte handle (world, index, version); every access checks the version, so a handle to a destroyed entity throws instead of reaching whatever reuses its index. See Entities and components.

EntityId

The 8-byte, unmanaged form of an entity: index plus version, without the world. Components store EntityIds to point at other entities; world.TryGetEntity(id, out entity) turns one back into a checked handle. See Indexes and relations.

Component

A struct implementing IComponent: plain data for one aspect of an entity (Position, Health). Components hold no behaviour and no references to systems or services. See ECS principles.

Tag

A component with no fields (Dead, Stunned). It only says yes or no, so systems use it in filters ([Without<Dead>]), and adding or removing it never copies data after the first time. See Entities and components.

Singleton

A struct implementing ISingletonComponent: one value per world, such as a clock, configuration or a spatial grid. A [ForEach] method takes it as a ref or in parameter. See Singletons.

Archetype

One combination of component types, and the table that holds every entity with that combination. EasyEcs is an archetype ECS: a query walks the tables whose combination it matches, column by column. See What is an ECS?.

Table, column, row

An archetype's storage. A table has one column per component type (an array, 64-byte aligned for unmanaged types) and one row per entity. Iteration reads the columns a system touches, front to back. See Architecture.

Presence bit

One bit per row and column that says whether the row has that component. Removing a component clears the bit and keeps the row, so toggling a state such as Stunned costs a bit flip, not a row move. Filters test the bits 64 rows at a time. See Architecture.

Query

The question "which entities have these components and pass this filter?". A [ForEach] method is a query; outside systems, world.Query<T…>(), Count, Any and struct jobs ask it. See Queries and filters.

Filter

The conditions of a query beyond its components: With, Without, WithAny, Changed, Removed and InGroup. They are attributes on [ForEach] methods, or a QueryFilter kept in a static readonly field. See Queries and filters.

Query cache

The world's memory of which tables match each query. The first use of a query shape scans every table once; after that the query reads an immutable list of its tables, and a new table is added to the lists it matches when it is created. Readers never lock. See Architecture.

Warm-up

The first updates of a world, which create the tables, the query cache entries and the buffers that later updates reuse. After warm-up, queries, iteration, component access and structural changes allocate nothing, so an allocation test runs one update before it counts bytes. See Testing systems.

System

A class deriving from EcsSystem with one job. Its [ForEach] methods run over every matching entity on each update; it keeps no state of its own and never calls another system. See Systems.

System group

A struct implementing ISystemGroup. Systems marked [UpdateInGroup<G>] run only on world.Update<G>(), so input, simulation and persistence can run at their own cadence. Systems without the attribute are in the default group, which world.Update() runs. A group can filter the entities of all its systems: [With<T>], [Without<T>] and [WithAny<T>] on the group struct, or IGroupWith<T> / IGroupWithout<T> implemented by the group or an interface it implements (the way a generic interface gives each actor type its own group). See Systems.

Update and tick

An update is one call of world.Update() (or world.Update<G>()): every enabled system of the group runs once, in order, unless its UpdateInterval skips this update. A tick is one step of the simulation at a fixed rate; a server's loop calls Update() once per tick. See Systems.

Stage

A run of consecutive systems with no order and no conflicting access between them. With WorldOptions.ParallelSystems, a stage's systems run at the same time; without it, every system is its own stage. See Threading.

Access set

What a system reads and writes, generated from its [ForEach] parameters: a ref component or singleton is a write, an in one a read, and [Changed<T>] or [Removed<T>] reads T. Two systems conflict when one writes what the other reads or writes. A system that can reach the whole world (an Entity or World parameter, an instance method, an OnUpdate override) runs alone. Only systems that do not conflict share a stage. See Threading.

Runner

What runs parallel work for a world: the systems of a stage, or the chunks of a parallel method. The calling thread works through the items together with up to WorldOptions.MaxDegreeOfParallelism - 1 reusable thread-pool work items, so a parallel run allocates nothing. It wakes those helpers only while measured runs show they make the work faster; a busy runner leaves the items to the calling thread. See Threading.

Chunk

A slice of the matching rows of a parallel method ([ForEach(Parallel = true)], ForEachParallel): a multiple of 64 rows, about four per thread, between 1,024 and 16,384 rows. The runner hands the chunks to its threads; fewer than two chunks run on the calling thread alone. See Systems.

Struct job

A struct implementing IForEach<T…>, IForEachEntity<T…> or IForEachBatch<T…> whose Execute method the row loop calls. The JIT inlines it, so there is no delegate and no virtual call per entity. The generator writes one for every [ForEach] method. entity.Run<T…, TJob>(ref job) runs an IForEachEntity job on one entity. A job's static int Writes names the components it writes; implementing INoStructuralChanges promises no structural change. See Queries and filters.

Batch method

A [ForEach] method whose component parameters are spans (Span<Position>, ReadOnlySpan<Velocity>). It receives runs of consecutive matching rows, element i of every span being the same entity, and a whole table in one call when every row matches; an EntitySpan parameter gives the entities of the run. The spans point into the tables, so the structure is frozen while it runs. Write one to vectorize a loop. See Systems.

Optional component (Maybe<T>)

A [ForEach] parameter for a component the entity may lack: the method visits every entity with its other components, and HasValue says whether this one also has T. See Systems.

Change tick

A counter of the world (world.ChangeTick) that grows once per stage and once after each update. Tracked rows record the tick of their last write, and each system records the tick it last ran at (LastRunTick). See Change tracking.

Tracked component

A component that also implements ITrackChanges. Its rows record when they were written or removed, so [Changed<T>] and [Removed<T>] visit only those rows. It costs 8 bytes per row; untracked components pay nothing. See Change tracking.

Structural change

Anything that changes which components an entity has, or which entities exist: create, destroy, Set of a new component, Remove, Disable. In EasyEcs it applies at once, even in the middle of a pass, with no command buffer. See Structural changes.

Pass

One walk over the matching rows: a run of a [ForEach] method, a ForEach job or a Query loop. A pass visits each entity at most once, skips the entities that stop matching before their turn, and does not visit the ones that join a matching table during it. See Structural changes.

Tombstone

The row an entity leaves when it is destroyed or moves to another table during a pass. Outside a pass, the table's last row fills the hole at once; during one, the row stays as a tombstone that passes skip, so no row shifts under a loop. The last pass to end closes the tombstones by moving live rows into them. This is why you can destroy or remove while iterating, with no command buffer. See Structural changes.

Frozen structure

A pass that holds refs or spans into the tables for longer than one call freezes the world's structure while it runs: batch methods, jobs that implement INoStructuralChanges, parallel methods and parallel stages. A structural change inside one throws InvalidOperationException. See Structural changes.

Structural gate

The check every structural change passes through (World.Structural(), internal to EasyEcs). Structural changes belong to the owner thread, so the gate is a plain flag the owner sets and clears, with no atomic instruction. It throws InvalidOperationException when a change is reentered from code running under the gate, or made while the structure is frozen, instead of tearing the tables. It cannot see every change made from another thread at the same moment; the analyzer reports the ones it can (EECS013, EECS014). See Threading.

Owner thread

The thread that calls a world's Update and makes its structural changes. A world has one at a time; a server runs one world per thread and hands input to it through a mailbox. See Threading.

Mailbox

A queue your code owns that carries input from other threads (network, timers, a database) to a world's owner thread. EasyEcs has none of its own: other threads post messages, and a system on the owner thread takes them and turns each into data, such as a request entity. See Threading.

Actor

A pattern, not an EasyEcs type: an entity that handles messages addressed to it by key (a shop, a bank account, a player). One type per kind of actor is at once its key component (IIndexed<TSelf>, found through its index), its system group and the group's filter (IGroupWith<In<TSelf>>), declared once through a generic interface; a request runs on its entity with entity.Run. See samples/Actors.

Prefab

A recipe of component values that belongs to no world (new Prefab().SetHealth(30)), so no query ever sees it. world.Instantiate(prefab) creates an entity, or a wave, with a copy of every value. See Prefabs.

Dynamic buffer

A DynamicBuffer<T> component: a list that belongs to one entity, such as a bag of loot or a path. Its writes need a ref, so every change is tracked, and snapshots copy its elements. See Dynamic buffers.

Value index

A lookup from a key to the entities whose component has that key: IIndexed<TKey> on the component, world.Index<T, TKey>() to query it. The index follows every Set; a comparable key also gives sorted ranges. See Indexes and relations.

Relation

A link from one entity to another. One link per entity is a component indexed by an EntityId; many links of one kind per entity are IRelation elements of a buffer. Both answer "who links to this entity?". See Indexes and relations.

Hierarchy

Parent and child entities linked by the built-in ChildOf component. world.Children(parent) lists the children, world.Descendants(root) walks the whole subtree depth first, and destroying a parent destroys its descendants. See Hierarchy.

Group (IGroup)

A component implementing IGroup whose value splits tables after world.GroupBy<T>(): the entities of one zone, map or match share tables, so a query of that group walks only its rows. Not to be confused with a system group. See Groups.

Cleanup component

A component implementing ICleanupComponent. Destroying its entity removes the other components and adds the Destroyed tag; the entity stays until a system releases the resource (a socket, a seat) and removes the component. See Cleanup and disable.

Disabled component

A component hidden by entity.Disable<T>(): the value stays, but queries, Has and Get act as if the entity lacked it until Enable<T>(). The entity carries the Disabled<T> tag meanwhile, which queries can ask for. See Cleanup and disable.

Snapshot

An in-memory copy of a world: world.Capture() takes one, world.Restore(snapshot) rolls back to it. Used for undo, rollback and resetting a world between tests. See Snapshots.

Save

A world, or some of its entities, written as bytes: world.Save and world.Load. Unmanaged components are written as raw rows, managed ones through Nino ([NinoType]). See Saves.

Migration

Moving a group of entities, such as a player and what it owns, to another world: SaveEntities and LoadEntities through bytes (another process), or MoveEntities directly (another world of the thread). Links inside the group follow the new ids. A record saves only what persists: SaveEntities with a ComponentSet, loaded onto entities that exist already with LoadEntitiesInto (markWritten: false keeps the restored values from counting as changed). See Migration and unloading.

Collectible ALC

A collectible AssemblyLoadContext: .NET's way to load a plugin and unload it later. world.RemoveTypes(context) removes the plugin's systems, components and singletons from a world, so the context can unload while the world keeps running. See Migration and unloading.

Edit on GitHub

Last updated on

How is this guide?

On this page