Hazel - My Game Engine // Code Review

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 มิ.ย. 2024
  • Visit brilliant.org/TheCherno/ to get started learning STEM for free, and the first 200 people will get 20% off their annual premium subscription.
    Get Hazel here! ❤️ ► / thecherno
    Instagram ► / thecherno
    Twitter ► / thecherno
    Discord ► / discord
    🕹️ GAMES MADE IN HAZEL
    Forest ► studiocherno.itch.io/forest
    Fragile ► studiocherno.itch.io/fragile
    Space Invaders clone ► • He MADE A GAME using m...
    One Hour Rocket game ► • Making a Game in ONE H...
    CHAPTERS
    0:00 - What is Hazel?
    3:49 - Repository and project overview
    5:49 - How many lines of code is Hazel?
    6:41 - Running Hazel
    11:16 - Entry point
    15:11 - Application architecture and Layers
    19:55 - Events
    21:03 - Main application loop
    22:06 - Hazelnut: Hazel's Editor
    22:40 - A note on large source files
    25:43 - Playing, updating and rendering scenes
    34:15 - Rendering architecture
    38:52 - Next steps
    Send an email to chernoreview@gmail.com with your source code, a brief explanation, and what you need help with/want me to review and you could be in the next episode of my Code Review series! Also let me know if you would like to remain anonymous.
    This video is sponsored by Brilliant.
    #CodeReview

