Hacker News new | past | comments | ask | show | jobs | submit login
Handmade Hero – A complete game live-coded from scratch (handmadehero.org)
536 points by tejohnso on Oct 13, 2017 | hide | past | favorite | 77 comments

I've already gone through 3 weeks worth of Handmade Hero episodes but stopped because of my busy schedule. During that short time I was able to appreciate the value of having full control over your code.

I've built a career using game engines other people have made. Sometimes it bothers me that I do not know what's going on behind the hood because of all the layers of abstraction. It's nice to be able to make something quickly, but the programmer in me feels sad that I'd have to trust things to just work without me knowing how.

Handmade Hero showed me how things work behind the scenes and it inspired me to be more aware of the internals of what I'm using as much as possible. Now I make it into a point to delve into documentations and source codes and am now also playing around with low level languages (Like C and Rust) during my free time. Overall these have helped me a lot and I look forward to improving myself more.

So kudos and thanks to Casey for this series. It has helped me strive to become a better programmer.

I see that you have already gone through 3 weeks of his episodes. I walked through the page provided, I can not see in what language is he writing ?


Casey is really well known in the gaming community - https://mollyrocket.com/casey/about.html Through Handmade Con, he's also interviewed many other creators like Jonathan Blow and Edmund Mcmillen. He also contributed to Blow's recent game, The Witness (specifically the movement system and the world editor).

This is a really good series by an experienced game developer that's basically free (or at least the Zed Shaw model of pay to download but free to view).

He also has some pretty cool articles on finding all walkable areas of the map ("walk_monster.cpp")and how he improved the grass planting system:



And here is Jonathan Blow and Casey chatting on Handmade Con two years ago: https://www.youtube.com/watch?v=Jpkrx1osuLc

I think you mean Tommy Refenes over Edmund McMillen.

I only came in to Handmade Hero after it had been going on for a while, and I followed it from the beginning episodically and made it about to the point where he starts talking about tiles and scrolling, then gave up.

Every now and then I pick up the current version of the code to see what it looks like, but there's no way I'm going to follow it through to the end. But for me, it does work as a reference for the various parts of the code he happens to be working on at the moment, and sometimes he stops to give a tutorial on something like basic 2d physics.

Watching the process overall is useful but if anyone is intimidated by the length of the stream I would suggest approaching it non-linearly.

He seems to have turned off comments on his Youtube stream, which I find disappointing. A lot of the value I've gotten from the early videos came from the comments people made either agreeing with, expanding on or disputing what was discussed.

The comments are enabled on the Twitch stream, in case you ever want to catch it live again.

If he saves Twitch vods, they contain the live comments as well as new comments from vod viewers.

He doesn't anymore. He has a portion before the stream where he likes to talk about things that are not code-related (like his opinions on X), and he doesn't want those recorded. As I understand it, people were taking the vods and posting snippets to Youtube, which went against the spirit.

I watched the first four or five weeks of episodes, but I'm still a bit puzzled by who Casey assumes to be the target audience. Granted, this is a really difficult endeavor, but I often find that he spends endless amounts of time explaining trivial things which, if you don't know them already, you'd have no chance of following along anyway. By that I mean, if you don't already know some algebra, you might "get" everything that he explains, but it's hard to imagine that you'd be able to actually internalize it to a point that you understand how it is later used in various parts of the code.

I know from my own experience, though, that it can be "fun" to explain things that you know inside out in (too much) detail because it gives you a feeling of satisfaction and appreciation of the material you're going over.

However, I can't help that for anyone to whom you have to explain high school math episode after episode, the rest of the show, i.e., actual (and sometimes rather low-level) programming would be completely over their head.

That said, I do enjoy watching the shows quite a bit and I still plan on finishing the full run. I just wish the trivial stuff wouldn't receive so much time, or that there was a good way of skipping forward without having to fear to miss something important.

One really awesome thing is that the source code is bundled up after each episode so that you can really easily get back to speed after a longer break, like in my case. What I plan to do is to find the last episode I watched, then download that episode's code, and remind myself of the current state of affairs by studying the code, rather than trying to remember the content of everything I already saw.

I think this whole series is such a cool thing to do. And you can really tell that he knows his shit.

Casey, if you hang out here on HN, two thumbs up for this awesome effort!

A community member actually annotates all the episodes with time stamped descriptions of what's going on in the videos; You can watch the episodes with them inline and clickable here: https://asafgartner.github.io/annotations_player/index.html

