Performance Bottlenecks in My Game Engine

Support and get Hazel ► / thecherno
Threads ► threads.net/@thecherno
Instagram ► / thecherno
Twitter ► / thecherno
Discord ► / discord
Hazel ► hazelengine.com
🕹️ Play our latest game FREE (made in Hazel!) ► studiocherno.itch.io/saving-c...
🌏 Need web hosting? ► hostinger.com/cherno
💰 Links to stuff I use:
⌨ Keyboard ► geni.us/T2J7
🐭 Mouse ► geni.us/BuY7
💻 Monitors ► geni.us/wZFSwSK
#Hazel

Пікірлер: 72

  • @mastershooter64
    @mastershooter6410 ай бұрын

    Haha yea who isn't addicted to speed!

  • @rapidstress2008

    @rapidstress2008

    10 ай бұрын

    "That's what she said" - A wise businessman, maybe

  • @Th3Y4nnix

    @Th3Y4nnix

    10 ай бұрын

    You can't sleep as a developer

  • @aaronmark3930
    @aaronmark39302 ай бұрын

    14:00 ohhh the aussie "noyyy" never get's old

  • @Zyhorn
    @Zyhorn10 ай бұрын

    Really enjoyable video, sad that it ended though. Wanted to see you tackle the bottlenecks and rewrite some code 😊

  • @Pspet

    @Pspet

    10 ай бұрын

    That probably takes weeks

  • @cookiecan10
    @cookiecan1010 ай бұрын

    For GetWorldSpaceTransformMatrix() if there is a parent, it gets called again because it's recursive, so for every transform matrix it might get called multiple times. Could that be the reason the amount of times the function gets called feels too high?

  • @Arwahanoth

    @Arwahanoth

    10 ай бұрын

    Yeah and it is counting recursive call but the out of scope is triggered after so maybe it is only counting time for the "leaf" ???

  • @sumikomei
    @sumikomei10 ай бұрын

    This was really cool to follow along with. I personally like this kind of content a lot, and I don't have anything that I would change about it.

  • @ChaoticFlounder
    @ChaoticFlounder10 ай бұрын

    Very nice video, good to see in depth thought process on detailed topics

  • @emilemil1
    @emilemil18 ай бұрын

    Moving loads from the GPU to the CPU or vice-versa is useful, but if you're already hitting your target framerate then there's no real benefit to doing so. In that case you could also use the "free" resources to do lower priority work. For example: - Precomputation for future operations, which can smooth out framerates. - Preloading of assets that might be used in the near future. - Updates that normally only run every few ticks, but can benefit from being real-time. - Improving existing operations, for example physics accuracy. - Perform heavy computations that you would prefer happen now rather than when resources are scarce, such as garbage collection. And the good thing about many of these is that they can be aborted as soon as the GPU is done and simply resumed the next tick.

  • @hawks3109
    @hawks310910 ай бұрын

    I'd love a video on how the compiler and other components work to actually package and ship the game itself. How is the exe built? How are the assets "cooked and packaged"?

  • @GameSmilexD
    @GameSmilexD10 ай бұрын

    Addiction to speed sounds like a paraphrasing for doing coke xD

  • @gamedev4432

    @gamedev4432

    10 ай бұрын

    It's actually what they call meth.

  • @ThyTrueNightmare
    @ThyTrueNightmare10 ай бұрын

    Hazel is getting to the point I could see myself using it for actually releasing games, question is what would the price be? I don't have a studio at the moment but it is a goal, with that being said I am very interested in VR and mod support for games within an engine

  • @redafakih12
    @redafakih1210 ай бұрын

    Awesome! However can we also see the asset pack binary format stuff? Would be also a nice dev log to watch.

  • @osys7832
    @osys783210 ай бұрын

    do you consider using valgrind to check the memory allocations/deallocations and/or intel vtune like cpu profiling or gpu profiling tools to check what’s going on and compare them maybe for unreal and/or unity?

  • @ShermanDev
    @ShermanDev10 ай бұрын

    "mmm, is too fast, something is wrong" 🤣

  • @vineilan
    @vineilan10 ай бұрын

    Awesome video like always!

  • @kirammanenjoyer
    @kirammanenjoyer10 ай бұрын

    Great video. PLEASE TALK ABOUT THE ASSET SYSTEM AND THE ASSET BINARY FILES PLEASSSSSSE 🙏

  • @JohnSmith-ze7sv
    @JohnSmith-ze7sv10 ай бұрын

    Cool video. If you want to trade memory for speed - you can always cache. Not sure if this is useful - but i'll share just incase it is. In my implementation of ECS i just return entity components by ref as opposed to by value. In the transformation objects themselves, I store the world matrix so that I update the matrix only when the transforms position,scale or rotation has changed. glm::mat4 Transform::GetWorldMatrix() { if (m_isDirty) { UpdateWorldMatrix(); } return m_mtxWorld; } I have an ECS-lite approach. I couldn't quite ditch OOP .... Components hold behaviour for manipulating the data they hold. It just makes sense to have that logic there.

  • @arrowsdev
    @arrowsdev10 ай бұрын

    much love man

  • @mascit
    @mascit10 ай бұрын

    we want more!

  • @arsenbabaev1022
    @arsenbabaev102210 ай бұрын

    Do you plan to support custom shaders / scriptable pipelines ? Or Hazel renderer is fixed to the PBR pipeline?

  • @Omar-mm6ms
    @Omar-mm6ms10 ай бұрын

    I cache the world matrix and have a flag that indicates whether it needs to be recomputed. That way it only gets recomputed if you try to access it and it needs updating. Most entities don’t move, so setting the flag on all descendants when an entity moves is relatively cheap.

  • @m00nshoes
    @m00nshoes10 ай бұрын

    good vid! do you plan on making a hazel profiler similar to UEs?

  • @zacharymiller7573
    @zacharymiller757310 ай бұрын

    Would you ever use a library like OpenMPI to partition tasks across CPU cores or is multi-threading sufficient for a game engine?

  • @goodecheeseburgers6320
    @goodecheeseburgers632010 ай бұрын

    THREADS!! ICANT😂 you do realise threads is going to be an echo chamber?

  • @nuttolum
    @nuttolum10 ай бұрын

    i just found this series because ive been working on my own game engine and wanted to see how other people did stuff, ive learned so much from it! will the vulkan renderer ever be put on the github?

  • @cankarkadev9281

    @cankarkadev9281

    10 ай бұрын

    It already is, but you have to be a patreon supporter to see it :D

  • @andy9999andy
    @andy9999andy10 ай бұрын

    Only mark object matrices (local and world space) as dirty, and only recalculate matrices when the matrix is requested. Recursive make child ws matrices dirty if needed, ie not already dirty or not dependent on parent matrix (world space object)

  • @martinlarsson6621
    @martinlarsson662110 ай бұрын

    I have a FPS Tracker package in my game which I knew was slow, and I know I could've optimized it myself. When deep profiling it took roughly ~3ms. Copied that block and pasted it into GPT and asked it to optimize it for me, worked on the first try and now it runs ~0.02ms during deep profile, everything worked the first time around, the AI made no glaring errors, I just refactored it slightly. It all took like 20-30minutes.

  • @infiteri6030
    @infiteri603010 ай бұрын

    Hes back

  • @Mnmn-xi6cj
    @Mnmn-xi6cj10 ай бұрын

    Cool video! I use Tracy myself and would be very interested in how you created these frame timers (HZ_SCOPE_PERF) 🙂

  • @imaymakesomevids

    @imaymakesomevids

    10 ай бұрын

    They're covered in one of the really early hazel videos, maybe the logging one.

  • @andersonklein3587
    @andersonklein358710 ай бұрын

    The thing I wonder is why not focus on optimizing the code running on the GPU? It might be bottlenecked by something silly even, like updating the textures every frame or sending tons of unnecessary buffers every draw? Because the Render Thread was waiting for the GPU, and the Main Thread was waiting for the Render Thread. The bottleneck was about 2 to 1 between the GPU and the CPU threads.

  • @luigidabro
    @luigidabro10 ай бұрын

    Why is Minecraft under the game category in the description?

  • @nerdastics3987
    @nerdastics398710 ай бұрын

    Cherno, what you are missing is SPEED IS KEY. also, one way to really speed stuff up is (if its available on your hardware) enabling intrinsics, like simd replacements for memcpy, memmove, etc. (i don't know if thats an option in msvc)

  • @user-sl6gn1ss8p
    @user-sl6gn1ss8p10 ай бұрын

    Is that the stanford bunny in the background?

  • @bagel7860
    @bagel78609 ай бұрын

    You forgot to add the annotation for your latest game jam game... 😭

  • @Asdayasman
    @Asdayasman10 ай бұрын

    That per-frame memory graph is fascinating - if the engine/game needs to allocate that stuff in one frame, then by the looks of things allocates it all again in the very next frame, why is it discarding it instead of reusing it? Would love to see words on that.

  • @rasmadrak

    @rasmadrak

    10 ай бұрын

    A guess - The entities were re-evaluated per frame due to the nature of the game - a game jam one. :) Any proper game would utilize cache and early out's to avoid allocating new memory.

  • @MrHuman-iy5lw
    @MrHuman-iy5lw10 ай бұрын

    i wish to have vulkan series chernooooooooooo

  • @user-tz4tl1zw7j
    @user-tz4tl1zw7j10 ай бұрын

    hey Cherno. when are you going to switch vulkan in 2d hazel

  • @absorbingdude

    @absorbingdude

    10 ай бұрын

    there’s no way I think, lots of things to cover, but if you are a little experienced with vulkan it’s not a problem to implement hazel with it, like I’m doin

  • @user-tz4tl1zw7j

    @user-tz4tl1zw7j

    10 ай бұрын

    @@absorbingdude where can i learn vulkan-hpp

  • @GamerPlaya12

    @GamerPlaya12

    10 ай бұрын

    @@user-tz4tl1zw7jvulkan-hpp is not needed. But if you want to learn it there are githib repos with samples

  • @absorbingdude

    @absorbingdude

    10 ай бұрын

    @@user-tz4tl1zw7jWhat about these great resources that helped me a lot: 1) vulkan-tutorial (base-база) 2) vkguide dev (there’s pretty good abstraction around descriptors) 3) Dustin H Land’s site fasterthan life (he ported doom to vulkan) also he explains what it costs to port something to vulkan 4) This year I saw lots of vulkan videos on YT, so just explore If I remember something useful maybe I’m gonna edit this comment. Edit1: I also remembered, there’s an indie developer (cakez) he has game series vulkan c++ on YT, I advise you to look at them. Edit2: Sascha willems samples && vulkan samples Edit3: also some extremely helpful theory videos are called “Vulkan lecture series”

  • @user-tz4tl1zw7j

    @user-tz4tl1zw7j

    10 ай бұрын

    @@GamerPlaya12 thank you

  • @eggmeister6641
    @eggmeister664110 ай бұрын

    Wasn't the previous bottleneck because you turned memory streaming on and the gpu wasn't using vram, but system ram instead?

  • @randomWork111
    @randomWork11110 ай бұрын

    Is it possible to use c++ to transfer huge volume(10 gb or more) of data from one system to another. system..will it support? Thanks Cherno

  • @charlielarson1350

    @charlielarson1350

    10 ай бұрын

    our ancestors have used C++ to transfer large data between systems for millennia

  • @not_herobrine3752
    @not_herobrine375210 ай бұрын

    can relate to the advice for optimizing for pc; i may have a mid range graphics card (for 2016), but theres no telling what the game is going to get run on though id personally work on the weakest hardware i find so as to cater to the greatest common denominator

  • @bobdagamer640

    @bobdagamer640

    10 ай бұрын

    When you're developing you need better hardware because the debug versions normally run slower

  • @not_herobrine3752

    @not_herobrine3752

    10 ай бұрын

    @@bobdagamer640 thats literally the physical reminder to create software that doesnt run like treacle on underperforming hardware

  • @bobdagamer640

    @bobdagamer640

    10 ай бұрын

    @@not_herobrine3752 the debug version will run slower when you're developing than the release version that will go to users

  • @not_herobrine3752

    @not_herobrine3752

    10 ай бұрын

    ​@@bobdagamer640 it is true that the debug version of some software will run slower on underperforming hardware than the release version that is expected to run on more performant hardware however if the developer ensures that this slow debug version runs fast enough on said underperforming hardware then surely there wont be any problem regarding performance because the user will logically only see a performance *increase*

  • @Bodzilla001
    @Bodzilla0015 ай бұрын

    Can you do a gaphics/engine react video on the GTA 6?

  • @yanko694
    @yanko69410 ай бұрын

    anyways gamefromscratch could do a review on hazelengine?

  • @fatsu
    @fatsu8 ай бұрын

    superluminal?

  • @keptleroymg6877
    @keptleroymg687710 ай бұрын

    Show us most important parts of engines source code

  • @alec_almartson
    @alec_almartson10 ай бұрын

    Really... Need For Speed 💯🎮👌🏻💻

  • @xXkelseyXx1
    @xXkelseyXx110 ай бұрын

    I am speed

  • @Jkauppa
    @Jkauppa10 ай бұрын

    need for speed hmh

  • @mrthomaschannelearth
    @mrthomaschannelearth10 ай бұрын

    So nobody is going to mention the cuteness at the start.. OK we live in a cold world I got it

  • @mastershooter64

    @mastershooter64

    10 ай бұрын

    Nah lol you're the one who missed out and didn't see the cute baby editor, we all finished talking about it!

  • @crazycdn8327
    @crazycdn832710 ай бұрын

    Sadly no one is using threads. Just stick to something like twitter. I'm not willing to download another app but wouldnt mind following you.

  • @debonairrose
    @debonairrose10 ай бұрын

    3:10 i know that hazel is the game engine. but you saying "huge thanks to hazel for sponsoring this video" triggered my fight or flight response and i had an impulse to skip this part of the video.

  • @MuhammadHosny0
    @MuhammadHosny010 ай бұрын

    Hazel website is dead