Basic save/load system #23

Merged
pyrex merged 2 commits from kistaro/chameleonic:persist into main 2023-01-02 23:08:04 +00:00
Contributor

Saves and loads:

  • the most recent level played
  • the maximum level reached
  • whether music is enabled or not

The music setting is stored "reversed" -- 0 is sound on, -1 is sound off -- because the starting state of a save file is all zeroes so the all zeroes file should show default behavior.

This is not golfed, there is almost certainly room for a lot of token savings. We probably need to start playing golf again pretty soon.

Currently, the maximum level is not enforced -- for development, the max is always level 31 -- but comment out the max_level= 1 line and uncomment the persist.max_level line in title:init and it limits the player to levels they've reached through gameplay, as intended.

Press and hold the down arrow on the title to wipe the save. This uses wrongbleep as an on-theme warning, vibration and all. There is currently no UI hint that this is available, this can be added in another patch.

Saves and loads: * the most recent level played * the maximum level reached * whether music is enabled or not The music setting is stored "reversed" -- 0 is sound on, -1 is sound off -- because the starting state of a save file is all zeroes so the all zeroes file should show default behavior. This is not golfed, there is almost certainly room for a lot of token savings. We probably need to start playing golf again pretty soon. Currently, the maximum level is not enforced -- for development, the max is always level 31 -- but comment out the `max_level= 1` line and uncomment the `persist.max_level` line in `title:init` and it limits the player to levels they've reached through gameplay, as intended. Press and hold the down arrow on the title to wipe the save. This uses `wrongbleep` as an on-theme warning, vibration and all. There is currently no UI hint that this is available, this can be added in another patch.
kistaro added 3 commits 2023-01-02 21:41:20 +00:00
Saves the music flag, the last level the player played, and the furthest level reached. Loads music flag on launch. Title screen starts on most recent level played; when in "release configuration" the title screen will only let the player pick levels up to the maximum reached through gameplay, but right now this is replaced with the 31.

Save file can be wiped by holding the down arrow at the title screen.
kistaro force-pushed persist from 39efcdc1d5 to 7b931d1fba 2023-01-02 21:44:29 +00:00 Compare
Author
Contributor

Rebased.

Rebased.
kistaro added 1 commit 2023-01-02 23:04:34 +00:00
Disabling writes during "wipe" and "first load" is not quite semantically what we want, it's writes during read we want to block. This happens because turning the music on or off tries to save the state, and it's easier to just ignore that persistence request than to rework the music code so it doesn't. "wipe" and "first load" are when we're actually reading (and enacting) state, but it's the act of reading rather than those two acts that should block writes.

It is also unwilling to write until it's done its first read, which I think is a feature; it makes it harder to accidentally blank out the player's data.
pyrex merged commit b6d1a21b7e into main 2023-01-02 23:08:04 +00:00
pyrex referenced this issue from a commit 2023-01-02 23:08:04 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pyrex/chameleonic#23
No description provided.