Back in December I implemented naive hot swappable game modules by simply checking for file
updated_at timestamp each time through the game loop.
This method has worked fine for hot reloading of the game DLL, but this week I wanted to extend the system to game assets, in order to have changes to textures or shaders be reflected instantly by the game while it is running.
File change notifications
The API is straightforward and in a couple hundred lines of code I was able to plug directory monitoring in both the game as well as the asset packer.
Watching asset changes and reloading
The asset packer watches the content directory and regenerate the
.MPAK file whenever one of the source assets changed.
The game watches for updates to the data directory. When an existing
.MPAK file is changed or a new one is added, the engine flushes all in memory assets and reloads from disk.
This watching functionality is not only useful for debugging purposes, but will also be a nice feature for modders of the game in order for them to quickly preview changes.