Skip to content

Search

رجوع
· وقت القراءة: 1 د

Save games

save::write and save::read, versioned and migrated, and a User data dock that opens saves and prefs.

save::write(slot, data) stores a table per player, and the User data dock opens it.

The User data dock with the prefs slot open

  • A save is written beside its file and renamed over it, so a crash mid-save keeps the old one.
  • Each file carries [save] version. An older one runs migrate_save once per version step.
  • The dock lists the game's user data folder and edits TOML and JSON files as trees.

The save page in Settings: the migrate script and the save version this build writes

save::write("slot1", #{ level: 4, coins: 120 });
let data = save::read("slot1");

Shipping: save games