Live data from Hacker News

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

godotengine.org

141–150 of 151 posts

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

#141

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. B…

It's indeed a common approach that they list their dependencies so you can build runtime DAGs for multithreading, but my main point is that within one system dependencies can be selected at will (I believe Unity allows to just change these at runtime as well). In the end they just get the entire gameworld fed in and then select what they need. If you take something like writing unit tests, you basically have to mock the entire gameworld because these dependencies could change, even if only theoretically. I struggle to find a good way a generic approach of DOD can prevent that.

In general it's also very hard to get dependencies done right. I think Unity does it well, but from what I saw some years ago it's one of few (for implentations that are public). Also not surprising considering Mike Acton seems to play a significant role in that.

Yeah their arguments on performance are an even worse aspect of the article. It's clear that no game or simulation of significant scale has been built with Godot.

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

#142
post #138

Earlier quoted context omitted.

If you wanna make me feel old, just consider that Commandos was released 10 years after my first commercial game, so I'm even older. :D Fun bit: I never ever finished a single mission in a Commandos game. Yeah I did code architecture work on Commandos 1, then led the tech & tools for the expansion and Commandos 2. A lot of the C1 work was related to this topic, actually: when I arrived at the project, it was hard inh…

It's never too late to start playing! If you ever get around to writing up a technical post mortem I'm sure it would be super interesting. The simulation seemed quite advanced for the low end hardware the game ran on, with view cones, pseudo height, physical objects, footprints, and pretty good AI. The Commandos series dying out is a great shame, although of course Kalypso is staffing up to attempt a sequel. What are…

Heh I was officially the last Pyro employee before it was folded, and my last task was to prepare and package up all backups when the IPs (rights, licenses, whatever it actually was) were sold to Kalypso. I not-so-secretly wished there would be a way for the Shadow Tactics team to make the next Commandos, but it wasn't to be (and Desperados 3 is awesome!).

For the past 2.5 years I've been at Lingokids, a mobile service filled with fun and educational content for kids in English. The tech challenge here is balancing constant forward movement with new games, while keeping all the previous ones working. But using my kids as testers beats anything else I've ever done in the fun-at-work department.

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

#143
post #142

Earlier quoted context omitted.

It's never too late to start playing! If you ever get around to writing up a technical post mortem I'm sure it would be super interesting. The simulation seemed quite advanced for the low end hardware the game ran on, with view cones, pseudo height, physical objects, footprints, and pretty good AI. The Commandos series dying out is a great shame, although of course Kalypso is staffing up to attempt a sequel. What are…

Heh I was officially the last Pyro employee before it was folded, and my last task was to prepare and package up all backups when the IPs (rights, licenses, whatever it actually was) were sold to Kalypso. I not-so-secretly wished there would be a way for the Shadow Tactics team to make the next Commandos, but it wasn't to be (and Desperados 3 is awesome!). For the past 2.5 years I've been at Lingokids, a mobile servi…

There's also this, which seems like a pretty good spiritual successor out of Russia. I've only played for twenty minutes or so but so far so good.

https://store.steampowered.com/app/1227530/Partisans_1941/

I can definitely see that being more fulfilling. There are only so many virtual Nazis you can kill before it wears thin!

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

#144

Earlier quoted context omitted.

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.

Sure you can solve it by basically adding more objects to the world. That's not different from any other engine, but littering your scene graph with nodes because the alternative is inheriting from more things really isn't good.

As much as godot wants to claim their nodes are lightweight, ending up with so many redundant tramsforms, vtables and more (see their Node3D class) just shows how inflexible it is. Again in engines like Unity you can take the exact same approach, they just allow you to author entities without this redundancy.

To add: the blog specifically mentions that using inheritance is used for better re-use, but the need for having this composition through nodes would take that away. I know this might not be your specific point, but it ironically makes it seem they don't see this as an alternative.

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

#145
post #26

Earlier quoted context omitted.

Yes, thank you! It certainly seems like a good and flexible way of structuring your game but I still don't understand where the performance benefits the article speaks of come from.

