[PR #7473] [MERGED] feat(game): generated worlds 4/5: hand edits, kit and world files, and an Experience's map pack (Capability API 1.72) #7753

Closed
opened 2026-10-24 04:07:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7473
Author: @kolacheee
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @kolacheee

Base: staging ← Head: feat/generated-worlds-4


📝 Commits (10+)

  • 11bd5fc feat(world): a world keeps hand edits applied after its compile
  • feeaf87 fix(world): an edit layer that does not fit its world is not applied
  • 12c3084 test(world): the edit-layer lane proves what its breaks found unproven
  • 46926dd test(world): drop a brief place the fantasy kit never compiles
  • 72237f8 fix(world): a world saved again is checked as compiled, not as edited
  • 2d2bb34 feat(world): setting kits and worlds as share files
  • 92332b0 feat(world): kit routes for a maker; share-file review fixes
  • 58c49d8 feat(world): an Experience's map pack (Capability API 1.68)
  • e2e5144 fix(world): map pack review fixes
  • 99fde26 fix(world): map pack proofs from the break round

📊 Changes

32 files changed (+2956 additions, -103 deletions)

View changed files

📝 docs/development/optional-agent-packages.md (+41 -0)
📝 docs/game/getting-started.md (+14 -1)
➕ e2e/game-world-files.e2e.ts (+210 -0)
➕ e2e/game-world-map-packs.e2e.ts (+298 -0)
📝 packages/client/src/components/game/GameJournal.tsx (+20 -1)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+65 -40)
📝 packages/client/src/components/game/GameSetupWorldChooser.tsx (+80 -3)
📝 packages/client/src/components/game/GameSetupWorldKitChooser.tsx (+171 -1)
📝 packages/client/src/components/game/GameSurface.tsx (+10 -0)
📝 packages/client/src/components/game/TownView.tsx (+5 -1)
📝 packages/client/src/components/game/WorldOverworld.tsx (+5 -1)
➕ packages/client/src/hooks/use-map-pack.ts (+20 -0)
📝 packages/client/src/hooks/use-overworld-view.ts (+7 -3)
📝 packages/client/src/localization/locales/en.json (+17 -0)
📝 packages/server/src/routes/game.routes.ts (+268 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+34 -0)
➕ packages/server/src/services/game/map-pack.service.ts (+75 -0)
📝 packages/shared/src/features/world/compile.ts (+14 -4)
➕ packages/shared/src/features/world/edits.ts (+281 -0)
📝 packages/shared/src/features/world/engine.ts (+14 -7)

...and 12 more files

📄 Description

Linked issue

Part of #7468

Follows #7472 (generated worlds 3/5), now merged; this PR is up to date with staging. Please review and merge the series in order. New Overworld games stay behind the MARINARA_OVERWORLD_GAMES switch from #7470, and this PR puts the map pack behind it too.

Why this change

  • A generated world is a starting point. A creator wants to rename or move a place, paint the ground or add a person without the next compile throwing it away.
  • A kit or a world made with care should be something a creator can hand to another player as a file.
  • An Experience (a package that sets up a game) should be able to ship its own setting: its kit, ready-made worlds and tile pack, so turning it on gives that world and no other.

