Elisa - Entity Component System
After quite a while, I have finally made an update to my attempt at using Python and pygame for Game Programming. You will be able to find the newest addition to the Elisa repository in the form of example number 16. In this I take the time to actually create a small entity component system.
The Entity Component System design pattern is data-centric approach to enable building complex game architectures using a compositional metaphor as opposed to the traditional object-oriented decomposition approach. That is, instead of breaking down complexity into a hierarchy of types, we recognize this complexity by following the Python duck-typing mantra - “if it quacks like a duck and acts like a duck, it probably is a duck”. Consequently, ducks are just ordinary game agents (entities) like dogs but they are associated with duck like properties (components). These components are often nothing more than data buckets attached (association) to our duck entity and the world our free agents (duck or dog) roam in makes sense of these properties. In the ECS approach this interpretation is perform by a system, different systems can interpret entities and their components differently. For example, a system responsible for environmental acoustics might use the “duck-quaking” component of our duck entity to fill the environment with a duck-sound whenever the duck opens it’s duckbill.
With this preliminary explanation head over and explore the code …