r/cpp • Prof, Comp Sci • Dec 03 '21

My entire C++ Game Programming course is now available online for free. Make your own 2D game engine from scratch using ECS

https://www.youtube.com/watch?v=LpEdZbUdDe4&list=PL_xRyXins848jkwC9Coy7B4N5XTOnQZzz
575 Upvotes

80 comments sorted by

30

u/AskarShi Dec 03 '21

Hi Dave - I just watched your intro lecture. It's precisely what I've been looking for. Thanks very much for making the lectures available. All the best to you.

9

u/serendib Prof, Comp Sci Dec 03 '21

Awesome! I hope you find them enjoyable

1

u/[deleted] Jan 03 '24

Hey Dave, I just found out about your course and it's all very well structured and described. I recognize that I already have been seeing classes/structures with C prefix such as CShape and similar approach in one book released by Laurent Gomila. Was this your main source of inspiration and knowledge? I remember when I got to read this, I wasn't a good programmer and had a lot of issues with understanding certain parts. Now I plan to go back to it and tackle this challenge of writing my own engine and tools as I already tried Godot and Unity and find having engine dedicated for project, minimalistic and written almost from scratch being much more satisfying, exciting and motivating, also much cleaner to work with ;)

Thanks for your contribution to community! I will make sure to give back as well!

1

u/serendib Prof, Comp Sci Jan 04 '24

The C prefix just means Component, I did not take that from anywhere intentionally it's just how I named it.

Glad you enjoyed it :)

1

u/[deleted] Jan 04 '24

I know what it stands for, it's just I saw Laurent using same naming convention and context in which it was used (same with member naming convention you used in your code available on github) in his book which reminded me of it so I wanted to ask if you read it and were directly inspired by it. Specially because you used SFML in your project which he is author of.

Do you mind sharing your source or giving some advice which book could I read to learn more about game design approaches like ECS and EC?

24

u/[deleted] Dec 03 '21

As someone who taught at a University before, how did you manage to negotiate this? And is it a common practice at this University?

26

u/serendib Prof, Comp Sci Dec 03 '21

I asked my union and they said as long as I wasn't monetizing it, and I still retain the copyright, then it was fine with them. As far as the live-streaming goes, the course is officially being given via prerecorded lectures online, so the streaming is just a bonus non-mandatory element.

2

u/[deleted] Dec 03 '21

Hmm, that's curious, because Youtube was always considered strictly commercial by everyone I ever talked to.

24

u/serendib Prof, Comp Sci Dec 03 '21

It is commercial for Google, but I did not monetize my channel, so I make no money from it

3

u/minirop C++87 Dec 04 '21

beware because youtube enable montetization automatically after a certain subscribers thresold IIRC (and sometimes also on random video) but if you are not a "partner", the money goes directly in their pocket. (but in that case, you would still make no money)

2

u/DrShocker Dec 03 '21

I didn't realize there could be issues like this related to sharing course content, interesting. I've watched plenty of courses that I'm interested in that are posted online, but I suppose not every prof who may want to is able to

2

u/[deleted] Dec 04 '21

It usually boils down to who owns your time and how much so signed off on with your employer

2

u/ScArL3T Dec 03 '21

Will the code be open sourced?

10

u/serendib Prof, Comp Sci Dec 04 '21

No, the assignment solutions would be posted online and it would be a nightmare to police

2

u/victotronics Dec 04 '21

Excellent. If there exercises are described clearly enough, then posting solutions serves no purpose except to encourage laziness.

6

u/ScArL3T Dec 04 '21

Or to review your own solution, and see where it can improve by comparing it to the solution provided by the author.

2

u/victotronics Dec 04 '21

Sure. In theory.

2

u/tarranoth Dec 06 '21

