Entity Component Systems - My Thoughts After Making a Game with One

preview_player
Показать описание


Thank you all so much for your support!
Рекомендации по теме
Комментарии
Автор

This video is a little different as I had less time this week to plan one and put it together. It does talk about some of the things I've been learning about and I think could be really interesting in GameMaker Studio 2's future. I hope you guys enjoy it. See the description if you want a copy of the source code to the project shown here.

uheartbeast
Автор

The slowdown he mentions at the end is caused by the overhead inherent to an ECS system. This is only noticable when dealing with relatively few entities. The true strength and performance gains from ECS come when you have large amounts of entities (strategy games, large multiplayer games, bullet hell games etc). When dealing with large amounts of entities it is generally much faster than most other methods. That being said, he is correct in that if your game is small and ECS is "slowing it down" modern hardware should be able to handle the overhead in such a small game with no real issue. On another note; the language used also matters because compiled languages (such as C++ or Rust) handle things different than JIT languages (Python or C#).

dennislp
Автор

I have been playing around with ECS s for a good while now, And i'm in love!
You mentioned performance. Turns out that in languages such as c++, or even Java, ECSs can yield better performance due to better cache prediction. Which is why they are almost universally used in AAA games these days.

GMWolf
Автор

I'm not sure this is a good ECS design. Entities are usually just an ID. What you've created is a regular old object hierarchy, where entity objects actually contain their components. In ECS you would instead store the component objects in a data structure like a map/dictionary where the entity ID is the key. When it comes time to process component behaviors with your systems, you would iterate through your maps of components by entity ID so all components of the same type get processed together. This is how the CPU cache performance benefits of ECS are had, by storing the data you're operating on (the components) together at the time they're processed.

Jason-fvrg
Автор

Great video, cool to see you experimented with LOVE as well. One of my most fun accidents while experimenting with ECS made it so that projectiles also fired projectiles. So the number of projectiles on screen just grew exponentially every time the player hit the fire button :)

tyfoo
Автор

This is almost like programming in C. Having structures without functions, but instead having functions which act upon those structures. Even having higher level "entities" with lesser components its eerily similar to how you have a tree struct which has very little data in it itself, but is connected to a much larger structure of nodes.

hikerwolfspaine
Автор

Hi, I am not an experty myself, but I quess you should decouple .health and .sound components from your collision system. There should be some kind of messenger that sends a message like: "to Health system: on entity X act as hit" and "to Sound system: on entity X act like hit".

rungames
Автор

Thanks for making this video! I've been looking into using an ECS for my next project as I wanted it to be easily expandible and it looks like this approach is very useful for establishing a framework for multiple games.

KryyssTV
Автор

Very good information, thanks. I'd like to recommend that you record with your desktop resolution set to 720p, even if you set the output resolution of the video to 1080ṕ, because it's hard to read such small characters in a 720p screen. Increasing the zoom in the code editor is also fine.

RobertoRenovato
Автор

May not be easy to use, but very very performant. Avoiding cache miss and RAM explosion from inheritance big must in large games.

lupinedreamexpress
Автор

6:10 you don't actually have to remove the comma at the end of the list.

execute
Автор

Which game engine do you want to install?
HeartBeast: Yes!

leoteles
Автор

Very helpful to actually see an ECS implementation, thank you man :)

robertwallace
Автор

Just bought your book! cant wait to read it <3

jasonsmith
Автор

Am I wrong into thinking it's a typical MVC architecture? It seems like it would actually benefit from inheritance by loosing some redundancy at least if not abstraction. Also... removing system instances doesn't seem like a very efficient way of debugging. xD I used to debug with `ldb` (lower case `l`) and can recommend it.

cprn.
Автор

You can have an object-oriented entity-component system tho. Edit: how is this entity-componemt system different than the one in unity? I assumed unity used ecs cus you have empty game objects with components that define their functionality

KeenanWoodall
Автор

How to structure the code if I want the player to die differently, then the enemies? Like do a backflip or something

YYYValentine
Автор

The ending was bizarre... The whole point of ECSs is that you trade away ease of use to get a performance boost, not the other way around. Then again - that's why you create them in C++ xD.

VestinVestin
Автор

can u make a video on full top down stealth system with hiding and chassing by enimes like that in gms2

radhakrishnann
Автор

hi guys i take this eror every time i run the game : the polygon shape for fixture 12 is concave or ordered it isnt what should i do??

_thelight