darkfo icon indicating copy to clipboard operation
darkfo copied to clipboard

Implement save/load

Open darkf opened this issue 8 years ago • 5 comments

This is a big task that will require game serialization, especially of maps and map objects and transient game state, as well as likely involve a custom HTTP server which handles save storage and stores the partial saves.

Save games are basically just serialized game state (where the player's party is, then a serialization of them, etc.) and a serialization of every touched (visited) map.

For serialization we could possibly use BSON, which is quite fast and compact, and can handle cyclic data (although we perhaps should not have that in the first place).

The other alternative is a custom binary format (why reinvent the wheel, though).

darkf avatar Feb 08 '16 11:02 darkf

I had an experimental branch that saved locally using BSON, but I cannot find it -- I should search for it, and see if it is still salvageable (it serialized game state and map data).

darkf avatar Feb 08 '16 11:02 darkf

The serialize branch has WIP support for serializing map/object data, but does not yet store them in a writable format (such as BSON; we might also look into MessagePack or CBOR, however.)

This branch should be updated, tested (especially across maps) and then a suitable serialization format should be chosen. Some form of saving and loading should then be implemented, using a backing store of either files on a server (such as served via Bottle or Flask), or localStorage (might need to zlib or xz compress the binary JSON before saving.)

darkf avatar Jul 10 '16 16:07 darkf

Current status is in the saves branch. It now uses IndexedDB to store savegame data directly, and locally.

Map and object (de)serialization is done, but needs further testing. Player/party (de)serialization should be improved and tested.

Special testing should be done for script states, including local (LVAR) and global (GVAR/MVAR) states.

In addition, if in-combat saving is desired, combat state should be serialized and specially tested. This is a secondary goal right now.

The UI is not yet implemented.

darkf avatar Feb 02 '17 15:02 darkf

#82 now tracks the save/load UI progress.

darkf avatar Feb 02 '17 16:02 darkf

Related (sub-)bugs:

#87 #88 #106

Other than those (mainly saving all dirty maps), script vars need to be saved.

darkf avatar Jan 02 '18 14:01 darkf