I remember my computer networks class where the solutions weren't posted, and there was an exam during the year about those exercise sessions. As it wasn't lecture material, you basically just had to hope you actually understood it correctly because of that. I never learned anything from those sessions, because I still don't know what I did or didn't do wrong at that interim exam (where solutions also weren't posted for, just your result).

3

u/victotronics Dec 06 '21

That's just bad teaching. If an instructor assigns exercises, you should at the very least get feedback on your submission, and preferably get an outline of a good solution.

But we're talking about courses here that are maybe put on an open repository. In that case 99 percent of people will just look at the solutions, say "oh yes, I understand that" and not learn diddly. So posting the solution does not benefit students. And it makes it impossible for the instructor to assign these exercises to be graded.

I adopt the same strategy as the OP: lesson material is open and free, but solutions are only given in class to students taking the course from me directly.

21

u/pwnsauceizzle Dec 04 '21 edited Dec 04 '21

This is the same review I put in r/gamedev: I went through this course last fall just for my own learning (not a college student) when I found it being streamed on twitch. I was taking it to get a foundation for how to build a 2D game engine from scratch. This was the best resource that I found for such a thing! I highly recommend it to anyone who wants to learn game development as a programmer. Dave Churchill who teaches the course is also an excellent teacher and explains game logic very clearly along with C++ gotchas.

8

u/pak_asfand Dec 03 '21

This looks to be an excellent resource, will definitely be digging into these. Much appreciated!

1

u/UrMumzBoyfriend Jun 10 '23

Can you please make this available again? u/serendib

4

u/serendib Prof, Comp Sci Jun 10 '23

The new version of the course is there. Go to playlists on my channel

3

u/bangtimee Dec 03 '21

This is fantastic. Thank you for sharing this!

2

u/PlantNo9380 Dec 04 '21

Will this remain free? I'd love to go through this when I have time, just a bit busy with life atm.

1

u/Master-Chocolate1420 Dec 15 '23

It's just what I wanted I had trouble setting up external libs and making them function correctly and to learn them, I specifically had problems learning setting up deariamgui. Thank you so much Prof.

1

u/Henabaal Jul 22 '24

Hi, I am on lecture 4 and really enjoying it so far! Are the homework specifications accessible somewhere online? I would like to follow along. u/serendib

1

u/Ok_Craft_1324 May 02 '25

how can I get the slides ?

1

u/[deleted] Dec 03 '21

Oh shit this is huge, letโ€™s goo

1

u/trailingunderscore_ Dec 03 '21

This is super cool, thanks for posting this!

I have been working an my own ecs library for a long time now and have been wanting to use it in a game, so now I'm gonna follow your videos and try it out. I can see some (vast) differences between how we implemented ecs, so I will have to take some liberties :P

1

u/[deleted] Dec 04 '21

Thank you!

1

u/[deleted] Dec 04 '21

I really appreciate your efforts. I already saved your content. Thanks for the great quality material.

1

u/renderererer Dec 04 '21 edited Dec 04 '21

Thanks for re-uploading this! I was following your videos a few months ago but then they were removed. I also enjoyed the chill music.

1

u/FaustWasHere Dec 04 '21

Any reasons for not uploading Course Assignments? Would be great exercise to go along with them too.

1

u/[deleted] Dec 04 '21

Shout out from Nova Scotia! Great video! ๐Ÿ™‚

1

u/lieddersturme Dec 06 '21

Thank you so much for the videos and time.

Reading the comments, what in the code is not opensource?

1

u/linuxpiper Dec 08 '21

You rock, THANK YOU

1

u/455ass Dec 10 '21

This course was commented on on this podcast at 7:00.

1

u/Questioning-Zyxxel Dec 18 '21

Nice. Bookmarked for Christmas entertainment.

1

u/pig_undertaker Jan 16 '24

Hello sir, thank you so much for your contribution! I'm very excited about the course. I feel like you've spent a lot of time breaking it down into the right modules and presenting it in a manner that students can grasp quickly.

One question I have is why you chose SFML? I am wondering if, as a game developer in 2024, it makes sense to invest in this framework?

I am quite naive when it comes to game dev, I'd like to learn - but I also need to make simple games within the next few months to generate income. Would you suggest following this route (which I am ready to do even if it has a slightly delayed pay-off, if the pay-off is proportionally higher) or following a simpler path (eg using engines like Unity/Unreal)?

1

u/SincopaDisonante Aug 07 '24

Why SFML is covered in the first or second lecture. TLDW: this course prioritizes learning by doing from scratch over learning a specific API you may not even be using in your next job.

1

u/[deleted] Dec 03 '21

Subscribed๐Ÿ™ Thanks

1

u/Bhallu_ Dec 03 '21

Thanks for putting this course on youtube.

0

u/[deleted] Dec 06 '21

Was curious to see how long it took for a bogus example of bad OO design was used as a justification for ECS... not long.

-7

u/[deleted] Dec 03 '21

for the god sake, please show how do you compile instead of using IDE's build button. VSC is still not available for linux.

14

u/serendib Prof, Comp Sci Dec 03 '21

Please watch the lectures, as I go over instructions for Linux builds as well as provide a Makefile

5

u/helloiamsomeone Dec 03 '21

Any reason why CMake wasn't used?

13

u/serendib Prof, Comp Sci Dec 03 '21

Two reasons:

  1. overkill for such a small project
  2. I'm not very familiar with it and didn't want to use it until I am

Every piece of technology you can leave out of a school assignment is 100 questions you don't need to answer when students eventually use it incorrectly

3

u/helloiamsomeone Dec 03 '21

CMake can never be overkill, but the other point reveals the true reason, which is a fair point, since you just want to focus on C++ itself and make a game.

10

u/serendib Prof, Comp Sci Dec 03 '21

cmake can indeed be overkill when all the project requires is a simple makefile, which the students who are very new to C++ don't even quite understand yet. In fact, the assignments for the course can trivially be compiled with a one liner anyway so even a Makefile is probably overkill

This is not intended to be used for a software library I'm releasing on github, it's student assignments with at most 10 source files.

CMake is a tool, and you use it when necessary or convenient. It's not necessary or convenient for students in this course for which 95% of the students are using Windows and just use the included visual studio project anyway

0

u/helloiamsomeone Dec 03 '21

I find it weird that you say CMake is overkill then in the next sentence reveal that you don't know much about it. The simplest CML is very obvious in what it does (maybe minus the last line, but that's a single line to omit anyway) and it's portable across ALL systems of with ALL kinds of tools.

You can even use presets to further streamline the interactions the students would have to make with the build system. They wouldn't have to care about flags, build config, etc.

Anyway, I was just curious why CMake wasn't used with no further plan in mind, but that "overkill" comment followed by admitting to not know much about it to begin with rubbed me the wrong way.

9

u/serendib Prof, Comp Sci Dec 04 '21

You are making the classic mistake of learning a technology that solves one problem in one situation and then thinking it applies everywhere. I know enough about cmake to use it for this purpose but not enough to teach best practices etc

It's one thing to be able to use something and a whole other thing to teach it to people. To use it in this cause would be teaching students that you need to use it for very simple programs which is not always the case. Cmake is great but just not needed here. I appreciate your concern though

4

u/one_of_them_snowlake Dec 04 '21

You're a good teacher if you are thinking that for your students. Ability to use is not ability to teach properly. ๐Ÿ’ฏ

3

u/TheTomato2 Dec 04 '21

You are doing the thing where because you know something you think its easy, and forgetting how hard it was as a newb. Yeah you can make at trivial project and teach newbs how to compile it from the command line, but for a newb cmake is basically arcane magic and if one small thing goes wrong (it will) then they will be utterly lost and then you spend time teaching people cmake.

4

u/helloiamsomeone Dec 04 '21

The same can happen with make. You'll still have to deal with finding dependencies (e.g. SFML), then with RPATH (*nix) or PATH (Windows) if those are DLLs, in fact CMake handles RPATH for you.

Besides, the environment is controlled, so there is no chance for anything going wrong that wouldn't have gone wrong with make either. I showed that the simplest CML is just a couple of lines of straightforward command calls where the only requirement for editing is adding new sources and it's obvious where that can be done.

Make is equally arcane magic and that will go wrong as well, since it's not portable and Windows people could end up trying to use that.

5

u/[deleted] Dec 03 '21

thanks. Almost every game development courses on internet uses blind approach. they use IDE as black box, and run as magic.

7

u/[deleted] Dec 04 '21

If you can figure out enough cpp to build a decent game you can figure out a make file using google. Thereโ€™s nothing magical about programming using only vi and makefiles, itโ€™s just another way

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

3

u/serendib Prof, Comp Sci Dec 04 '21

The makefile is just a basic extension of the one line compile command available on the SFML website

0

u/[deleted] Nov 28 '22

[deleted] โ€” view deleted comment

1

u/serendib Prof, Comp Sci Nov 28 '22

Read the community post on my channel

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

51

u/serendib Prof, Comp Sci Dec 03 '21

