The entity component system

The entity component system is a programming pattern, which allows entities to possess properties and functionality through the means of composition, as opposed to inheritance. The biggest benefits of using this pattern include stronger decoupling of logic, easier serialization and de-serialization of entities, better reusability of code and ease of creating new entities. It does, however, add a fair bit of complexity to your code base.

The typical implementation of this pattern consists of three parts:

  • Entities: In most cases, entities are barely anything more than identifiers, slapped on a collection of components
  • Components: These are the building blocks of entities, that are nothing more than collections of data
  • Systems ...

Get SFML Game Development By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.