Live data from Hacker News

Why isn't Godot an ECS-based game engine?

godotengine.org

121–130 of 151 posts

Re: Why isn't Godot an ECS-based game engine?

#121
Whether or not to make your game have ECS has been debated for years, probably rightfully so to some extent. I ended up writing something like this myself for my own 2D game engine. To name something, it's greatly decoupled, but it also means any algorithm (i.e. system if you will) can literally access any data from any object in your gameworld. It just breaks encapsulation to a huge extent, any data you add is immediately visible to every of these systems and in most cases, you cannot reason what inputs/outputs a system really has. That at least goes for the generic solutions out there.

However, I think this blogpost tries to argue against ECS for all the wrong reasons. I'm not going to go into every detail, but let's start out with this: I don't want to bash on Godot, I think it's amazing they're pushing the game engine scene, but a blogpost like this really makes me question the quality of what they wrote.

> Inheritance is more explicit

I cannot remember a time I ever found it useful to look at an inheritance diagram that presumably will be littered with diamond patterns. Besides, inheritance isn't immediately excluded from other codebases, it just isn't the core principle of their software design for composing objects. Also also, I might have hundreds of (slightly) different objects in my game, so even without diamond patterns, that inheritance hierarchy is not going to be very useful to me.

> Scenes are more explicit

I'm looking at the picture and I'm not sure why I want a scene graph to show my inheritance patterns in the first place! If you ask me, it clutters the scene graph with details about this object. I mean, not unworkable, but I cannot understand this is an advantage. Besides, easily replicated by listing the components that an object is composed of in any game engine, it's not like other editors/game engines can't do it. Most engines do this with a separate view that shows all the data for this object.

> Re-usability improves This one is beyond hilarious if you look at some of their source code. The 2D vs 3D is a prime example, take audio_stream_player_2d/3d for example. A lot of the functionality has been copied between their counterparts (with some inconsistencies, of course). That's kind of logical from the structures, since the algorithms and data they operate on has been completely sealed off, so they couldn't even decently share it if they wanted to. It seems completely due to the fact that at the top of the hierarchy sits a hard distinction between 2D and 3D nodes.

To then point out you don't even need something like prefabs (for those not familiar: think of a template/blue print of a pre-composed entity with data already filled in) is just a weird stab. You could just as easily create such a pre-composed object in code with any component-like design, Unity's prefabs just give you the flexibility to compose these in the editor instead. How is an architecture where I need to explicitly type code to compose new objects ever easier than that?

There are other things I'd find questionable by a quick glance over that codebase that are also a side-effect of these architectural choices. Like, singletons that are used to combine nodes of the same type to form some spatial datastructure, because those nodes cannot be easily made aware of each other. There seems all kind of implicit dependency issues and I've always struggled with nicely engineering dependencies in such architectures as well.

But I'm going to stop here, there's just too much I can go on about in this blog (I would even consider dedicating an entire blogpost myself breaking my disagreements down).

The whole tone of: we use inheritance and we think it's better for the entirety of our software is just strange. As always, inheritance is a tool, you should use it when it's right, yada yada. If you use multiple inheritance and end up with diamond patterns, I don't think I'm the only one that would say that you should reconsider. Shoving all your logic for every aspect of your program into single objects has rarely worked well either.

I already mentioned what I dislike about the generic ECS that everyone keeps talking about like in Unity, but they can improve their architecture and/or apply DOD without doing a 180 into that direction. This weird deflecting of potential architectural flaws certainly didn't sell Godot to me, but hopefully they come back to this post and think it a couple times over.

Re: Why isn't Godot an ECS-based game engine?

#122

I first met ECS when modding an RTS called Tiberian Sun. The units were all defined in ini files and you specified the components for each unit eg the difference between a building and a moving piece was whether there was a movement component etc. And a small but vibrant modding community grew up around it. Everything was dynamic, read from data definitions when the game loaded. One downside to godot’s inheritance is…

> One downside to godot’s inheritance is everything is set up in code and decided at compile time instead? That's not really the case because Godot can load scenes at runtime. The scene format itself (.tscn files) is text based[1] (which is also nice for version control) and could be edited by hand, then loaded into the game at runtime. Though since the Godot editor is open source and totally free it would probably b…

What I think he's referring to is that you cannot compose new entities that consist of a different mixture of data. I cannot create a ProjectileWeapon that also plays audio, without changing the class to also inherit from an audio node type.

Re: Why isn't Godot an ECS-based game engine?

#123

Earlier quoted context omitted.

I would say it is 100% not Unity's fault. As someone else posted, there's a t-machine blog posted and that entire blog has been filled with ECS with that specific term for years. But aside from that it has been a heavily discussed thing for many years in the gamedev scene. There's a wikipedia page on it, showing a bit of history from well before 2017, but you will find most on it on gamedev.stackexchange and gamedev.…

DOTS is not ECS. "Unity Classic" is ECS. DOTS is a more cache-efficient architecture designed to support larger numbers of entities.