I failed high-school math, and couldn't even spell linear algebra two years ago. I'd never done any game programming to speak of, and had never written any C code before starting Handmade Hero.

After watching through most of the series, and writing a 3d engine (HH style, no libraries), I have internalized an amazing amount; the vast majority of what Casey's gone over. I agree that often times he goes into more detail than necessary - even for me, who started knowing literally nothing about what he was talking about, but I would attribute the amount of learning I've gotten out of the series to exactly that. For someone that doesn't understand the difference between an Object Transform and a Camera Transform, the only way for them to actually learn what they are is to hammer it home again and again - through examples and practice. I think I am exactly his target audience - young programmers who want to learn how to make video games.

Just my 2c

I think he's aiming at hardcore gamers who are interested in learning more about engine and gameplay coding.

Game development is a great way to either brush up on your linear algebra skillz or motivate you to develop them in the first place, so he can't assume that his audience is either fully up to speed or completely ignorant.

I really feel like I should start live streaming some of my coding sessions; taking a clear task from my issue tracker and working on it until completion. When I work on stuff on my own, I get distracted by things like ... well .. typing this comment on hackernews.

Streaming a coding session over a well defined feature seems like a really good idea to stay focused .. like XP except not terrible and make you want to stab your partner in the face.

To each their own, but for me the series were just too slow. As in, it felt like half the streams were just going over the basics and explaining every little detail. Which I'm sure some enjoy, but if you're like me, I'd recommend Jonathan Blows streams (naysayer88 on Twitch) for a little faster development.

That's what youtube 1.5x / 2x speedup is for ;-)

as i understand it, the format of handmade hero is intended to allow for a code-along, from zero to complete game.

Thank you for that, I had no idea he streamed. The Witness is one of my all time favorite games.

I'm surprised nobody has mentioned Notch's (the creator of Minecraft) entries into Ludum Dare, a 48-hour video game development competition [1]. I only looked briefly on Twitch and his entry for #22 [2] was the only one I could find--nonetheless, it's really insightful seeing him work.

[1] http://ludumdare.com/compo/author/notch/

[2] https://www.twitch.tv/videos/38122415

Here's the beginning of Prelude of the Chambered. A Link's Awakening-inspired dungeon crawler:


A comment thread from a couple years ago that resonated with me: https://news.ycombinator.com/item?id=11087399

I watched about a dozen Handmade Hero episodes, and I was a bit annoyed that every session resulted in a random hunt to fix a bunch of bugs because there was not sufficient abstraction. It wouldn't be so bad if the abstractions were upcoming, but Casey seems to have an aversion to abstraction and I stopped watching because I grew bored of watching him jumping around in a bunch of files trying to figure out what memory write caused an issue at run-time.

That's the exact point of HM. Abstractions come from the knowledge gained after wrestling with problems, not as a form of premature optimization.

And this is especially true in games because you need to get all abstractions right otherwise the game will be limited and/or not performant enough.

In many other programming fields you don't get punished for adding a few abstractions that are not strictly necessary, so usually other programmers are used to abstracting things away fairly early (eg in OOP: properties vs public variables, ...) because they're free as long as you don't overuse them.

Also you should keep in mind that the stream is educational so Casey sometimes takes the scenic route before getting to the point, and he's both implementing the engine and designing it, so sometimes he doesn't know yet what he wants exactly.

I'd say you're right if we'd talk about a junior dev, but not when talking about a seasoned senior.

this isn't really an issue of "junior" or "senior".

I've watched roughly 90% of the series to date and I'm happy to report that this "jumping around in a bunch of files trying to figure out what memory write caused an issue at run-time" is infrequent, at best. Occasionally there's a gnarly wild-ponter-esque bug that takes an hour, and very occasionally two, to debug, but the vast majority of the time on the series is spent writing new code and refactoring old systems that need to use some new feature.

I actually find it amazing that sometimes 400 hours of programming and 2 years later he goes back to code written in the first few weeks and is fairly easily able to modify it to work with a new system that's just been implemented.

EDIT: Formatting

This is not uncommon in game development. Jonathan Blow and others have spoken at length about why game development is different than web development or other types of software engineering (not in a condescending way but in a "it's different, here's why" way):

- https://www.youtube.com/watch?v=JjDsP5n2kSM

In order to really start talking about it, we'd need to see someone writing something of similar complexity and longevity live in the same amount of time, and see whether they've spent less time to get to the same place.

With the same restrictions of course - relatively little dynamic memory allocation, and hitting frame rate consistently on the lowest supported platform.

