Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

What is an Entity System?

Lutz Kellen edited this page Aug 24, 2017 · 4 revisions

An Entity System is simply a game architecture, which is used to help you manage your game, no matter how complex it may need to be. Entity Systems help split up your logic from your data, much the same way the MVC design pattern helps you split your model from your view-controller. An Entity System is typically split into three major parts: entities, components and systems.

The Entity

An Entity (also known as a GameObject) represents an object inside of your game, this could be anything, such as: a machine gun, water, lava, cheese, or anything else that you can think of.

Coding Details

Typically an Entity is represented by an identifier, which is usually a number (such as UUID or a plain old int). An Entity could be implemented with the following line of code:

typedef unsigned int Entity;

However, I have not implemented it in this way, as I wanted this library to be easy to use.

The Component

A Component is what represents the data for entities. Within your game, they are attached to entities. The data which a Component contains could be anything, such as: position, velocity, collision information, rendering information, etc. Components are used to describe what an entity is.

Coding Details

Since an Entity is typically represented with a number, Components are not actually stored within an Entity. Instead it is stored with a more data-oriented approach and locally stored within one area.

The System

The System is where all the logic for the game is contained. Typically a system should be interested in doing one job, and one job only. A System processes particular entities with a specific list of components. For example: a rendering system would only be interested in entities with a position and rendering information (and perhaps more components with information about the transformations, such as rotation, scale, etc.). The rendering system's job would be to render these entities to the screen.

Further Reading