A Simple Entity Component System (2019)
austinmorlan.com
A Simple Entity Component System (2019)
1–10 of 38 posts
Re: A Simple Entity Component System (2019)
#2Re: A Simple Entity Component System (2019)
#3- Avoid the inheritance vs. composition issue
- Entity as a first-class concept (no more Object vs. "Just Value Object", confusion regarding equality of objects, object hash methods)
- System as a first-class concept (not just a consequence of a call stack between multiple inter-dependent objects)
- It serves much of the same purpose of the Flyweight Pattern
- Naturally conductive of functional programming
This particular implementation is interesting, it introduces some additional pieces (Component Manager, System Manager).
Re: A Simple Entity Component System (2019)
#4Re: A Simple Entity Component System (2019)
#5The main mechanism seems to be for 'systems' being able to iterate over tuples of 'components' of a specific type for all 'entities'. I can't help but wonder if there isn't a more elegant way of doing this than trying to keep the set of entities for each system up to date. Though I suppose it depends on what you want to optimize.
Re: A Simple Entity Component System (2019)
#6Re: A Simple Entity Component System (2019)
#7That's certainly an interesting way to organize things, though I dislike the reliance on several 'manager/coordinator' classes. (though part of this is my superstition that class names shouldn't end in -er or -or) The main mechanism seems to be for 'systems' being able to iterate over tuples of 'components' of a specific type for all 'entities'. I can't help but wonder if there isn't a more elegant way of doing this…
An alternative approach, which does not sacrifice the more common OOP style: https://www.doc.ic.ac.uk/%7Escd/ShapesOnwards.pdf
Re: A Simple Entity Component System (2019)
#8Might be a misread, but this feels a little similar to relational vs columnar databases. Relational databases store a thing's data together; columnar store a type of data together.
ECS are more similar to the relational model than OOP is, and do not necessarily suffer the same 'object–relational impedance mismatch'.
Re: A Simple Entity Component System (2019)
#9But the origin of ECS is Data Oriented Design, also known as DOD, that emerged as a reaction to the bad properties of OOP.
DOD is more general and IMHO more interesting than ECS.
I have not yet seen a satisfying implementation of ECS, it can be extremely fast compared to OOP approach, but also cumbersome when dealing with dependencies between systems and the ways to handle structural changes.
My take would be : learn the principles, do some benchmark, but do not consider any ECS implementation as gospel, this is not mature yet.
Use the ideas and principles to build a fast simulation in your own way.
Re: A Simple Entity Component System (2019)
#100: https://brochington.github.io/ecstatic-doc-site/docs/example...