Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm going to have to give a hard disagree. I've been making my own engines for a long time, and have used many different engines for a longer time. Inheritance-based entity systems are often a pain in the ass to work with, a massive pain in the ass to debug, and tend to invite shitty hacks to get around the shortcomings of the inheritance model.

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.



Godot doesn't expose inheritance to scripting AFAIK; it's strictly a convenience used internally to describe the core nodes. When you script Godot to make complex entities, it's through composition of arbitrary nodes in arbitrary hierarchies, often encapsulated as scenes. References are mostly done by relative path, and the scripting language has sugar to make this a convenient process.

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.


Composition does not strictly imply inheritance. A DOM tree is a perfect example of composing nodes without inheritance.


Strange to see this worded this way because I often think of composition as the opposite of inheritance.

Instead of “this thing uses this subset of parts from its parent” it is “this thing is composed of this collection of parts.”


Can you give an example of how the composition works, or where it is used?

With everything inheriting from the Node class, I've only seen it as being an OOP/inheritance system.


So what does Jai do that is different?

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


Jai is a programming language and not a game engine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: