Coding basic Entity Component System but I am dumb. Game Engine ep. #3

  Рет қаралды 6,155

Code Gains

Code Gains

Күн бұрын

Пікірлер: 24
@graphicstalk7609
@graphicstalk7609 8 ай бұрын
Use tuples instead of vectors. Tuples allow you to have a dynamic array that contains multiple types.
@Code_Gains
@Code_Gains 8 ай бұрын
Thanks for the tip. I will be sure to include tuples in my analysis once I come back to this in the future vids.
@timtreichel3161
@timtreichel3161 7 ай бұрын
No I don't think this is a good if you want to go with an ECS architecture. You want the components to be stored continuously, for each component type. So going with a single vectors for each component is exactly the right way to go. Then you want to iterate over the components vectors individually when updating the game/simulation state. That way you have the most cash benefits. Code duplication can be avoided with templates. Looking up components can also be implemented with linear or binary search and will probably be fast enough in most cases. Dealing with hash maps brings their own draw back, but I guess it can be done and might be needed in some cases.
@Abdullah-nu4od
@Abdullah-nu4od 3 ай бұрын
Love this channel
@GTGTRIK
@GTGTRIK 9 ай бұрын
This is really helpful on my own ECS journey. I've been struggling with the whole magic layer of "linking components to entities".
@Code_Gains
@Code_Gains 9 ай бұрын
Glad to hear I helped someone
@TheTimmyewrard
@TheTimmyewrard Ай бұрын
I'm now not alone with feeling dumb...
@basboerboom9328
@basboerboom9328 9 ай бұрын
I feel your pain. I am currently on my countless'th iteration of ECS for my game. Every time I almost get a Eureka moment, I run into a problem with my ECS system.
@ParanoicoBR
@ParanoicoBR 11 ай бұрын
The internet historian style video but for programming. I love it! Keep up the good work, man!
@anthonyapm
@anthonyapm 8 ай бұрын
Good job man. I've been battling the same problems 😅
@aybcrazybeats8588
@aybcrazybeats8588 4 ай бұрын
I suggest you consider creating a generic "Component" type. After that all those individual component vectors could get replaced a single vector holding either component pointers or better yet, smart pointers. Doing that you don't have to create new containers for every new component type. Exploit the features of polymorphism, that way you can write code that's more maintainable and easily expandable with new features
@theseangle
@theseangle 18 күн бұрын
Interesting approach, except that it goes against the whole point of ECS, which is Data Oriented Design. At that point your code will not get any benefit from ECS. Storing each component instance in a random place in the heap will *not* make your code any better than multiple-inheritance OOP mess
@drominitoketchup
@drominitoketchup 8 ай бұрын
Nice, another guy who loves low level programming². Oh, I'm already a subscriber to your site, I didn't even notice 🤔
@liutaurasgaidamavicius1379
@liutaurasgaidamavicius1379 11 ай бұрын
shadow wizard money gang
@doce3609
@doce3609 11 ай бұрын
i am loving it 👍🏻👍🏻
@dontknow7863
@dontknow7863 11 ай бұрын
Best video so far ,,🔥💪😎
@thomasp9511
@thomasp9511 11 ай бұрын
Keep it up champ💪
@Felix-we7iq
@Felix-we7iq 11 ай бұрын
Deciding what type of int the ID of an entity should be sure is the most difficult part of ecs
@Code_Gains
@Code_Gains 11 ай бұрын
I think I will switch to size_t later :')
@arnoldaz
@arnoldaz 11 ай бұрын
God programmer is back at it again. When you were explaining why you moved to ECS, is there any reason why do you think you need separate classes for Physics Sphere or Physics Trail Sphere? Can't you just have some parameters in Sphere class that can be set on or off for each functionality? Or even do dependency injection for components if they share some common base. Amazing video as always tho!
@Code_Gains
@Code_Gains 11 ай бұрын
There is nothing inherently special with ECS that allows to solve this and you likely could make it work. In my case having separate classes in OOP would ensure that you are not wasting memory by having properties on objects that should not have these properties (like physics) and passing parameters to enable functionality would likely still have the same memory overhead issue. I did not even consider doing something like injecting components (I guess ECS is kind of similar in a sense?), but I would have to be honest that I had my mind set on ECS without much consideration for OOP to begin with since I have plans for large scale simulations.
@Doggy_Styles_Coding
@Doggy_Styles_Coding 11 ай бұрын
looks cool :D cant find anything dump
@Code_Gains
@Code_Gains 11 ай бұрын
Hopefully someone will. I need to live up to the title
@stevenfarmer5203
@stevenfarmer5203 10 ай бұрын
🤷 "promo sm"
React Crash Course | Learn React Quickly | In 80 Minutes
1:17:07
WolfDenCode
Рет қаралды 3,3 М.
CAN YOU DO THIS ?
00:23
STORROR
Рет қаралды 45 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 29 МЛН
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
QUICKLY Writing an Entity Component System (ECS) in C++
3:08:17
Coding with Mat
Рет қаралды 2,8 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 1 МЛН
Something Strange Happens When You Take This To Its Logical Conclusion
32:44
Mathieu Ropert: Data Storage in Entity Component Systems
1:09:50
SwedenCpp
Рет қаралды 2,9 М.
Entity Component System | Game Engine series
43:05
The Cherno
Рет қаралды 128 М.
NSA Releases Internal 1982 Lecture by Computing Pioneer Rear Admiral Grace Hopper
1:29:36
The Black Vault Originals
Рет қаралды 275 М.
I Optimised My Game Engine Up To 12000 FPS
11:58
Vercidium
Рет қаралды 707 М.