Handmade Penguin


Handmade Penguin is a companion to Casey Muratori's amazing Handmade Hero series. As the name suggests, Handmade Penguin chronicles how to follow along if you're using the Linux operating system. Casey will be spending a few weeks covering porting the game to different platforms, but for those of us who want to follow on from the beginning, hopefully this will help. Notably, this is not a tutorial by itself, but more a list of things you need to change to get the game working. It will therefore probably fizzle off after a couple of weeks when all of the platform-specific code is done.


  1. Getting Started / Introduction to C (following Into to C on Windows)
  2. Setting Up the Linux Build (following Setting Up the Windows Build)
  3. Opening an SDL Window (following Opening a Win32 Window)
  4. Allocating a Backbuffer (following Allocating a Backbuffer)
  5. Animating the Backbuffer (following Animating the Backbuffer)
  6. Graphics Refactoring and Review (following Windows Graphics Review)
  7. Gamepad and Keyboard Input (following Gamepad and Keyboard Input)
  8. Initialising SDL Audio (following Initializing DirectSound)
  9. Playing a Square Wave with SDL (following Writing a Square Wave to DirectSound )
  10. Variable-Pitch Sine Wave Output (following Variable-Pitch Sine Wave Output )
  11. SDL_GetPerformanceCounter and RDTSC (following QueryPerformanceCounter and RDTSC)
  12. Making Graphics Portable (following The Basics of Platform API Design)
  13. Platform-indpendent Sound Output (following Platform-independent Sound Output)
  14. Platform-indpendent User Input (following Platform-independent User Input)
  15. A Trip Down Memory Lane (following Platform-independent Game Memory)
  16. Platform-independent Debug File I/O (following Platform-independent Debug File I/O)
  17. Bits and Pieces (following VisualStudio Compiler Switches)
  18. Unified Keyboard and Gamepad Input (following Unified Keyboard and Gamepad Input)
  19. Enforcing a Video Frame Rate (following Enforcing a Video Frame Rate)
  20. Improving Audio Synchronisation (following Improving Audio Synchronization)


This is aimed at people who are comfortable using (and programming) on Linux, as it's neither an intro to Linux tutorial nor an intro to programming tutorial. Of course, the best way to know if it suits you is to try to follow along with the first few chapters and see if you understand it and/or like it! I'll be developing using Kubuntu Linux and using the KDevelop IDE for debugging (with an editor of your choice for the actual coding). I think Casey is probably going to be using Linux Mint which is just as good. You should be able to follow along with most of it on your own Linux distro or IDE with very little trouble.


If you have any questions, feel free to email me at david@ingeniumdigital.com.

A Note on SDL

A few people have asked why Handmade Penguin is using SDL, whereas Casey is not going to use any non-system libraries. There are a couple of reasons for this. Firstly, SDL is much easier to use than calling X11 directly: if I were using X11, there's no way I'd be able to write these without falling behind. Secondly, while doing things from scratch is an excellent learning experience, once you're comfortable with how things work under the hood, using a library like SDL is really the right way to go: most of the SDL code we use works without modification on other platforms, and all of the nasty bugs and issues with X11 and the like are already worked out for us. I've done QA for a lot of Linux games, and the ones that used SDL were significantly less buggy than those that used X11 directly.

Besides, since Casey is going to be doing a Linux port later anyway, it'd be boring to do exactly the same thing twice!

Good Luck!

I'm looking forward to sailing on the Cs of adventure with you all!
— David