Skip to content

0.4.0

Choose a tag to compare

@dmccoystephenson dmccoystephenson released this 07 Oct 03:46
· 32 commits to main since this release
3c8ccf8

0.4.0

Upgrading from v0.3.0 needs no code changes, and existing saves load unchanged. Browser builds now get a Saves control below the game, where players can download their saves as a file or load them from one. Several save-safety fixes are included, so a session can no longer delete or overwrite saves it didn't write. Games can now report scores and achievements to arcade, and on arcade they can opt in to cloud saves. Small console programs can run in the browser without being rewritten.

Changes

Save safety

  • In browser builds, a sync only writes files and deletes the ones this session saw the game remove. It no longer clears the whole stored save directory, so saves from another tab, or saves this session never loaded, are kept. A sync that can't read every file sends nothing (#22).
  • SaveFileManager.get_next_available_slot() checks the disk and never offers a slot whose directory still holds files, even if list_save_files() doesn't show that slot. If the save directory exists but can't be read, it returns None, not 1. The new SaveFileManager.slot_holds_files(n) exposes the same check (#22).
  • list_save_files() no longer returns an empty list when one slot can't be read. That slot is listed with unreadable metadata, and the other slots still appear (#22).
  • chooseSlot leaves out "Create New Save" when the proposed slot is occupied, instead of refusing it after the player picks it. This fixes a loop introduced in #22, and test stand-ins like MagicMock managers still get the option (#23).
  • If saves can't be read from IndexedDB at startup, the session no longer syncs. Earlier saves stay untouched, and the player sees a notice that this session's progress won't be kept (#18).

Browser saves and cloud backup

  • A Saves control lets players download a game's saves as a file and load them back, in both browser runtimes (#20). Its link colour is now readable on the dark background (#26).
  • Opt-in cloud saves on arcade (cloudSaves: true in the boot config) via /tak/cloud.js. Backups trail local saves and are never newest-wins: a save changed on two devices is kept twice, and a deletion is never pushed to another device (#24).
  • cloud.js accepts a freeName hook, so a game whose save units aren't slot_N can choose where the kept copy of a conflict goes (#25).

Arcade scores and achievements

  • New tak.arcade module with submitScore(board, value, run=None) and unlock(achievementId). Both are fire-and-forget, never raise, and do nothing outside a Pyodide build on arcade, so games can call them unconditionally (#21).

Browser runtime

  • The Pyodide worker brings its own blocking time.sleep. Previously, games died with "SuspendError" at the first wait for input under Safari (#19).
  • New tak.web.console.page() builds a page that runs an unmodified input()/print() program in the browser, keeping the files it writes in IndexedDB. It needs the /tak/console.* assets and must be served with COOP/COEP headers.

Version

v0.3.0 → 0.4.0 — MINOR. Mechanical floor from comparing the package's public surface and save paths: MINOR.
Judgment: Every change adds a capability or makes an existing behaviour safer: tak.arcade, the console runtime page, save download/load, opt-in cloud saves, and stricter rules for what counts as a free save slot. Saves written by v0.3.0 load the same way, and no default changes meaning. The one contract change is small. get_next_available_slot() now skips a slot whose directory still holds files, and it returns None when the save directory can't be read, not only when all slots are full. That is a data-loss fix rather than a break, so I kept the floor. The diffs for saves.js and console.js were cut off. saves.js is loaded on every Pyodide game page, so its behaviour is unverified here.

  • minor: public module added: tak.arcade
  • minor: public name added: tak.arcade:ID_PATTERN
  • minor: public name added: tak.arcade:RUN_PATTERN
  • minor: public function/method added: tak.arcade:submitScore
  • minor: public function/method added: tak.arcade:unlock
  • minor: public function/method added: tak.saves.manager:SaveFileManager.slot_holds_files
  • minor: public module added: tak.web.console
  • minor: public name added: tak.web.console:DEFAULT_BUNDLE_URL
  • minor: public function/method added: tak.web.console:page
  • minor: save path changed: src/tak/saves/manager.py
  • minor: save path changed: src/tak/saves/menu.py

Verification

Verified before publication; this tag points at the exact commit that was verified.

  • tests gate run: the library's own suite at this commit — Python 3.8: 236 passed in 42.80s; Python 3.12: 236 passed in 42.54s (8 assertions passed).
  • save-compatibility gate run: saves written by v0.3.0 and the curated fixture were read by this release twice with every file byte-identical, and a new save was added beside them without touching them (18 assertions passed).
  • consumers gate run: Tidewater (145 passed in 1.73s), Overwinter (67 passed in 1.69s), FishE (965 passed in 60.67s (0:01:00)) — each one's own test suite, green on its current pin — passed with this release (12 assertions passed).

Install: pip install "tak @ git+https://github.com/Stephenson-Software/tak@v0.4.0". What the checks cover: python-release-gates.


drafted by Claude on behalf of Daniel Stephenson