Video Game Programming From Scratch With Casey Muratori - CoRecursive Podcast

CORECURSIVE #062

Video Game Programming From Scratch

With Casey Muratori

Video Game Programming From Scratch

Casey Muratori

I’m not really a big gamer, but lately, I’ve fallen down this rabbit hole into the world of Casey Muratori, and this project that he started on Twitch in 2014. He is building a video game from scratch and explaining it all as he goes along.

Casey is a professional video game and game engine, creator. He has been doing it for over 30 years. His approach to development feels a little bit like it’s from the 1970s. Yet, it resonates with many smart people who are learning how to truly build things and understand fundamentals from Casey.

Casey has a lesson about learning and teaching for us all.

Transcript

Note: This podcast is designed to be heard. If you are able, we strongly encourage you to listen to the audio, which includes emphasis that’s not on the page

Intro

Adam: Hello, and welcome to CoRecursive. I’m Adam Gordon Bell. I’m trying to find and share the personal experiences of building software. I’m not really a big gamer, but lately I fell down this rabbit hole into the world of Casey Muratori, and this project that he started on Twitch in 2014.

Casey: The videos are me just programming. They’re not even good. I mean, I’ll be honest. I’d love to say that they’re amazing, and that I’m really great. But they’re not. They’re not. All they are is a regular programmer who does actual real programming work. Right? It just ended up taking on a life of its own.

Adam: Casey’s game programming videos, they started a movement. It’s a movement that in some ways feels like software development from the ’70s. But in other ways, it’s totally modern and maybe points towards the future of learning or entertainment. I’m not sure where to start with Casey’s story, but the basics of his approach, they date to this job he had in the late ’90s.

Casey: In 1999, I took a job at RAD Game Tools. I was still a C++ programmer at the time, meaning I was still … If I was going to write a matrix multiplication, it would be like templatized on the size of the matrix. Right? Traditional C++ class hierarchy with inheritance kind of programming. Smart pointers, for example. One of the things that was cool about RAD Game Tools is it was me and there were two other programmers there. RAD Game Tools is legendary in that the amount of money they make per programmer is staggering.

They were making millions of dollars a year and they had three programmers or something, and not on weird web laundering of money where you basically you’re selling ads to be like … Literally selling software. This is libraries they’re selling. Right? The two programmers there at the time, beside me, when I joined Jeff Roberts, who has literally written the video codec for every game basically in existence almost in history. Every game. Name a game, the videos play back through something Jeff wrote, right? From basically the year ‘94 to today.

Adam: Wow.

Casey: Whatever the latest game is you pick up, it’s videos are playing back through something Jeff wrote. The other programmer was John Miles, who’s the guy who wrote the engine for Ultimate 5 way back in the day. He wrote the Miles Sound System which was the sound system used in most dos games. It was extremely popular, still exist to this day, in fact, and it’s used by people for sound. I want to say he also wrote the render on Wing Commander III. Anyway, those two programmers who were there and they are old school C programmers.

Here I am looking at this and I’m like, “Well, these are way better programmers than me, and they don’t use any of this stuff, and I wonder why.” Right? Why is it that you get some programmers who are literally some of the best programmers I’ve ever seen and they don’t use any of this stuff? Why is that? Right? Not only that, but if you take Jeff, for example, it might be argued he’s a programmer who as far as the video game world is concerned. I mean, it’s staggering to think of how many games have his code in it. Right?

Because they all [inaudible 00:03:32] It’s just like looking at how impactful they are and what amazing stuff they were able to do, and it’s like why am I using all this stuff? Do I know something they don’t? Because that seems unlikely. Right? There’s a little bit of programmery I always know what I’m doing nonsense, and it’s like do you? I mean, why are these other people who are so good not need that thing? Right. Being honest with you, you have to be a little bit introspective and go, “What’s going on here?”

Being Critical Of Your Own Skills

Adam: Did these guys talk to you and say why are you using templates or-