What changed

  • Hand edits: a game's world can carry an edit layer (painted ground, places renamed or moved, places and people added, people renamed), applied in the one resolver every reader goes through (features/world/edits.ts), so the Game Master, the overworld, the towns and the World tab see it at once. A renamed place still answers to its old name. Hand edits never rewrite the past: history and the world's own changes read the compiled world, and towns keep their layout, with added places and people taking the next free lots. A layer is checked when saved and again on read, so one written around the check is left out when it does not fit. Routes for an editor: GET /api/game/worlds, GET /api/game/:chatId/world/edit, PUT /api/game/:chatId/world/edits, GET /api/game/:chatId/world/people.
  • Share files: a kit file (.worldkit.json) and a world file (.world.json: its kit, seed, brief and hand edits), read strictly: another format, a newer version, a kit or brief that does not read or a world from another generator is refused with the reason, and what does not fit is left out with a note. Setup gains Download this kit, Import a kit file, Download this world and Import a world file; a game's World tab has Download the world. Routes for a kit maker: GET /api/game/world-kits, /world-kits/starter/:id, /:chatId/world-kit, POST /world-kits/check and /world-kits/read.
  • Map packs (Capability API 1.72): contributions.gameSurface.mapPack { kit, worlds?, tiles? } needs the game-surface slot, schema version 2, the Engine's own setup and every path in assets.paths. The Engine reads the files through the verified asset path (refused above a declared 2 MB) and checks them as it checks share files; a pack that does not read is refused whole, with the reason (map-pack.service.ts). With the Experience on, the wizard shows its kit as set and offers only its maps; POST /game/create refuses map_pack_invalid and map_pack_locked; the game is drawn with the pack's tiles while the package is installed.
  • The Overworld lock: the map pack chooser sits inside the World step's locked fieldset with the kit and world pickers, and with the switch off a map pack's kit and world are not sent either.
  • Capability API 1.72, since staging holds 1.66 to 1.71 (#7470 took 1.69 and 1.70, #7488 took 1.71 for agentContent); capability-package-lifecycle pins 1.72.
  • From the staging merge: a place added by hand that takes an empty home keeps the home's id (as #7472 does for the story's places), and its people work there by that id. The World tab keeps #7472's useWorldJournal hook and adds Download the world beside it. The game-world-files e2e opens the journal from the Session window, as staging's game controls now do.
  • Lanes: world-edits, world-share-files, world-map-packs, capability-package-lifecycle. E2E: game-world-files, game-world-map-packs.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md
  • On this branch after merging staging cb16d6f07 (which includes #7472 and #7488): pnpm check green; every world-* and capability-* lane passes; the game-world-files, game-world-map-packs, game-world-towns and game-world-journal e2e specs pass on desktop Chromium. The full regression run is recorded on the first and last PRs of the series (#7470 and generated worlds 5/5); the four that fail there (memory-recall-revectorize, regeneration-context, and the native-export-memory and ruleset-combat-director timeouts) fail the same way on staging aee076362 in the same container.
  • Earlier, on the separate branches: each part's lane and the world e2e specs on desktop and mobile Chromium, with planted defects caught for every part.

Manual verification notes

  • Share files: the e2e imports a world file, makes a game from it and downloads from the wizard and from the World tab. Map packs: the lane and e2e use a test package.
  • Hand edits have no screen of their own in this PR; a world editor calls these routes.
  • Not checked by a person yet: a share file made by another tool, and a released Experience with a map pack (none exists yet).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)
  • No CHANGELOG.md edit, per #7483; "What changed" above is for the release notes. docs/development/optional-agent-packages.md and docs/game/getting-started.md changed; the translations are tracked on the Game Mode catch-up issue #6813 (https://github.com/Pasta-Devs/Marinara-Engine/issues/6813#issuecomment-6127991796).

UI evidence (if applicable)

No screenshots attached; the e2e specs above drive these screens (the wizard's import and download buttons, the World tab download and the wizard's locked-kit view with a map pack).