JavaScript gains no performance benefit from ECS because JS arrays are dynamic and sparse. The performance benefit comes from dense, contiguous data (structures of arrays, instead of arrays of structures) in languages that allow that. Consider the difference between: object 1 property A property B object 2 property A property B and: property A of object 1 property A of object 2 property B of object 1 property B of ob…

I think some JS engines may treat arrays as dense as an optimization in certain cases

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

#146
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…

> [ECS was] Popularized by Scott Bilas' engine for Dungeon Siege.

Make that nothings' and MAHK's http://enwp.org/Dark_Engine for (initially) Thief.

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

#147

The article makes more than a few baffling statements beyond the core argument regarding ECS. The claim of Godot having similar tools as other engines certainly caused me to raise an eyebrow. The strangest in my mind, however, is trying to downplay the importance of the performance advantages by claiming games with many objects are rare. I currently work on optimising a game which falls somewhere between indie and AA…

> is trying to downplay the importance of the performance advantages by claiming games with many objects are rare.

Which games in https://en.wikipedia.org/wiki/2020_in_video_games have thousands of live objects?

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

#148
post #99

Earlier quoted context omitted.

Tiberian Sun's technology is really unique and cool and I wish they'd open source it so I can see how they did everything. The 2d lighting really have it a distinct atmosphere.

Approach it like a mid 90s demo coder. Alphas, light maps, shadow casting. The coolest 80s trick was rotating the palette to get moving water.

Starcraft does this for it's map animations. Each player in the game has a different color (so you can tell who's units are who's) and on some level that color is implemented as an index into memory, so if you set the player color above what the designers intended you can end up with wonky colors and (if memory serves correctly) some indices can land you in the rotating palette and give you subtile animated colors on your units. Most where just garbage memory though. This leads to a crash too because unlike most units the special 'flag' unit (for capture the flag) has a different portrait for each player color. It's also indexed by player color, so if you click on a flag of an invalid-color player, it crashes the game. This lead to fun maps like 'dont click the flag' but also woe in long running maps where players could click crash flags by mistake. Again, if memory serves, the crash was fixed by some hacks people would use in Roleplay maps (vision hacking allowed you to stack buildings) so RP map makers would include then anyway. Units to use as labels where at a premium in RP maps, you see...

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

#149

Earlier quoted context omitted.

JavaScript gains no performance benefit from ECS because JS arrays are dynamic and sparse. The performance benefit comes from dense, contiguous data (structures of arrays, instead of arrays of structures) in languages that allow that. Consider the difference between: object 1 property A property B object 2 property A property B and: property A of object 1 property A of object 2 property B of object 1 property B of ob…

In this context, what do you mean by sparse? Simply that similar data is not packed together?

Computer memory access is efficient when linear. That is, when the next thing you need is located directly after the last thing you needed, in memory. In JavaScript, arrays are conceptually sequential, but this is only an abstraction for the programmer. In truth, the array elements are scattered around in random memory locations. This means that when you iterate over an array, the CPU cache misses on every iteration, and the CPU has to wait for the next data to load from memory.

In a language where arrays are not sparse, but rather dense, the whole array is allocated as one contiguous stride of memory. Iterating through it is very fast, because the CPU cache hits every time and the next data you need is always ready, as it immediately follows the previous in memory.

Additionally, ECS wants to pack data even further, so that unneeded data is not interleaved within the memory stride at all. Every byte you "skip" is wasted space in the CPU cache, and eventually accumulates into a full cache miss, which stalls program execution.

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

#150
post #147

The article makes more than a few baffling statements beyond the core argument regarding ECS. The claim of Godot having similar tools as other engines certainly caused me to raise an eyebrow. The strangest in my mind, however, is trying to downplay the importance of the performance advantages by claiming games with many objects are rare. I currently work on optimising a game which falls somewhere between indie and AA…

> is trying to downplay the importance of the performance advantages by claiming games with many objects are rare. Which games in https://en.wikipedia.org/wiki/2020_in_video_games have thousands of live objects?

From that list? The Last of Us Pt. 2, Ghost of Tsushima, Half-Life Alyx, FF7 Remake. I'm not seeing Cyberpunk 2077 on the list, though.

Objects are anything from walls and NPCs to sprites, particle effects, imposters, ... they pile up very quickly in a complex scene.

Post reply on HN