Unity's DOTS is definitely an ECS system. You technically can have an ECS without all the data-oriented and cache efficient stuff, if you just want the architectural benefits, but it's pretty hard to build a data oriented game engine that is not fundamentally ECS

Re: Why isn't Godot an ECS-based game engine?

#124
My experience with Godot is that it has a very clean design. There is just nothing hacky or unintuitive about it.

Although I don't know much about entity component systems, my impression is that it is basically just multiple inherentence. Personally, I never had any need for such a thing in Godot.

Re: Why isn't Godot an ECS-based game engine?

#125

Earlier quoted context omitted.

That paragraph really should've been the focus of the article, front and center - and from there an explanation on why it ain't built-in.

I'm a fan of Godot, so I'll state that in the beginning, so I'm biased. But I took a look at her(?) GitHub page and wondered why there isn't more effort being put into this branch. Even from his own words, ECs is a more efficient style when a large number of objects/nodes are involved, or when optimization becomes important. At the moment Godot is really only viable as a 2D engine, as it tends to bog down when used a…

> But I took a look at her(?)

Seems to be a guy, Andrea is a male name in Italian, and female in pretty much any other language.

Re: Why isn't Godot an ECS-based game engine?

#126

Whether or not to make your game have ECS has been debated for years, probably rightfully so to some extent. I ended up writing something like this myself for my own 2D game engine. To name something, it's greatly decoupled, but it also means any algorithm (i.e. system if you will) can literally access any data from any object in your gameworld. It just breaks encapsulation to a huge extent, any data you add is immed…

My experience here is very limited, but at least in the Rust world, some ECSs seem to make component dependencies explicit, partially to support scheduling parallel systems execution. That is, if there are two systems where neither system writes any component that the other accesses, they can run in parallel. Is that not common in general?

Godot usually gets a lot of praise of HN and elsewhere, probably rightly so. But I got the same weirdly defensive vibes from reading the article. Performance is the strawman used throughout: claiming you don't need that many objects anyway, claiming that there design is "higher level" -- without ever really explaining what that means. I know from other contexts that the real problem with deep inheritance hierarchies often is code duplication, you simply can't solve the diamond problem. Good job pointing out examples of that.

Re: Why isn't Godot an ECS-based game engine?

#127
post #59

I'm a bit confused between there's a hugely popular place between inheritance-based entities and ECS (Entity-Component-System), which is what you could call a "Entity-Component system) (notice spelling) or perhaps a Component-based entity composition system. Inheritance based: you derive Vechicle, then derive Tank, Car, etc. This was most used from 95 to 2005 as teams moved to C++. Component based: you create a Tread…

You worked on Commandos? Holy crap. I'm mid way in to my game development career and played that to death before I even started. Plus 70 hours on Steam as an adult...

Re: Why isn't Godot an ECS-based game engine?

#128

Earlier quoted context omitted.

> One downside to godot’s inheritance is everything is set up in code and decided at compile time instead? That's not really the case because Godot can load scenes at runtime. The scene format itself (.tscn files) is text based[1] (which is also nice for version control) and could be edited by hand, then loaded into the game at runtime. Though since the Godot editor is open source and totally free it would probably b…

What I think he's referring to is that you cannot compose new entities that consist of a different mixture of data. I cannot create a ProjectileWeapon that also plays audio, without changing the class to also inherit from an audio node type.

In Godot, you could create a ProjectileWeapon and then add a sub node that plays audio. I don't think that Godot's design limits what you can do at all, there's just a different way of doing the same thing.

Re: Why isn't Godot an ECS-based game engine?

#129
post #59

I'm a bit confused between there's a hugely popular place between inheritance-based entities and ECS (Entity-Component-System), which is what you could call a "Entity-Component system) (notice spelling) or perhaps a Component-based entity composition system. Inheritance based: you derive Vechicle, then derive Tank, Car, etc. This was most used from 95 to 2005 as teams moved to C++. Component based: you create a Tread…

Not about ECS, but speaking of components: I’m developing an unreal engine game and component based programming has been a dream. You end up with the opportunity to create so many pieces of code that are able to be dumb and that don’t need to know about the rest of the system. Then you add come control code that is also as dumb and blind (in a good, decoupled sense) as possible and the whole application comes togethe…

Not to sound rude but IMO I find components really hard to organize and structure data. Components are probably really nice for storytelling games and games with simple logic: they really shine when you can just take some effect like a particle system and attach it to some object like a Sci-Fi weapon. But it's really hard to separate model, view, and controller from your game when they're all separate components on the same object.

Re: Why isn't Godot an ECS-based game engine?

#130
ECS or no ECS? it doesn't matter

the problem of that kind of engines is the users are computer-illiterates

they don't understand how memory/cpu works

what happens is 90% of 3D indie games suffer from major performance/optimization issues

and we start to see the same kind of performance issues in AAA games, because, as always, we always want to cut costs, everywhere

worse, clueless people are gaining power and are getting into high positions, and they hire more clueless people so nobody can oust them, or tell them they are wrong, they want people to comfort them, and defend their bad decisions

Post reply on HN