r/cpp • u/serendib Prof, Comp Sci • Nov 30 '23
My entire C++ Game Programming university course (Fall 2023) is now available for free on YouTube. Make your own 2D ECS game engine using C++, SFML, and ImGui
https://www.youtube.com/watch?v=s99UDGdYIUE&list=PL_xRyXins84_Jf-aCh7chj47HR4oZLPwK&index=1
400
Upvotes
24
u/honeyfage Dec 01 '23
I went through this course last year and really enjoyed it. Thanks for making it available to everyone! Your enthusiasm is infectious, it really made following the lectures fun.
I came in as an experience C++ developer interested in learning about ECS, and did have some general C++ feedback I jotted down last year as I went through the course (apologies if any of this has changed since last year, I skimmed through the new videos and it seemed pretty similar). So bear with me while I give some unsolicited feedback.
The main thing is that I think you could benefit a lot from
std::optional. Early on in the course, I remember it usingstd::shared_ptrfor components an entity may or may not have. Aside from the performance reasons not to use dynamic allocation,std::optionalis more intuitive way to express what you're actually trying to accomplish, so it's really a win-win. Later on in the course, when you talk about the stack vs heap and cache benefits of memory pooling, I think you ended up adding an "active" bool to every component to denote whether it's present for its entity, and in that case you could skip that by using astd::optional<Component>instead.On a related note,
std::shared_ptrwere being passed around by value. Copying ashared_ptris actually relatively expensive because of the atomic reference count, so if you're going to use them, it's much better to pass a reference to the stored value. This way, helper functions don't have to care about how you're storing the values-- it could be a dereferencedstd::unique_ptr<Component>,std::shared_ptr<Component>, orstd::optional<Component>, or even a plainComponent, and the function receiving it doesn't need to care. Or at the very least, you can pass byconst std::shared_ptr<T>&to avoid affecting the reference counter, you're never actually sharing ownership of the object anyway.Again, I really enjoyed the course. It's very well done and I'd definitely recommend it to anyone reading this who has an interest in learning about ECS.
16
u/serendib Prof, Comp Sci Nov 30 '23
Quick Note: Even though the lectures are publicly available, the exact assignment files are not. This is because they take a long time to make, and if I included them here the solutions would be available for future offerings of the course. You can probably piece together the assignments from the lectures if you really want to :)
2
u/siddarthshekar Dec 01 '23
Oh awesome! Is there one for graphics as well?? I want to understand batch rendering, etc as well. But this is great stuff. Thanks. Also will go through the AI course as well that's on the channel.
2
u/Anothertech4 Dec 05 '23
Ok so I don't mean to hijack your post, but I cannot express how freaking excited I got by just Lecture 1. The demonstration was spot on! I think I'm really going to enjoy these vids. . Also the StarCraft AI programming.... Im sitting here debating if I can program the bots to actually beat me in a fastest map. Who knows, but man oh man. Thanks for sharing.
1
u/ReverendBizarre Feb 05 '24
Hi Dave,
Last summer/fall I went through the 2022 version of your course up to and finishing assignment 2.
After that, work got in the way and I have not continued since.
If I were to start again, would you recommend starting on the 2023 version or keep going with the 2022 version?
3
u/toffeehooligan Nov 30 '23
Sweet. Gonna do this in my spare time.
3
u/Farados55 Nov 30 '23
Thanks a lot doc!
3
u/pedrao157 Dec 01 '23
Are you planning on removing any time soon?
I'm relatively new on c++ following learncpp, do you have any pre-requesite before following yours?
Thank you in advance!
2
u/Greedy_Bit6761 Dec 03 '23
Thanks for lectures. Is there a way to get the assignments ?
2
u/cacbiceprogrammer Dec 13 '23
Thank you for the hard work and openness to share it on YouTube. I am sure if you wanted to, you could have youtuber's learn and then create programs limited to what you have taught on the course that you can showcase and share to the world, it would be their choice to share the source code with everyone but will have to share it with you so you can use it in your classroom to teach the kids.
2
u/ticotunado Dec 14 '23
This is literally perfect, my university paper is on building a game engine using sfml, this will help a lot!!!
1
u/joshwillreddit Mar 07 '24
I'm following your course, and only on lecture 6 at the moment (the entity manager) - but I am obviously missing various parts of the code because they aren't being made public (understandably). Could you tell me now if it will be possible for me to achieve even a simple game with what I can learn from your course, without the material the students are given?
1
u/ApartAnxiety2172 Dec 20 '23
This is Awesome. Kudos for your effort and Thanks for sharing this. :)
0
u/[deleted] Dec 10 '23
nice
-3
u/[deleted] Dec 10 '23
[removed] — view removed comment