Something went wrong. Try again.
Something went wrong. Try again.
Hot Reload #
Hot reload is implemented by compiling src/game as a dynamic library and running a separate loader executable from src/lib/hot_reload.
How it works #
just build-gamebuildsbuild/hot_reload/game.{dylib,so,dll}.- The loader copies that file to a versioned path such as
game_0.dylib. - The loader uses
core:dynlibto load exported symbols with thegame_prefix. - When the canonical game library changes, the loader copies and loads the new version.
- If
size_of(Game_Memory)is unchanged, the old memory pointer is passed togame_hot_reloaded. - If the size changed, the loader shuts down the old game memory and initializes fresh memory.
Rules of thumb #
- Keep persistent game state in
Game_Memoryor reachable from it. - Temporary per-frame allocations should use
context.temp_allocatorand be cleared each frame. - Changing the size of
Game_Memoryrestarts memory automatically. - Do not store function pointers from the hot-loaded library in persistent memory unless you manage their lifetime carefully.
Controls #
F5: force a reloadF6: force a memory restartEsc: quit