Thanks for watching! Don’t forget you can try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/TheCherno. The first 200 of you will get 20% off Brilliant’s annual premium subscription!
@wjrasmussen6668 ай бұрын
Sure, do another video on how you would refactor this code. Or, have you done a video on profiling?
@y4ni6088 ай бұрын
@@wjrasmussen666 I have actually implemented all the stuff cherno advised me to do (build system, project strcture, scenehandler, and even the naming conventions) i just really hope he can create a last and final episode, i hope to get a review for that. And i didnt even really intent to create a ECS
@mobslicer15298 ай бұрын
did you see my email about my c game engine
@learningtoride17148 ай бұрын
Failing to learn or failing, to learn.
@prakashraj45198 ай бұрын
I think it's the later
@user-sl6gn1ss8p8 ай бұрын
you should open a fortune cookie business
@BruceOnder7 ай бұрын
@@user-sl6gn1ss8p Or, should they open a fortune, cookie business?
@alexkhazov72648 ай бұрын
I don't think the object slicing remark is entirely correct. It has nothing to do with the objects being stack allocated. The issue would occur if you were to pass in a subclass type by value to a base class type. This could happen even with a heap allocated object if you were to dereference the subclass type when calling a function that takes a base type by value. The most important thing is everywhere where you take in a base class to take it in by pointer or reference... Which you should be doing normally anyways - don't make redundant copies :)
@Gastrostomi8 ай бұрын
That was informative in a way I did not expect. I have never really thought about the deeper inner workings of how an ECS is structured and how it works.
@user-sl6gn1ss8p8 ай бұрын
I really like these reviews, but I do feel like in a multi-episode series like this one it would have been nice to see what the thing actually does and maybe skim a sample project.
@GB_Parametric8 ай бұрын
Would love to see the implementation of ECS.
@whoshotdk8 ай бұрын
Me too, proper ECS is *hard*, for many of the memory reasons The Cherno stated. I've made a partial-ECS which works like "old" Unity does (Entity has Components) but trying to come up with something more efficient than that has beaten me many times so far!
@AnteP-dx4my7 ай бұрын
SAME !!
@aboliguu1168Ай бұрын
This comes a bit late and probably isn’t too helpful but i can give the basic idea on how to hold different sized objects in tightly packed arrays. It was the main problem for me before. You basically want to have a hash map of std::type_index -> some pointer of BaseComponentArray. Then you inherit from that Base array with a templated ComponentArray class that holds a vector of type T. When you add a component, you call a templated function so you can get it’s corresponding vector from the hasmap with std::type_index(typeid(T)). Then just cast the pointer to the vector to the correct type and push it there. I can elaborate if needed.
@mariwanj52928 ай бұрын
Please make a diagram design structure how all these parts should be designed and make it visual .. from entity, to requiremnets for each entity.
@ProGaming-kb9io8 ай бұрын
He already has the game engine series, there he does it in the right way
@mariwanj52928 ай бұрын
@@ProGaming-kb9io I know, but visualizing that in a structured diagram will help to understand better.
@TheAxeForgetsTheTreeRemembers8 ай бұрын
Yes! Possible solutions would be a great follow up!
@lromaniuk8 ай бұрын
Weather members will be stack or heap allocated is determined how you allocate them, not where you put them in the code. There is nothing wrong with use of polimorphism to make an ECS - and still you can put derived classes in their seperate memory buckets - nothing stops you from doing so. Personally I would not put any functionality in components - just the data. All of this continious memory effort is useless if you have to process logic that requires multiple component types at the same time - basically you will be fetchind data from different buckets all the time causing a lot of cache misses - but its true that some systems (rendering) may benefit from such arrangement.
@natescode7 ай бұрын
*whether
@Spirrwell8 ай бұрын
Man, with how hard you're tearing into this, you should do a code review of the Source SDK for Source Engine. This code here, while having some questionable design decisions, is not that bad.
@bluesillybeard8 ай бұрын
If what I've heard is correct, the source engine is a (still fairly well optimized) mess and a half.
@Theawesomeking44448 ай бұрын
the dev : please roast me the cherno : for each (lines of code) make a 30 minute video on why that line of code is bad
@maxrinehart41778 ай бұрын
Every dev would be lucky to get roasted like this. learning new things, getting feedback on why their implementation is wrong, and how to fix it is by far the best kind of code roasting.
@sirpalee8 ай бұрын
Memory layout of components is an implementation detail of ECS, not a requirement for an ECS system.
@rtc448 ай бұрын
1. Fields are not stack allocated. 2. Object slicing is not about allocation, it's about copying the object by assigning to somewhere, It's about static type. Sorry, can't resist)))
@Stroopwafe18 ай бұрын
When the class/struct is stack allocated, its fields are stack allocated, when the class/struct is heap allocated, its fields are also heap allocated. Check it out in godbolt. Fields are just an offset from the first field
@gabrielciordas33698 ай бұрын
Great video as always Cherno, you're like the Bob Ross of programming in c++
@gelis073 ай бұрын
sebastian lague is the bob ross of programming
@tiagocerqueira94598 ай бұрын
If your child component need access to the parent and you store the parent pointer, it is usually a red flag.
@sub-harmonik8 ай бұрын
how would you do that otherwise? store an index into some entities table?
@DeusExAstra8 ай бұрын
I dont think that's necessarily the case. It depends on how things are structured and what the entities and components do.
@yesntpittzant41568 ай бұрын
@@sub-harmonikDepending on the situation, having a list of certain entities can be reasonable. But that's not the point. If you make an Entity Component System and your child components needs access to the parent, then it kinda defeats the whole purpose of having an ECS. Because ECS is "best" when you have a clear hierarchy and independent components. If the child component needs access to the parent, you might as well make it one component. Or restructure the components
@RigelOrionBeta8 ай бұрын
An index is essentially a pointer. Just an offset to a memory address. Depends entirely on what that thing points to. Not necessarily a bad thing.
@MrHaggyy8 ай бұрын
@sub-harmonik - just implement child in parent and not every object needs every method - try different data and function structures that avoid the problem by good design. - try a virtual class and propper VTable design. -put each object in a data structure and let the program code deal with seperaten, do not abstract in the class.
@sinom8 ай бұрын
Writing a custom arena allocator would be an interesting video topic
@gabrielbeaudin35468 ай бұрын
After listening to your channel a bunch, I realised what I really wanted to build is an engine and not an editor. My "Compositions" should just be known at compile time because I won't use an editor to build them. I ended up not having a entity component system at all. I know my classes will be next to each other in memory and won't cache miss.
@thygrrr3 ай бұрын
I actually enjoyed reading the architecture of s2d, because it's a fresh perspective on some things. (sometimes a dangerous perspective, see Object Slicing) After >30 years of programming, I learn primarily not from reading "best" practices, I learn from good practices and even bad practices I observe in the field. :3
@the_gobbo8 ай бұрын
Really cool book reference! will definitely check it out!
@user-sl6gn1ss8p8 ай бұрын
it is a kinda dense book, but it is really, really good
@MasonDixonAutistic8 ай бұрын
The Game Engine Architecture(3rd edition) book is currently discounted on Routledge, so I've ordered it and can stop sucking and start failing...upwards.
@informagico63318 ай бұрын
It is simply about to study enough to get the knowledge that boosts your project, and to practice enough to learn, get results, and not to get frustrated becuse of the infnite available contents to study. I feel this the most difficult part of software engineering, to make the optimal solution acquiring enough knowledge to reach it. Do not just study programming and do not just make programs, find the optimal way to get things done.
@MrHaggyy8 ай бұрын
And once you are decent with your study start and keep breaking and fixing larger and larger systems. If you know how an problem or issue is made in a small scale it much more likely that you catch it in a big system.
@_blank86a8 ай бұрын
Multi threaded design patterns would be a great because as we start to scale the applications by adding more features the applications start to get slow so please 🙏 do teach us by giving some suggestions and stuff...
@mad_circuits8 ай бұрын
1:35 It is not possible to "just build, not learning". My opinion.
@zanagi8 ай бұрын
Would want to see young Cherno code
@spaaske8 ай бұрын
Where can I find more elaborate information on keeping a flat structure rather than keeping a hierarchy?
@R4t4n8 ай бұрын
I actually have pure virtual base class in my current "ECS" I am building and I still store them in continuous memory for performance. Reasoning behind is that all our components have to have some common functionality and some required methods for template hell that is happening around. I am trying to shield colleagues from engine related things as we are not any close to gaming project and renderer is just a tool for us.
@gabetobias4438 ай бұрын
I would love to see you build a memory arena system but I'm also curious to see how you would go about creating a simple custom ECS system
@fappylp25748 ай бұрын
Me too, i always get hung up on iterating over groups of components. Separating the component arrays into archetypes seems sensible, but how do you then access these separate arrays in a sorted manner (for example for forward rendering)?
@lromaniuk8 ай бұрын
@@fappylp2574 You dont, you just itarate over all renderables and submit work to your rendering system which sorts your rendering commands however you need and then you submit your sorted rendering commands to the rendering API. Decouple systems and keep their responsibilities isolated.
@Nhurgle8 ай бұрын
If you are on a budget, Game Engine Architecture can be read on the Internet Archive ;)
@gsestream8 ай бұрын
learning is not copying, by instructors commands, as you said its more 1st hand experiencing (the why's rather than 2nd hand copying like a machine). why do you have to call something ecs or something btw, thats the teachers dictation. the term definition or even dictating of using those terms will nuke a learner into a copy machine. get rid of pointers and all complexity as fast as you can. not productive, its an inhibitor. first solve figure out the memory pointers issue, to make a base system to build on, so that the future building is more simply constructed, you would not re-solve making a building block each time, but solve it once, then use the same mold for all the other less custom blocks. iterating versions of the same program, prototypes is no shame or detriment, its the actual learning, by you, not someone else. you should design and rewrite your stuff many times, after writing it for the n previous times lol.
@vcv65608 ай бұрын
Success or failure, its all yours. Try, fail, correct, continue. I'm nearly 60 and this remains a truism in my life. Its the only thing that works. For the next I'll quote Calvin Colliage (President of the United States in the 20s): “Nothing in this world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan 'Press On!' has solved and always will solve the problems of the human race.”
@Driver___8 ай бұрын
I actually have 2-3 other similar projects downloaded and opened from where I am learning to write my 2d-3d engine
@rmt35898 ай бұрын
Yes! Please show us how to solve these issues. I just, in this video, found out you can have hierarchy in ECS, which I thought was a defining thing in OOP besides classes and subclasses.
@tematoscybersage56268 ай бұрын
I think that iterating contiguous memory gives benefits, because in that cases computer knows start and end point of data that need to be computed and can activate assembler feature called DMA(Direct Memory Access). I used this feature when I was making game for NES to draw background of level in fast way. But I am not sure does C++ uses that same feature with contiguous data.
@whoshotdk8 ай бұрын
Its been such a long time since I did NES ASM but "STA $2007" rings a faint bell :P Did you ever finish and release any games? I'd be interested in seeing them. I started several myself (including a version of Stardew Valley lol) but never got round to completing lol.
@tematoscybersage56268 ай бұрын
@@whoshotdk I just made simple side-scroller with easy boss fight. It was the beginning of my gameDev path. Yes, I released more then one project, but not for NES. For example Dreamcast remake of Textorcist. If you want, I can send you my game and also sources for it;) but I need to correct it a bit, because it was made as a present for person that I don't like to be in a game anymore😄so if you want, after correction I will send it;) P.S. the only one thing that I didn't get my hands on it was sound, when I understand complexity, I understood that there is not much free time left, to implement that
@whoshotdk8 ай бұрын
@@tematoscybersage5626That sounds really good! I remember how hard it was to implement decent platformer physics. Don't go out of your way to correct your game just to show me. But if you ever decide to upload to Github or somewhere like that, do send me a link!
@tematoscybersage56268 ай бұрын
@@whoshotdk Ok, so I will do that. Will notify you here when it will be ready
@sub-harmonik8 ай бұрын
these days it has a lot to do with cache and ram locality. (the caches will read 'cache lines' into faster locations closer to the registers, so when you get data that's next to itself it's way faster because it will already be read into the cache as part of the same cache line)
@maarten92228 ай бұрын
A lot of the things you mention I see in Rockstar's Rage engine although they love inheritance.
@rishavgaming86628 ай бұрын
I was thinking that can dani have comeback but not with unity but with Hazel make video like back then
@user-ib3gl6pj6h8 ай бұрын
Nice to see you again
@meistrimeez8 ай бұрын
There is always the dilemma when choosing between composition and inheritance. I don't think there is right and wrong here. It's just the experience or history of the individual developer.
@CreativeSteve698 ай бұрын
I work with using python, when I start on a small scale project can I send it your way Cherno for a episode of this fun series in the future? or in css/html?
@bekdev5648 ай бұрын
I'd love to see your reaction on GTA VI trailer just like your Unreal Engine 5 reaction video!
@scoliossis8 ай бұрын
happy birthday for 5 days ago i think
@ev3rybodygets1775 ай бұрын
lol every time i watch one of these reviews i always walk away thinking there are more issues with the underlying language c++ than the actual code....
@TheMrTka48 ай бұрын
I think a lot of things have been said over the course of all these videos. The code author can begin to correct or rework the project at this stage. Everyone needs a little refresher, different code, different author.
@y4ni6088 ай бұрын
Yeah i did spent alot of time rewriting it and im really happy now. I hope he reviews the newly written code + project structure
@powerclan19108 ай бұрын
@@y4ni608 let's hope @The Cherno gets to see this
@andreirusei24668 ай бұрын
What theme are you using for visual studio?
@lalishansh8 ай бұрын
Dark theme and visual assist color scheme, though if you are student i would recommend JetBrains IDE's (Rider for Visual Studio Solution based), they are faster and more accurate than `Visual Studio + Visual assist` (they just took time indexing symbols, after that they blaze through)
@gower19738 ай бұрын
He also spelt physicsbody wrong in the typename
@nathbarbosa837 ай бұрын
I love your videos, but for some reason they give me headaches
@n8style8 ай бұрын
love a Ph *s* ysicsBody, much better than a PhysicsBody lol
@mjthebest72948 ай бұрын
Where is the raytracing series? :/
@Mempler8 ай бұрын
ive eaten it.
@krids35468 ай бұрын
Black myth wukong,i need reaction from u,please❤
@skeleton_craftGaming8 ай бұрын
Java code is always horrible... (saying this makes me happy) though no its not Java. All code written in any true OOL* (ie java, JavaScript) . I think that true OOP generates messy code as a necessity *to be a true OOL at least two things have to be the case 1) the smallest exposed unit in a translation layer has to be an object 2) all classes [either directly or indirectly] have to inherit from one single base class [most of the time named Object]