PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
630 stars 58 forks source link

Hot Reloading? #121

Open davesmith00000 opened 3 years ago

davesmith00000 commented 3 years ago

Dismissed in early versions before Indigo only targeted Scala.js, but since games are now targeted at browsers, we could persist the game state every frame and reload the JS files on-change with a file watcher. You'd have to restart the engine (in case it was an asset change) but due to the way state is managed the pause would only be brief?

davesmith00000 commented 2 years ago

Late follow up comment: Tyrian does this.

A future Indigo improvement would be to replicate Tyrian's hot reloading approach into Indigo.

I think there are two workarounds though:

  1. Tyrian natively supports Indigo games. So you could set up a Tyrian project, add hot reloading, integrate your game, and get the hot reloading events to propagate through to Indigo.
  2. Tyrian's hot reloading is just a 'save to local storage (overwrite) every second' and when the site loads, load from local storage if it exists. It's horribly simple and very effective. It could just be implemented per game in a subsystem.