Unity Entity Component System using Entitas

2 min. read

Unity Entity Component System using Entitas

Unity Entitas
Also called ECS (Entity Component System)
Separate state from behaviour
Atomic data is represented by components (cant divide them any further)
Components are associated logically by an entity
All entities are managed and are queryable (searchable/iterable)
All behaviour (creation, transformation and destruction of entities) is implemented in Systems, which are called periodically

Entity
The entity is a general purpose object. Usually it only consists of a unique id. They tag every coarse gameobject as a separate item. Implementations typically use a plain integer for this.
Component
the raw data for one aspect of the object, and how it interacts with the world. “Labels the Entity as possessing this particular aspect”. Implementations typically use Structs, Classes, or Associative Arrays
System
“Each System runs continuously (as though each System had its own private thread) and performs global actions on every Entity that possesses a Component of the same aspect as that System.”

GitHub:
https://github.com/sschmid/Entitas-CSharp

Tutorials
https://github.com/sschmid/Entitas-CSharp/wiki/Unity-integration
https://github.com/sschmid/Entitas-CSharp/wiki/Unity-Tutorial-Hello-World
http://www.mikecann.co.uk/portfolio/projects/tinkering-with-entitias-entitiasteroids/
https://github.com/sschmid/Entitas-CSharp/wiki/Tutorials

Examples
https://github.com/sschmid/Entitas-CSharp/wiki/Example-projects
https://github.com/JamesMcMahon/entitas-2d-roguelike

Sound game:
https://drive.google.com/file/d/0B7HJ449wzJBmYlpUdTk4VlVsME0/view

Videos
https://www.youtube.com/watch?v=lNTaC-JWmdI

Adding Entitas to a game:
Download Zip from here: https://github.com/sschmid/Entitas-CSharp/releases
Create a folder in Unity Libs/Entitas
Copy Addons and Entities to the Entitas folder
Once Imported, Click the Entitas menu at the top
Set everything to “Everything”

References
https://en.wikipedia.org/wiki/Entity%E2%80%93component%E2%80%93system
https://en.wikipedia.org/wiki/Data-oriented_design
http://www.powershow.com/view/3c8f96-MTNiY/A_Data-Driven_Game_Object_System_powerpoint_ppt_presentation?skipadult=1
https://en.wikipedia.org/wiki/Observer_pattern
https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller