HackerTube.dev

Handmade Hero Day 021 - Loading Game Code Dynamically

Molly Rocket · 83.2K views · 2014-12-16 · 1:43:46

Open on YouTube ↗

If playback is restricted in your region, try opening the original video. Use Mark watched to add it to your marked videos.

Overview

Day 21 of Casey Muratori's Handmade Hero, which covers loading game code dynamically from a DLL on Windows. He builds hot reloading of C game code from scratch in about an hour and a half.

On Hacker News

Recommended as a clear, from-scratch demonstration of how simple code hot-reloading is with plain OS facilities.

Recommended by 2 HN people across 2 months · HN mentions 2021–2024

Topics

Search by tags

What people said

kleiba · 2024-01 · Recommendation

In one of the earlier episodes of the Handmade Hero series, Casey Muratori writes a hot-reloading functionality for C from scratch in about an hour (while giving detailed explanations of what he's doing). The following two episodes then improve upon the initial results. [VIDEO]

Read the original HN comment ↗
coley · 2022-10 · Recommendation

The first time I learned about dynamic loading was while watching an episode of Casey Muratori's Handmade Hero - a series where he builds a video game, in C, from scratch. He compiles the game code as a dll and dynamically loads it at runtime in the Win32 platform layer code. This way he can keep platform code and game code separate and reload the game code at runtime if any changes are made. Being new to this technique, I was impressed to say the least. I always assumed the same functionality was available in the linux environment, but I hadn't bothered to look it up. Now I know. For those who want to learn how to do this in Win32, here's the episode I mentioned above - [VIDEO]

Read the original HN comment ↗
59nadir · 2024-01 · Reference

I don't think any game engine in use today except maybe the ultra-general ones would be without sections that are recompiled and reloaded live for gameplay code in this fashion. For all I know the ultra-general ones probably do it some stupidly complex way that sucks because they're overthinking things. Most setups will likely stream both code and assets to wherever the game is running while you're developing as well, but I wouldn't necessarily call that trivial. Recompiling a shared library and hot reloading it if it's changed is (on the order of 20 or so lines), though, and I wouldn't expect any game to be developed without at least some code being reloaded this way. While I haven't seen it as much, developing servers this way is also very doable, depending on how much you have to change data structures that have to be kept around. Edit: See [VIDEO] for an example of how trivial it is to get this using just your OS facilities (`stat` + `LoadLibrary`/`dlopen`). None of this stuff is new and it's certainly been used with C/C++ or any language like it for a very, very long time.

Read the original HN comment ↗

Sources

Video by Molly Rocket, played through YouTube.

Data and selection notes

HN summaries and labels may contain AI errors. HN dates refer to discussions, not video publication.

HN Library: HackerTube export (2026-10-31) and open-index/hacker-news. Upstream summaries and classifications may contain AI errors.

Views, duration and playback status refresh separately from the published catalog. When an update fails, existing data remains visible.

Selection checks
  • SaaS & AI candidates: Topic keywords do not match
  • Editor-approved picks: Editorial review is required

Rule matches identify candidates. They do not guarantee video quality or financial results.

About the library and its sources