ความคิดเห็น • 219

  • @TheCherno
    @TheCherno  ปีที่แล้ว +33

    Hope you enjoyed a look at Hazel - more to come! Also definitely visit brilliant.org/TheCherno/ to get started learning STEM for free, and the first 200 people will get 20% off their annual premium subscription.

    • @oamioxmocliox8082
      @oamioxmocliox8082 ปีที่แล้ว +1

      ;)

    • @PhoenixDigitalGamer
      @PhoenixDigitalGamer ปีที่แล้ว +3

      Can u make tutorial on creation of game engine Cinematics system. Please :)

    • @user-fn3qd8fc3c
      @user-fn3qd8fc3c ปีที่แล้ว

      サイキックフィーバー🇯🇵🏎️

    • @cherno2232
      @cherno2232 ปีที่แล้ว +1

      No I'm cherno

  • @ChimeraReiax
    @ChimeraReiax ปีที่แล้ว +329

    Imagine if you finished this review going "woof, this whole thing needs a rewrite"

  • @myanrueller91
    @myanrueller91 ปีที่แล้ว +28

    The large file size bit:
    I'm always of the thought that if the file will be as large as it needs to so long as it only does what is in its domain. For example, if the renderer also ends up implementing math functions for physics, that's when I might break things out.

    • @navibongo9354
      @navibongo9354 ปีที่แล้ว +6

      Completely unrelated but i love ur dog! Hes super cute

    • @Ulchie
      @Ulchie ปีที่แล้ว +5

      @Harshil Pandey "Completely unrelated but..." I... think they know that...

  • @elturco9573
    @elturco9573 ปีที่แล้ว +14

    Cherno, it's great to see someone explain the code for their own game engine. Thanks.

  • @mjthebest7294
    @mjthebest7294 ปีที่แล้ว

    Can't wait to see the follow up videos. This is very motivating!

  • @c.codyflick2210
    @c.codyflick2210 ปีที่แล้ว +23

    Loved the Ctrl+m text overlay. Literally was thinking to myself last night how I need to learn more keystrokes in VS but as I'm still learning it's hard to know what the useful ones are, or what they'd call the ones you use and I love the style of navigating code and highlighting/replacing text you use. I think I've seen in discord that your vs profile is available or something, but it would be great to have one quick video of all the shortcuts you use so I can be faster. Thanks for all the great content!

    • @Rythm0562
      @Rythm0562 ปีที่แล้ว +2

      I love you so much for telling me the keybind

  • @skip9827
    @skip9827 ปีที่แล้ว +2

    to see your progress motivates me good job keep going

  • @icesentry
    @icesentry ปีที่แล้ว +3

    Would love to see a video doing an overview of the sound graph thing.

  • @juanfranciscocastillo5149
    @juanfranciscocastillo5149 ปีที่แล้ว

    Great job!! 🛸🙋🏻‍♂️

  • @nicholasamaral7156
    @nicholasamaral7156 ปีที่แล้ว +1

    Would love a sequel with the audio part :)

  • @mishabytes8209
    @mishabytes8209 ปีที่แล้ว

    you’re an inspiration to me

  • @mkfusion2522
    @mkfusion2522 ปีที่แล้ว +1

    There's always something in these videos, that attracts me. It's always an inspiration.

  • @Steven-tw7iz
    @Steven-tw7iz ปีที่แล้ว +6

    I am sure many people want to dive into a lot of the complex systems like rendering and events and what not. But I'm sitting here wondering how the launcher works lol. Would be super cool to see how to put that together :)

  • @TeriyakiTakeout
    @TeriyakiTakeout ปีที่แล้ว +1

    I haven’t watched you in a while, although I have always loved and used your content to learn, but I just want to make sure you are okay because you seem absolutely exhausted. Like, you seem so tired to me, from your voice and mannerisms in comparison to a few years ago. Please make sure you are taking care of yourself and your energy. Love your content either way, even if I’m catching up after a few years.

  • @MBBGun14
    @MBBGun14 6 หลายเดือนก่อน

    This is amazing

  • @BenBE1987
    @BenBE1987 ปีที่แล้ว +3

    Re around 25 min in with the array marshalling: If you need to look up how that is done it's likely complicated enough that you might be better of abstracting it away. Putting DRY to the extreme might not be the solution either, but abstractions (especially when they can be done at zero cost™) can help to improve your overall project and code structure. That being said: While having large files isn't wrong by itself, the scripting engine example is a good place where it might be worth considering to split things by topic (one file per subject: audio, 3D objects, rendering, shaders, utils) as even though regions (as seen in the video) give one level of structure, so can both additional files and folders.
    In my projects I often tend to split heavily by functionality/concerns. Simple example: Consider a motor controller you need to talk to: You have one layer raw communication (like a serial cable or digital signal), one layer for the communication protocol (implementing e.g. frame encoding/decoding or checksums needed for command frames), another one for the commands you need to send (go forward, backward, speed control, acceleration, breaking), the control logic (does it make sense to hit the break while pushing full speed ahead?), and finally the actual application logic. That's 5 layers of distinct functionality that should be reflected in the code by splitting those concerns. In my case this would likely result in about 5 code files (+headers), even though those all are concerned with driving that one single motor (controller). And similar can be applied to your scripting engine and interfacing logic: One layer just interfacing the raw data types and helper functions/classes for that task, a second layer (potentially split horizontally) to map/translate your logic, and a third layer implementing high-level logic that's not just plain mapping/translation between those two worlds. I see why you might want to do it in one big file, but abstraction and grouping of concerns may reduce the amount of code you write and as a side effect even make it more easy to understand overall.
    2ct

  • @Fewkulele
    @Fewkulele ปีที่แล้ว +2

    Would love a video about your sound graphs and your audio engine

  • @HappyMatt12345
    @HappyMatt12345 ปีที่แล้ว

    So basically this video is exactly what I do whenever I look back at Its a Cube and especially Deathly Descents code base lol. This will be cool to watch!

  • @diligencehumility6971
    @diligencehumility6971 ปีที่แล้ว +1

    Wow the UI looks smooth

    • @exa211
      @exa211 6 หลายเดือนก่อน +1

      It looks exactly like Unreal Engine 5

  • @s1nister688
    @s1nister688 ปีที่แล้ว +4

    Looking forward to videos on modifying imgui to have no titlebar and making these modern looking UIs, and the node editor that you have. :D

    • @Ev3r0x
      @Ev3r0x ปีที่แล้ว +2

      Imgui has nothing to do with that, titlebar belongs to non-client area and can only be removed using winapi. It's most often done using DwmExtendFrameIntoClientArea function

    • @evannibbe9375
      @evannibbe9375 ปีที่แล้ว

      I don’t like that aspect of games, since it takes away power from the user. Getting rid of the red X in the corner is what different malware use to undermine the confidence of newbie computer users.

  • @epiphaeny
    @epiphaeny ปีที่แล้ว +2

    I am actually pretty happy, when I have to deal with only 3000 loc in a file :D. Some older files in our projects have almost 30 000 loc that are hardcore old C style code with goto's and up to 15 nested if statements and loops... Those files are absolutely insane.

  • @NeiroGMD
    @NeiroGMD ปีที่แล้ว +2

    Hi! Nice video! I have a question to run user's scripts are u using multi threading?

  • @benoitrousseau4137
    @benoitrousseau4137 ปีที่แล้ว +5

    Just my 2 cents, but personally I prefer spreading the implementation of my very large classes over multiple cpp that cover a facet of it, ie: mainscene_physics.cpp, mainscene_rendering.cpp, mainscene_devmode.cpp, etc. That's a very "C" approach to structuring code but it works better for me than a giant file that I need to Ctrl+F or use VAssist to find anything, or that constantly needs merging because everyone works in it. This is also really nice to avoid Windows.h macro pollution if you sandbox the platform-specific parts of a class into its own cpp.

  • @teamclouday
    @teamclouday ปีที่แล้ว +3

    Would love to learn how the engine handles shadows for so many point lights😀

  • @Veraxo
    @Veraxo ปีที่แล้ว

    amazing

  • @gwentarinokripperinolkjdsf683
    @gwentarinokripperinolkjdsf683 ปีที่แล้ว +2

    Hay I just wanted to comment about a game engine feature that I really think more game engines need.
    Unigine is the only modern game engine I know of that does this.
    Unigine is effectively just a library, you still control the main function in your game, this allows for significantly more freedom.
    If you still can, please try and make that a possibility in Hazel, and check out Unigine they do some very cool stuff that's not standard for game engines.

    • @GonziHere
      @GonziHere ปีที่แล้ว

      Because Unigine is aimed at industries. But still, I absolutely agree. It's my most favorite engine, actually, because of things like these. It feels like a well documented toolset rather than opinionated program.

  • @powerclan1910
    @powerclan1910 ปีที่แล้ว +3

    What are your plans for Hazel in the long run. Do you want to build your own indie games with it, or do you want to become competition for the big 3 of game engines? (not including propriatary engines ofc)

  • @Gmitbotw
    @Gmitbotw ปีที่แล้ว +11

    Having a 3k line of code file isn't good for compilation times since it can't be compiled in parallel.
    Also, the most important thing is *recompilation* times. If you modify a single line in this file the whole 3k lines have to be recompiled.
    Also, having an organized file structure for your different functionality is a good thing for code maintainability in the long run with a bigger team.
    At work we have some C++ files of 15k+ lines and it's a pain... There is a huge effort to refactor them into smaller files.
    Also, CTRL-F can easily be replaced by a grep command or some CTRL-SHIFT-F

    • @edwin5145
      @edwin5145 ปีที่แล้ว +1

      But it is good for performance given that everything in that file can be inlined if used within the same file without the use of lto. Besides, it's just 3k likes, that isn't that much.

    • @Gmitbotw
      @Gmitbotw ปีที่แล้ว +2

      @@edwin5145 But you have LTO, so that doesn't change anything. Having a 3k lines file isn't the end of the world, but splitting up your files can really improve iteration speed when you need to recompile your code.
      And IMO if you have good code navigation tools in yout IDE (idk about VS), I find it easier to find what you're looking for, but that's a personal thing

    • @gulneckm.3475
      @gulneckm.3475 ปีที่แล้ว

      @@Gmitbotw He uses visual assist, so he should have no problem navigating around.

    • @dankmemesstudios3987
      @dankmemesstudios3987 ปีที่แล้ว +1

      But on the flip side you have thousands of files, split over hundereds of 'organized file structures' and you have to open up uselessly many files to find what you actually need. Then you need to change something and then go through all these other files to change it properly. And then what about your member data? A class is a nice things because it contains also data. Now you have to worry about how the data gets transfered between different files or you have to build a large data struct which you create here and then pass along there. And if all your 'organized files' just contain some static functions that take in data and spit it back out, then why not just have them back into the initial file in the first place (apart from your recompilation argument)? Like all things you have to have a good balance between under organizing your project and over-organizing it.

    • @dankmemesstudios3987
      @dankmemesstudios3987 ปีที่แล้ว +1

      And I should mention that splitting things up into many different files is much better AFTER you have figured out how the program will achieve it's end result. Otherwise doing it too early can be very very bad. Say you thought of this 'idea' about how to do it, and then you go about making all these small files and abstractions which removes flexability in your program. Then you idea turns out to be flawed. Then you hate life. So aswell as personal preference it also depends on the stage of your program if splitting things up is a good idea also.

  • @astroid-ws4py
    @astroid-ws4py ปีที่แล้ว

    Cool, Thanks..

  • @mindgame6404
    @mindgame6404 ปีที่แล้ว

    Great content. May I know what font are you using in this vid?

  • @snesmocha
    @snesmocha ปีที่แล้ว +4

    when hazel releases, is it possible to bypass the c# scripting and directly use the c++ api?

  • @neubertdaniel
    @neubertdaniel ปีที่แล้ว

    Just wondering for some time now: what camera and lens are you using? Looks great.

  • @kurciqs8355
    @kurciqs8355 ปีที่แล้ว

    the epicest ever

  • @manucanedo8039
    @manucanedo8039 ปีที่แล้ว +8

    What's the Cpp standard the project uses? Unrelated question, why don't you AAA (almost-always auto)?
    It's cool to see that you can simply stop App from running, cleanup and let that while loop restart your everything. Most code I see out there has many global static objects (such as singletons) lingering around that force to fully stop the execution to do a complete reset.

    • @Ev3r0x
      @Ev3r0x ปีที่แล้ว +2

      C++17

    • @lalishansh
      @lalishansh ปีที่แล้ว +1

      Try writting code without intellisence you'll know (experience from cpp20 modules)

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      " why don't you AAA (almost-always auto)?"

    • @manucanedo8039
      @manucanedo8039 ปีที่แล้ว

      Yo are right about intellisense. But not using a code server it's a voluntary choice and we should not pesimize maintainability and performance based on a developer's choice to not use tools.
      Regarding the las reply. What's the runtime performance cost of type deduction? None. AAA in large codebases actually improves performance because i avoids implicit conversions.

  • @user-ux3cp4kr6r
    @user-ux3cp4kr6r ปีที่แล้ว +1

    All code in one file?! Great

  • @mastershooter64
    @mastershooter64 ปีที่แล้ว +1

    Cherno in the intro:
    Standing here I realize....

  • @G1g4ntvltLP
    @G1g4ntvltLP ปีที่แล้ว +1

    Hey CHerno, super interesting! It would be kinda nice, if you would have the time to do a video on the custom render RenderQueue, or at least the concept of creating a fixed sized buffer, submitting functions with parameters into it and then retrieving everything during process. I can't figure it out on my own and also do not know where and how you would learn this...

  • @TheDoomerBlox
    @TheDoomerBlox ปีที่แล้ว +1

    30:00 - Hey look, it's another version of the Tesselated Ocean Simulation Underneath the Game World (achieved with CryEngine 3(tm))
    Very cute!

  • @GonziHere
    @GonziHere ปีที่แล้ว +11

    While I absolutely agree with readability of the (reasonably) larger files, there is one caveat to it, which is IMO the main reason against it: refactoring and teamwork. Say you have 10 people and every one is touching something between cpp and csharp. They might touch totally different parts of it for totally different reasons, but they will have to deal with it in the merge. On the other hand, if one touched "arrayglue.cpp" and other touched "stringglue.cpp", its easier to see/review those changes for others while also preventing merge conflicts.
    Add to it, that someone actually changes something in a more meaningful way (say reorder/rename/split of a few functions) and you are in a world of hurt.

    • @TurtleKwitty
      @TurtleKwitty ปีที่แล้ว +1

      Other than the fact that two people working in entirely different parts of the file nowadays is basically free to merge because the auto merging is smart enough to realise theyre entirely different parts of the file you'd be right

    • @GonziHere
      @GonziHere ปีที่แล้ว +1

      ​@@TurtleKwitty yeah... unless you move something somewhere ;)
      I'm not saying that it will be an issue at every single merge, but it's enough to be annoying.
      For us, it was typically something like menu, because reordering was producing conflicts and EVERY time two developers have tried to add something at the end, it was a (simple) conflict.
      The general idea is that you should have a file(or files) per feature, so that when you work on said feature, you aren't touching anything else (think modules).
      The glue isn't a feature, it's a layer.

    • @gulneckm.3475
      @gulneckm.3475 ปีที่แล้ว

      VSS has merge tool built-in so it's not an issue.

  • @Glyn-Leine
    @Glyn-Leine ปีที่แล้ว +17

    I partially disagree with the large files thing. the script glue stuff for instance could be a large folder instead. i generally find things easier to find in well organized folder structures with medium sized files than in a large file

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว +1

      So you're going to search file contents in your folder by catting them all or something to find the example you're looking for and that is somehow more convenient to you than ctrl+f? I don't buy it. It is often the case that you need to find some piece of code but don't know quite exactly where it is, and you are suspecting perfect recall of which of those many files you will need to check. Yes, you can work around this by gluing yourself to an IDE that will search the entire project...

    • @Glyn-Leine
      @Glyn-Leine ปีที่แล้ว

      @@zvxcvxcz I barely ever use ctrl+f I always use ctrl+t, also if you name your files correctly then it won't be an issue to know what is in which file

    • @majormalfunction0071
      @majormalfunction0071 7 หลายเดือนก่อน

      ​@@zvxcvxczC++ is harder to search, but grep will find the definition and references if you know the symbol. I use 'sed -i s///g ' to globally search and replace.

  • @normwaz2813
    @normwaz2813 ปีที่แล้ว +1

    Really enjoying your videos. Quick question - how do AAA game engines export game projects to an executable format?

    • @kendarr
      @kendarr ปีที่แล้ว +1

      I belive they build it, like unreal or unity does, I don't know what they do do technically speaking tho

    • @cvspvr
      @cvspvr ปีที่แล้ว +1

      they run it through a compiler like visual studio but with more files automatically generated by the game editor

  • @tematoscybersage5626
    @tematoscybersage5626 10 หลายเดือนก่อน

    Do you have main targets in developing of Hazel? Like unique benefits comparing to other engines? Or it mostly simplicity and education?

  • @CreativeOven
    @CreativeOven ปีที่แล้ว

    Thanks to explain the actual state of your engine, looking forward to use it any luck with mobile phone developement what about linux?

    • @evannibbe9375
      @evannibbe9375 ปีที่แล้ว +1

      Apparently the community has made it work in Linux if what he said at the start of the video is correct.

  • @theforthdoctor7872
    @theforthdoctor7872 ปีที่แล้ว

    Reminds me of that sticker you will find of many Monty Python books
    "Winner of the Monty Python award for their own books..." 🤣

  • @jarekmyszko3332
    @jarekmyszko3332 ปีที่แล้ว +9

    @The Cherno To answer your question at 23:25: Let's say you just started your project and you have 6 interconnected classes. It's easier to just swap between the files in your project viewer than keep scrolling up and down. Also, from the psychological point of view, when you have to look through large amount of code your brain subconsciously analyzes a lot of text, which may cause a feeling of being overwhelmed. I prefer to encapsulate a simple functionality in a small class, which I can then save in a separate file and forget.

    • @zdeneksotolar2852
      @zdeneksotolar2852 ปีที่แล้ว +1

      Hi. You can have a similar feeling just to see over 50 files that are interconnected in some way. I´d say it has to have a technical meaning to divide a feature into more files/classes. About "ubconsciously analyzes a lot of text"... let´s say you need to go through all the different files to put together the solution to the problem. You can´t just forget what you saw. Navigating through one file is much easier than jumping around among files if it´s done properly.

    • @jarekmyszko3332
      @jarekmyszko3332 ปีที่แล้ว +2

      ​@@zdeneksotolar2852 I like to work with people that use descriptive function and class names and organize them in files with similar names. If there is a bug and it takes me more than 5-10sec to analyze the code/algorithm then it's a waste of time.
      I currently work on a project that has thousands of files, each with about 100-200 lines, all well organized in filters(VS) and I don't have to remember more than 3-5 at a time. I can't imagine the pain of debugging that code if they would put it in fewer, larger files, but then again, maybe for you it's easier.

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      Nano doesn't have a project viewer, nor do gedit or notepad... it's easier for me to ctrl+w than monkey around in a bunch of files... I'm often working on remote servers without a GUI. Yes, there are IDEs with no GUI... but the chances that it will be configured the way you like on the server are slim. Yes, you can move around the profile... but that's a slow down all by itself.

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      @@jarekmyszko3332 "If there is a bug and it takes me more than 5-10sec to analyze the code/algorithm then it's a waste of time. "

  • @AntonioNoack
    @AntonioNoack ปีที่แล้ว +3

    Why is there a sponsored section in a video, that is effectively an ad (for a commercial project, because access *is limited to paying people) anyway? 🤨

  • @TheWayManREAL
    @TheWayManREAL ปีที่แล้ว

    What are your opinions on carbon? I am sure someone has been trying to ask, will you make a vid on it?

  • @CamdenVaughan
    @CamdenVaughan ปีที่แล้ว +10

    Would love to see you do something like this but going through godot or unreal engine

    • @yoshi314
      @yoshi314 ปีที่แล้ว

      oh boy, he'd never finish that.

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      I think Unreal Engine is closed source? Godot is all available though. Ah, interesting, Unreal Engine is source available commercial, not sure if one could comment on it in a video under the license though, maybe, probably fair use but might be pushing the envelope a little.

    • @CamdenVaughan
      @CamdenVaughan ปีที่แล้ว

      @@zvxcvxcz Its full open source and its license lets you comment on it or adapt it fully main stipulations come from actually using it, there are a couple of TH-camrs who have made videos about its achitecture but I would love to get Cherno's opinion on it, but I bet that would be a massive undertaking so I don't expect it :(

  • @developer6508
    @developer6508 ปีที่แล้ว

    Hey bro you have that "Open file in solution" extension, it won't be that hard for you to find necessary file if you split it onto multiple

  • @zvxcvxcz
    @zvxcvxcz ปีที่แล้ว

    Why aren't you statically linking assimp? I'm a bit of a noob at this... but oh, is it because Forest was a game jam game so you wanted a faster compile cycle?

  • @maxi-g
    @maxi-g ปีที่แล้ว

    why did you choose to use openGL instead of DirectX as the graphics api ?

  • @benlee6140
    @benlee6140 ปีที่แล้ว

    Hi will you make a video talking about Carbon, the new language Google invented to replace C++? I'm really interesting in your thought! Thank you ~

  • @saomoon
    @saomoon ปีที่แล้ว

    what ide are u using?

  • @erenenadream
    @erenenadream ปีที่แล้ว

    Hello @TheCherno I have downloaded your lastest github repo (master branch). And I have runned cloc program and it says 6464 lines of code total in Hazel-master\Hazelnut\src. Why is that ??

  • @DiogoManteu
    @DiogoManteu 11 หลายเดือนก่อน

    I was stunned by the quality of the engine and then I remembered. Oh yeah this guy coded the engines for EA

  • @madeso
    @madeso ปีที่แล้ว

    17:45 wouldn't it be way better if you could connect to the game your are playing on your phone in the editor instead? Like unity remote or chrome devtools.

  • @RomanianProductions
    @RomanianProductions ปีที่แล้ว

    The logo in your thumbnail looks a lot like the Hostinger logo

  • @visuallization
    @visuallization ปีที่แล้ว

    Holy moly, hazel looks almost like unity!

  • @Lameless
    @Lameless ปีที่แล้ว

    Is hazel gonna have implemented multiplayer?

  • @teyo_gh
    @teyo_gh ปีที่แล้ว

    Love your videos. Can you do one on Carbon the new programming language intended to replace C++. I would like to know your opinion it.

    • @xr.spedtech
      @xr.spedtech ปีที่แล้ว

      C++ is it's own successor ...

  • @SabeDoesThingsChannel
    @SabeDoesThingsChannel ปีที่แล้ว

    What is your visual studio theme?

  • @victordedon3917
    @victordedon3917 ปีที่แล้ว

    Hi please could you do a Video on Carbon and what you think about the language?

  • @lavakusa9638
    @lavakusa9638 ปีที่แล้ว

    Please make a video about design patterns in c++..
    I read documents and manuals in internet but not able to understand properly..
    If possible make a short video about it..

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      Don't worry, design patterns are just opinions. That's how you should think of them, they're just common ways that some opinionated people like to organize their code. They may or may not be applicable or appropriate for the problem you are actually working... so while they may inform you approach, don't be afraid to ignore them when they don't fit your use case.

  • @neotune64
    @neotune64 ปีที่แล้ว +3

    Hey, Yan, what are your thoughts on rust?

  • @unkgames-abdullahali4048
    @unkgames-abdullahali4048 ปีที่แล้ว

    Could u make blueprint code (graph editor) on your game engine "hazel"

  • @thebasicmaterialsproject1892
    @thebasicmaterialsproject1892 ปีที่แล้ว

    oi oi to the cherno is there any nvidia cuda round here i just got a nividia gpu

  • @RogyDev
    @RogyDev ปีที่แล้ว

    What about spot lights?

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว

    Looking at all of those includes you must be chomping at the bit to get modules in C++.

  • @evantseng6832
    @evantseng6832 ปีที่แล้ว

    “cannot open Hazel/vendor/Glad: No such file or directory”
    Hello Cherno, I have this issue when running the setup.bat. But I'm sure that Hazel/vendor/Glad exist. Could you please let me know if you have any idea?

    • @ghitagusteru7823
      @ghitagusteru7823 ปีที่แล้ว +1

      Did you recursively clone the repository?

  • @davidheary2482
    @davidheary2482 ปีที่แล้ว

    For the algorithm

  • @felipelopes3171
    @felipelopes3171 ปีที่แล้ว

    From my perspective, it's very hard to justify huge files. There are several reasons:
    (1) compiler optimizations work by applying several passes of optimization algorithms. If there's way too much data, this optimizer can get lost and it will waste a lot of compilation time without optimizing anything.
    (2) if something changes in that file, the compiler will have to recompile everything, and if you change signatures or types, it's likely that will cascade to everything that depends on it, which can be even the entire code.
    (3) The complexity of the code grows exponentially with the side. It's much easier to read code scattered on several files than a large one, because dependencies are more constrained. There have been several times in my career where I stuffed a lot of things in a class because I needed them to optimize things. I thought "yeah, it's unavoidable", and only after I broke up the file in desperation, it was obvious to see that I could have used a better data structure, initialize something to speedup queries later, use a design pattern to make something configurable, etc. I literally could only see this after I broke up a giant file.
    (4) if you go by the data, software engineering research is pretty much unanimous on this. They call it the god class code smell, and studies show that it slows development quite a lot. Try to keep your classes small!

    • @zvxcvxcz
      @zvxcvxcz ปีที่แล้ว

      1) Compilers seem to slow down much more dealing with code spread across many files, or perhaps it is the linkers that do, but in any case that seems to slow down the build more than having the code in fewer larger files, this also matches Chernikov's experience.
      2) No disagreement on this point
      3) I couldn't disagree more. One large file allows reading code that belongs together conceptually to actually be together. The code complexity is identical. We're dealing with file size, not different algorithmic choices. Spreading it across many files just increases cognitive load as we hop around many files trying to figure out the big picture of what is happening and dealing with the inevitable changes to variable names as they are passed around. So now we can't see what is happening in one place and I need to remember two names for the variable because it gets a new one when it comes into the class, which is hopefully similar but systemically different. Yes, some people prefer to handle this cognitive load by their choice of IDE... but nano, gedit, and notepad don't really help out with that and they're usually what is reliably installed so they're what I'm usually using.
      4) Citation needed, particularly outside of corporate work. In corporate work with large teams it is advantageous to break things up because each can be designated their own responsibilities, i.e. the code structure serves double duty as a way to break up the work with each piece being individually testable with another person just to right tests for it. For a small team that can all be involved in all parts of the project, well, I'm skeptical that the same results would hold because being able to keep everything logically in working memory seems to be a larger concern than divvying up work. It's more important that they can find all the C# bindings in one place easily than for the bindings to be individually testable or for a person to be responsible for writing a single binding. In this scenario it is more important that the code structure matches the mental model than for it to be chunkable for any given size.

  • @lazizkhan1
    @lazizkhan1 ปีที่แล้ว

    I'm waiting for next video of ray tracing

  • @user-ib3gl6pj6h
    @user-ib3gl6pj6h ปีที่แล้ว

    How to ship a completed C++ project?

  • @SourceCodeDeleted
    @SourceCodeDeleted ปีที่แล้ว

    This isn't a code review.
    This is a code explaination.

  • @lemonke8132
    @lemonke8132 ปีที่แล้ว +1

    hey cherno,
    could you please take a look at john lin's voxel engine (on youtube) and analyze how he renders so many voxels at once? He's made some absolutely INCREDIBLE stuff, and I would really appreciate your view on it!
    (awesome video btw!)

    • @mikelowery6732
      @mikelowery6732 ปีที่แล้ว +1

      Most Voxel Engines use Octrees, don't they?

    • @exa211
      @exa211 6 หลายเดือนก่อน +1

      John lin uses raytracing with octrees to get reasonable performance.

    • @lemonke8132
      @lemonke8132 6 หลายเดือนก่อน

      @@exa211 No he doesn't.

    • @lemonke8132
      @lemonke8132 6 หลายเดือนก่อน

      @@exa211 A quote from lin himself: "octrees are extremely terrible for ray tracing, and dags actually do a very poor job of representing sparse voxel data despite their gains over esvo, which is also a terrible structure for representing sparse voxels"

    • @exa211
      @exa211 6 หลายเดือนก่อน

      Im sorry but where did you get this information from exactly? Did you read his blog-post? He is of course saying that octrees are bad for storing data but not so bad for rendering. His micro-voxel engine is developed in Vulkan with Raytracing.@@lemonke8132

  • @stevencowmeat
    @stevencowmeat ปีที่แล้ว

    My question is how do u loop through all those objects and have decent performance

    • @vunderstudios
      @vunderstudios ปีที่แล้ว

      data orientated

    • @stevencowmeat
      @stevencowmeat ปีที่แล้ว

      @@vunderstudios what do u mean data oriented? Edit: googled it nvm😂

  • @countinfinity776
    @countinfinity776 ปีที่แล้ว +5

    Now that Unity shot itself, Maybe Hazen can slowly start taking its place in a few years lol.

  • @francis_the_cat9549
    @francis_the_cat9549 ปีที่แล้ว +4

    Could you make a code review of the godot engine?

    • @vyking1972
      @vyking1972 ปีที่แล้ว

      There is a video for that by the lead developer of Godot

  • @matthewdee6023
    @matthewdee6023 ปีที่แล้ว +1

    3000 line file is ok, 3000 line function probably not. The 3000 line SQL script I had to work with once, was about as far away from ok as you can get 😢

  • @nickandrievsky5705
    @nickandrievsky5705 ปีที่แล้ว +2

    After 10 minutes 0 lines of code. What we’re even doing here?

  • @MatteoDeCarlo
    @MatteoDeCarlo ปีที่แล้ว +2

    Splitting a big file into multiple files is faster, if you compile with more than one core

    • @sacredgeometry
      @sacredgeometry ปีที่แล้ว +1

      It's also way more legible and manageable. Plus it generally insinuates that you have properly organised your code but the converse could be true too. Its all about the rationale. If the code belongs there, it belongs there. Doing it because you think that its easier to find things (learn your tools better) is just a bad a reason in my opinion as moving it explicitly because its longer than n lines. Code organisation especially in an OO language is pretty much informed by the paradigm.

    • @MatteoDeCarlo
      @MatteoDeCarlo ปีที่แล้ว

      I'm going to expand on what I wrote. I had the necessity to split into multiple files only once, when I was compiling some boost::python bindings. I had to separate each binding into a separate file or I would not have enough ram to compile (boost::python heavily uses templating). As a side result the compilation time got more then halved, because the very big job could now be divided into multiple jobs on multiple cores.
      Apart from this, I generally agree with Cherno. Do what makes your code more organized and comfortable, don't bind yourself to certain rules just because, make the choices that make sense for your project. Big files are useful in certain occasions.
      Curiosity: Unreal Engine has some big classes that are splitted across multiple cpp files.

    • @gulneckm.3475
      @gulneckm.3475 ปีที่แล้ว

      Also you don't have to recompile functions you didn't change, which is always a plus.
      And let's be honest, in file that has KLOCs it's majority of the functions.

  • @Ilyas_Alrai
    @Ilyas_Alrai ปีที่แล้ว

    man the giant files scare me, what is your opinion about design patterns ? I suppose you like to focus on the goal rather than structuring code

  • @redhotbits
    @redhotbits ปีที่แล้ว

    is this working under macos?

    • @JG-nm9zk
      @JG-nm9zk ปีที่แล้ว

      C# scripting, Windows specific functions, Developed entirely within VisualStudio.... MacOS is a high priority for them.

  • @shoaibzafar5663
    @shoaibzafar5663 7 หลายเดือนก่อน

    Please make series on Nvidia physx

  • @tri--
    @tri-- ปีที่แล้ว

    Does Hazel 3D support OpenGL?

  • @goshaevstratov426
    @goshaevstratov426 ปีที่แล้ว

    Does anyone know what font in editor used?

    • @dr.pencil5272
      @dr.pencil5272 ปีที่แล้ว

      Looks like Cascadia Code

    • @Ev3r0x
      @Ev3r0x ปีที่แล้ว

      opensans and roboto

  • @Mr_Coco_GameDev
    @Mr_Coco_GameDev ปีที่แล้ว

    Hey,I really like your Video,Can you share your Camera and Len

  • @turdle2767
    @turdle2767 ปีที่แล้ว +1

    @22:45 - i'm a c++ noob, but i've heard that over the years the view as shifted from the mid 90's, where they viewed large files as inherently bad. Now it's more acceptable. My project file I'm learning c++ on is 2k lines and growing, and after the initial few days, navigating the file isn't a struggle at all

  • @subhamprasad1373
    @subhamprasad1373 ปีที่แล้ว

    your thought about carbon programming language

  • @cnb_kevin
    @cnb_kevin ปีที่แล้ว

    I was watching to figure out how Hazel does the render thread command queue since that's where I'm at on my side (even though I should probably start single-threaded mode first). But uhm I just got to the point where you say it's not implemented yet and a video will be coming soon.
    I'm looking forward to that video, then

    • @cnb_kevin
      @cnb_kevin ปีที่แล้ว

      Nevermind. I use bgfx and while the documentation is unclear at times, it already does that kind of thing by itself already. I was just confused.

  • @stuntfax9004
    @stuntfax9004 ปีที่แล้ว

    Maybe start a company who makes games like a game engine, and get like 40 employee or something to help

  • @soulblaze5716
    @soulblaze5716 ปีที่แล้ว

    Hi @Cherno I had a question.... How your Game engine's cpp to c# binding works.... I mean you have _OnUpdate()_ and _OnStart()_ but none of them are overrides... I thought that both of these functions were virtual but they arent bec you havent added override keyword in your c# script. Maybe you should make a video on how to bind languages like that....

    • @Steven-tw7iz
      @Steven-tw7iz ปีที่แล้ว

      Check out his other channel Cherno Unplugged ( th-cam.com/users/ChernoUnpluggedvideos ) for the live streams where he explains exactly that

    • @WitherCreations
      @WitherCreations ปีที่แล้ว

      He uploaded a VOD on his Cherno Unplugged channel on how to do that

  • @trafficface
    @trafficface ปีที่แล้ว

    Hazelnuts are very healthy

  • @chrs8466
    @chrs8466 ปีที่แล้ว +1

    Hey, Cherno!
    What syntax highlighting theme are you using?
    Thanks, Chris

    • @static_bantic360
      @static_bantic360 ปีที่แล้ว

      visual assist

    • @chrs8466
      @chrs8466 ปีที่แล้ว

      @@static_bantic360 Thank you!

    • @luz_reyes_676
      @luz_reyes_676 ปีที่แล้ว

      @@chrs8466 he actually changed it. so its not the same one

    • @chrs8466
      @chrs8466 ปีที่แล้ว

      @@luz_reyes_676 Thank you! I noticed that.

  • @tristonarmstrong4617
    @tristonarmstrong4617 ปีที่แล้ว +1

    sooo, Godot is one of the top smaller game engines.. and yours LOOKS so much better.. Especially that node graph, gosh Godot's nodes are horrible! And thats coming from a Godot fanboy

  • @linuxlegion4312
    @linuxlegion4312 ปีที่แล้ว

    Is it true that Google carbon will take over c++ ?

    • @Ev3r0x
      @Ev3r0x ปีที่แล้ว +1

      no, it isn't...

  • @Jkauppa
    @Jkauppa ปีที่แล้ว

    thank your saviour, I hope its God

    • @Jkauppa
      @Jkauppa ปีที่แล้ว

      whoever that is, you give the honor to, I hope its God

    • @Jkauppa
      @Jkauppa ปีที่แล้ว

      brilliant

    • @Jkauppa
      @Jkauppa ปีที่แล้ว

      there is not use going under law, then you stop doing, and start worrying, again

    • @Jkauppa
      @Jkauppa ปีที่แล้ว

      the main thing is to make something to do the things, nothing else

    • @Jkauppa
      @Jkauppa ปีที่แล้ว

      sometimes is better to rewrite everything, from ground up

  • @Phillsen
    @Phillsen ปีที่แล้ว

    Hey Cherno ma man, slow down on the muffins ^^
    Quality content as always

  • @JG-nm9zk
    @JG-nm9zk ปีที่แล้ว

    Do you really have to put a sponsor slot in a video that is already pretty much just an ad?

  • @raahimfareed
    @raahimfareed ปีที่แล้ว

    Is it available on Linux