The entire point is to show him code an entire game in C from scratch without using libraries, for educational reasons. Given that, what would you like to change and why?

If you writing complex code, you are going to be having bugs, abstractions or not.

C certainly isn't the language where one expects to encounter deep abstractions, is it?

I've gone through the first 20 and don't think you are accurately characterizing them. Maybe 2 or 3 of them involved significant time hunting down a bug.

You would likely still encounter bugs while building the abstractions to not have bugs. It might be neat if you could pick out a particular example and show how your approach would have avoided the problem or be quicker though.

So? Watching most folks code is the most boring thing ever. Very few people are entertaining to watch. Abstractions get in the way when one is hacking.

After 15 years of software development, watching Casey's videos changed how I code. His approach feels right. He's amazing, I'm very grateful for his series.

I have no delusions of having enough time to ever follow through all of these videos, but it's still an idea that appeals to me. Something I'm curious about though:

If I wanted to follow along on a Mac instead of Windows, how different of a process am I looking at?

You can start with handmade penguin, which uses SDL2 instead of the windows API, this should be relatively easy to get working on a mac https://davidgow.net/handmadepenguin/

Not too bad, Casey does a good job of separating the platform code from his game code. Also he's using emacs.

> Also he's using emacs.

Not anymore.

What is he using now?

He's using 4coder - https://4coder.handmade.network/

He likes that its configuration language is C, so he doesn't have to learn a configuration language to get things done.

But if you are already using emacs, you already have learnt the configuration language. What's the benefit?

From what I remember, he switched to 4coder because it supports modal editing that's better for his rsi problems. I guess he didn't care for vim or emacs with vi emulation. Casey also likes to support his "Handmade" network promoting simple C/C++ applications.

Most people don’t spend nearly enough time in a editor-specific language to keep it fresh and loaded at all time. So having to switch from a language/environment you’re fluent in to one you can merely get by in is a frustrating experience.

Watching Casey add some fairly powerful features in the editor in an hour or two, including using Windows APIs directly, was quite illuminating.

There are a few ports to other systems, but there's a small part of the process that will be opaque because someone other than Casey has done the legwork. By which I mean that you won't get any insight into how windows are built on OSX, how input is handled etc. because it's not part of the stream. As I understand it most of the code is platform agnostic, but the development process is windows biased and won't get to be cross platform until the engine is finished. I would love for someone to go over the unique pieces for mac in a supplemental video series the same way Casey does.

Seems like it was ported over (the code anyway): https://github.com/itfrombit/osx_handmade

What I find most notable about Handmade Hero is that Casey doesn't follow the mindless OOP mentality that is currently prevailing. I have been using more and more free functions, for example. It really made me question a lot of what is considered best practices.

For my personal projects I've adopted a lot of his style, which is very enjoyable to work with, and I found no downside.

This is probably a horses-for-courses thing. Typical OOP patterns are a poor fit for the lower-level aspects of a real-time game engine, where you really need to know what's happening on the critical path. Things like GC and constructors/destructors/finalizers can become an imposition rather than a convenience if they're not kept out of the main loop, and that can put you at odds with the usual idioms in an object-oriented setting.

I think the biggest benefits attributed to OOP are really from splitting up the namespace into more manageable pieces. This can and usually should be done in larger C and C++ projects even if you're not using an OOP approach. The defaults in this regard are a little unfortunate, but both languages provide tools to do it (internal/"static" linkage in C, namespaces and using declarations in C++).

If you like HMH, I encourage you to also check out Ferris Makes Demos and Ferris Makes Emulators

https://www.twitch.tv/ferrisstreamsstuff https://www.youtube.com/channel/UC4mpLlHn0FOekNg05yCnkzQ

It's a mix of livestream development and democoding (mostly Rust and C++) and super-detailed breakdowns of demos and tools he's built. He does a super good job of taking effects and tools that seem very intimidating and breaking them down into understandable parts.

I want to point out that the website has a search tool. Good if you are looking for some specific stuff. Examples:

https://hero.handmade.network/episodes/search?#light%20rende... https://hero.handmade.network/episodes/search?#sucks

The youtube playlists are also very well organized if you are looking for a single topic.

The "SGX and Unbreakable DRM" episode is pretty interesting: https://hero.handmade.network/episode/chat/chat005

I've followed the first ~50 or so videos mainly because I'm interested in 2D game design and game physics at the basic levels (writing engines and physics).

Commenting to ask if anyone has additional resources / streams / guides on those topics they can recommend.

I'd recommend making at least three games and shipping them on existing engines before trying to write your own. That's the best way to figure out what is and isn't a must-have feature.

