IT lexicon › Programming › Entity Component System

Entity Component System

Programming På svenska → Updated: 2026-10-02

An architecture where objects are bare IDs, data lives in components, and all logic sits in systems that sweep over those components.

The pattern came out of inheritance hierarchies failing to scale in games. The moment you have a FlyingEnemy and a SwimmingEnemy and need something that does both, the class tree becomes unmanageable. ECS inverts it: an entity is just an integer, a Position or Health component is pure data, and a system asks for "every entity with Position and Velocity" and updates them in bulk. Thief and Dungeon Siege popularised the idea around 1998–2002.

The performance win comes from memory layout. Components live in contiguous arrays, so a system updating ten thousand positions streams straight through cache instead of chasing scattered objects — the same reasoning behind data-oriented design. Unity's DOTS and Bevy in Rust are modern implementations. The cost is readability: there is no class you can open that describes what an enemy is.

← Back to the lexicon