How the Compile Time ECS works In my Minecraft Clone? + Templates

  Рет қаралды 3,209

Low Level Game Dev

Low Level Game Dev

2 ай бұрын

In this video, I will explain the details of how the Compile time ECS in my Minecraft Clone works.
#cpp #gamedev
Join my Discord 🕹️😎:
/ discord
Repo🙀:
github.com/meemknight/ourCraft
Check out my game Midnight Arrow on Steam 💪:
store.steampowered.com/app/23...
Join this channel if you want to support me 😻:
/ @lowlevelgamedev9330
Playlist 🥵:
• Minecraft clone

Пікірлер: 37
@Ddos2212
@Ddos2212 2 ай бұрын
Click the right mouse button on your video and then stats for nerds. There you will see content loudness -10.6dB. This means the audio is too low. Try to keep it close to 0. -0.5 is okay too. Above 0 is too loud. Just so you know
@ExplosionPower1387
@ExplosionPower1387 2 ай бұрын
-10.6dB❌ -6.8db✅
@Ddos2212
@Ddos2212 2 ай бұрын
@@ExplosionPower1387 What do you mean
@ExplosionPower1387
@ExplosionPower1387 2 ай бұрын
@@Ddos2212 ABOUT LOUDNESS YOU TALKING
@Juanao-nk3vu
@Juanao-nk3vu 2 ай бұрын
​@ExplosionPower1387 no need to scream random youtube user
@pine_and_appl
@pine_and_appl 2 ай бұрын
I’m highly recommend you release part of this separately as a tutorial on templates as it explains them really well. Cleared up all confusion with them I had.
@nicholastheninth
@nicholastheninth 2 ай бұрын
Ah yes, templates. I’ve done some cursed things with those, like creating a non-template lambda wrapper that can be directly created from any kind of lambda (as long as the lambda isn’t templated), so I can just use it in function parameters. Super useful.
@nickst2797
@nickst2797 2 ай бұрын
Very clean code.
@depralexcrimson
@depralexcrimson 2 ай бұрын
hopefully youre being sarcastic
@its_code
@its_code Ай бұрын
❤❤❤❤
@3DWithLairdWT
@3DWithLairdWT 2 ай бұрын
Compile time composition > inheritance based ECS built in C++ I love that! Please do more on the set up for keeping your arrays of entities & components contiguous over runtime and multiple updates? I've found this to be one of the most complicated parts of grasping ECS at it's most efficient form
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
well I just store each entity in its own array so things are kinda well placed in memory
@arandomguythatdoesntpost
@arandomguythatdoesntpost 2 ай бұрын
​@@lowlevelgamedev9330why not do vector
@arandomguythatdoesntpost
@arandomguythatdoesntpost 2 ай бұрын
why not a vector of Entity
@3DWithLairdWT
@3DWithLairdWT 2 ай бұрын
@@lowlevelgamedev9330 iirc the "Entity" in an ECS is just the ID used to index into the arrays of components that it has. Such that when you update "Position" for example, you traverse the array of all positions to update them, and the data is all contiguous in memory - hence the performance gain. If each object has its own data, and you have an array of objects, I'm pretty sure it's not really an ECS at that point. That's just OOP with good use of composition over inheritance, but you don't gain the cache coherence benefits of contiguous memory = much less cache misses
@3DWithLairdWT
@3DWithLairdWT 2 ай бұрын
@@arandomguythatdoesntpost That's not how an ECS works, it's a bit complicated to say. Contiguous memory is what makes ECS fast. The "Entity" part is just an ID that knows which arrays (components) it has. Cache coherence is why ECS is fast, using contiguous arrays.
@Broom-fz2gm
@Broom-fz2gm 2 ай бұрын
*This comment is quite long* Can you please do a C++ tutorial series for beginners who don't know how to use it? It would be nice to them if you made one. Yes, I know that you made C++ tutorials and an April Fools C++ tutorial series (which was just a joke), but I don't think those have all the things that beginners should know. I know that I can look for C++ tutorial series on KZfaq, but this project you created is (very) complex, and your tutorials are perfect and they can avoid people making mistakes in C++ programming, so I think you're the perfect one to make a C++ tutorial series.
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
I don't plan on making a cpp tutorial
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
maybe later, rn I don't plan one because it takes a lot of time and it doesn't make that many views
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
but I will make some beginner topics tutorials like the pointers one 💪
@Broom-fz2gm
@Broom-fz2gm 2 ай бұрын
@@lowlevelgamedev9330 Oh... but hey! I know how to make it get views!
@brockdaniel8845
@brockdaniel8845 2 ай бұрын
that noise cancelation
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
best part 😂
@arandomguythatdoesntpost
@arandomguythatdoesntpost 2 ай бұрын
for the add example, why not do: int addi(...) { ... } float addf(...) { ... }
@tuhkiscgibin6627
@tuhkiscgibin6627 2 ай бұрын
Because C++...
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
well that's not the point, the point of templates is to be able to do what I showed in the end, make a function that can work with anything, if you just need float and int yes you would do that
@tuhkiscgibin6627
@tuhkiscgibin6627 2 ай бұрын
@@lowlevelgamedev9330 sadly that's how they are used in some codebases
@bluesillybeard
@bluesillybeard 2 ай бұрын
C does has templates. They're called "macros", and if you thought C++ templates were hard, C "template" macros are about 10 times worse. Anyway, this system seems really nice, and is quite similar to what I'm developing for my own game project. The only fundamental difference is that mine is written in Zig.
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
well they are totally different and I know how to use both and I would say that templates are worse simply becausw they have a ton of rules with move semantics and decay and forwarding and stuff, yes zig is better for this kinda stuff 💪
2 ай бұрын
And with templates you can use concepts to restrict what you do (saner than SFINAE) and you can be very stupid with templates. I love templates but they also drive me crazy
@lowlevelgamedev9330
@lowlevelgamedev9330 2 ай бұрын
yes tho I have never tried concepts, fortunatelly, for what I do here I don't need concepts or sfinae, so things are rather simple
2 ай бұрын
@@lowlevelgamedev9330 Concepts are great to limit your template parameter options or to create interfaces that don't use virtual polymorphism, so I would strongly argue anybody that uses virtual polymorphism should look at them
2 ай бұрын
@@lowlevelgamedev9330 Concepts are great for limiting the allowed inputs into your templates (much easier than with SFINAE), and they are fantastic for creating interfaces instead of using pure virtual methods that you override, which are more expensive (and again, easier than SFINAE). For example: say that you have an IAnimal interface with the methods Speak and Move, simple stupid, but it works, you could do: class IAnimal { public: virtual ~IAnimal() = default; virtual auto Speak() -> void = 0; virtual auto Move() -> void = 0; }; class Dog : public IAnimal { public: auto Speak() -> void final { std::cout void final { std::cout Speak(); animal->Move(); } int main() { IAnimal* dog = new Dog(); GiveMeAnimal(dog); delete dog; } Or you can simply use concepts and do even better, and using the stack instead of the heap: template concept IAnimal = requires(T a) { { a.Speak() } -> std::same_as; { a.Move() } -> std::same_as; }; class Dog { public: auto Speak() const { std::cout
@ThatOneGuy-dc2xe
@ThatOneGuy-dc2xe 2 ай бұрын
I will not say “first” I will not say “first”..
@shadow_blader192
@shadow_blader192 2 ай бұрын
1
@Felix-att
@Felix-att 2 ай бұрын
Ok then, First!😂
Making Minecraft, but the server can have UNLIMITED threads (almost)
6:04
Low Level Game Dev
Рет қаралды 22 М.
making Multi-Player Minecraft in C++ is HARD!
10:23
Low Level Game Dev
Рет қаралды 27 М.
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 31 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 120 МЛН
Me: Don't cross there's cars coming
00:16
LOL
Рет қаралды 15 МЛН
Apple’s WORST iPhone Case Cost HOW MUCH?!
0:47
Nick Bradley
Рет қаралды 12 МЛН
$1 vs $2,500 Lightsaber
0:58
Mrwhosetheboss
Рет қаралды 37 МЛН
There are Random Numbers in Computers!
9:46
Low Level Game Dev
Рет қаралды 5 М.
Finally understand Pointers! FULL GUIDE!
20:48
Low Level Game Dev
Рет қаралды 12 М.
Stolen Minecraft Versions Mojang Can’t TAKE DOWN…
12:59
TheMisterEpic
Рет қаралды 488 М.
Understand C++ Compile and Linker Errors!
8:59
Low Level Game Dev
Рет қаралды 3,9 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 813 М.
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 31 МЛН