Entity-Component-System
The Entity Component System (ECS) is a software design pattern which is used for the representation of 3D world objects. It’s often used in game development.
- An entity is a container for components
- Components are plain data
- Systems are functions matched with entities that have a certain set of components. Systems implement the entities’ behavior.
Entities and their components are user-facing in the scene editor for which you have control over. The systems are taken care of within the 3dverse engine and are not exposed.
💡 As you attach, modify, or delete the components of an entity, you modify the behavior of the entity.
Let’s look at a concrete example of an entity with mesh reference and material components (this schema is oversimplified but shows the general idea):
- An entity has multiple components including a material component and a mesh reference component_._
- The components are just plain data. The material component contains data such as albedo (type: vec3) and roughness (type: float), and the mesh reference component contains data such as a mesh reference (type: string).
- In the rendering engine there is a system which acts upon all entities with mesh reference AND material components. This system simply renders the referenced meshes of these entities while also taking into account the materials, and so that is how we see the rendered cube.
This is how the entity, its component_(s), and the system_(s) are related, so as to orchestrate the look and behaviour of a 3d world.