Several worlds: a Worlds list with load, rename and delete; old save migrates to World 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 00:20:18 -04:00
co-authored by Claude Opus 5.5
parent c434faefc4
commit aadcbc6efb
11 changed files with 274 additions and 35 deletions
+3
View File
@@ -196,6 +196,9 @@ above, including:
- **Screw tubes carry bars**, one whole bar at a time, in line with the grains: a belt pushes a
bar into a tube's side, it rides through corners and leaves the mouth. The owner asked how bars
should be moved and chose tubes over a separate bar lift.
- **Several worlds are kept.** Each world has its own save and autosave; the title screen's Worlds
list loads, renames and deletes them, and a new or imported world never overwrites another. An
old single save becomes 'World 1'. The owner asked for multiple saves.
## Ideas not built yet
+7 -7
View File
@@ -369,16 +369,16 @@ The title screen art.
- functions: buildTitleCells, drawTitle
- variables: FONT5, TITLE
### src/ui/saves.js (106 lines)
### src/ui/saves.js (177 lines)
Saves in IndexedDB, world files (export / import) and the blueprint library.
- functions: saveWorld, newestSave, b64FromBytes, bytesFromB64, gz, exportWorld, importWorldFile, libLoad, libSave, bpEncode, bpValid, bpDecode
- variables: DB
- functions: newWorldId, worldWrite, listWorlds, putWorldEntry, worldNewest, deleteWorld, renameWorld, migrateWorlds, saveWorld, newestSave, b64FromBytes, bytesFromB64, gz, exportWorld, importWorldFile, libLoad, libSave, bpEncode, bpValid, bpDecode
- variables: DB, worldIdTime, worldIdCounter, worldWrites
### src/ui/session.js (87 lines)
### src/ui/session.js (122 lines)
Starting, loading and quitting a game; modal dialogs; the pause menu.
- functions: showLoading, enterGame, startNewWorld, startFromSave, quitToTitle, refreshContinue, anyModal, openModal, closeModal, closeAllModals, topModal, dialog, openPause
- functions: showLoading, enterGame, startNewWorld, startFromSave, quitToTitle, refreshContinue, anyModal, openModal, closeModal, closeAllModals, topModal, dialog, openPause, renderWorlds
### src/ui/settings.js (116 lines)
### src/ui/settings.js (122 lines)
The settings screen.
- functions: openSettings, renderSettings, applySettings, toggleFullscreen, confirmWipe
- variables: SET_TABS, setTab
@@ -430,7 +430,7 @@ Previews drawn under the cursor: build ghosts, drill aim and pulses, selections,
Events from the simulation (emit) turned into sounds, toasts and cards.
- functions: drainEvents
### src/ui/loop.js (117 lines)
### src/ui/loop.js (119 lines)
The frame loop and boot.
- functions: scanVisible, frame, boot
- variables: lastT, acc, lastRender, frameMs, simMs, fpsSm, ambientT
+24
View File
@@ -4,6 +4,30 @@ What agents have done, newest first. Add an entry for every piece of work: the d
note or request it was for, what changed, the files touched, the tests run, and anything left
open or not verified. Keep each entry short; the git history has the details.
## 2026-10-24: several worlds, with a Worlds list (Claude Code, with Codex)
Note: "support multiple saves". The owner chose a world list.
- `src/ui/saves.js`: each world has an id and its own `<id>:main` / `<id>:auto` saves, plus an
index record `worlds` (name, seed, size, created, saved, playtime). A save writes the world
and its index entry in one transaction. `GAME.worldId` is the open world.
- Migration: an old single `main` / `auto` save is copied to "World 1", every byte compared,
and only then are the old keys deleted (in the same transaction that writes the index). If
anything fails the old save is kept and a toast says so.
- Title screen: Continue loads the most recently saved world; a Worlds button opens a list
with Load, Rename (trimmed, at most 40 characters, escaped when shown) and Delete (with a
confirmation). New and imported worlds get new ids. Settings' "Delete saves" became "Delete
all worlds" with a confirmation. `shell.html`, `session.js`, `loop.js`, `settings.js`,
`state.js`, `style.css`, `docs/DESIGN.md`, `docs/PROJECT_MAP.md`.
- `test/play.py` (149 checks): migration of an old save, two worlds listed, load switches,
rename survives a reload, HTML in a name shows as text, long names cut to 40, delete and
cancel, Continue picks the newest, import adds a world. All 11 headless suites pass;
`t_smooth.py` passed in Codex's run and failed its known flaky check in mine.
- Shots: `shots/worlds-{pixel,smooth}.png` and `-900` versions.
- Not committed: a line in `AGENTS.md` about running `kandown work` appeared in the working
tree during this task; it was not part of the task and is left for the owner.
- Open: nothing.
## 2026-10-24: screw tubes carry bars (Claude Code, with Codex)
Note: "how do you transport bars? belts work but tubes do not, should they?" The owner chose