Casey: No. It was just … I mean, I am always as critical of my own habits as I am of anybody else’s, right? If I am aggravated with some piece of software that someone else’s … I’ve had some famous rants about Visual Studio, for example, and how bad it’s gotten. That dialogue, I mean, you might be tempted to think that that is just me complaining about someone else [inaudible 00:04:36] software. No. That dialogue is happening in my head about my programs all the time. I always think they’re terrible, right?

I’m always going what could I have done to make this less terrible? It only comes out of that. It was me just looking and going like, “There’s probably something to learn here.” Incontrovertible, these guys are better programmers than I am. That’s true. One reason for that could be that I just suck and I’m never going to get any better, so it doesn’t matter. So just keep using C++ and whatever. Right? Another possibility is that I could learn to be as good as they are, and I’m just not taking it seriously enough. I’m not trying. Right?

Adam: Yeah.

Casey: Yes I’m trying to program, but I’m not trying to get better. Right? What are things I can use to get better? Well, I can look at what they are doing and go, “What about what I am doing is different, and can I assess if any of those are the answer?” Because they might not be. It might be that they just happened to program in C and I happened to program at C++, and they happened to be good and I happen to suck. That’s a totally possible thing that could have happened there. But another thing could be that actually I could be good, I could be writing code as good as they are, but I need to learn what are the things that they know that I don’t?

What are the practices they have that I don’t have? Right? I always try to do that as much as I can. If I see something that looks like it’s working well, or that they’re getting something done well, I try to go, “How can I reassess what I’m doing to see whether there’s something of that that would make a difference for me?” Because I want to be better, I don’t want to be writing bad code. But it’s not always obvious how to improve.

Trying Just Plain C Programming

Adam: Did you spend time watching them code?

Casey: Not in so many words. I never walked into someone’s office and was like, “Teach me how to program.” But I tried to say what are the things I could do that would assess my own practices in light of the fact that I have some good examples just sitting here? Because typically watching a programmer program at that time would have been creepy. I’d be sitting and we’d be like, “Kilroy was here.” I’m peeking up over the chair. A little Casey head pops up. What I did was I was in charge of the character animation system, and I wrote the first version, it sucked. I was going to write the second version as, let me try. Because I started programming C, not C++, and I had become a C++ programmer.

I was like, “Let me try just going back to see,” because honestly I know how to do it because I used to program [inaudible 00:07:22]. Let me try going back to C and what I’m going to do is I’m only ever going to use one of these features in C++ if I actually can demonstrate to myself that it would create a benefit here. What I found was that literally the only two things that were at all useful were operator overloading and function overloading. Those are the only two. Everything else, I was like, “Yep. The code was better without it.” Unlike most programmers, I actually had the experience of literally taking the time to see, do these features actually improve the code or don’t they?

I could actually test it because I was fortunate to have the time and control over a project to actually see what happened. From there, I was just like, “You know what? I need to do that for everything. I need to actually start taking this seriously and stop just assuming that because someone else puts something in a language that it must be good.” When you change your thinking to I’m going to evaluate rather than I’m going to trust, what you start finding is that most things most people say are mostly wrong, and the reason for that is they have to be because a lot of them are overlapping.

Most of the time you see two different people suggesting two different ways to do something, obviously someone’s wrong or there isn’t a better way to do it, meaning it doesn’t matter which one you pick. Either somebody was wrong and one of them was the correct way, in which case there was one that you should have rejected, or it doesn’t matter which way you do this, in which case they were all wrong for suggesting that you needed to do it this way. I think ever since that point in my career, it’s been about 20 years since then, I’ve just always evaluated things as carefully as I could.

When I see a new thing suggested, I go, “What does this actually yield?” If I look at the difference between doing it this way and doing it in whatever way I would have done it before, and I go, “Does that result in less lines of code, less bugs, less time?” Blah, blah, blah. I go, “Can I make an argument along any of these lines?” What you’ll find out if you do this, honestly, is a lot of the stuff is just a waste of your time.

The Do It Yourself Development Aesthetic

Adam: Casey, didn’t just leave C++ behind, he also nurtured this sort of obscenely DIY development aesthetic that’s pretty uniquely his. He doesn’t use an IDE. Just Emacs 1. He doesn’t use make or a build script. He doesn’t use any libraries. He thinks other people should try this approach.

