To speed up development of my game I made a little hot reloader. Its super hacky at the moment, but y'all might enjoy it anyway. It consists of a simple nodejs web server which hosts the game content itself, and a launcher which downloads the game content from the server when the app starts up. And it'll download a fresh copy when you press shift+R or touch your mobile screen with 5 fingers.
Its not clean - the whole thing was done in a single evening. So caveats:
- It doesn't reload automatically when the source files change
- When you reload the game it re-downloads all your assets. That could all be fixed pretty easily by looking at timestamps.
- It doesn't recover automatically when you lua throws errors
- It won't terminate secondary threads. (Easily fixable by adding an optional love.unload() function that could get called when reloading the game)
- It doesn't support custom love.run function
- If it can't contact the server the client should just run the last good copy of your game. (Its sitting *right there* in the save directory). That'd be great for demos and stuff. Right now it just hangs.
Oh yeah, and you need to reference your assets from _bundle/images/sprite.png instead of just images/sprite.png. I don't think there's a way to add file search paths from lua, and I'm hesitant to dump the whole game raw in the save directory. (Which is how it works right now). I guess I could hotpatch all the love functions which load files to look in _bundle, but that seems error prone.
The hot reloader itself is here. Have fun! Let me know if you run into problems. (Or, as I say - fix them. Its seriously <200loc.)
Thanks to everyone behind the love example browser for example code showing how to reload a love2d game.