Game dev
Saved & recent

ECS

Also called: entity component system

Related terms: object components

A way to organize game code around data. An entity is just an ID. A component is plain data attached to it, like position or health. A system is a function that runs over every entity that has a given set of components.

Behavior comes from which components an entity has, not from a class hierarchy. Storing each component type in a tight array is also fast for the CPU cache.

Further reading
Unity: Entity component system concepts
entity id position velocity cart 2 3 tree 4 — drone 1 2 movement system position after 1 s matching rows
The movement system selects entities with both position and velocity. The cart and drone move in the example step, while the tree has no velocity entry.

View in the full Game dev collection