Episode Guide
The detailed episode guides linked to on this page would not have been possible without the generous contributions of time and energy from Jace Bennett (@jacebennett), Abner Coimbre (@AbnerCoimbre), Matthew VanDevander (@mvandevander, supportable on Patreon), Gustavo Chávez (@gusChvz), Kasper Sauramo (@KMSchme), Ben Craddock (@theinternetftw), Dustin Specht (@Dustin_Specht), Jacob Pike (@pikejd), Matt Mascarenhas (@miblo_), Miguel Lechón (@debiatan), Cory Henderlite (@effect0r), Insofaras (@insofaras_), Clay Murray (@powerc9000) and Tim Liou (@wdliou).
Matt (Miblo) is currently the sole maintainer, doing so live on Twitch and may be supported on Patreon.
Please take a moment to thank our contributors if you happen to see them on The Twitters! :)
How to Use This Guide
Handmade Hero is broken up into four parts: a basic programming introduction, the construction of a platform prototyping layer, the coding of a game engine, and the coding of the game itself. These parts can be fluid, and blur into one another, but if you would like to skip directly to one of the parts without watching the preceding ones, you may be able to do so, depending on your level of experience.
The basic (very limited) introduction to C programming is Week 0.
The construction of a Win32 prototyping layer is Weeks 1 through 5.
Game engine coding begins on Week 6.
Game coding itself has not yet begun.
Text Editor Tutorial
By popular demand, Casey goes through his emacs setup and shows how he makes use of the text editor
Week 0: Intro to C
Before starting Handmade Hero, I did a five-day series on C programming to test the Twitch streaming set up. It is too brief to be a complete introduction to C, but may be better than nothing if you are trying to start from scratch. At some point, when there is time, I may try to do a more complete intro series for people who want to follow Handmade Hero but have little or no programming experience
- Day 1: Intro to C on Windows - Day 1 (With Notes) + Q&A
- Day 2: Intro to C on Windows - Day 2 + Q&A
- Day 3: Intro to C on Windows - Day 3 + Q&A
- Day 4: Intro to C on Windows - Day 4 + Q&A
- Day 5: Intro to C on Windows - Day 5 + Q&A
Week 1: Simple Framebuffer on Windows
The first week of Handmade Hero was spent setting up a Windows build, creating a window, and making it so that we could directly write animating graphics into a framebuffer and have Windows display it in our window
- Day 001: Setting Up the Windows Build (With Notes) + Q&A
- Day 002: Opening a Win32 Window (With Notes) + Q&A
- Day 003: Allocating a Back Buffer (With Notes)
- Day 004: Animating the Back Buffer
- Day 005: Windows Graphics Review
- Iker's Weekly Illustration
Week 2: Sound and Input on Windows
The second week of Handmade was spent getting sound, input, and timing working
- Day 006: Gamepad and Keyboard Input (With Notes)
- Day 007: Initializing DirectSound (With Notes)
- Day 008: Writing a Square Wave to DirectSound (With Notes)
- Day 009: Variable-Pitch Sine Wave Output (With Notes)
- Day 010: QueryPerformanceCounter and RDTSC (With Notes)
- Iker's Weekly Illustration
Week 3: Defining the Platform Layer Boundary
The third week of Handmade Hero had us abstracting our Win32 code so we could divide the project into platform-specific and platform-independent parts
- Day 011: The Basics of Platform API Design
- Day 012: Platform-independent Sound Output (With Notes)
- Day 013: Platform-independent User Input
- Day 014: Platform-independent Game Memory
- Day 015: Platform-independent Debug File I/O
- Iker's Weekly Illustration
Week 4: Win32 Prototyping Layer Cleanup
The fourth week of Handmade Hero was spent cleaning up our Win32 code, and getting to a lot of the "TODO" markers we put in the source code
- Day 016: VisualStudio Compiler Switches
- Day 017: Unified Keyboard and Gamepad Input
- Day 018: Enforcing a Video Frame Rate
- Day 019: Improving Audio Synchronization
- Day 020: Debugging the Audio Sync
- Iker's Weekly Illustration
Week 5: Fun with Win32
The fifth week of Handmade Hero is all about taking some time to do crazy, fun, and useful stuff with our Win32 layer
- Day 021: Loading Game Code Dynamically (With Notes)
- Day 022: Instantaneous Live Code Editing
- Day 023: Looped Live Code Editing
- Day 024: Win32 Platform Layer Cleanup
- Day 025: Finishing the Win32 Prototyping Layer
- Iker's Weekly Illustration
Week 6: Game Engine Architecture
The sixth week of Handmade Hero spends time laying the foundation of the game upon the platform work done over the previous weeks
- Day 026: Introduction to Game Architecture
- Day 027: Exploration-based Architecture
- Day 028: Drawing a Tile Map
- Day 029: Basic Tile Map Collision Checking
- Day 030: Moving Between Tile Maps
- Iker's Weekly Illustration
Week 7: Coordinates and Tilemaps
The seventh week of Handmade Hero is about figuring out how we want to store the game world, as well as how to represent positions within that world
- Day 031: Tilemap Coordinate Systems
- Day 032: Unified Position Representation
- Day 033: Virtualized Tile Maps
- Day 034: Tile Map Memory
- Day 035: Basic Sparse Tilemap Storage
- Iker's Weekly Illustration
Week 8: Bitmaps
The eighth week of Handmade Hero focuses on loading and displaying our first asset files
- Day 036: Loading BMPs
- Day 037: Basic Bitmap Rendering (With Notes)
- Day 038: Basic Linear Bitmap Blending
- Day 039: Basic Bitmap Rendering Cleanup
- Day 040: Cursor Hiding and Fullscreen Support (With Notes)
- Iker's Weekly Illustration
Week 9: Vector Math and Player Movement
The ninth week of Handmade Hero introduces vectors and begins the process of using them to improve character motion
- Day 041: Overview of the Types of Math Used in Games
- Day 042: Basic 2D Vectors
- Day 043: The Equations of Motion
- Day 044: Reflecting Vectors
- Day 045: Geometric vs. Temporal Movement Search
- Iker's Weekly Illustration
Week 10: Player Collision
The tenth week of Handmade Hero concentrates on iteratively improving the nascent collision detection code
- Day 046: Basic Multiplayer Support (With Notes)
- Day 047: Vector Lengths
- Day 048: Line Segment Intersection Collisions
- Day 049: Debugging Canonical Coordinates
- Day 050: Basic Minkowski-based Collision Detection
- Iker's Weekly Illustration
Week 11: Basic Entity Handling
The eleventh week of Handmade Hero is mainly about handling entities
- Day 051: Separating Entities By Update Frequency
- Day 052: Entity Movement in Camera Space
- Day 053: Environment Elements as Entities
- Day 054: Removing the Dormant Entity Concept
- Day 055: Hash-based World Storage
- Iker's Weekly Illustration
Week 12: Entities in Space
The twelfth week continues with entities. And space. Entities in space
- Day 056: Switch from Tiles to Entities
- Day 057: Spatially Partitioning Entities
- Day 058: Using the Spatial Partition
- Day 059: Adding a Basic Familiar Entity
- Day 060: Adding Hitpoints
Week 13: Simulation Regions
The thirteenth week concentrates on simulation
- Day 061: Adding a Simple Attack (With Notes)
- Day 062: Basic Moving Projectiles
- Day 063: Simulation Regions
- Day 064: Mapping Entity Indexes to Pointers
- Day 065: Finishing the Simulation Region Change
Week 14: Collision Rules
The fourteenth week continues with simulation regions. And Figure out how to handle collision rules
- Day 066: Adding Support for Non-spatial Entities
- Day 067: Making Updates Conditional
- Day 068: Exact Enforcement of Maximum Movement Distances
- Day 069: Pairwise Collision Rules
- Day 070: Exploration To-do List
Week 15
Week fifteen
- Day 071: Converting to Full 3D Positioning
- Day 072: Proper 3D Inclusion Tests (With Notes)
- Day 073: Temporarily Overlapping Entities (With Notes)
- Day 074: Moving Entities Up and Down Stairwells (With Notes)
- Day 075: Conditional Movement Based on Step Heights
Week 16
Week sixteen
- Day 076: Entity Heights and Collision Detection (With Notes)
- Day 077: Entity Ground Points (With Notes)
- Day 078: Multiple Collision Volumes Per Entity (With Notes)
- Day 079: Defining the Ground (With Notes)
- Day 080: Handling Traversables in the Collision Loop
Week 17
Week seventeen
- Day 081: Creating Ground with Overlapping Bitmaps (With Notes)
- Day 082: Caching Composited Bitmaps
- Day 083: Premultiplied Alpha (With Notes)
- Day 084: Scrolling Ground Buffer
- Day 085: Transient Ground Buffers
Week 18
Week eighteen
- Day 086: Aligning Ground Buffers to World Chunks
- Day 087: Seamless Ground Textures
- Day 088: Push Buffer Rendering
- Day 089: Renderer Push Buffer Entry Types
- Day 090: Bases Part I (With Notes)
Week 19
Week nineteen
- Day 091: Bases Part II (With Notes)
- Day 092: Filling Rotated and Scaled Rectangles (With Notes)
- Day 093: Textured Quadrilaterals (With Notes)
- Day 094: Converting sRGB to Light-linear Space (With Notes)
- Day 095: Gamma-correct Premultiplied Alpha (With Notes)
Week 20
Week twenty
- Day 096: Introduction to Lighting (With Notes)
- Day 097: Adding Normal Maps to the Pipeline
- Day 098: Normal Map Code Cleanup
- Day 099: Test Enviroment Maps (With Notes)
- Day 100: Reflection Vectors (With Notes)
Week 21
Week twenty-one
- Day 101: The Inverse and the Transpose (With Notes)
- Day 102: Transforming Normals Properly
- Day 103: Card-like Normal Map Reflections (With Notes)
- Day 104: Switching to Y-is-up Render Targets (With Notes)
- Day 105: Cleaning Up the Renderer API
Week 22
Week twenty-two
- Day 106: World Scaling (With Notes)
- Day 107: Fading Z Layers (With Notes)
- Day 108: Perspective Projection
- Day 109: Resolution-Independent Rendering (With Notes)
- Day 110: Unprojecting Screen Boundaries (With Notes)
Week 23
Week twenty-three
- Day 111: Resolution-Independent Ground Chunks (With Notes)
- Day 112: A Mental Model of CPU Performance (With Notes)
- Day 113: Simple Performance Counters (With Notes)
- Day 114: Preparing a Function for Optimization (With Notes)
- Day 115: SIMD Basics (With Notes)
Week 24
Week twenty-four
- Day 116: Converting Math Operations to SIMD (With Notes)
- Day 117: Packing Pixels for the Framebuffer (With Notes)
- Day 118: Wide Unpacking and Masking (With Notes)
- Day 119: Counting Intrinsics
- Day 120: Measuring Port Usage with IACA
Week 25
Week twenty-five
- Day 121: Rendering in Tiles (Marathon) (With Notes)
- Day 122: Introduction to Multithreading (With Notes)
- Day 123: Interlocked Operations (With Notes)
- Day 124: Memory Barriers and Semaphores (With Notes)
- Day 125: Abstracting the Work Queue (With Notes)
Week 26
Week twenty-six
- Day 126: Circular FIFO Work Queue (With Notes)
- Day 127: Aligning Rendering Memory
- Day 128: Push-time Transforms
- Day 129: Adding Orthographic Projection (With Notes)
- Day 130: Seamless Bilinear Tiling (With Notes)
Week 27
Week twenty-seven
- Day 131: Asynchronous Ground Chunk Composition
- Day 132: Asset Streaming (With Notes)
- Day 133: Preliminary Asset Structuring (With Notes)
- Day 134: Mapping Assets to Bitmaps (With Notes)
- Day 135: Typed Asset Arrays
Week 28
Week twenty-eight
- Day 136: Tag-based Asset Retrieval (With Notes)
- Day 137: Matching Periodic Tags
- Day 138: Loading WAV Files (With Notes)
- Day 139: Introduction to Sound Mixing (With Notes)
- Day 140: Implemented a Sound Mixer
Week 29
Week twenty-nine
- Day 141: Streaming Large Audio in Chunks
- Day 142: Per-sample Volume Interpolation
- Day 143: Pitch Shifting in the Mixer
- Day 144: SSE Mixer Pre and Post Loops
- Day 145: SSE Mixer Main Loop (With Notes)
Week 30
Week thirty
- Day 146: Accumulation vs. Explicit Calculation
- Day 147: Defining the Asset File
- Day 148: Writing the Asset File Header
- Day 149: Writing Assets to the Asset File (With Notes)
- Day 150: Loading Assets from the Asset File (With Notes)
Week 31
Week thirty-one
- Day 151: New Platform File API
- Day 152: New Win32 File API Implementation
- Day 153: Merging Multiple Asset Files
- Day 154: Finding Assets Files with Win32
- Day 155: Introduction to Particle Systems
Week 32
Week thirty-two
- Day 156: Lagrangian vs. Eulerian Simulation
- Day 157: Introduction to General Purpose Allocation
- Day 158: Tracking Asset Usage
- Day 159: Cleaning Up the Loaded Asset Infrastructure
- Day 160: Introduction to General Purpose Allocation
Week 33
Week thirty-three
- Day 161: Finishing the General Purpose Allocator
- Day 162: Introduction to Fonts
- Day 163: Asset Processing with STB TrueType (With Notes)
- Day 164: Asset Processing with Windows Fonts (With Notes)
- Day 165: Fixing an Asset System Thread Bug (With Notes)
Week 34
Week thirty-four
- Day 166: Adding Locks to the Asset Operations (With Notes)
- Day 167: Finishing Win32 Font Glyph Extraction (With Notes)
- Day 168: Rendering Lines of Text
- Day 169: Aligning Text to a Baseline (With Notes)
- Day 170: Defining Font Metadata (With Notes)
Week 35
Week thirty-five
- Day 171: Adding Font Metadata to the Asset Builder (With Notes)
- Day 172: Extracting Kerning Tables from Windows (With Notes)
- Day 173: Precise Font Alignment (With Notes)
- Day 174: Adding Sparse Unicode Support (With Notes)
- Day 175: Finishing Sparse Unicode Support (With Notes)
Week 36
Week thirty-six
- Day 176: Introduction to Debug Infrastructure (With Notes)
- Day 177: Automatic Performance Counters (With Notes)
- Day 178: Thread-safe Performance Counters (With Notes)
- Day 179: Tracking Debug Information Over Time (With Notes)
- Day 180: Adding Debug Graphs
Week 37
Week thirty-seven
- Day 181: Log-based Performance Counters (With Notes)
- Day 182: Fast Thread ID Retrieval (With Notes)
- Day 183: Platform Layer Debug Events (With Notes)
- Day 184: Collating Debug Events (With Notes)
- Day 185: Finishing Basic Debug Collation (With Notes)
Week 38
Week thirty-eight
- Day 186: Starting to Debug Event Recording (With Notes)
- Day 187: Fixing an Event Recording Bug (With Notes)
- Day 188: Adding Hover to the Debug Graphs (With Notes)
- Day 189: Incremental Debug Frame Processing (With Notes)
- Day 190: Cleaning Up Debug Globals
Week 39
Week thirty-nine
- Day 191: Implementing a Radial Menu (With Notes)
- Day 192: Implementing Self-Recompilation (With Notes)
- Day 193: Run-time Setting of Compile-time Variables (With Notes)
- Day 194: Organizing Debug Variables into a Hierarchy (With Notes)
- Day 195: Implementing an Interactive Tree View (With Notes)
Week 40
Week forty
- Day 196: Introduction to UI Interactions (With Notes)
- Day 197: Integrating Multiple Debug Views (With Notes)
- Day 198: Run-time Editing of Debug Hierarchies
- Day 199: Reusing Debug Interactions
- Day 200: Debug Element Layout (With Notes)
Week 41
Week forty-one
- Day 201: Isolating the Debug Code (With Notes)
- Day 202: Multiply Appearing Debug Values (With Notes)
- Day 203: Debug UI State Caching
- Day 204: Unprojecting the Mouse Cursor (With Notes)
- Day 205: Picking Entities with the Mouse (With Notes)
Week 42
Week forty-two
- Day 206: Implementing Introspection (With Notes)
- Day 207: Using Introspection Data (With Notes)
- Day 208: Adding Data Blocks to the Debug Log (With Notes)
- Day 209: Displaying Buffered Debug Data (With Notes)
- Day 210: Consolidating Debug Data Storage (With Notes)
Week 43
Week forty-three
- Day 211: Removing Records and Translation Units from the Debug Code (With Notes)
- Day 212: Integrating Debug UI into Game Code (With Notes)
- Day 213: Turning Debug Switches into Events (With Notes)
- Day 214: Collating Permanent Debug Values (With Notes)
- Day 215: Cleaning Up Debug Event Collation (With Notes)
Week 44
Week forty-four
- Day 216: On-demand Deallocation (With Notes)
- Day 217: Per-element Debug Event Storage (With Notes)
- Day 218: Hashing Debug Elements (With Notes)
- Day 219: Automatically Constructed Debug Hierarchies (With Notes)
- Day 220: Displaying Data Blocks in the Hierarchy
Week 45
Week forty-five
- Day 221: Implementing Multi-layer Cutscenes (With Notes)
- Day 222: Laying Out Cutscenes (With Notes)
- Day 223: Playing Multiple Cutscenes (With Notes)
- Day 224: Prefetching Cutscene Layers (With Notes)
- Day 225: Fading In and Out from the Windows Desktop (With Notes)
Week 46
Week forty-six
- Day 226: Handling Multiple Metagame Modes
- Day 227: Switching Between Metagame Modes
- Day 228: Waiting for Dependent Tasks on Metagame Mode Changes
- Day 229: Sorting Render Elements (With Notes)
- Day 230: Refining Renderer Sort Keys (With Notes)
Week 47
Week forty-seven
- Day 231: Order Notation (With Notes)
- Day 232: Examples of Sorting Algorithms (With Notes)
- Day 233: Can We Merge Sort In Place?
- Day 234: Implementing Radix Sort (With Notes)
- Day 235: Initializing OpenGL on Windows (With Notes)
Week 48
Week forty-eight
- Day 236: GPU Conceptual Overview (With Notes)
- Day 237: Displaying an Image with OpenGL (With Notes)
- Day 238: Making OpenGL Use Our Screen Coordinates (With Notes)
- Day 239: Rendering the Game Through OpenGL (With Notes)
- Day 240: Moving the Renderer into a Third Tier (With Notes)
Week 49
Week forty-nine
- Day 241: OpenGL VSync and sRGB Extensions (With Notes)
- Day 242: OpenGL Context Escalation (With Notes)
RSI Leave
Q&A Sessions while Casey is on RSI leave resting his typing fingers
- Chat 001: Health and Emulation (With Notes)
- Chat 002: Asset Files and Installers (With Notes)
- Chat 003: Resources, Files and DRM
- Chat 004: Cross-compiling
- Chat 005: SGX and Unbreakable DRM (With Notes)
- Chat 006: Error-based Drawing Algorithms (With Notes)
- Chat 007: Inverse Kinematics (With Notes)
- Chat 010: Partial Specialization
Week 50
Week fifty
- Day 243: Asynchronous Texture Downloads (With Notes)
- Day 244: Finishing Asynchronous Texture Downloads (With Notes)
- Day 245: Using wglChoosePixelFormatARB (With Notes)
- Day 246: Moving Worker Context Creation to the Main Thread (With Notes)
Week 51: Debug System
The fifty-first week sees us reacquainting ourselves with and enhancing the debug system
- Day 247: Simplifying Debug Values
- Day 248: Cleaning Up Data Block Display (With Notes)
- Day 249: Cleaning Up Debug Macros
- Day 250: Cleaning Up Debug GUIDs (With Notes)
- Day 251: Finishing the Debug Hierarchy (With Notes)
Week 52: Debug System
The fifty-second week continues to enhance the debug system
- Day 252: Allowing Debug Value Edits (With Notes)
- Day 253: Reenabling More Debug UI (With Notes)
- Day 254: Reenabling Profiling (With Notes)
- Day 255: Building a Profile Tree - Q&A Annotations Only (With Notes)
- Day 256: XBox Controller Stalls and Fixing GL Blit Gamma (With Notes)
Week 53
Week fifty-three
- Day 257: Cleaning Up Some Win32 Issues (With Notes)