Casey: I think everyone should have the experience of building something from the ground up. Most programmers, no matter what they work on, would benefit greatly from having written one thing from scratch, meaning start in a fairly bare language, such as C, don’t use the libraries, just write everything yourself from just basic things. Even better if you want to try assembly language, but assembly language has a bunch of things that you have to do, like register allocation. I’m not sure you get much learning from the extra work that you have to do, right? Something C I find is a really good language for doing this kind of experiment because there’s so little in it, right?

It’s a very sparse language. It just has the few basic things. It translates fairly directly into assembly language. It’s easy to go on Godbolt anytime I want to and show someone how C translates to [inaudible 00:10:54] It’s trivial, right? It’s really easy to see. I think most programmers would benefit greatly from going through that exercise. Pick something simple, a simple web server, a thing that just answers non-HTTPS. Just HTTP. You can write a simple web server and see in not very many lines of code, if you’re a web developer, doing that one time and seeing how it actually works, I think it would be greatly educational for a lot of people. Not because I think you should go rewrite your web server and see yourself because that may be a very bad idea for you. It’s for your understanding. I think it’s invaluable to have done at least one project from scratch.

Slow Code is Dishonorable Code

Adam: Something that’s very different from the current aesthetic in the cloud development world that you learn working on a game development tool is that developer ergonomics should take a back seat to performance concerns.

Casey: Yeah. I think there’s a failure to recognize that it’s not sufficient to simply serve ourselves, is the broadest way to put it. When you sit down at a computer, your first thought should not be, how do I make my job easier so I can go home earlier today. Right? The thought should be, how do I make the best program for my user, right?

Adam: Yeah.

Casey: When we fundamentally start thinking about how do we make the easiest possible thing for the programmer to program, and we don’t care that the thing that we ship the user is 100 times slower than it should be? To me, in a way it’s almost dishonorable. It’s like I feel like I’m being dishonorable by thinking primarily about my experience and not about theirs.

Handmade Hero Starts

Adam: Eventually, Casey leaves RAD Game Tools. He starts his own thing called Molly Rocket, and he works on some indie games. Then in 2014, something happens.

Casey: I’m friends with Jonathan Blow who is a very famous game designer. He made Braid and The Witness. He’s also famously working on a new language right now called JAI, but he was doing streams on Twitch, the gaming live stream platform, to talk about his ideas for baking a programming language way back then. He was like, “We need to make a new programming language, and I want to talk about some ideas that I have.” I’m pretty sure that was the first thing that I saw on Twitch of anyone doing a programming thing on Twitch. Right?

I liked it, and there were other people there who knew who I was. The reason for that was because I had worked on the witness with John and I had written some articles. I wrote these things called Witness Wednesdays, where I talked about some of the code in The Witness and how it worked. I did a bunch of work with collision detection systems because we were doing some novel stuff there to make it so that you couldn’t ever do stuff like fall through the world. I don’t know if you’ve ever seen bugs in video games where people are trying to walk and that … Right?

We did some pretty novel stuff in that game to make it so that that couldn’t happen, right? So that we had provably secure algorithms where you couldn’t actually have these kinds of bugs happen. I’d written some of that up, and I wrote up some other things and blah, blah, blah. People knew who I was who would have tuned into John’s broadcast. Right? It’s like we were linked in that way. When I was on the Twitch chat, some of the people were asking me, “When are you going to do a programming stream?” I was like, “I don’t know what I would do with programming stream. I don’t know.”

Then in my head, I started thinking, I was like, “I’ve always wanted to have a complete recording of making an entire game engine just to watch what happens.” Because when you think back about what happened when you’re programming, your memory is far from perfect. You compress down things that actually maybe took you quite a bit of time. You overemphasize things that maybe didn’t take you very much time. I was just curious to see what if we just recorded this? Would it give us any insight? I was like, “Oh, okay. Maybe I’ll do this thing where I’ll stream just making a game. Right? I’ll just make a game.”

