Repository navigation
RPG R3: rule-system packs, the dungeon-crawl pack, New game command - #71
Merged
Merged
Conversation
A game note names a pack with system: path (or { path, version }). The
pack's system.md frontmatter goes under the game's: lists keyed by id are
joined (the game's entry wins), anything else the game sets replaces the
pack's; the pack's from: paths and pictures move to be relative to the
game. A missing pack or another major version is a problem. When the pack
has a rules.ink, the generated engine INCLUDEs it by a relative path.
- src/game/system.ts (systemRef, layerSystem, withSystem, joinPath), used
by the disk loader and the vault loader (loadGameNote; the pack's note
is a dependency).
- normalizePath keeps a leading .. instead of dropping it, so a pack
outside the folder being checked is read, and a bad path fails loudly.
- Note tables take spawn/count columns; rows read from notes are checked.
- check-ink skips the ink of a pack folder (INCLUDEd by games).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
packs/dungeon-crawl: system.md (2d6, a crew of four, the foe kind with eight templates, room and monster tables, torches/potions/gold), rules.ink (the crawl tunnel: rooms, traps, shrines, fights with one hero striking per round, potions, fleeing, the warlord in the last room), a playable template game and 说明.md. A test keeps the template's engine current and plays it in both languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
…me/description Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
The packs are bundled (virtual:packs, scripts/packs-bundle.mjs). The pure src/templates/packs.ts lists them (packList, the pack's name and description from system.md's pack:) and plans the files (packGame: the pack into 规则包/<id> / Rule packs/<id>, the template into the new folder, system: rewritten as the way from the game to the pack). main.ts: createGame (shared with the journal template; the engine generated from the note as written, its pack layered under it; folders made trashed on a failure), command new-game with a picker, api.newGame(pack, folder?). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
The metadata cache lags behind a note just written, so generating the engine right after making or editing game.md read no frontmatter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
|
Review: I read the diff and found no blocking bugs, but I did not run Two minor points, neither blocking:
I would merge as is. |
…ths above the game Review follow-ups: newGame looks for the pack under 规则包/ and Rule packs/, writes only the pack files that are missing, and a test covers resolving a pack's rules.ink from a game folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B
|
Review: I found no blocking bugs, so I would merge as is. I read
Two minor edge cases, neither blocking:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RPG R3 (
docs/rpg-engine-prd.md§5): rule-system packs, the first pack, and a "New game" command.Packs
game.mdnames a pack withsystem: <folder>orsystem: { path, version }.src/game/system.tslayers the pack'ssystem.mdunder the game's frontmatter: lists keyed by id are joined and the game's entry wins; anything else the game sets replaces the pack's. The pack'sfrom:and image paths are moved so they are relative to the game.systemMissing/systemVersion).rules.ink. Pack files are dependencies, so editing a pack marks the engine stale.spawn/countcolumns.check-inkskips the ink in a pack's own folder; itstemplate/is still checked.loadGameNotereads the note from the file rather than the metadata cache, which lags behind a note that was just written.Dungeon crawl (
packs/dungeon-crawl, original rules)-> crawl ->and then readscrawl_result(won / left / fallen).template/and a说明.md. A test keeps the template's engine current and plays it to an ending in both languages.New game
main.js(virtual:packs). The command "New game" opens a picker (the journal template or a pack), then asks for a folder.规则包/<id>unless a copy is already there, copies the pack's template into the new folder withsystem:rewritten, and generates the engine. The API call isapi.newGame(pack, folder?).Verified in Obsidian
10.3 示例, a crew of three overriding the pack) were added. The example passescheck-ink --randomin zh and en andgen-engine --check.Tests: 580 pass; lint is clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_015vdVgYTb9jm7MRdePSgs8B