LambdaHack- A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone




Saving and restoring game state, used by both server and clients.



type ChanSave a = MVar (Maybe a) Source #

saveToChan :: ChanSave a -> a -> IO () Source #

wrapInSaves :: Binary a => COps -> (a -> FilePath) -> (ChanSave a -> IO ()) -> IO () Source #

restoreGame :: Binary a => COps -> FilePath -> IO (Maybe a) Source #

Restore a saved game, if it exists. Initialize directory structure and copy over data files, if needed.

Internal operations

loopSave :: Binary a => COps -> (a -> FilePath) -> ChanSave a -> IO () Source #

Repeatedly save serialized snapshots of current state.

Running with -N2 ca reduce Max pause from 0.2s to 0.01s and bytes copied during GC 10-fold, but framerate nor the frequency of not making a backup save are unaffected (at standard backup settings), even with null frontend, because saving takes so few resources. So, generally, backup save settings are relevant only due to latency impact on very slow computers or in JS.