Hey everybody. I've been a game programmer professionally for about a year now, and I recently started watching Casey's stream. Most of it was stuff I had done or seen before, until the episodes around 20-24. Specifically, the live code reload/interactive coding/input looping features blew me away (especially when it all came together).
Still, it seems that these come with significant restrictions in your programming style. Ignoring the debate of whether of not the tradeoff is worth it (I think it probably is), I'm trying to make sure I understand all the implications and restrictions imposed by how it's implemented here.
Sorry if this is all stuff that has been covered before, I'm behind on episodes so I don't always watch the questions (though I did for these episodes).
Anyway, my understanding is that the implementation of this imposes the following restrictions
- The executable needs to be divided into two parts, the platform and game code. The game code is loaded from a DLL by the platform code, and called using a reasonably simple API. (This one is obvious)
- Game memory (which must contain all game state game state) needs to be located at a fixed address range. Any pointers in this range must point into this region. This means:
- No use of function pointers, virtual methods, or anything implemented using these in any object that gets stored in the game memory.
- No pointers to any static objects from the game code DLL should be in game memory. Somewhat annoyingly, this means no pointers to string literals.
- Any function pointers, pointers to objects with vtables, or pointers to static objects defined in the game code and stored in the platform code's memory must be reloaded when the DLL is reloaded.
- No pointers returned by system malloc/new (unless overridden with a custom implementation that does the right thing) in game memory.
- No pointers from the game memory into the platform memory.
- You can't reload code if you change the data layout or otherwise break ABI. (Though, Casey mentioned once or twice that there was a way to make this less fragile but that it was too much work to do on the stream. If anybody has information about this, I'd be extremely interested to hear and/or read more).
- The game code's update function should take the current input state as an argument, so that recording and playback can work. (This isn't a huge deal by any stretch of the imagination).
I think that's the big stuff at least (and I hope that it was clear enough), am I missing anything?
Also, am I correct in thinking that if you have a dynamically linked runtime and are willing to give up loading from a snapshot saved during a previous run of the program, that you can ignore 2.5? (This really isn't worth it at all, but I just want to make sure my mental model is correct).