Optimization October!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
ah so i did a live stream last night she's up to no good she's going to pull something out of there and then she's going to steal it and play with it she's contemplating is it worth it [Music] okay diffused bomb defused and in the stream i talked about the theme for this month it's optimization october i've wanted to do this for the longest time and so when a month starting with the letter o finally rocked up i had no choice basically what we're going to be doing this month is optimizing hazel let's talk about what that means so those of you keeping up with the hazel devlogs have probably noticed that hazel is coming along pretty well like we seem to be getting all of these new features and you're probably wondering when are you going to start making games with hazel and the answer is that's already happening there are several game projects that are currently being worked on using hazel however i can't talk about them just yet but what has happened is that those projects have highlighted some of the performance and usability issues that hazel has now most of these issues i've been aware of there are things that i've been meaning to get back to later because you can only develop a game engine so fast but some of them some of them i didn't quite expect so what we're going to do is build our own game during live streams that are going to specifically exploit some of these issues so that we can then optimize them and that's effectively what we started last night i called it project orange why orange because i just needed like a code name and orange is my favorite color so there we go what's the game cubes falling out of the sky something like that it's really quite fun but again the point of this game is to create ourselves honestly like a little test that combines all of the worst features of hazel so that we can then like use that as like a benchmark so that we can kind of measure their performance work to improve them and then see the improvement and what i'll be doing is kind of using that as a teaching tool to hopefully like document this process to show the improvement and how i'm actually able to to do this optimization one of the hardest things for me whilst developing this engine is specifically choosing to do things in a way that i know i'll have to get back to later just because it doesn't make too much sense for me to narrow in and focus on something at that current stage either because there are other features that need to get done or simply because we just don't know the full extent of the problem so why spend time optimizing a solution that might need to change later but now we kind of like there are some things that are more or less like we're comfortable with them they've been around for a year we know they're gonna basically stay the same way we've learned a lot the whole team has learnt a lot and we've had some experience from people making actual games that can show us like what what's bad and what needs to change also when i say optimization the word optimization and what it means in the scope of this month it's not just simply optimizing performance so reducing something from taking two milliseconds to one millisecond that's not that that's not the full picture i'm talking about optimizing everything optimizing your whole life not just performance so i'm also talking about optimizing like the usability of hazel so in other words if you want to achieve a particular effect or make something in your game maybe there's an easier way for you to do that maybe there are certain features even certain small features that are simply missing that would make your life easier so that you wouldn't have to kind of go through the work around to make that happen a few of those have popped up throughout game projects but then there's also like all of the code the code in certain areas is quite messy it's not very well documented and it's it's probably probably has some bugs in it let's be honest but basically there are a few things that i've written down here as to what exactly needs to be optimized and this is more from like a performance perspective so the first thing is the renderer there are a lot of things there that we are not really doing correctly and i mean we'll probably discuss them more like in videos later on this month but just know that like specifically the renderer needs to be optimized uh also we want to be able to do instanced rendering so at the moment if you are rendering five cubes you just render them as like five separate draw calls whereas it's possible to kind of be like hey the geometry is the same so we can kind of optimize that use case because that's actually quite common also because our renderer literally has like no optimization at the moment meaning there's like no culling of objects there's like no sorting we end up with like a lot of overdraw and a lot of other needless stuff that gets submitted when it shouldn't be there's also a bunch of like other low-level rendering things which we'll get to assets and memory usage ah we don't i don't think we even unload assets ever at the moment apart from like maybe if you unload the whole scene so in other words once you load an asset it's there for good we don't really manage memory at all i mean i've got 32 gigs on my it seems to work that's not good the scripting runtime so the way that c-sharp scripts work at the moment especially when we want to instantiate prefabs and a lot of them during the runtime of a scene that can get quite slow and i've actually looked at like profiling results in the past and i know that that's a bit of a bottleneck so we'll also have to basically probably explore the entire script engine runtime and finally finally in terms of performance the big thing you've all been waiting for [Music] multi-threading hazel has been designed in a way where multi-threading should be relatively easy to make happen so from the ground up i've kind of built it with that architecture in mind so that it wouldn't be a complete disaster to try and switch a single threaded engine to a multi-threaded engine however as it stands right now we only have a single main thread for basically everything in the engine except for audio so audio i think has two threads audio being done on another thread that's that's pretty obvious that's already done but the main engine and the way that it operates everything is on a single thread so all of like the asset loading all of the scripts all of the physics is done on the main thread and all of the rendering is done on the main thread that is that has to change because computers obviously have several cores which we can take advantage of and so specifically what we're going to be doing is moving the entire cpu side of rendering so all of the vulcan related code a lot of the rendering related calculations as well that have to be done mathematically all of that stuff is going to move on to its own thread so we're going to have a main thread and a render thread and then from there we can like branch off using a job system into many other kind of job threads basically if we need to that's going to be quite exciting because again i have been wanting to do that for so long but it's just one of those things that's a little bit hard to justify because performance has been surprisingly fine for a lot of things but now that real games quote-unquote real games have have started being made with hazel that kind of you know not scaling very well on the cpu side we're really beginning to see that because in a lot of the stuff that i've seen at least the gpu seems to be keeping up fine gpu times still quite low but the cpu seems to be the bottleneck so we're definitely gonna be able to optimize that by moving that rendering code to another core so for all of those optimization features i know all of you guys are really interested in that stuff so i will be i'll be trying to make as many videos as possible on those topics throughout this month i'm probably going to do like a weekly vlog i'll try and kind of summarize everything that's been going on i mean honestly i'm going to take this opportunity this month to just optimize my life as well not just hazel so i'll kind of try and take you along for the journey but as i mentioned there are also other things not just performance that we want to optimize so there are some features that are simply missing for example at the moment we don't really have a way to render transparent materials in hazel so if you want something to kind of fade out you can't really make that happen we like technically support that but there's no like proper way of doing it after the opaque pass or anything like that so we need a way to render transparent objects that just has to be done and there's a bunch of other usability things that i've written down here such as like you know when you click on the camera it'd be nice to see like a little picture in picture so that you can see like what the camera sees as you move that around in your scene in the editor we don't have that be nice to include that and there are also some issues with the current mesh workflow kind of system that also need to be improved so yeah that's basically the plan for this month it's going to be all about optimization i'm happy to announce that i won't be really working on any major features in hazel this month i can finally take a break from that take a step back and optimize what we already have if you guys have been accumulating a large amount of performance and tech debt in your own projects i also encourage you to maybe take a step back and spend this month along with me just optimizing everything and if you're not happy with how you're living your life and how you're structuring all of your projects and work around your life your work-life balance maybe all of that kind of stuff this is also the time to kind of take care of that so yeah optimization october let's make it a thing i'll see you guys in the next video goodbye [Music] you
Info
Channel: The Cherno
Views: 6,577
Rating: 4.9693723 out of 5
Keywords: thecherno, thechernoproject, cherno, c++, programming, gamedev, game development, learn c++, c++ tutorial, game engine, how to make a game engine, game engine series, hazel, optimization october, optimization, optimize, c++ optimization, game engine optimization
Id: ZJJdLhx9u9c
Channel Id: undefined
Length: 9min 20sec (560 seconds)
Published: Wed Oct 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.