๐Ÿ“ECS architecture allows great flexibility in defining entity types

top

Entity Component System (ECS)

OOP hierarchies make it hard to quickly create complex classes by re-combining multiple aspects (that often happens in games).

Examples when OOP hierarchies fall short:

ECS solves this by making all these aspects into their own components: Weapon, Armor, IceDamage, FireDamage. Then shield becomes [Armor(defense=5), Weapon(damage=5)] and fire-ice sword becomes [Weapon(damage=10), FireDamage, IceDamage]. Entities and components are just data and itโ€™s up to systems how to interpret it.

ECS allows to easily create new entity types by recombining existing components.

ECS also allows adding components dynamically. So if the player enchants their weapon to fire damage, you can simply add that component dynamically.

Backlinks