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

  Рет қаралды 5,068

Code Gains

Code Gains

Күн бұрын

Am I moving backwards or forwards? Nice to see you again for another time in the C++ engine series. This was an "adventure" to say the least and I hope that you were pleased. This was more of a theoretical video in terms of what you saw, but we will soon get to use this more in practice.
Thank you for watching!
Resources:
github.com/SanderMertens/ecs-faq - has a lot of general information and links around the web for existing ECS implementations.
/ ajmmertens - lots of articles from the same person about ECS.
0:00 Intro
1:08 The Plan Failure
2:12 Why New Architecture
3:11 Data Oriented Design
4:21 Firewood Analogy Interlude
5:24 ECS Basics
7:04 Me Admitting I'm Dumb
7:29 The Grind Starts
8:15 Experience Sharing Interlude
8:53 My Own C++ ECS
10:51 HashMap Querying
11:48 Component Archetypes
12:05 Remapping Component Indexes
12:43 A Small Demo Scene
13:09 Future Plans
13:46 I Know That I Know Nothing
Music:
Intro:
Iron Jack-o-Lantern - TeknoAXE
Guitar Interludes:
Sardana - Kevin MacLeod
Background:
Awake - Emmit Fenn
Vibing Over Venus - Kevin MacLeod
On The Rocks - TrackTribe
Staycation - Corbyn Kites

Пікірлер: 20
@graphicstalk7609
@graphicstalk7609 3 ай бұрын
Use tuples instead of vectors. Tuples allow you to have a dynamic array that contains multiple types.
@Code_Gains
@Code_Gains 3 ай бұрын
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 2 ай бұрын
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.
@GTGTRIK
@GTGTRIK 4 ай бұрын
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 4 ай бұрын
Glad to hear I helped someone
@ParanoicoBR
@ParanoicoBR 6 ай бұрын
The internet historian style video but for programming. I love it! Keep up the good work, man!
@basboerboom9328
@basboerboom9328 4 ай бұрын
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.
@anthonyapm
@anthonyapm 3 ай бұрын
Good job man. I've been battling the same problems 😅
@doce3609
@doce3609 6 ай бұрын
i am loving it 👍🏻👍🏻
@liutaurasgaidamavicius1379
@liutaurasgaidamavicius1379 6 ай бұрын
shadow wizard money gang
@drominitoketchup
@drominitoketchup 3 ай бұрын
Nice, another guy who loves low level programming². Oh, I'm already a subscriber to your site, I didn't even notice 🤔
@thomasp9511
@thomasp9511 6 ай бұрын
Keep it up champ💪
@dontknow7863
@dontknow7863 6 ай бұрын
Best video so far ,,🔥💪😎
@arnoldaz
@arnoldaz 6 ай бұрын
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 6 ай бұрын
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.
@Felix-we7iq
@Felix-we7iq 6 ай бұрын
Deciding what type of int the ID of an entity should be sure is the most difficult part of ecs
@Code_Gains
@Code_Gains 6 ай бұрын
I think I will switch to size_t later :')
@Doggy_Styles_Coding
@Doggy_Styles_Coding 6 ай бұрын
looks cool :D cant find anything dump
@Code_Gains
@Code_Gains 6 ай бұрын
Hopefully someone will. I need to live up to the title
@stevenfarmer5203
@stevenfarmer5203 5 ай бұрын
🤷 "promo sm"
Bob Nystrom - Is There More to Game Architecture than ECS?
23:06
Roguelike Celebration
Рет қаралды 189 М.
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 42 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 133 МЛН
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 26 МЛН
La final estuvo difícil
00:34
Juan De Dios Pantoja
Рет қаралды 27 МЛН
Lights and Materials but I am dumb. Game Engine ep. #1
11:47
Code Gains
Рет қаралды 10 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 783 М.
Here's My Opinions Of Godot After Using It For A Month
18:51
Adam Lutton - Game Dev
Рет қаралды 3,4 М.
Blazingly Fast Greedy Mesher - Voxel Engine Optimizations
23:35
Entity Component Systems - Nico Schoeman
11:57
bbdtv
Рет қаралды 8 М.
The purest coding style, where bugs are near impossible
10:25
Coderized
Рет қаралды 855 М.
Better Mountain Generators That Aren't Perlin Noise or Erosion
18:09
Josh's Channel
Рет қаралды 267 М.
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 42 МЛН