frnsys / half_earth

Half-Earth Socialism: The Game, for Half-Earth Socialism (Verso 2022)
GNU Affero General Public License v3.0
41 stars 7 forks source link

Game saving #126

Closed frnsys closed 2 years ago

frnsys commented 2 years ago

Just a simple save system in case e.g. someone closes the browser or something accidentally.

frnsys commented 2 years ago

So this is actually more complicated than I thought, since the engine was designed around one way serialization (we originally didn't intend to have game saves).

Possible workaround: use serde_json and define a Saveable trait that has a save method which returns a JSON value and a load method which takes a JSON value and modifies the struct's data accordingly.