Understanding Terminology

In this lesson, we’ll learn about the Entity Component System.

We'll cover the following

What is ECS?

ECS uses a common set of terms to denote its different parts:

  • An entity can be anything: an adventurer, an orc, or a pair of shoes. The game map is an exception; it’s usually not an entity but rather a resource that entities reference to travel. Entities don’t have logic associated with them. They’re little more than an identification number.

  • A component describes a property an entity may have. Entities typically have many components attached to them, serving as a description and adding functionality through systems. For example, a goblin might have a Position component describing where it is on the map, a Render component describing how to render it, a MeleeAI component indicating that it attacks with hand-to-hand combat, and a Health component describing how many hit points it has left. A sword might also have a Position component describing its location on the map and a Render component indicating what it looks like. It would differ from the goblin by having an Item component to indicate that it’s an item. Components don’t have logic associated with them, either.

  • Systems query the entities and components and provide one element of game-play/world simulation. For example, a Render system might draw everything with a Render component and a Position component onto the map. A Melee system might handle hand-to-hand combat. Systems provide the game logic that makes the game function. Systems read entity/component data and make changes to them, powering the game’s functions.

  • Resources are shared data available to multiple systems.

The figure below illustrates the relationship between these terms.

Get hands-on with 1200+ tech skills courses.