Summary by CodeRabbit

  • New Features
    • Import and export setting kits and complete worlds, including compatible hand edits.
    • Edit generated worlds by changing terrain and places or adding places and people. Hand edits appear in game views and can be included in world downloads.
    • Experiences can provide map packs with a fixed setting kit, selectable maps, and custom tiles.
  • Bug Fixes
    • Incompatible or unreadable world files and map packs display errors and prevent starting a game when required.
    • Hand edits that don’t match a world’s current seed and brief are left out of game setup.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7473 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/generated-worlds-4` --- ### 📝 Commits (10+) - [`11bd5fc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/11bd5fc07286d351f8e7f09468b22b46f9b29343) feat(world): a world keeps hand edits applied after its compile - [`feeaf87`](https://github.com/Pasta-Devs/Marinara-Engine/commit/feeaf8795634d1a9bc719b5bd09c3b1a72a99fb6) fix(world): an edit layer that does not fit its world is not applied - [`12c3084`](https://github.com/Pasta-Devs/Marinara-Engine/commit/12c3084faaf9074be54baa392c7b5de3e7d805cf) test(world): the edit-layer lane proves what its breaks found unproven - [`46926dd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/46926dd72002a3994e5710b11d1258844313fb94) test(world): drop a brief place the fantasy kit never compiles - [`72237f8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/72237f8725327d12ce15419d917b63f039359084) fix(world): a world saved again is checked as compiled, not as edited - [`2d2bb34`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2d2bb3485cbfca3ea8213744e00f5e56e65668a4) feat(world): setting kits and worlds as share files - [`92332b0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/92332b065e28d4fa63d95eb15b434bc4b174fd50) feat(world): kit routes for a maker; share-file review fixes - [`58c49d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/58c49d8bafe6160db3ceeca37a1e8f423c9331cf) feat(world): an Experience's map pack (Capability API 1.68) - [`e2e5144`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e2e514444b562bd222047a19b990869a02aec544) fix(world): map pack review fixes - [`99fde26`](https://github.com/Pasta-Devs/Marinara-Engine/commit/99fde26b17ed212120cc8cd649bdc51f421a6e17) fix(world): map pack proofs from the break round ### 📊 Changes **32 files changed** (+2956 additions, -103 deletions) <details> <summary>View changed files</summary> 📝 `docs/development/optional-agent-packages.md` (+41 -0) 📝 `docs/game/getting-started.md` (+14 -1) ➕ `e2e/game-world-files.e2e.ts` (+210 -0) ➕ `e2e/game-world-map-packs.e2e.ts` (+298 -0) 📝 `packages/client/src/components/game/GameJournal.tsx` (+20 -1) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+65 -40) 📝 `packages/client/src/components/game/GameSetupWorldChooser.tsx` (+80 -3) 📝 `packages/client/src/components/game/GameSetupWorldKitChooser.tsx` (+171 -1) 📝 `packages/client/src/components/game/GameSurface.tsx` (+10 -0) 📝 `packages/client/src/components/game/TownView.tsx` (+5 -1) 📝 `packages/client/src/components/game/WorldOverworld.tsx` (+5 -1) ➕ `packages/client/src/hooks/use-map-pack.ts` (+20 -0) 📝 `packages/client/src/hooks/use-overworld-view.ts` (+7 -3) 📝 `packages/client/src/localization/locales/en.json` (+17 -0) 📝 `packages/server/src/routes/game.routes.ts` (+268 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+34 -0) ➕ `packages/server/src/services/game/map-pack.service.ts` (+75 -0) 📝 `packages/shared/src/features/world/compile.ts` (+14 -4) ➕ `packages/shared/src/features/world/edits.ts` (+281 -0) 📝 `packages/shared/src/features/world/engine.ts` (+14 -7) _...and 12 more files_ </details> ### 📄 Description ## Linked issue Part of #7468 Follows #7472 (generated worlds 3/5), now merged; this PR is up to date with `staging`. Please review and merge the series in order. New Overworld games stay behind the `MARINARA_OVERWORLD_GAMES` switch from #7470, and this PR puts the map pack behind it too. ## Why this change - A generated world is a starting point. A creator wants to rename or move a place, paint the ground or add a person without the next compile throwing it away. - A kit or a world made with care should be something a creator can hand to another player as a file. - An Experience (a package that sets up a game) should be able to ship its own setting: its kit, ready-made worlds and tile pack, so turning it on gives that world and no other. ## What changed - **Hand edits:** a game's world can carry an edit layer (painted ground, places renamed or moved, places and people added, people renamed), applied in the one resolver every reader goes through (`features/world/edits.ts`), so the Game Master, the overworld, the towns and the World tab see it at once. A renamed place still answers to its old name. Hand edits never rewrite the past: history and the world's own changes read the compiled world, and towns keep their layout, with added places and people taking the next free lots. A layer is checked when saved and again on read, so one written around the check is left out when it does not fit. Routes for an editor: `GET /api/game/worlds`, `GET /api/game/:chatId/world/edit`, `PUT /api/game/:chatId/world/edits`, `GET /api/game/:chatId/world/people`. - **Share files:** a kit file (`.worldkit.json`) and a world file (`.world.json`: its kit, seed, brief and hand edits), read strictly: another format, a newer version, a kit or brief that does not read or a world from another generator is refused with the reason, and what does not fit is left out with a note. Setup gains **Download this kit**, **Import a kit file**, **Download this world** and **Import a world file**; a game's World tab has **Download the world**. Routes for a kit maker: `GET /api/game/world-kits`, `/world-kits/starter/:id`, `/:chatId/world-kit`, `POST /world-kits/check` and `/world-kits/read`. - **Map packs (Capability API 1.72):** `contributions.gameSurface.mapPack { kit, worlds?, tiles? }` needs the game-surface slot, schema version 2, the Engine's own setup and every path in `assets.paths`. The Engine reads the files through the verified asset path (refused above a declared 2 MB) and checks them as it checks share files; a pack that does not read is refused whole, with the reason (`map-pack.service.ts`). With the Experience on, the wizard shows its kit as set and offers only its maps; `POST /game/create` refuses `map_pack_invalid` and `map_pack_locked`; the game is drawn with the pack's tiles while the package is installed. - **The Overworld lock:** the map pack chooser sits inside the World step's locked fieldset with the kit and world pickers, and with the switch off a map pack's kit and world are not sent either. - Capability API 1.72, since staging holds 1.66 to 1.71 (#7470 took 1.69 and 1.70, #7488 took 1.71 for `agentContent`); `capability-package-lifecycle` pins 1.72. - From the staging merge: a place added by hand that takes an empty home keeps the home's id (as #7472 does for the story's places), and its people work there by that id. The World tab keeps #7472's `useWorldJournal` hook and adds **Download the world** beside it. The `game-world-files` e2e opens the journal from the Session window, as staging's game controls now do. - Lanes: `world-edits`, `world-share-files`, `world-map-packs`, `capability-package-lifecycle`. E2E: `game-world-files`, `game-world-map-packs`. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` - On this branch after merging staging cb16d6f07 (which includes #7472 and #7488): `pnpm check` green; every `world-*` and `capability-*` lane passes; the `game-world-files`, `game-world-map-packs`, `game-world-towns` and `game-world-journal` e2e specs pass on desktop Chromium. The full regression run is recorded on the first and last PRs of the series (#7470 and generated worlds 5/5); the four that fail there (`memory-recall-revectorize`, `regeneration-context`, and the `native-export-memory` and `ruleset-combat-director` timeouts) fail the same way on staging aee076362 in the same container. - Earlier, on the separate branches: each part's lane and the world e2e specs on desktop and mobile Chromium, with planted defects caught for every part. ### Manual verification notes - Share files: the e2e imports a world file, makes a game from it and downloads from the wizard and from the World tab. Map packs: the lane and e2e use a test package. - Hand edits have no screen of their own in this PR; a world editor calls these routes. - Not checked by a person yet: a share file made by another tool, and a released Experience with a map pack (none exists yet). ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) - No `CHANGELOG.md` edit, per #7483; "What changed" above is for the release notes. `docs/development/optional-agent-packages.md` and `docs/game/getting-started.md` changed; the translations are tracked on the Game Mode catch-up issue #6813 (https://github.com/Pasta-Devs/Marinara-Engine/issues/6813#issuecomment-6127991796). ## UI evidence (if applicable) No screenshots attached; the e2e specs above drive these screens (the wizard's import and download buttons, the World tab download and the wizard's locked-kit view with a map pack). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Import and export setting kits and complete worlds, including compatible hand edits. * Edit generated worlds by changing terrain and places or adding places and people. Hand edits appear in game views and can be included in world downloads. * Experiences can provide map packs with a fixed setting kit, selectable maps, and custom tiles. * **Bug Fixes** * Incompatible or unreadable world files and map packs display errors and prevent starting a game when required. * Hand edits that don’t match a world’s current seed and brief are left out of game setup. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:07:11 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
Pasta-Devs/Marinara-Engine#7753
No description provided.