Entity–component–system
Entity–component–system (ECS) is an architectural pattern that is mostly used in game development. An ECS follows the Composition over inheritance principle that allows greater flexibility in defining entities where every object in a game's scene is an entity (e.g. enemies, bullets, vehicles, etc.). Every Entity consists of one or more components which add additional behavior or functionality. Therefore, the behavior of an entity can be changed at runtime by adding or removing components. This eliminates the ambiguity problems of deep and wide inheritance hierarchies that are difficult to understand, maintain and extend. Common ECS approaches are highly compatible and often combined with data oriented design techniques.
What's an Entity System?
("Component/Entity System", "CES")
Component/Entity Systems are an architectural pattern used mostly in game development. A CES follows the Composition over Inheritance principle to allow for greater flexibility when defining entities (anything that's part of a game's scene: enemies, doors, bullets) by building out of individual parts that can be mixed-and-matched. This eliminates the ambiguity problems of long inheritance chains and promotes clean design. However, CES systems do incur a small cost to performance. Concept
A game or application making use of the C/ES pattern involves at least the following:
- Entity - A container into which components can be added, usually hierarchical (any Entity can have sub-Entities).
- Component - Class of objects through which behaviors, looks and data can be added to an entity.
Libraries
- EntityX: https://github.com/alecthomas/entityx
- anax: https://github.com/miguelmartin75/anax
- EntityPlus: https://github.com/Yelnats321/EntityPlus
- EnTT: https://github.com/skypjack/entt