Handmade Hero»Forums»Code
David Roguin
15 posts
C++ Hot reloading
In yesterday stream someone asked if it's possible to hot reload their game and how much time it will take to rewrite their engine. Casey said something about how horrible is C++ and all that.

In an attempt to add to the response, maybe that person could look into unreal engine 4 code and see how they did that in C++.

Cheers!
Mārtiņš Možeiko
2559 posts / 2 projects
C++ Hot reloading
There is Runtime Compiled C++ (https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledCPlusPlus) It is similar to what Casey does. I haven't tried it, but it is supposed to work with any C++ code.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
C++ Hot reloading
You can definitely do it in C++, it's just a massive amount more work. It was, you know, 20-30 lines of code for us to implement hot reloading _and_ state replay. In C++, it would be a whole engineering project.

- Casey
Tod Hansmann
10 posts
Just a guy
C++ Hot reloading
The problem is generalizing the solution. It's fairly straightforward in our implementation in HH because we're architecting in a very specific manner with how we are structuring our memory, our data structures, and where our code is going and being accessed. Taking that and putting it in arbitrary code for hotloading is... problematic. Like anything in computing, it can be done, but at what cost?

With C++ specifically, and things like classes or whatnot it requires a lot knowledge of the underpinnings of those implementations. vtables, inheritance profiles, etc, etc, etc. It's a lot simpler our way because we're not messing with those abstractions (and for good reason, they don't give us anything). This couldn't be done randomly for any application, so it's probably not worth the effort to break the problem out into a solution anyone and their brother could use.