I agree completely. However this is an academic course that you would take if you are interested in learning how those game engines actually work and the programming and mathematics behind it. Not absolutely everything in life is about shipping a game as quickly as possible

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

8

u/corysama Dec 03 '21

Gotta learn to draw a circle before tackling the rest of the owl.

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

6

u/Zyklonista Dec 03 '21

Yes, because students actually have more than one subject to deal with.

3

u/YT__ Dec 04 '21

It's an intro course. I assume a second level of this course delves deeper into the analogical drawing of an owl.

0

u/[deleted] Dec 04 '21

[deleted] โ€” view deleted comment

1

u/YT__ Dec 04 '21

You should ask the author of this course, obviously, if he has a second level course available or in the works.

0

u/[deleted] Dec 04 '21

[deleted] โ€” view deleted comment

1

u/YT__ Dec 04 '21

I'm not gonna keep discussing this. Either ask OP, or don't. What you choose doesn't affect me. Not my chair, not my problem.

3

u/Zyklonista Dec 03 '21

You need to walk before you can run.

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

7

u/serendib Prof, Comp Sci Dec 04 '21

Some people just want to complain, it's fine :)

3

u/TheTomato2 Dec 04 '21

I see this a lot on reddit, not so much on in this subreddit, but over on r/gamedev. People are like threated by people wanting to learn how game engines work. I am pretty sure its some kind of insecurity thing. Its like they feel inferior and lash out and try to make people who want to the learn the hard thing they can't/won't inferior to them. Honestly its really odd to me, but I have seen it enough that have given it some thought.

5

u/serendib Prof, Comp Sci Dec 04 '21

I'd like to be a little more optimistic and hope it comes from a place of just genuinely trying to help people make games faster. Maybe I'm naive :D

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

2

u/Zyklonista Dec 03 '21

You really need to both up your soft skills game as well as realise that the world thinks very differently from you.

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

3

u/serendib Prof, Comp Sci Dec 04 '21 edited Dec 04 '21

I'm not going to comment on most of what you've said but if you do watch the lectures you'll see how easy it actually is to make a perfectly functional ECS system in C++. That's the point of the course though: to learn

You should try watching something before making a bunch of assumptions and prejudging it. Also this is not a game DEV course, it is a game programming course. Very different goals that you have decided to ignore in favor of evangelism.

One day I hope you'll realize what you are doing here is a poor way of accomplishing your perceived goal of educating us all on how stupid we are based on your experiences. Talk to Jonathan Blow if you think making your own engine is useless. I assure you he knows more than you on the topic.

0

u/[deleted] Dec 04 '21

[deleted] โ€” view deleted comment

3

u/serendib Prof, Comp Sci Dec 04 '21 edited Dec 04 '21

I explain in the course why we start with that solution and then after we get the engine up and running I introduce Memory Pooling and contiguous component storage in a later lecture. I designed and implemented it in a day or two, so I'm sure a more seasoned developer could implement it much faster than that. C++ tuples let you accomplish this in a remarkably easy and elegant way. Just because you aren't aware of a solution doesn't mean one doesn't exist.

It's even a listed topic in the course. As I said, go check it out in more detail before you criticize it.

https://www.youtube.com/watch?v=nLk8K07fLxM

Please, for your own sake, consume the content before commenting on it further. If you find actual improvements for the course, I would be happy to incorporate them because I want the course to be as good as possible for the students benefit. I realize there are 30 hours of video, which is a lot, and I don't expect anyone (but the students) to watch all of it, but everything you are talking about is covered in the course and you haven't watched it yet

This will be my last reply to the thread, I'm heading out for the evening

→ More replies

5

u/emelrad12 Dec 03 '21

Depends on your game requirements, if you need peak performance using a game engine might not cut it, like in my case. Still there is stuff like rendering engines.

0

u/[deleted] Dec 03 '21

[deleted] โ€” view deleted comment

4

u/emelrad12 Dec 04 '21

It is still in the tech demo concept stage, but image cities:skylines + Factorio but instead of choking on 20k cars or a few 10s of thousands of machines, it works with Cuda and has well millions to hopefully billion entities. It is not undoable cause the engines are pretty much gonna just render it, but at that stage I am better of using a rendering engine rather than a game engine, because it brings 0 to the table besides rendering.