by bogwog · 5y ago · 0 comments
The article says that "Godot does composition at a higher level than in a traditional ECS", but I don't get what he means by that? Combining nodes with incompatible hierarchies is hardly composition, and is just what you typically have to do when using inheritance.
Inheritance-based entity systems are not always terrible, and even though I tend to hate them, I use them quite a lot in my projects where an ECS would be overkill. If designed for a particular project, you can usually be more productive, and write cleaner and less code with inheritance.
However, for a general purpose engine like Godot, that's a bad choice IMO. The flexibility offered by an ECS far outweighs all benefits of an inheritance-based system.
So, yeah, try it. It's the best system I've encountered for the general-purpose use-case, and I've designed a fair few myself.
Instead of “this thing uses this subset of parts from its parent” it is “this thing is composed of this collection of parts.”
With everything inheriting from the Node class, I've only seen it as being an OOP/inheritance system.
For performance at least my focus is usually on eliminating information-lossy interfaces i.e. try to keep the hot loops where the compiler can see them