randomPoison / gunship-rs

An experimental game engine written in Rust.
MIT License
27 stars 3 forks source link

Hotloader Auto-Restart Support #34

Closed randomPoison closed 8 years ago

randomPoison commented 8 years ago

The design choice that Rust makes (and that I'd like to stick with for Gunship) is that an error that puts the program in an invalid state (in a way that means there's a bug in the program) is handled by panicking and completely terminating the program. This forces you to address bugs as they're found since you can't keep running with them present, but it's annoying when combined with hotloading support because a simple mistake in game code will crash the entire game and force you to restart. We can improve this by having the loader automatically restart the game if the game panics. This will allow the developer to more quickly diagnose bugs, deal with intermittent failures, and generally improve the development experience by making it so the dev only needs to start the game from the command line once.

Catching a panic can currently only be done across processes, so the loader will have to spawn a child process for the game. This should have the added bonus that we can remove the duplicated main loop code from the loader and have the loader run the engine's normal main loop. We'd only need to add a bit of extra synchronization to make sure the loader only reloads the DLL between frames.

randomPoison commented 8 years ago

The hotloader hasn't worked for a while, and I'm probably going to substantially rework it before it'll work again, so this issue is no longer valid.