[PR #7470] [MERGED] feat(game): generated worlds 1/5: kits, worlds, history, living world, Overworld switch; market days, held riders #7748

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

📋 Pull Request Information

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

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


📝 Commits (10+)

  • 1ab38f0 feat(rulesets): market days: rare stock, limited items and selling back (#6934)
  • f0c2771 feat(rulesets): a rider can fire on held weapons by item tag
  • db76f47 feat(game): setting kits, the words a world is written in and the kinds of change it has
  • 12d5a17 fix(game): a setting kit write lands only on the kit it was asked for, and a broken kit blocks the setup download
  • 2c75317 feat(game): make a world from a seed in the setting kit's words
  • 45d5c4d feat(game): a world's people, drawn by the seed and named in their own culture's words
  • 26b7f42 feat(game): a world's history, the world engine run from the founding to now
  • 467d789 feat(game): the world's ledger, what the story does to a world
  • 0454601 feat(game): a living world, the world engine stepping in play
  • 1640213 Merge staging into feat/world-setting-kit

📊 Changes

75 files changed (+12479 additions, -236 deletions)

View changed files

📝 .env.example (+3 -0)
📝 CHANGELOG.md (+9 -0)
📝 docs/CONFIGURATION.md (+1 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+53 -3)
📝 docs/examples/rulesets/gravewatch.json (+25 -7)
📝 docs/extending/ruleset.schema.json (+90 -5)
📝 docs/extending/writing-rulesets.md (+31 -4)
📝 docs/game/getting-started.md (+34 -1)
📝 docs/game/party-and-npcs.md (+1 -1)
📝 e2e/game-experience-setup.e2e.ts (+415 -1)
📝 e2e/game-ruleset-markets.e2e.ts (+177 -2)
➕ e2e/game-world-places.e2e.ts (+520 -0)
📝 packages/client/src/components/game/GameJournal.tsx (+6 -4)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+95 -18)
➕ packages/client/src/components/game/GameSetupWorldChooser.tsx (+613 -0)
➕ packages/client/src/components/game/GameSetupWorldKitChooser.tsx (+492 -0)
📝 packages/client/src/components/game/GameSurface.tsx (+9 -1)
➕ packages/client/src/components/game/game-setup-classes.ts (+9 -0)
➕ packages/client/src/hooks/use-world-library.ts (+12 -0)
📝 packages/client/src/lib/game-setup-share.ts (+20 -1)

...and 55 more files

📄 Description

Linked issue

Part of #7468
Part of #7469

Targets staging. This is the first of five stacked PRs for generated worlds; the other four build on this branch, so please review and merge them in order. It also carries two ruleset parts (market days and held-weapon riders) that the worlds code builds on.

Why this change

  • Game Mode's prompts and tables assume a European fantasy world. A wuxia, modern-day or space opera game gets a fantasy world's words for places, groups, travel, the calendar and names, and nothing keeps crime or wars out of a cozy setting.
  • The Game Master invents geography and people on the spot, so a river town is not the same place forty sessions later, models reuse the same few names, and markets, loot and travel do not know how big a place is.
  • A world with no past gives the Game Master nothing true to lean on, what the party does to a world lives only in the model's memory, and a world that changes only when the party looks at it feels like a stage set.
  • Since #6917 (Capability API 1.65) a ruleset's market never changes: shelves never run out, nothing rare turns up and the party cannot sell back. A ruleset rider such as 5e's Sneak Attack matched only attack-list rows, so it would stop firing once weapons are items held from the bag.
  • Overworld games are not ready for everyone yet, so they ship switched off.

What changed

  • Market days (Capability API 1.69): market.places[] with a daily purse, market.buyBack, a seller's stock (a loot table rolled once a day) and limited on a sold rule or item. A day lasts until the Game Master names another place or writes [place: ... day="new"]; it is derived from the messages and seeded, so a reply's preview and save roll the same shelf. [inventory: action="sell"] pays a share of the fair price up to the day's purse, with named refusals; buy can be sold-out. Prices are said in the coin the cost is written in (a 5e 50 gp potion is 50 gold pieces). Gravewatch, schema and docs updated.
  • Held-weapon riders (Capability API 1.70): a rider can name weapons: { tags } and fires on a held item weapon carrying one of those tags, off-hand strikes included; checked at import against the items block's tags.
  • Setting kits: an optional Setting kit on the World step: eight starters (high fantasy, wuxia, modern day, space opera and others), a model-written kit for the player's setting (checked, retried once, then refused with the reasons) and an editor for every word. The Game Master reads it every turn and keeps out the kinds of change it does not allow. A late kit write never replaces a kit picked since, and shared/src/features/world/* is its own game-world chunk to keep the build under its chunk budget.
  • Worlds from a seed: Make a world lays out regions, settlements on the kit's size ladder and the ways between them from a seed, with a preview, optional grounding in the places the lorebooks state, and a model-written brief the player can change. A game stores the seed and brief and recomputes the rest; the Game Master always knows where the party is and where it can go, and a world place named in a place tag takes the world's size, on a ruleset market's ladder too.
  • People: each settlement's residents are drawn from the seed, named from the brief's per-culture lists (never the overused names), with a job suited to the place, a temperament and a look. The Game Master is offered people it has not met; one it names in full joins the tracked characters, and two who share a name are told apart.
  • History: a deterministic engine runs the world from its founding to now: settlements grow, groups rise, change leaders and fall out, and where the kit allows it wars and famines happen, each only after a build-up. Dated lore events happen when the lore says. The Game Master gets the notable past and can ask for more with [history: ...].
  • Ledger: [world: deed=... | fact=...] records the party helping or crossing a group, siding with or betraying one, improving, damaging, taking or ruining a place, destroying a group or crowning a head, and the places and groups the story adds; each is refused when the world does not allow that kind of change. The ledger is the answered tags in the replies, so a swipe or regeneration takes a change back.
  • Living world: when the Game Master says time passes, the world takes its own weekly steps (fortunes, newcomers, rivalries, new heads, and where allowed trouble and wars after a season of tension), never deciding anything where the party is. News travels as rumour, brewing trouble nearby is shown so the party can act, and the party's deeds count for more as it becomes known.
  • The Overworld lock: MARINARA_OVERWORLD_GAMES (off by default; .env.example, docs/CONFIGURATION.md). Off, the wizard greys out the setting kit and world pickers and says why, and the server refuses a new game, or a shared room's game, that carries a kit or a world (403 overworld_locked). GET /api/game/overworld tells the client. Regressions and the e2e servers run with it on; world-places and multiplayer-game-runtime check it off.
  • Merging staging: the kit and world writers use staging's configured generation timeout, and the install gates check 1.69 and 1.70 (staging already holds 1.66 to 1.68).
  • Lanes: world-setting-kits, world-places, world-people, world-history, world-ledger, world-living, game-ruleset-markets, game-ruleset-weapons, capability-package-lifecycle, multiplayer-game-runtime. E2E: game-experience-setup, game-world-places, game-ruleset-markets.

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 c83344993 (which includes #7466): pnpm check green; node scripts/run-regressions.mjs 589/593. The four that fail (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 lanes and e2e specs on desktop and mobile Chromium, with planted defects caught for every part.

Manual verification notes

  • Setting kit and world: checked with a real model on an isolated instance: it wrote a kit for a border kingdom (two cultures, a calendar, 12 group kinds) in about 150 s and a brief with 10 places and 5 groups in about 100 s; the compile made 25 settlements, and a travel turn answered [place: ... result="ok"]. A real-model run named people from the brief's lists and showed the brief's events plus generated wars in the past.
  • Market days: the e2e plays a buy, a sell and a sold-out buy on desktop and mobile. Held riders: the lane covers a held finesse and ranged weapon, the off-hand strike and a non-matching tag.
  • Not checked by a person yet: whether the eight starter kits, names per culture and Gravewatch's market numbers read right; the pacing of the past and of the living world over a long campaign. Writing a kit or brief takes minutes and the screen says only "Writing". A held-weapon rider in play needs the 5e package's equipment update.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)
  • CHANGELOG [Unreleased] entries added. docs/CONFIGURATION.md, docs/development/game-rulesets-and-sheets-implementation.md, docs/extending/writing-rulesets.md, docs/game/getting-started.md and docs/game/party-and-npcs.md changed, plus the data files docs/extending/ruleset.schema.json and docs/examples/rulesets/gravewatch.json; the translations are tracked on the Game Mode catch-up issue #6813.

UI evidence (if applicable)

No screenshots attached; the e2e specs above drive these screens (the setting kit cards and editor, the Make a world panel and its preview, and the World step with the Overworld lock off).

Summary by CodeRabbit

  • New Features
    • Added optional Overworld setup with eight starter settings, editable or AI-generated setting kits, lore-based world briefs, and seeded world generation.
    • Overworld games can develop histories, places, residents, and events that shape play over time. The feature is disabled by default; setup offers Classic games only while it is off.
    • Markets can offer daily stock with purchase limits, buy items back from players while funds last, and refresh stock and funds on a new market day. Prices use the item’s cost currency when it exactly covers the amount.
    • Ruleset riders can target attacks from held weapons, and inventory journals now record sales.
  • Documentation
    • Added guidance for Overworld setup, market-day features, and weapon-based riders.

🔄 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/7470 **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-1` --- ### 📝 Commits (10+) - [`1ab38f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1ab38f0b1134195cd8453726dcb789c99d306aa7) feat(rulesets): market days: rare stock, limited items and selling back (#6934) - [`f0c2771`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f0c2771fe9ee4f04cd93b3503ed3f994d245d322) feat(rulesets): a rider can fire on held weapons by item tag - [`db76f47`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db76f47eca278cec6257bf031427d98901c3bcc2) feat(game): setting kits, the words a world is written in and the kinds of change it has - [`12d5a17`](https://github.com/Pasta-Devs/Marinara-Engine/commit/12d5a17b3a1bb795749152fb998a16fd6e882553) fix(game): a setting kit write lands only on the kit it was asked for, and a broken kit blocks the setup download - [`2c75317`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2c7531764421f59a37bc849b88752fc3ec6709eb) feat(game): make a world from a seed in the setting kit's words - [`45d5c4d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45d5c4da5312a4ed27046bc2f3c4bcc46ee6e42b) feat(game): a world's people, drawn by the seed and named in their own culture's words - [`26b7f42`](https://github.com/Pasta-Devs/Marinara-Engine/commit/26b7f42a562f97ecbd0305c0bd10b4e55561747b) feat(game): a world's history, the world engine run from the founding to now - [`467d789`](https://github.com/Pasta-Devs/Marinara-Engine/commit/467d789743df3660fec84fbe7af430dcf222131b) feat(game): the world's ledger, what the story does to a world - [`0454601`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0454601fe040d78ac9d932f55900edb7d3c44ac8) feat(game): a living world, the world engine stepping in play - [`1640213`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1640213ce967d8daecad521905ec836a65a3eaf2) Merge staging into feat/world-setting-kit ### 📊 Changes **75 files changed** (+12479 additions, -236 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+3 -0) 📝 `CHANGELOG.md` (+9 -0) 📝 `docs/CONFIGURATION.md` (+1 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+53 -3) 📝 `docs/examples/rulesets/gravewatch.json` (+25 -7) 📝 `docs/extending/ruleset.schema.json` (+90 -5) 📝 `docs/extending/writing-rulesets.md` (+31 -4) 📝 `docs/game/getting-started.md` (+34 -1) 📝 `docs/game/party-and-npcs.md` (+1 -1) 📝 `e2e/game-experience-setup.e2e.ts` (+415 -1) 📝 `e2e/game-ruleset-markets.e2e.ts` (+177 -2) ➕ `e2e/game-world-places.e2e.ts` (+520 -0) 📝 `packages/client/src/components/game/GameJournal.tsx` (+6 -4) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+95 -18) ➕ `packages/client/src/components/game/GameSetupWorldChooser.tsx` (+613 -0) ➕ `packages/client/src/components/game/GameSetupWorldKitChooser.tsx` (+492 -0) 📝 `packages/client/src/components/game/GameSurface.tsx` (+9 -1) ➕ `packages/client/src/components/game/game-setup-classes.ts` (+9 -0) ➕ `packages/client/src/hooks/use-world-library.ts` (+12 -0) 📝 `packages/client/src/lib/game-setup-share.ts` (+20 -1) _...and 55 more files_ </details> ### 📄 Description ## Linked issue Part of #7468 Part of #7469 Targets `staging`. This is the first of five stacked PRs for generated worlds; the other four build on this branch, so please review and merge them in order. It also carries two ruleset parts (market days and held-weapon riders) that the worlds code builds on. ## Why this change - Game Mode's prompts and tables assume a European fantasy world. A wuxia, modern-day or space opera game gets a fantasy world's words for places, groups, travel, the calendar and names, and nothing keeps crime or wars out of a cozy setting. - The Game Master invents geography and people on the spot, so a river town is not the same place forty sessions later, models reuse the same few names, and markets, loot and travel do not know how big a place is. - A world with no past gives the Game Master nothing true to lean on, what the party does to a world lives only in the model's memory, and a world that changes only when the party looks at it feels like a stage set. - Since #6917 (Capability API 1.65) a ruleset's market never changes: shelves never run out, nothing rare turns up and the party cannot sell back. A ruleset rider such as 5e's Sneak Attack matched only attack-list rows, so it would stop firing once weapons are items held from the bag. - Overworld games are not ready for everyone yet, so they ship switched off. ## What changed - **Market days (Capability API 1.69):** `market.places[]` with a daily `purse`, `market.buyBack`, a seller's `stock` (a loot table rolled once a day) and `limited` on a sold rule or item. A day lasts until the Game Master names another place or writes `[place: ... day="new"]`; it is derived from the messages and seeded, so a reply's preview and save roll the same shelf. `[inventory: action="sell"]` pays a share of the fair price up to the day's purse, with named refusals; `buy` can be `sold-out`. Prices are said in the coin the cost is written in (a 5e 50 gp potion is 50 gold pieces). Gravewatch, schema and docs updated. - **Held-weapon riders (Capability API 1.70):** a rider can name `weapons: { tags }` and fires on a held item weapon carrying one of those tags, off-hand strikes included; checked at import against the items block's tags. - **Setting kits:** an optional **Setting kit** on the World step: eight starters (high fantasy, wuxia, modern day, space opera and others), a model-written kit for the player's setting (checked, retried once, then refused with the reasons) and an editor for every word. The Game Master reads it every turn and keeps out the kinds of change it does not allow. A late kit write never replaces a kit picked since, and `shared/src/features/world/*` is its own `game-world` chunk to keep the build under its chunk budget. - **Worlds from a seed:** **Make a world** lays out regions, settlements on the kit's size ladder and the ways between them from a seed, with a preview, optional grounding in the places the lorebooks state, and a model-written brief the player can change. A game stores the seed and brief and recomputes the rest; the Game Master always knows where the party is and where it can go, and a world place named in a place tag takes the world's size, on a ruleset market's ladder too. - **People:** each settlement's residents are drawn from the seed, named from the brief's per-culture lists (never the overused names), with a job suited to the place, a temperament and a look. The Game Master is offered people it has not met; one it names in full joins the tracked characters, and two who share a name are told apart. - **History:** a deterministic engine runs the world from its founding to now: settlements grow, groups rise, change leaders and fall out, and where the kit allows it wars and famines happen, each only after a build-up. Dated lore events happen when the lore says. The Game Master gets the notable past and can ask for more with `[history: ...]`. - **Ledger:** `[world: deed=... | fact=...]` records the party helping or crossing a group, siding with or betraying one, improving, damaging, taking or ruining a place, destroying a group or crowning a head, and the places and groups the story adds; each is refused when the world does not allow that kind of change. The ledger is the answered tags in the replies, so a swipe or regeneration takes a change back. - **Living world:** when the Game Master says time passes, the world takes its own weekly steps (fortunes, newcomers, rivalries, new heads, and where allowed trouble and wars after a season of tension), never deciding anything where the party is. News travels as rumour, brewing trouble nearby is shown so the party can act, and the party's deeds count for more as it becomes known. - **The Overworld lock:** `MARINARA_OVERWORLD_GAMES` (off by default; `.env.example`, `docs/CONFIGURATION.md`). Off, the wizard greys out the setting kit and world pickers and says why, and the server refuses a new game, or a shared room's game, that carries a kit or a world (403 `overworld_locked`). `GET /api/game/overworld` tells the client. Regressions and the e2e servers run with it on; `world-places` and `multiplayer-game-runtime` check it off. - **Merging staging:** the kit and world writers use staging's configured generation timeout, and the install gates check 1.69 and 1.70 (staging already holds 1.66 to 1.68). - Lanes: `world-setting-kits`, `world-places`, `world-people`, `world-history`, `world-ledger`, `world-living`, `game-ruleset-markets`, `game-ruleset-weapons`, `capability-package-lifecycle`, `multiplayer-game-runtime`. E2E: `game-experience-setup`, `game-world-places`, `game-ruleset-markets`. ## 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 c83344993 (which includes #7466): `pnpm check` green; `node scripts/run-regressions.mjs` 589/593. The four that fail (`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 lanes and e2e specs on desktop and mobile Chromium, with planted defects caught for every part. ### Manual verification notes - Setting kit and world: checked with a real model on an isolated instance: it wrote a kit for a border kingdom (two cultures, a calendar, 12 group kinds) in about 150 s and a brief with 10 places and 5 groups in about 100 s; the compile made 25 settlements, and a travel turn answered `[place: ... result="ok"]`. A real-model run named people from the brief's lists and showed the brief's events plus generated wars in the past. - Market days: the e2e plays a buy, a sell and a sold-out buy on desktop and mobile. Held riders: the lane covers a held finesse and ranged weapon, the off-hand strike and a non-matching tag. - Not checked by a person yet: whether the eight starter kits, names per culture and Gravewatch's market numbers read right; the pacing of the past and of the living world over a long campaign. Writing a kit or brief takes minutes and the screen says only "Writing". A held-weapon rider in play needs the 5e package's equipment update. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) - CHANGELOG `[Unreleased]` entries added. `docs/CONFIGURATION.md`, `docs/development/game-rulesets-and-sheets-implementation.md`, `docs/extending/writing-rulesets.md`, `docs/game/getting-started.md` and `docs/game/party-and-npcs.md` changed, plus the data files `docs/extending/ruleset.schema.json` and `docs/examples/rulesets/gravewatch.json`; the translations are tracked on the Game Mode catch-up issue #6813. ## UI evidence (if applicable) No screenshots attached; the e2e specs above drive these screens (the setting kit cards and editor, the Make a world panel and its preview, and the World step with the Overworld lock off). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added optional Overworld setup with eight starter settings, editable or AI-generated setting kits, lore-based world briefs, and seeded world generation. * Overworld games can develop histories, places, residents, and events that shape play over time. The feature is disabled by default; setup offers Classic games only while it is off. * Markets can offer daily stock with purchase limits, buy items back from players while funds last, and refresh stock and funds on a new market day. Prices use the item’s cost currency when it exactly covers the amount. * Ruleset riders can target attacks from held weapons, and inventory journals now record sales. * **Documentation** * Added guidance for Overworld setup, market-day features, and weapon-based riders. <!-- 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:06 +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#7748
No description provided.