Handmade hero

September 07, 2016

I've been, relatively speaking, recently exposed to Handmade Hero. It's a project to create a complete game, all recorded on video, with no libraries. It's written in C++, although most of it is straight C with a very small subset of C++.

It's clear that the programmer, Casey Muratori, has written a lot of code and is very comfortable with it. He demonstrates simple yet effective ways of solving problems that are typically considered dealbreakers when considering C as a language. Memory management, data structures, and overall program management are discussed in great detail, with solutions presented that effectively manage the complexity at hand.

Another aspect that resonated with me is what he calls "compression oriented" development. It's a refreshingly straightforward way to approach writing code, namely, write the usage code first, and then "compress" it when it gets repeated. He describes this as the first instinct when writing code, and urges that this should continue to be the case. Too many times programmers try to create the abstractions first, and then calling into the api can become awkward when there is a mismatch.

Although the emphasis is on game programming, I found it particularly striking how broadly applicable a lot of the insights were. Yes, a lot of it is game specific, but the techniques used to solve most of the problems encountered can be adpated for lots of other domains. Performance is discussed as well, at a level that is atypical these days outside of focused use cases. I've found myself enjoying and learning a lot from these videos, and highly recommend them.