I was thinking a little tiny game that was just some sprites on a backdrop or something, right? Pretty basic. I mean, on Twitch at that time, for a programming stream, I mean the viewer count if you looked in the equivalent of the programming category, the numbers were 10 people, right? For whatever reason, and I have no idea what the reason is, the first episode of this thing got 1,000 viewers or something.

Adam: Oh, wow.

Casey: It was a massive turnout for this thing.

Building a Professional Commerical Quality Game Engine From Scratch

Adam: That first lesson started with creating a text file called Handmade.cpp, opening it in Emacs and compiling it. From there, writing stuff into a buffer and displaying that buffer on a screen. Casey would live stream building a professional commercial quality video game from scratch every week night for as long as it took until it was done.

Casey: It just ended up taking on a life of its own, whereas like, oh, I guess I should start trying to teach real stuff here to a certain degree and take this more seriously, because it’s like it seems like this is something that people actually really wanted. I’m surprised even to this day, originally I had my email on the Handmade Hero homepage. I received so much email I had to take it down.

Adam: Oh, wow.

Casey: People were just like, “Thank you so much for putting this up. This is so helpful. I didn’t understand how to do any of this programming until I watched these videos. I went through four years at university, I don’t feel like I learned anything. I watched these videos and it all clicked for me.” Mind you, this is just me … The videos are me just programming. They’re not even good. I mean, I’ll be honest. Honestly, I’d love to say that they’re amazing and that I’m really great, but they’re not. They’re not. All they are is a regular programmer who does actual, real programming work. Not a theoretician or somebody who’s pie in the sky and talking about solid principles or whatever people like to theorize about. Right?

Adam: Yeah.

Casey: All it was was just a regular programmer programming and people being able to see that made all the difference for them. Because they’re like “Oh, I can do that.” Right? I was having trouble understanding how the Liskov Substitution Principle comes into play when I need to print out the number five. Hint, it doesn’t. Forget about it. It’s irrelevant. But if you just focus on what programming actually is and not all of the crap that people have piled on top of it, a lot of people can do it.

Adam: In other words, people wanted to know where to start.

Join the Newsletter

Did you know CoRecursive has a newsletter?

Sign up to get insights, takeaways, and exclusive content from each new episode.

    We won't send you spam. Unsubscribe at any time.

    Learning Game Development From First Principles

    Adam: A lot of people love video games and want to build one for themselves, so they would tune in. In a Twitch, there’s a chat and people would ask questions, and in true Casey style, he would answer these questions from scratch.

    Casey: One of the things that people often mention about when they ask a question on one of my programming streams, I think the joke is I always start with the universe cooling down. First, the Big Bang happened, and then I explain from there to the question that [inaudible 00:18:30] Right? It usually takes 40 minutes. Someone asks about some CPU thing on a Modern X64, and I’m like, “Well, when you started with an 8-bit CPU, it did this that, and you could see this here, let’s pull up a diagram.” Right?

    For some reason, I just, by habit, always seem to go back and sweep all the way through the history. I think it might just be how my brain stores things, and it’s probably just wasting their time at some level. Right? But it also helps for doing things like instructional courses, because there you’re dealing with beginners, they need the whole thing. So working with a novice, I can be more effective, I think, usually.

    Adam: He also tried to explain the background on whatever was being done that day. If the game requires sound, we need to learn about how waves work. If we need to do rotations, then we better learn some linear algebra. Did I mention he started in 2014? It’s now early 2021, and he’s still going. People are following along and they’re building up their own things. They’re using him as inspiration for their own games, for their own programming languages, for their own debuggers. If you pre-order the game, you can get access to GitHub where there’s an annotated version of the source code linking to all the videos.

    I’m not entirely sure how many hours of content he’s produced building this game, but he has about 700 episodes so far, and they range from one to three hours. Conservatively, there’s at least 1,500 hours of programming content, which is astounding, right? I do not have 1,500 hours of content I can put out that I could teach people.

    Learning To Program As A Child

    Adam: It makes me wonder how Casey learned all this. How did he get started?

    Casey: My dad taught me how to program when I was seven. The way that home computing used to work in those days was that anything that was even remotely considered a home computer had BASIC on it. A lot of times it was built in. If you think about very popular names of computers from the day, so Commodore 64, Apple II, these computers all had BASIC in the ROM. Meaning when you turn the computer on, you don’t have to put in any … you don’t have to connect any storage of any kind to it. The literal ROM chip soldered into this computer has a BASIC interpreter in it.

    BASIC for people who don’t know is the language that looks like 10 PRINT “Hello, World” Right? That’s basic. Definitely, it’s a language that’s really designed for people like a seven-year-old like me. It doesn’t have hardly any syntax. It looks more like a command prompt than anything else. If you can do CD and Durer, you can probably put in a crappy little BASIC program. When I was seven, my dad taught me how to do some BASIC programming, and that’s just like … Yeah. I mean, you can imagine a seven-year-old …

    You can learn to type, print and put in some words, and then you go out and you just type a run to run the program or whatever, and it would run and it would type the thing out. Right? It was a super crappy program. It was basically [inaudible 00:21:29] like print, and it printed out a thing for my mom. It said, “Pick one of the following options,” and it had one, two or three. Then if you type one, it would print something. If you type two, it would print something.

    That was it. But it has all the things you need to start understanding programming, the ability to print something out so you know what happened. The flow control of going to something based on what the input was, right? And the ability to run the program afterwards and see it happen, that’s that gets you started. Right? I’ve been programming ever since.

    Learning Programming Used to be Easier

    Adam: BASIC was definitely a simpler language than the languages we have today. Casey thinks the simplicity of this earlier environment, it just made things easier to learn in a way that people today refuse to acknowledge.

    Casey: If you’ve grown up your whole life and you learn to program in a simple way at a simple time, I think it can be very hard for people me like, for example, to appreciate just how much garbage today’s beginner without a guide would think they had to wade through. Because where do you start? You don’t know … If you come at programming today, you don’t have a BASIC interpreter on a Commodore 64 or the Deck Rainbow. You don’t get introduced to programming’s fundamentals. Let’s take a simple example. You’d never even hear about GoTo, okay? GoTo, considered harmful, is just a phrase that we say, right?

    Adam: Yeah.

    Casey: I’ll be completely honest. I don’t use GoTos in my codes, and I generally don’t think you typically need to use GoTos in my code. I certainly wouldn’t sit around going, “Oh, woe is me. Where have my GoTo gone?” But a beginner programmer should absolutely start with GoTo because that’s what the CPU is doing. If a person fundamentally thinks that programming’s actual … that what is actually going on in programming is that you can map something over an iterator, which is nonsense. It doesn’t exist in a computer. It’s a fictional construct we created because we found it convenient, right?

    It maps to GoTo. When you look at the assembly language code, there is no map over iterator, right? The assembly language has a jump statement. One of the things that I think people don’t understand, especially people who didn’t have this experience, is that if you never teach someone what a GoTo is, they’ll go their whole life not understanding how a computer works. It sounds like a joke. I mean, when I see the emails people write me, it absolutely breaks my heart to think about how far they’ve gone through life and the things they tell me that they were told or that they didn’t understand that all they need is just someone going, “Look, let’s just take basic, how a computer works and build programs out of it, because then there’s nothing wrong with mapping something over an iterator,” right?

    Adam: Mm-hmm (affirmative).

    Casey: But you need to know what that turns into. Giving someone the fundamentals of what actually goes on in a program for real makes it so much easier to understand all of these other things and not only that, but they can see the equivalences between them. They can understand the difference between a four loop, right? And mapping something over an iterator versus a Lambda versus a blah, blah, blah. There’s all kinds of related programming things that are going on. They all turn into a very simple set of things, right?

    Test, jump, basic register operations. If you start understanding all of those underpinnings, suddenly all of this other stuff just gets immediately demystified because you’re just like, “Oh, it’s just another way of producing this set of assembly code, and now I can just, in my head, trivially decide which one of these things was better rather than going to stack overflow and asking question of the form, should I be using this Ruby construct or that Ruby construct to do blah?” You don’t need to ever ask those questions. Right? You can learn to have the fundamental understanding to just evaluate these things yourself and know how you would investigate them yourself in a very little amount of time.

    Bottom Up Learning

    Adam: I mean, I like the sentiment a lot. But I feel like I disagree with parts of it. I think the Python is easier to learn than C. I mean, it just is, right? I think that … I used GoTos in basic, but I didn’t understand that they were the same … I didn’t understand that they became a jump instruction, right? I mean, that wasn’t important to my understanding of a basic program, I guess.

    Casey: Well, two things I would say about that. It’s not understanding that they turn into a jump instruction. It’s understanding jumps. If you learn to program in basic, you intuitively understand that the computer is a thing that has an instruction pointer in it, and it moves from one to the next to the next and then jumps, move you from wherever you are to wherever you’re going. You don’t have to know that assembly language even exists.

    Basic, by its very nature, line number, that’s instruction address, right? GoTo, that’s jump. The line number you’re going to, that’s the parameter, the jump instruction. Your brain was taught without you ever knowing how a computer really works. Now when someone shows you a loop, your brain automatically maps it onto that thing. Right?

    Adam: Yeah.

    Casey: When you come at something having had a more reasonable introduction to how a computer actually works and you build on it, that’s so much easier for you to handle than starting with something incredibly complicated where it’s very difficult to parse out all of the rules and what people are telling you and trying to get back down to that layer without a guide, right? In some sense, I guess I’m saying I had an advantage when I learned to program computing. I got to start when it was simple. I didn’t have to journey down …

    I didn’t have to start at Python and eventually work my way back down to figure out what the heck was going on and why Python programs are so slow, right? I knew that coming into it, because I’d started from the easier place, and it’s just like … It may also not be for everybody. Different people may learn in different ways, but the problem is no one was teaching it this other way. All of the people who couldn’t make sense of it, all of a sudden they can. Does that make sense?

    Adam: Yeah. No, it does make sense. I mean, I guess you’re saying I like to teach things bottom up. Let’s start with base principles and let’s accumulate our knowledge on top, step-by-step. Does that-

    Casey: Yes. Another way to think of it is let’s suppose that you were going to sit down. Do you play any video games?

    Adam: I’m not a big gamer. It’s funny for me to interview you, I think in a way.

    Casey: Okay. This analogy might not land, but for any of your listeners out there who play video games, they probably intuitively know the difference between the type of game where you are handed a controller and every button on the controller is mapped to some crazy thing, and you go through hour-long series of tutorial levels where they’re like, “In order to distract the guard, hold down the right trigger and then press A and B at the same time and then move the left stick to choose the location and then let go. But if you hold it for more than a second, it will …”

    Everyone knows the difference between that and the game that just starts you playing and introduce those concepts slowly. You start off and you don’t have to distract the guards. You just learn how to move by moving through the space. Then there’s a guard up ahead and they’re like, a little thing maybe says, “Hold A to throw something in the environment,” and then you do, “Oh, I see.” Right? It would be very strange if that same thing that so obviously happens when learning a simple system somehow wasn’t equally effective when learning a much more complicated system.

    Adam: In other words, it’s not harder to build something from scratch. It’s easier. You learn C and [inaudible 00:30:15] how computers execute code, and you just start going, and Casey’s there to guide you. Casey is trying to build the guidance system he wished he had. When he was young, he wanted to build a text adventure game, but he never figured out how.

    Getting People Started Is Half The Battle

    Casey: The reason that I didn’t know how to build a text adventure was I always imagined that in order to solve a problem, it has to be solved well. I know it’s a strange thing to say, but I always imagined that other people are solving a problem well. When I play a text adventure, I imagine them having something when they built that text adventure, their structure for the program and how they built it. If you were to compare in the abstract as a child when I was looking at those text adventures, what I imagined them to be doing under the hood, even though I couldn’t conceptualize it because I didn’t know …

    I mean, first of all, the Infocom, which is the main text venture company at that time, under the hood, the most advanced text adventures of the time from Infocom were actually running sort of a Lisp variant. Right? I don’t even know. It was their own Lisp, basically. They came from the AI department of MIT if I remember correctly. I mean, they loved their scheme over there, and so Lisp languages are big. I mean, I didn’t know what Lisp was. I knew what BASIC was. I wouldn’t have even had a way of conceptualizing even the language that they were using to develop these text adventure games. But one of the things that would happen in my brain is I would just imagine that whatever their solutions must have been, they were very advanced. Right?

    Adam: Yeah.

    Casey: But in actuality, if you could look at the code, it’s terrible and very primitive. Right? Even just knowing what I did, if I just said, “No, make it work with what you have now, your stupid seven-year-old brain that only knows BASIC,” I could’ve made a little text adventure if I just really pushed myself to just, no matter how ugly and not really solving the problem this is, just paper over it as best you can, and that would have made a text adventure. I wish I had learned that lesson earlier because assuming that this thing that you’re actually building has to be better than it really does is very limiting.

    I think a lot of who are writing me these letters, they’re not saying, “Thank you so much for teaching me how to program. I program just like you and I watched all your streams, and oh my God, you’re amazing.” No, I don’t think that’s what they’re saying at all. I think they’re saying, “Thank you for showing me how to start doing this thing,” and then I think they go their own way. I think they’re learning to program the way they want to program. I don’t think I’m really … I don’t think I’m providing the programming education that way.

    I think I’m giving them the opportunity to have their start at this more fundamental type of programming. I’m super proud of that, and I’m super happy about it. I don’t want to minimize it, but I don’t think I’m providing any SWAMI programming wisdom. I don’t think that’s what’s actually happening. I think I’m providing just the place for them to start. The reason that I say that is because if I go back in my own history, the reason I never really wrote much assembly language as a child was because I didn’t know how. I never had someone show me, oh, here’s an assembler, A, here’s how you start writing the code that you need to just get a simple thing running.

    I would have loved to have done that. Right? But I just didn’t know how. To me, I think that’s more of what’s happening. I’m just showing them here’s how to get started, and then I think they … I think it’s in them. It’s not in me. It’s not coming from me into them. It’s in them and they just couldn’t access it, and I’m just showing them, oh, here’s the door, let me open the door for you, and then they’re off, right? They don’t need me anymore.

    Adam: Yeah. Yeah. It makes a lot of sense. It’s like you’re an existence proof that this is possible. [crosstalk 00:34:17]

    Casey: That’s all it is. And that little bit of startup. Because then they [crosstalk 00:34:22] Because they’re very smart. You can tell these people are good. They only needed me to show them that there was a direction to go in, and then they’re going, they’re the ones who are going.

    Adam: Yeah, it’s not magical. There’s not wrong ways. You just go at it.

    Casey: Yeah. They’re going to end up programming much different from me, and you know what? I love that. I do think it literally just boils down to that sometimes. It’s just that mental permission that someone tells you, “No, of course you can do this. Here’s how you get started.” Then for people who have that natural drive to do something, that’s sometimes all they needed. It might also be something I would say as a word of encouragement to people learning to program who are older is that I can assure you that as a little kid going through it, it just feels like growing up, and you might feel stupid right now because you’re not getting a programming theory. It’s like no, that’s just … Your programming brain is growing up and it takes time, right? It just takes time for your brain to structure itself in a way that these things will work. Persistence and curiosity, if you can just keep them alive long enough, you will gain that ability.

    Reflection’s On Learning

    Adam: If everybody watched your first 30 videos, everybody who is wanting to develop software, what would that change about them or the world?

    Casey: The first thing I’ll say is I don’t even know if that’s something I would recommend, because you have to understand that Handmade Hero was something started on a whim, it wasn’t designed for any particular purpose. It was just designed to be a record of a complete recording of how you program a game engine. Right? So it’s not designed for anyone to watch the first 30 videos and get anything out of it. It was never designed for that. My new project, which is Star Code Galaxy, is designed for that.

    The answer I have for you there is I’m trying very hard to produce my attempt at the first universal programming course, a course that basically everyone can go into this and learn something about programming if they’re not already an expert. What I think it does is refocus on those fundamentals, right? It’s an attempt to say, “What are the crucial things that you need to know about programming that are always true?” Because what I see in a lot of course materials and educational materials, both for novices and intermediates, is they focus on learning something specific.

    The problem with learning something specific is it’s here and then it’s gone. If I teach you how to use angular, you know how to use angular, and that’s it. To answer your question directly, if they were to go watch 30 or 40 hours of Handmade Hero, what would that change? Really all I think that it offers is here is how a person who programs from first principles without libraries, without using a whole set of frameworks [inaudible 00:37:41] stuff, here’s how they step-by-step bootstrap themselves up into a fully functioning system.

    Because within the first 30 episodes of Handmade Hero, we’ve got graphics on the screen and sound and controller input, and we’ve got dynamic code reloading. We have looped live code editing. You can hit the record button, move the character around and then hit the stop button. It’ll play that back. You can go into the C code, change the C code, and it will change on the fly as it’s playing back [crosstalk 00:38:13] the recording. That’s all in the first 30 or 40 episodes actually. What I think you could get out of it is, wow, this stuff is a lot more accessible maybe than I thought, because you can watch me do it in 30 or 40 hours, get straight to that point. No SDL, no libraries, no boost, no Python, no interpreter, no JavaScript, no nothing. Just C code.

    Outro

    Adam: That’s what Casey brings to the table. It’s directness. Casey does hate modern C++ and Python and Visual Studio, and, well, maybe everything. But he’s teaching approach works because he doesn’t have to teach all that. He just started building a game and started answering questions along the way. Learning modern software development, it could take a lifetime. There’s just too much to learn. If you got into software wanting to build a game, then at some point, you just might wonder hey, when do I get to build my game?

    That’s when you find Casey, and he says, “Step one, create a text file and put a main method, and let’s make a buffer and we’re going to start writing things to the screen.” That’s what I’ve learned from Casey. I’m probably not going to go build a video game. But if I want to build a video game or if I want to make a programming language or a database or whatever, the thing I’ll remember from Casey is start with what you know, and you’ll be surprised how far you get even if it’s ugly. That was the show. I hope you liked it. If you did, please tell somebody about it or give me a review in whatever your podcast app is.

    I’m on Android and I use Podcast Addict, and you can leave reviews right in there. If you’re on the iPhone, you can leave reviews in the Podcast App, or if you use Overcast, I think you give a star and the stars increase the ranking of the podcast, I think so. That’s super helpful. But my absolute favorite thing is when people just tell other people about the podcast I see people recommending it on Twitter or LinkedIn, and somebody wrote a blog post mentioning it, and that’s just my favorite thing. That brings me a lot of joy.

    It makes me feel good about the effort that I put into this. So thank you very much for anyone who does that. I’m also working on the website, trying to add some professional transcripts, trying to put together a newsletter and just improving how things look a bit. There’s lots happening. This is Adam Gordon Bell. Until next time, thank you so much for listening.

    Adam: I’m going to place you on the C++ language committee. First meeting’s tomorrow, you get to decide the agenda.

    Casey: Okay. I’m in charge of the C++ standards committee?

    Adam: Yeah.

    Casey: I mean the first item on the agenda would be to start … whatever they have, a working group, a committee, a subcommittee. I would start a subcommittee on carbon neutral ways to incinerate the C++ 1,700 page specification in a way that produces energy, but doesn’t harm the atmosphere. Right? When that committee reported back, we would burn all the copies of the C++ spec and start over.

    1. Correction: Casey is no longer using Emacs. He uses 4coder on stream, and a custom-built editor on for his main projects. 

    Join the Newsletter

    Did you know CoRecursive has a newsletter?

    Sign up to get insights, takeaways, and exclusive content from each new episode.

      We won't send you spam. Unsubscribe at any time.
      Audio Player
      back 15
      forward 60s
      00:00
      00:00
      41:14

      Video Game Programming From Scratch