How does a custom game engine work? // Code Walkthrough

  Рет қаралды 172,633

jdh

jdh

Күн бұрын

big nerd explains his C++ game engine and says "um" a lot.
SEE THE MAIN VIDEO: • 3 Months of Game Progr...
TWITTER: / jdah__
PATREON: / jdah
GITHUB: github.com/jdah
EDITOR: NeoVim
VIMRC: gist.github.com/jdah/4b4d98c2...
THEME: gruvbox
RESOURCES:
cppreference.com/
learnopengl.com
opengl-tutorial.org
shadertoy.com
stackoverflow.com
0:00 Intro
1:35 Globals
7:22 Project Structure
8:35 Components and Managers
18:35 Usage Demo
23:13 Events
26:15 Level Data
27:20 Renderer
31:56 Resource Management
39:30 Palettization/Compositing
44:00 UI
45:44 Memory Allocation
49:00 Utils
51:00 Outro

Пікірлер: 351
@jesperkha3425
@jesperkha3425 2 жыл бұрын
thank you for making this video! a lot of youtubers just make a devlog and skim over the details, which is a shame because i love seeing how things are implemented and what solutions they found to various problems
@glassystudio
@glassystudio 2 жыл бұрын
You making game engine?
@rmt3589
@rmt3589 7 ай бұрын
​@@glassystudioI am, and videos like this are few and far between.
@ksurette92
@ksurette92 2 жыл бұрын
53 minutes of C++ implementation for real problems. Looking forward to watching this
@deckard6052
@deckard6052 2 жыл бұрын
Agreed
@pe_w
@pe_w Жыл бұрын
did you finish watching it?
@MrNathanShow
@MrNathanShow 2 жыл бұрын
Thank you! Very nice, casual, and descriptive. I would say, these kinda of review/informal kind of chat after a main video is great! I understand if they are exhaustive or more work. But I like the deeper off the cuff dive after the more entertaining and thought out dev blogs.
@jdh
@jdh 2 жыл бұрын
they're actually much much much easier than the main video, not much prep/work at all - so good to know that you appreciate them!
@neocell710
@neocell710 Жыл бұрын
@@jdh Hi there, may I ask what software (and which version) were you using in this video of yours? I'm new so I apologise in advance.
@grimtermite191
@grimtermite191 Жыл бұрын
@@neocell710 He is using vim
@neocell710
@neocell710 Жыл бұрын
@@grimtermite191 Thanks.👍👍
@The_Codemaster144k
@The_Codemaster144k Жыл бұрын
@@neocell710 he’s actually using nvim (neo vim) it’s like a version of vim but better
@natanaelrabello
@natanaelrabello 2 жыл бұрын
Your codebase looks well designed. I got really inspired by this. Thank you. It's a great video format.
@xhidden9817
@xhidden9817 2 жыл бұрын
Im glad you made this video because I've been working on my own game engine in c++ for a while after being inspired by some of your videos a long time ago and I think it will be quite useful to compare my code structure to yours and maybe this will help me on some problems that im currently having! Keep up the good work!!
@BertPdeboy
@BertPdeboy 2 жыл бұрын
I was legit asking myself how some of your code would look during/after watching the summary video. It's been about 5 years since I last programmed C/C++, very interesting to see some of the modern stuff.
@rmt3589
@rmt3589 7 ай бұрын
This is utterly amazing! I've already learned a lot from the first watchthrough, like macros, using ECS & OOP, and about memory allocation. I will definitely be rewatching this as I work on my own C++ engine, and I'm so glad I discovered you!!!
@TheDDgun99
@TheDDgun99 2 жыл бұрын
Ever since you uploaded the Minecraft video where you start on this engine, I’ve been working on my own engine in rust. Every time you upload I’m just amazed at the progress you make. Anyway, thanks for the great video, keep it up!
@duckonaut
@duckonaut 2 жыл бұрын
Really cool video! I love long talky videos, your streams were also great so I'm excited that you are considering doing more of those
@obszczymucha1337
@obszczymucha1337 Жыл бұрын
Dude, you're building your own computers and game engines... I gotta get my shit together and do something myself too. Thank you for inspiring me and keep up the amazing work!
@TravisVroman
@TravisVroman Жыл бұрын
This just popped up on my feed. As someone who writes engines in C, I basically live by the "You can take a C programmer out of C, but not the C out of a C programmer" bit 🤣. Interesting stuff.
@orlaani1451
@orlaani1451 Жыл бұрын
Just started learning C++ and managed to split some strings with help in around 6 hours. I think I make a similar project now. :) Jokes aside, i really want to use c++ for some gamedev and maybe make my engine some day so this video just came around the right time. Thanks for the entertainment in these past few years, keep it up legend.
@Magnogen
@Magnogen 2 жыл бұрын
Another video? We are BLESSED
@JMM57
@JMM57 2 жыл бұрын
this is way more interesting than"ok so I put this line of code in to make this happen" then dont explain it at all. As a hobbist game developer I really appreciate this and thank you. I hope to see more code walkthroughs like this pop up.
@atraps7882
@atraps7882 2 жыл бұрын
not only he's an excellent programmer, dude is fu*king handsome too.
@blarghblargh
@blarghblargh 2 жыл бұрын
"you're doing great, son!"
@legosi1875
@legosi1875 Жыл бұрын
Damn true
@gosunov
@gosunov 2 жыл бұрын
Very exciting format! Please do more of this stuff
@drewhoener1
@drewhoener1 2 жыл бұрын
Not sure if you've read any of it, but the devs of the game Factorio have an amazing dev blog that they release every friday where they've taken deep dives into problems that they're facing, and how they go about implementing them. Obv it'd be a lot of work but I think it'd be cool to see a more detailed narrow focus on how you fixed specific things as you go. Loving the development updates btw, it's been so cool to see this channel evolve from the first minecraft video
@HoshoLegacy
@HoshoLegacy Жыл бұрын
Always cool to see how other people do things! I love your "macro garbage" for tracking types. I was discouraged from using macros early-on and I never really went back to find the places where it makes sense to use them, i think this looks like a solid example.
@hyverian1165
@hyverian1165 2 жыл бұрын
Very cool! I'm not even close to a point where I could understand any of this, but it was still very fun to listen along and try to understand at least a tiny bit :> You have a soothing voice to listen to!
@jonathancamarena3117
@jonathancamarena3117 Жыл бұрын
Great vid man! the inheritance-based design definitely has its uses, but I also favor composition for games where you have a lot of similar entities with slightly different behaviors.
@brendon205
@brendon205 2 жыл бұрын
I was just thinking yesterday how nice would a video like this be, and voilá! Thank you for the video, and I hope you do more of these detailed videos.
@kalebaustgen6367
@kalebaustgen6367 Жыл бұрын
This was super cool! I hope you make more of these types of videos
@logankraver3775
@logankraver3775 2 жыл бұрын
Thank you for the code walkthrough! I really enjoyed your description of your work. I was just wondering how you do the searches with your neovim config? Other than that, I really enjoy your content and it’s super inspiring!
@arial_01
@arial_01 2 жыл бұрын
Dude I have been waiting for this to happen, this is so sick and I love the "lecture style." Man I love the DIY aspect of making your own game, ON YOUR OWN ENGINE. Lmao, keep it up man. Edit: I also much prefer the new font, it is less minecraft like. Edit 2: Do you think this will ever be available on steam? (Or on the git hub, but I don't think anyone would be angry if you monetized it and sold it on steam)
@BenBerke
@BenBerke 2 жыл бұрын
I sense that this video would be useful if I knew c++
@Sharlenwar
@Sharlenwar 2 жыл бұрын
Man, this is epic! I always want to know the reasons why people make the decisions they do. Helps for our game dev journeys!
@albatroshd7945
@albatroshd7945 Жыл бұрын
I've programmed some small projects with my Arduino. Currently in our class we are trying to do more complex stuff with c++. And to see someone building a game engine with c++ is great!
@SethEden
@SethEden 2 жыл бұрын
Thank you for going through this!! Really great to see how an engine is architected. I'm planning to build an engine in JavaScript based on BabylonJS. So much of the design patterns can still apply. Code would of course be completely different. But you really used some good and interesting design patterns here. I can see how you followed the factory pattern for your entity components. Good stuff!! Thanks again!! :-D
@gachastorys5129
@gachastorys5129 Жыл бұрын
If you dont mind me asking, why javascript as a languge for the engine?
@SethEden
@SethEden Жыл бұрын
@@gachastorys5129 Because I'm already using it to build an enterprise scale automation platform and eco-system of toolkits for building business applications and I realized that my architecture is adaptable enough to be reused as a toolkit and framework for building a game engine based on the existing BabylonJS rendering engine. BabylonJS was the only engine that I could find that I knew I could natively support multi-camera, multi-view, multi-monitor support without doing some weird hackish trickery. Plus it was the best architecture I could find in combination with the tech-stack of Electron and VueJS to make it easy to build a run-time skinnable application interface. Which I also wanted to build into my top-level architecture. Not to mention I already had started on a base architecture, so it just made sense to continue to advance the systems integration to support the requirements objectives I set out for myself. 😀
@gachastorys5129
@gachastorys5129 Жыл бұрын
@@SethEden oh OK. Good luck!
@SethEden
@SethEden Жыл бұрын
@@gachastorys5129 Thanks. Its not a matter of luck any more. Just a matter of time. I've already built out every major subsystem except the GUI. I have a full command engine and custom scripting language and as of yesterday a plugin interface. :-D I suppose I still need a message bus, an event bus and a bindings manager.
@jumbledfox2098
@jumbledfox2098 2 жыл бұрын
Always excited for a jdh video!!
@afnandanish
@afnandanish Жыл бұрын
Absolutely love your lectures. I would love to see one for your Minecraft in 48 hours video 💙
@rmt3589
@rmt3589 7 ай бұрын
That would be awesome!!!
@user-hk7fz5yj8e
@user-hk7fz5yj8e 9 ай бұрын
Dude you're an absolute gem. Love watching your game dev journey! Godspeed!. Dude you're an absolute gem. Love watching your game dev journey! Godspeed!.
@justinmonroe8683
@justinmonroe8683 4 ай бұрын
This right here most avoid, thinking people wont watch or learn, I'm glad your not the tow the line person, and work against the grain of let some other program do it, or advise people to visit messy forums that tell little about your custom approach. You have my appreciation and gratitude for your work and expertise, but even more for your in depth look into your code logic, and explaining the coding, and your thinking on the route you took. This puts you lightyears ahead of a lot of tutorials, that often only partially explain or like I said before point you to some forum that explains little to nothing and seemingly an ongoing research project instead of study which comes to the conclusion of knowledge and properly used experience, which is the same result in advising a program to run their code and explains little to nothing about their line of thought or the code. Thank you for not being lame, and pretending to explain things which only beg more questions. Not that you should take time to explain all terminology in use of the video, but would be nice to have in description for the key terms used. SO people maybe not as researched a me can also know the reference and meaning of the words you're using in your presentation. A minor nit pic on my part not crucial to those who are going to do their homework anyway. I like your style of layout/structure, it is more organized, and optimization is usually a better idea once bugs are worked out and game functions properly in accordance to desired functionality and desired result. Then makes sense to go back and clean up code, and optimize. pre optimization can and does ruin the progress of many games. Only certain practices in front end optimization aren't detrimental to overall development and usually applies to API's not so much what your doing here from scratch. The main benefit you have is customization, the only disadvantage I see, is portability. Your code maybe less robust than the API driven engines, but is far more manageable to the individual coder, than having assist programs and three libraries open looking for the mistake written in API driven engines, which actually slows the computer and overall progress. Which most API's lack comprehensive interpretation of code, unless towing the line, and remaking what's been made already, and is frowned upon among gamers.
@pedroduran8927
@pedroduran8927 2 жыл бұрын
This makes you feel that your programming carrer is a joke 😂 amazing work man! keep it going, i want to see this project grow
@sfsarfe
@sfsarfe 2 жыл бұрын
bruh I can't even make a simple game in unity
@ayyo7820
@ayyo7820 2 жыл бұрын
Just keep pushing through
@blarghblargh
@blarghblargh 2 жыл бұрын
you couldn't walk when you were born either. the solution is to keep working at it.
@rmt3589
@rmt3589 7 ай бұрын
Have you tried godot or hazel?
@DalpakaNBA
@DalpakaNBA 6 ай бұрын
frfr
@DalpakaNBA
@DalpakaNBA 6 ай бұрын
@@rmt3589 youre right theyre better and open source and hazel is created by @TheCherno or smth so thats cool
@bitw1se
@bitw1se Жыл бұрын
I really appreciate you doing such a video, there's a lot to learn :D I also think your amount of use of `std::unordered_map` is very comical xD
@Ash-qp2yw
@Ash-qp2yw 2 жыл бұрын
I really enjoyed this video, I agree that more of these would be really cool to see. Have you ever considered teaching CPP/game dev this way at all?
@MrDeatmatch
@MrDeatmatch 2 жыл бұрын
Hello big nerd, big nerd and a fan of your channel here. You're really the only gamedev channel I follow right now, really top tier content. You plan on making multiplayer features for this? If not full multiplayer, consider a dark souls / elden ring type multiplayer? Would at least be fun to code networking stuff.
@xynyde0
@xynyde0 2 жыл бұрын
Networking is hard
@dot32
@dot32 2 жыл бұрын
you have a really nice setup with your terminal and macos!
@-aexc-
@-aexc- 2 жыл бұрын
I actually really wanted a video like this, thank you
@cave_0
@cave_0 Жыл бұрын
I must say you are riding at the apex in the new wave of engineering right now. I wish i were even half as talented
@silva1512
@silva1512 2 жыл бұрын
What plugins are you using in neovim? Greate video!
@morgan0
@morgan0 Жыл бұрын
if you’re converting from lab to rgb often, you might want to consider using oklab instead of cielab (i say “sea lab” no clue if that’s correct). it’s better for hue and chrome representation and comparable for luminance, but it’s much simpler and faster. the reference implementation is in c++ so it should be easy to bring it in. also the author has made color spaces comparable to hsl and hsv using oklab which could be useful for stuff like colored lights the user can set the color of, or flowers that can be bred to have different petal colors, or whatever, with a space that both looks right and is easy to use (like having saturation instead of chroma so out of gamut colors are less of an issue). he also has an article on gamut compression so you can transform colors and reduce the inaccuracy when converting it back to rgb
@griffinbrooks6748
@griffinbrooks6748 2 жыл бұрын
LETS GOO ANOTHER VIDEO :D I've always wanted to make a game engine... (also i found that programmers often use // in their video titles instead of like | or something.)
@blackbird1665
@blackbird1665 2 жыл бұрын
Hippity hoppity your code is now my property But in all seriousness, you are just incredible. The fact alone that you can code in c and even do highly complicated tasks in OpenGL… Cudos.
@Chimponaut
@Chimponaut Жыл бұрын
Subbed, this is amazing content. Random noob question about the BumpAllocator, is it bumping up or down?
@visionary4040
@visionary4040 2 жыл бұрын
a one hour jdh video… am i in heaven?
@ZeonLP
@ZeonLP Жыл бұрын
the code looks beautiful!
@Jova
@Jova 2 жыл бұрын
If you ever make a course, making an engine like the one you have from start to end product with some kind of playable game, I would pay for it. I'm sure many others would as well.
@astroid-ws4py
@astroid-ws4py 2 жыл бұрын
Indeed, And he can upload his series to Udemy or a similar platform and make some money out of it, I guess there will be a lot of demand.
@Jova
@Jova 2 жыл бұрын
@@astroid-ws4py Udemy is exactly what I had in mind. I'd love to have an engine that was built from the ground up, and to have an understanding of everything. I'd prefer that over trying to learn how to use an engine like unity.
@astroid-ws4py
@astroid-ws4py 2 жыл бұрын
@@Jova Just like me, I much prefer the traditional software engineering approach for making games I.e. , using open source libraries and other stuff (Krita, Blender etc.) and assembling it all together myself the way I want it.
@steved.1091
@steved.1091 2 жыл бұрын
Imma pay for that too. I seriously would love to explore engine architecture and implementation without getting into openGL.
@blarghblargh
@blarghblargh 2 жыл бұрын
check handmade hero. it's free
@enricolus521
@enricolus521 2 жыл бұрын
Thank you very much for this! Exactly what I needed
@m4rt_
@m4rt_ 2 жыл бұрын
will the source code be released on github at some point?
@logicmaster756
@logicmaster756 2 жыл бұрын
Nice and um this um just what i need "um"
@jdh
@jdh 2 жыл бұрын
um thanks
@luderx
@luderx Жыл бұрын
Holy shit en fantastisk video. Din tekniske viden er vildt imponerende, er det primært selvlært, eller noget du har lært på UNI etc?
@Uvuv6969
@Uvuv6969 2 жыл бұрын
Currently writing a console game engine with graphics and all that good stuff. no renderer, just raw c++ (although I’m still using some windows functions). It’s hell AAAAAA
@flowfrog101
@flowfrog101 Жыл бұрын
Thanks for the video. A little improvement suggestion to the format: add those youtube video chapters, it would be much easier to jump to section someone might be interested in. Other than that very nice video.
@justsomebody5319
@justsomebody5319 2 ай бұрын
Really like your font, what font are you using?
@mikhaildidur9567
@mikhaildidur9567 2 жыл бұрын
Thanks for interesting video! What are you using as an IDE for the game engine development?
@rmt3589
@rmt3589 7 ай бұрын
I was wondering this too.
@realdlps
@realdlps 2 жыл бұрын
Really like these types of videos
@Soul_Dev783
@Soul_Dev783 Жыл бұрын
hi I wanted to know what you studied before studying game creation it seems very complex for me to start from scratch and make games from scratch without an engine if you have any tips or tell me what I need to study to reach your level
@klutch4198
@klutch4198 Жыл бұрын
Dude this is amazing!!!! Thanks for sharing!!!
@anon_y_mousse
@anon_y_mousse Жыл бұрын
This looks pretty good and I appreciate the C++ written as though it was C style. The organization is quite nice. I like your color scheme and I'm wondering if you're using tmux or if neovim has all that built-in? Also, what *was* that at 49:27 ?
@jdh
@jdh Жыл бұрын
ooh that should have been cut out hahaha recording while sick is a dangerous game!
@anon_y_mousse
@anon_y_mousse Жыл бұрын
@@jdh But what was it?
@OrangeDied
@OrangeDied 2 жыл бұрын
I love these types of videos!
@DragonKidPlaysMC
@DragonKidPlaysMC Жыл бұрын
Do you mind telling what is the name of your neovim colorscheme? It looks gorgeous!
@oreos3174
@oreos3174 2 жыл бұрын
Unfortunately I’m not going to watch through this at the moment as it’s too advanced for me, but this will be great to come back to.
@Assassin_Droid
@Assassin_Droid Жыл бұрын
will you make a QnA video sometime in the the near future because I have two questions from you, do you have a degree, if yes, in which subject and to what extend, for example undergraduate or graduate. Second question is how long are you coding from because I recently started coding and your and Sebastian lague video make me question my choice...
@nickk1077
@nickk1077 2 жыл бұрын
thanks this video was very informational. also what nvim plugins do you use?
@jdh
@jdh Жыл бұрын
the primary drivers are the builtin LSP (using clangd), nvim-cmp, and FZF
@justinmonroe8683
@justinmonroe8683 4 ай бұрын
It's unique in textures but not in general, when coding for 6502, specifically NES, they used Sprite Atlases. Not a new concept but definitely a new usage for the concept and simply genius. They did so to save on Rom and Ram space, and would imagine you saved quite a bit by implementing textures in this method, would be interesting to test and see how optimizing this is.
@redskater42
@redskater42 2 жыл бұрын
For someone that is very novice at game dev and graphics programming - where would you suggest going to get the foundational information for game engine development and graphics programming?
@user-sl6gn1ss8p
@user-sl6gn1ss8p 2 жыл бұрын
So, I'm still starting to explore this myself, but my two cents: I haven't worked through the whole thing yet, but Jason Gregory's Game Engine Architecture (2019, from CRC Press) is very in-depth. It is over a thousand pages long, but the first few chapters can stand on their own as a very solid introduction, I think. It covers from the basics of how computers work to implementation, discussing a lot of architectural decisions for game engines. Fabian Sanglard has a series of Books called "Game Engine Black Book": each book is a breakdown of an older engine, like Doom and Wolfenstein. I have only skimmed them, but they might be interesting if you'd rather take a more practical/exploration-oriented approach, specially since you can get the source code and mess with it. You should be able to find these books somehow if needed : p Other topics you may want to explore are linear algebra, your programming language of choice, computer graphics/rendering and some methods for dealing with things such as collisions and space partitioning, I think.
@grig517
@grig517 2 жыл бұрын
as a starter i would recommend you glfw + opengl and GLAD function loader. All of them have documentation. I was learning by seaching an answer to my current problems in those docs and with pain ive done it. For game engine specifically i would suggest you 2 books "Foundations of Game Engine Development, Volume 1: Mathematics" by Eric Lengyel and Volume 2: Rendering. It was practically enough
@user-sl6gn1ss8p
@user-sl6gn1ss8p 2 жыл бұрын
now that grig mentioned it, if you want to get something up and running quick and prefer videos, "the cherno" has a couple videos on using imGui for that, as well as a series on opengl which I think also uses glfw and glad
@redskater42
@redskater42 2 жыл бұрын
Thank you both, this is very insightful.
@jdh
@jdh Жыл бұрын
for both, just read a lot of code. I've recently been reading through OpenMW (github.com/OpenMW/openmw ) but the DOOM II or Quake 3 sources are also good places to start. As for graphics, I can highly recommend learnopengl.com which is very OpenGL-specific but with general principals of graphics and Jonathan Blow's excellent "lecture" on 3D graphics here: kzbin.info/www/bejne/mHjIXpdmbrOWla8
@eyad6159
@eyad6159 2 жыл бұрын
great video very informative, do you have ur nvim configuration file uploaded some where by any chance?
@1337dingus
@1337dingus 2 жыл бұрын
It's literally linked in the video description (vimrc)
@eyad6159
@eyad6159 2 жыл бұрын
oh..weird I checked thanks!
@xesf
@xesf 2 жыл бұрын
Damn, this c++ code look so clean. Most of the time is so hard to read c++ code and with this one is very easy to follow. Do you plan to release any of your bgfx or other libraries abstractions on github?
@jdh
@jdh 2 жыл бұрын
bgfx isn’t mine :) it’s a really well done library though, you can check it out on GitHub!
@xesf
@xesf 2 жыл бұрын
@@jdh lol, looks like I missed a word, I meant the bgfx abstractions you are doing :)
@mikumikudice
@mikumikudice 2 жыл бұрын
3:00 for me global state is only worth in game dev. In any other kind of application, global variables are a bad idea, but for a enclosed world it's very handy have things like player's state accessable globally
@ivanjermakov
@ivanjermakov 2 жыл бұрын
In other kind of apps your application logic is not limited to 16ms execution time. First thing I noticed when I started game development: performance matters.
@tamakolumisade
@tamakolumisade 2 жыл бұрын
In Web Development, frontend frameworks like Vue, React, Angular utilizes the idea of a global state, so individual components can interact with the global data or send these information between each other
@redisputed
@redisputed 2 жыл бұрын
This was great and the code review caught bugs, win-win.
@Tigrou7777
@Tigrou7777 2 жыл бұрын
Why did you made the switch from Visual Studio Code to NeoVim ?
@126sivgucsivanshgupta2
@126sivgucsivanshgupta2 2 жыл бұрын
first thing fisrt, love this format, its so intresting to see the little things that you wouldnt add to the properly edited videos, second thing, why do you use a allocator in the first place (bump allocator), if something is required every frame, wouldnt it be better to just stack allocate it, is there any benefit to using a bump allocator ?
@karolkrzosa3462
@karolkrzosa3462 2 жыл бұрын
You can allocate deep in the call stack and data will persist regardless, you are not bound to the stack lifetime. You won't overflow the stack.
@josealvim1556
@josealvim1556 2 жыл бұрын
Have you considered std::type_index as a key for registering types from different translation units at runtime? std::map foo; template T const & get(ID_t id) { return dynamic_cast(foo.at(typeid(T))).at(id); } I'd recommend std::map as opposed to std::unordered_map because the standard doesn't guarantee that std::type_index::hash is unique between different types (although it suggests it to be).
@jdh
@jdh Жыл бұрын
I did, but the dynamic_cast requirements and continuous hashing of std::type_index make it a performance no-go. much rather just use integer indices into a tightly packed array over a map :)
@josealvim1556
@josealvim1556 Жыл бұрын
@@jdh understandable. Don't read the following as me insisting on it or whatever, it's your implementation and I presumed you've profiled it. std::type_info and the type_index wrapper ought to be linealy ordered types though, so you could have forgone hashing. One could also forgo the tree entirely and store pairs of std::type_index and whatever pointer-to-base type in a linearly ordered vector if runtime addition is rare enough, and access it O(log n). If you don't care about deleting those containers, you could be a truly based C programmer and just store ans reinterpret cast a void* so you don't pay for the RTTI checking involved in dynamic casting afaik (as ostensibly you've already paid it by finding that pointer in the vector). You could then store deleters in a separate array that only get invoked when the parent object dies (or not even that, because at that point the application ought to be closing). Obviously, it will lose to constant time indexing into an array, but the number of components is finite at runtime, and log(n) will probably be rather small, like less than 10.
@DFPercush
@DFPercush Жыл бұрын
What I did is make a constexpr template that extracts the signature of the type as a char array and hashes that at compile time. It's compiler dependent though, because of macros like __FUNCSIG__ and __FUNCTION__ . Nothing a handful of #ifdef's won't fix though. But if you've already got a working solution there's no point changing it now.
@tinocaer
@tinocaer 2 жыл бұрын
What theme do you use for you text editor?
@yairlevi8469
@yairlevi8469 7 ай бұрын
The Cherno has to make a code review on this. I think he'll like it.
@protodrew5731
@protodrew5731 Жыл бұрын
Ticks are pretty common in custom engines, most famous implementation that people who don't code would be aware of is Minecraft, which uses it to handle built in updates and better manage server performance at scale.
@m4rt_
@m4rt_ 2 жыл бұрын
Is your vimrc on github gist updated? Since I think you have changed some things, and I would like to have the nice updated config
@-aexc-
@-aexc- 2 жыл бұрын
doesn't neovim generally use .lua files for the config or am I confused
@michaeldraga1159
@michaeldraga1159 2 жыл бұрын
@@-aexc- As far as I know they started out with .vim files and only introduced .lua config files later. As of now .lua is recommended I think, but most of the configs are still in vimscript since there is just no point in translating it usually
@llblumire
@llblumire 2 жыл бұрын
tomlplusplus implies you've familiarity rust, as that sort of popularised toml as a format, is there a reason you went with C++ over Rust as the systems language for this? It's about 50:50 on the gamedevs I watch that are using their own engines if it's C++ or Rust and I'm always curious what drives the decision for them
@jdh
@jdh 2 жыл бұрын
I've tried rust a few times on smaller projects and have always found that the friction that it introduces with the borrow checker/other extras hasn't been worth it for me. will likely give it another try at some point though!
@yearswriter
@yearswriter 2 жыл бұрын
AfaIk games in Rust always require unsafe code, which defeats the point. That is one reason I never tried, for example, I, personally, tried vulkan in Rust, even though it is possible and people do it it feels for me kinda using the wrong tool.
@MrNathanShow
@MrNathanShow 2 жыл бұрын
@@yearswriter Curious about your point that games require "unsafe" code? Is there something specific in optimization or something that pure safe Rust can't do?
@yearswriter
@yearswriter 2 жыл бұрын
​@@MrNathanShow No, I mean practically, every library that uses vulkan needs to disable borrow checker at one point or another . I am sure it can be abstracted, but I am not game dev, but I do hobby stuff every now and then, so maybe there is some obscure way to do that. It is just practically, it was really easy to finish any vulkan or OpenGl tutorials out there to the point of having some scene.
@DerNivel
@DerNivel 2 жыл бұрын
@@yearswriter The whole standard lib is full of unsafe code internally, still everyone uses it. I think if unsafe code is locked away in some safe abstraction over it, that's fine. In the end that's how whole Rust works.
@ashersaipe
@ashersaipe 2 жыл бұрын
the legend has uploaded
@aiyushg1769
@aiyushg1769 2 жыл бұрын
Woop, can't wait to finish watching this :)
@bitflop
@bitflop Жыл бұрын
Are you using a plugin when you search through your file system for a line in the code? Or is it built in nvim? Thanks!
@smjonas8616
@smjonas8616 Жыл бұрын
That's the fzf plugin for Neovim
@Ketpain
@Ketpain 2 жыл бұрын
2 videos out quickly :o
@erickapilik9529
@erickapilik9529 Жыл бұрын
What vim plugin are you using for file exploration? 0:53 I have looked through your vimrc but the current version doesn't seem to include the plugin.
@spambox399
@spambox399 Ай бұрын
A year late but i think it’s called telescope ;)
@michaeldraga1159
@michaeldraga1159 2 жыл бұрын
Hey, can somebody tell me which plugin jdh uses for the quick open feature? Loved the video btw, hope you'll release the code at some point :)
@jdh
@jdh Жыл бұрын
FZF!
@zydeas
@zydeas 2 жыл бұрын
You don't need to apologize for using macros, there's nothing wrong with them when not misused. They're an incredibly powerful tool.
@bluedev6304
@bluedev6304 Жыл бұрын
how do you go about debugging your code in neovim?
@jdh
@jdh Жыл бұрын
i just use LLDB and occasionally hop into CLion if it’s really bad
@vaquarshaikh9790
@vaquarshaikh9790 Жыл бұрын
Do you have a course or maybe a playlist where you teach things ??? Can we connect to you on any social media handle ?
@GamerSaga
@GamerSaga 7 ай бұрын
Curious, would you be willing to share your doom map, editor code?
@jankucera8505
@jankucera8505 Жыл бұрын
whenever I think of myself as a good coder, I come back to you to level my ego
@Scrawlerism
@Scrawlerism 2 жыл бұрын
oh this is beautiful, thank you so much!
@assa716
@assa716 2 жыл бұрын
12:41 what is that template template thing?
@ultrasword5222
@ultrasword5222 2 жыл бұрын
thank you good sir for this masterpiece
@wilykary
@wilykary Жыл бұрын
Just wondering what font are u using?
@-sbin
@-sbin 2 жыл бұрын
Very cool, haven't seen the whole video yet obviously, but are there any weird things about the language that you ran into and had to figure out?
@jdh
@jdh 2 жыл бұрын
the whole thing, I'm a little tired of C++ at this point. very powerful but I miss C! I would say the weirdest/worst things are constructor boilerplate, template garbage (and compiler errors!) and not being able to make an std::optional. edit: also the "mutable" keyword is pretty wack
@dilonatron1164
@dilonatron1164 Жыл бұрын
where did you learn all the things that you are able to do? i would love to do stuff like this as i am very interested in computers but just watching youtube videos dont seem to help
@andyzaft8827
@andyzaft8827 Жыл бұрын
The best way to learn is by doing. Start small, with a simple goal and work towards that. Many years ago I was interested in how to do something simple in opengl, so I picked an opengl tutorial and after 3 or 4 basic steps I started to understand how to draw a basic 2d game state, then made something that I guess we would call a tetris clone, it was operating on colors instead of shapes. Anyway, the point is that doesn't matter what tutorial you pick, as long as you learn from it and able to bend it to your will. Try to find what works for you, you might not like the way one chain of tutorials is making you progress, experiment with others. Pick a game from a tutorial and try to modify it. First just one aspect, change how scoring works, or how the entities move on the screen. When I was learning programming, one of the first thing I did was to add a key to snake to make a U-turn. This was in text mode and super simple, but I learned a lot just from that simple change. Maybe an already existing engine would provide you a better framework, because it gives you a lot of things that you don't have to reinvent yourself, but it could also be too restricting in how you are learning, and you do want to understand every part that puts a game together. Be consistent, but don't overdo it. For me what worked is to spend almost every day an hour trying to solve one problem and then stop, think about it over the day until I picked it up again and came back to it with a dozen new ideas in my head. For some of us it takes time to "digest" what we learn, others can go 16 hours a day and learn everything in no time. If I try it that way, I burn out and keep slacking until I completely abandon the project. You will find the best way for you to learn, starting something is the hardest, it's overwhelming and everything is new, have to believe that over time it will get easier. Hope my 2c helps you a little bit.
@kushagrgoyal9614
@kushagrgoyal9614 2 жыл бұрын
This was so cool…. Wat is the theme you used for the ide?
@StealerSlain
@StealerSlain 2 жыл бұрын
It's in the description
@kushagrgoyal9614
@kushagrgoyal9614 2 жыл бұрын
@@StealerSlain ahhh..thank u.
@RaveYoda
@RaveYoda Жыл бұрын
I'd say globals aren't too bad depending on how and why they are used. Making them singleton where possible helps too.
@gachastorys5129
@gachastorys5129 2 жыл бұрын
So I notice that only when you talk can we here background noise or any noise in general. Is that noise canceling or something? Or are you just editing out all noise when your not talking
@greenkeys442
@greenkeys442 2 жыл бұрын
How did you get the file switching window shown at 0:54 in vim?
@greenkeys442
@greenkeys442 2 жыл бұрын
Thanks for the answer to De Flesz’s comment, I will check out fzf.
I added reflection to C++ just to make my game work.
16:30
4 Months of Game Programming With My Own Engine
21:30
jdh
Рет қаралды 382 М.
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 74 МЛН
Indian sharing by Secret Vlog #shorts
00:13
Secret Vlog
Рет қаралды 45 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 27 МЛН
¡Puaj! No comas piruleta sucia, usa un gadget 😱 #herramienta
00:30
JOON Spanish
Рет қаралды 22 МЛН
I made an entire OS that only runs Tetris
22:37
jdh
Рет қаралды 1,6 МЛН
3 Months of Game Programming in 20 Minutes
20:32
jdh
Рет қаралды 590 М.
How NOT to make a game from scratch
8:34
jdh
Рет қаралды 270 М.
I built my own graphics card
15:34
jdh
Рет қаралды 1,4 МЛН
Why it Was Almost Impossible to Put a Computer in Space
17:20
Linus Tech Tips
Рет қаралды 722 М.
Why Doom is Awesome: Binary Space Partitioning
26:25
ShreddedNerd
Рет қаралды 999 М.
Building my indie game: one month of progress
12:26
jdh
Рет қаралды 272 М.
Remaking MINECRAFT 2D (Minicraft)
15:46
jdh
Рет қаралды 307 М.
Blazingly Fast Greedy Mesher - Voxel Engine Optimizations
23:35
⌨️ Сколько всего у меня клавиатур? #обзор
0:41
Гранатка — про VR и девайсы
Рет қаралды 647 М.
Introducing GPT-4o
26:13
OpenAI
Рет қаралды 4,4 МЛН
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,3 МЛН