Beyond that, if you're interested in physics look up everything Erin Catto has written about the design and implementation of Box2d.

Interesting, yes I'll read Catto's work.

My background is in physics, that part interests me the most, I'd be happy to make a physics sandbox myself.

Very cool. One suggestion (in case it will be heard) -- add some dates to the homepage and each post, such as on the episodes page. Besides being generally useful, it helps reassure visitors today that the project is still active.

Pfft. Did not fire and dye his own silicon transistors.

This is a brilliant gimmick for promotion, catch the intersection of gamers interested in game design.

I think the amount effort put into this goes way beyond gimmick. I only followed the first few episodes, but it was clear that he was very engaged with his audience, and that he put a great deal of emphasis on the educational value of the project.

You're right. I've watched many hours from the very beginning and this is about learning from the basics. It starts even before episode 1 with intro to C stuff. And he constantly reinforces the fact that this is for teaching "from scratch" and therefore isn't using libraries, but if you were to build a real game for sale there are places where you wouldn't be doing things the same way. Overall a very educational project.

Yeah I don't think that's a fair categorization at all. It's all free. And his dedication and commitment is to be commended. This is a free, multi-year, live training program that has been ongoing since 2014.

Yup, most game developers love sharing/talking about the craft. It's not an industry you join if you aren't passionate about the process of developing interactive content.

I'm not sure what your definition of gimmick is, but 600+ hours and several years (so far!) of content sounds more like a labour of love. If you'd watched the series you'd realize this man loves, and is highly proficient at, programming.

This is not a gimmick haha. Read my comment from earlier in this thread:

Casey is really well known in the gaming community - https://mollyrocket.com/casey/about.html Through Handmade Con, he's also interviewed many other creators like Jonathan Blow and Edmund Mcmillen. He also contributed to Blow's recent game, The Witness (specifically the movement system and the world editor).

This is a really good series by an experienced game developer that's basically free (or at least the Zed Shaw model of pay to download but free to view).

You cant fake this- this is heart, soul and spouse sacrificed to teach the world how to make games. I guess if you cant feel that passion for something -it must be kind of scary.

I can not throw a basketball into the hoop - and if it would save my life. Now i could downplay all the NBA players, calling it a "nice hobby", a gimick to sell shoes. Or just admit with a nod of acknowledgment- that i will never be this good. Literally cant be. And its okay.

I’m sorry but this is nuts. The series is excellent but it’s obviously specifically setup to support both working full time and dealing with life as well as recording everyday.

If you want to put a bit of time in everything shown is easily attainable and that’s the point. None of this is cutting edge, it’s basic making games stuff without libraries and a fairly modest goal in terms of the actual game.

> heart, soul and spouse sacrificed

Spouse? What happened?

Wow this is crazy; I'm surprised its still going on after all this time. Doesn't seem healthy imo to stick just one project for so long without significant ROI. But yes, commendable indeed, and I hope people got significant value out of it, for his sake.

> Doesn't seem healthy imo to stick just one project for so long without significant ROI.

I don't think he's in it for the money. I think that he, and many game developers of a similar vintage, are frustrated with the direction that modern software has taken. It's slow, getting slower, and often doesn't work correctly. I think this is his way of expressing that frustration, by teaching how the machine you're programming ACTUALLY WORKS. I for one have gotten more out of Handmade Hero than any other single source of learning in my life.

2 years is nothing for a video game project. Also, keep in mind he's only working on it while he's streaming, which is 5 hours a week (max. sometimes, it's less). He's also been making a game he intends to sell for money for the past 2 years (1935[0]).

[0]: https://mollyrocket.com/news_0023.html

I think it has healthy funding from his Patreon account, plus the $15 to buy the game, as well as serving as sort of inadvertent PR for his upcoming commercial game (1935.)

He's a craftsman practicing his craft. You have a strange concept of what is unhealthy.

The purpose of the project is education. It does have significant ROI, just not significant commercial profit.

Exactly. True education is something you do to give people humongous ROI on their time, not something you do for your own ROI.

> Doesn't seem healthy imo to stick just one project for so long without significant ROI.

Maybe the ROI is the feedback and such from the community that has popped up around the game? That, and the $15.00 per copy to get access to the source code as the series goes on. But I'd be willing to bet that the feedback and community is the driving thing for this guy.

My understanding is that Casey was specifically bothered by newer game programmers not understanding the underlying internals and writing slow software. Seems like he wanted to do something about it and this was his expression and attempt of doing so!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact