Skip to content

Keep the save through ztk::game and continue at the last entry - #19

Merged
beetlebugorg merged 1 commit into
title-pausefrom
save-continue
Dec 4, 2026
Merged

beetlebugorg merged 1 commit into
title-pausefrom
save-continue

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

Closes #3. Based on #18.

The save goes through ztk::game save lamplighter in the data folder of the app. It has version 2 and last, the entry that the player started last. Continue goes to that entry when it is open and not done, else to the first entry that is open and not done.

At the start, the host reads the save of ztk::game load. With none, it reads lamplighter.save of 0.1.0 and stores it through ztk::game save. A save of an unknown version, a text that is not a dict, or a bad unlocked gives a new game.

ztk.js of 1.0.0-beta.8 keeps no storage, so ztk::game save in the browser lasts only for the page. The play page keeps the text of app(save) in localStorage and gives it to the game as base64 in app(webSave), so the text cannot run as a script. A text with characters outside printable ASCII is dropped.

What ran here: ztcl test (78 tests pass, 8 new), tests/tk/smoke.tcl and the new tests/tk/save.tcl with ztk 1.0.0-beta.8 headless, and two loads of the play page in headless Chromium with one profile: the second load continued at the entry of the first. CI runs the new save test. What did not run: a phone, and a desktop window across a real restart.

The save has version 2 and the entry that the player started last.
Continue goes there when it is open and not done. A save of 0.1.0 is
read and moved. The play page keeps app(save) in localStorage and
gives it back as base64.
@beetlebugorg beetlebugorg added this to the v0.2.0 milestone Dec 4, 2026
@beetlebugorg
beetlebugorg merged commit aa339a2 into title-pause Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant