What is the Entity Component System Design Pattern?

A quick primer on this common game development design pattern

Tech Notes
2 min readFeb 5, 2024

--

The Entity-Component-System (ECS) is a popular design pattern extensively utilized in game development and other fields where managing numerous objects with diverse characteristics or behaviors is essential. This pattern excels in scenarios requiring the dynamic composition of objects with different attributes or functionalities during runtime. Renowned for its exceptional performance and adaptability, the ECS pattern is a favored choice in complex system management.

the system is divided into three main parts:

Entities

Entities are in essence the objects in your system. Tagged with a unique id, an ECS entity is a lightweight, general purpose object. They don’t contain and data or behavior logic on their own, but are just containers for components tagged with an id for tracking within the game system. I might consider a 3D model to be an entity.

Components

Components are plain data structures that contain data values but no behavior logic. This is similar to the computer science concept of a “model” class (as opposed to a “controller” class, in the Model-View-Controller design pattern). Components can be attached to entities to add data or state to them. For example, a “Position” component with x, y, and z coordinates.

Systems

--

--