Skip to content
0:00 / 0:00

#handmadehero#caseymuratori#dynamicloading

Handmade Hero Day 021 - Loading Game Code Dynamically

Molly Rocket

148K subscribers • 32 videos on Hallway

YouTube
  • Recommended by 3 people: 2 on Hacker News and 1 in engineering communities.
  • A classic. People kept recommending it from 2020 to 2024.
  • Presented by Casey Muratori, creator of Handmade Hero
  • May be out of date. Uploaded 11 years ago, in an area where tools change fast.

Intermediate. Assumes working knowledge.

83K views11 years ago3 recommendations

Game developmentSystems programmingGame programmingBuilding a game engineC

Casey Muratori demonstrates how to build a hot-reloading system from scratch in C by dynamically loading game code from a DLL on Windows.

Day 021 of coding on Handmade Hero. See handmadehero.org for details.

Why it's here

3 people recommend this

What people say. Highly recommended as the classic demonstration of implementing C/C++ hot reloading from scratch using dynamic libraries.

u/s0llyin r/gameenginedevs • Recommends

Loading C Code Dynamically

coleyon Hacker News • Recommends

On “Anatomy of Linux Dynamic Libraries”

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 - link to this video

kleibaon Hacker News • Recommends

On “C and C++ Hot-Reload/Live Coding”

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. link to this video

u/michaelshmittyin r/C_Programming • Mentions

On “Interesting ways to use C?”

The first time I learned about creating a live coding environment in C was through Casey Muratori's Handmade Hero series. And it blew my mind. It never occurred to me you could do that. Anyway the series is a bit verbose, but it's great to follow along the first 25 or so episodes (25 hours) if you have the time and a bag of popcorn. The dynamic code loading, live code editing and replay (another fun one to combine) starts around episode 21: link to this video

u/michaelshmittyin r/C_Programming • Mentions

On “Is there any portable method to create and load dynamic libraries in c? What would be the best possible alternative if that isn't possible?”

The Handmade Hero video series may interest you. Especially the first 25 days (hours) or so. Skip the intro to C and skip the stuff about basic graphics and sound output if you like: link to this video Possibly of particular interest to you: * Handmade Hero Day 011 - The Basics of Platform API Design * Handmade Hero Day 021 - Loading Game Code Dynamically * Handmade Hero Day 022 - Instantaneous Live Code Editing

nextaccounticon Hacker News • Mentions

On “Paradox of the perfect code editor”

Yes. On Rust specifically link (discussed here link ) And then there's this crate link which works on the same principles as the article above, and is based on C code (i.e. the same approach works for C). On the documentation there's links to "Interactive Programming in C" link and "Loading Game Code Dynamically" link to this video (this video by Casey Muratori is btw where I first heard about this technique) There's a bunch of other libraries that work the same way, and some example code that can do this. I can find link and link and link and link And there's link which has a nice API but uses a deprecated rustc internal API and doesn't build anymore. Anyway there was a library that…

59nadiron Hacker News • Mentions

On “Show HN: Hook – a simple graphical C/C++ runtime editor”

…eloading 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 link to this 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.…

u/sw1shin r/C_Programming • Mentions

On “Advice for building a modular program and what library type to use (static or shared)”

I'm not sure if this is what you're looking for, but Casey Muratori has a great video on hot reloading by having a separate library that gets dynamically called from the main application, and it might help with what you're trying to do link to this video