Hearthtable system packs

A system pack is one game system as data: its stats, derived numbers, dice, sheet, character builder, levelling, initiative, rests, conditions, table defaults, options, its own house rules and the credit its licence asks for. A campaign plays one pack (or none: the generic sheet). Packs are data, never code — the engine reads them, validates them and refuses anything it can't check.

This page is the contract for anyone adding a system. Read it end to end before you start a pack.

The server mirrors the engine byte for byte at packages/server/src/lib/tabletop/engine/ (parity-tested): after any change under packages/tabletop-engine/src/, copy it across (rsync -a --delete packages/tabletop-engine/src/ packages/server/src/lib/tabletop/engine/).

The rules every pack follows

  1. Names are mechanics words, never a trademark. A pack is "Generic d20", "Narrative approaches", never a game's brand. Compatibility wording (for example "5E compatible") appears only in compatibility, only when the licensor's own page allows that exact wording, and the review records where (allowedWording + allowedWordingSource). The checker refuses known marks in the name, the sheet name and the description (PACK_MARK_BLOCKLIST).
  2. Accepted licences only: CC-BY-3.0, CC-BY-4.0, CC-BY-SA-4.0, ORC, or AGPL-3.0-only for our own packs. OGL 1.0a is never accepted, nor any non-commercial or no-derivatives licence. A share-alike pack (shareAlike: true) lives in its own folder and the editor tells a group that their changes stay under that licence.
  3. Copied rules text is gated. A pack's mechanics (numbers, structure, our own short labels) ship in pack.json. Any text copied from the licensed source (spell descriptions, class features, rules prose) goes in a separate content.json that is never bundled or shown while contentReviewed is false. Only the owner flips it, after a lawyer has looked: the review then carries contentReviewedBy: "owner" and legalLook: "<date>", and the checker refuses true without both. Our own packs never have a content.json.
  4. Credit is verbatim. licence.attribution is the licensor's exact statement; licence.notAffiliated is "Not affiliated with or endorsed by <licensor>."; both travel with the pack (packCredit) and are shown wherever its sheet is.
  5. No new data flow. A pack is bundled data. It never fetches anything, names no URL the app loads, and adds no third party.

Folder layout

packages/tabletop-engine/packs/<pack-id>/
  pack.json          the format below
  LICENSE.md         the pack data's licence (ours: AGPL-3.0-only)
  content.json       third-party packs only, copied rules text; ignored until contentReviewed
packages/web/third-party/tabletop-<pack-id>/
  review.json        the licence review (see "Licences")

The pack id is the folder name: lowercase letters, digits, - and _, up to 60. After editing, run node packages/tabletop-engine/scripts/bundle-packs.mjs (see "Bundling"; --check fails when any generated file is stale) and update the SHA-256s in review.json.

Bundling

bundle-packs.mjs writes three kinds of file under packages/tabletop-engine/src/packs/ (never edit them by hand), then copy src/ to the server's mirror (packages/server/src/lib/tabletop/engine/):

File What it holds Who reads it
bundled/<pack-id>.ts one pack's data, and its content.json only once reviewed loaded on demand
catalogue.ts PACK_CATALOGUE (id, name, description, compatibility, licence — enough for a picker and a credit line) and PACK_LOADERS (one import() per pack) the app
bundled.ts BUNDLED_PACKS, every pack at once the server and the engine's tests (systemPacks() / systemPack())

The app never imports bundled.ts, packs/systems.ts or the engine's index: the picker and credits read the catalogue, and a screen that needs a pack's steps or lists loads it with loadPack / usePack (packages/web/src/components/hearthtable/packs/, over the engine's packs/load.ts: validated once, cached), so each pack is its own chunk and none sits in the main bundle (packsModel.test.ts checks the imports).

The format

Top level of pack.json:

Field What it is
format "ramphearth.systempack/v1"
id, version, release id = folder; version a whole number (data version, migrations step it); release a label
name, compatibility, description rule 1 above
licence { spdx, attribution, shareAlike, notAffiliated, source }
contentReviewed false until the owner's legal look (rule 3)
dice { core, rollTypes, customDice }
character stats, resources, derived numbers, lists of options (origins, callings, talents…)
ladders named rungs for numbers (+2 "Fair")
sheet { name, sections: [{ id, label, fields }] }
layout `{ sections: [{ id, columns: 1
builder { steps }
advancement `{ xp: number[]
initiative `{ style: rolled
rest rests: what each restores and which conditions it clears
conditions the pack's conditions { id, name, tone, rounds, description? }
table grid unit / size / diagonal rule, the token bars
options the knobs the GM may turn per campaign (see "Options")
rules the pack's own house rules, a ramphearth.rules/v1 document (see "House rules")
migrations [{ from, to, changes }], a chain from 1 to version

Limits are SYSTEM_PACK_LIMITS in systemPack.ts.

Dice

The sheet grammar is the engine's dice grammar (NdS, keep high/low kh/kl, >= counts, +/- terms) with references: @self is the field the roll sits on, @key / @{key} another of the sheet's numbers. A roll type (rollTypes) is a named roll fields point at with rollType: { id, label, dice, under?, bands?, versus?, advantage }. under makes it roll-under (succeeds at or under a formula); bands name results by the highest min reached. natural: { success?, fail? } (roll-under only) settles a roll on its face alone — a 1 always saves, a 20 always fails.

versus (engine versus.ts) rolls the score against challenge dice instead: { dice, cap?, results, match?, burn? }. dice is plain NdS (1–4 dice); the score beats a challenge die only when strictly greater, and results names each count of dice beaten ({ beats, label }, one per count from 0 to N). cap limits the score, match is the words when every challenge die shows the same face, and burn names a sheet number (momentum) that may stand in for the score: the outcome then says whether burning it would beat more dice, and a negative value equal to the action die cancels that die. A versus roll type has no under, bands or advantage. On the server (rollAsEntity in entities.ts) the score (or a fixed progress score, which isn't rolled) and the challenge dice are two rolls through the table's own roll path, so both show in the log with the same visibility, and the answer's outcome is the engine's words. Burning is a hint: the player sets momentum on the sheet.

A custom die is { id, label, faces: number[] }, written Nd[id] (4d[plusminus]). When its faces are consecutive whole numbers each appearing the same number of times, the sheet rolls it as ordinary dice (standardFormOf: −1 −1 0 0 1 1 is 1d3−2). Any other custom die (a blank face, a doubled symbol) stays in the dice tray (rollPackDice).

Character

character is the engine's rules pack (RulesPack in rulesPack.ts): stats (key, label, min, max, default), resources (max is a formula), derived (formulas over stats, level and each other — every formula is parsed and evaluated once at validation), lists of options with grants (tags, picks from another list, stat choices, resource bonuses, named rolls), and level gains (levels). Choice ids are unique across the whole pack. A stat grant may carry cap (the increase stops there, a level 20 capstone's 25); a statChoice may carry cap (a choice that would pass it is refused with "choose another stat") and gmOnly (pattern indexes only the GM may give, such as a second raise after a major milestone). A derived number with problem is a check: any value other than 0 stops the save with those words (the skill column's rule), unless the GM saves it house-ruled. A prerequisite may be { "anyOf": [ … ] } (at least two, one level deep): "needs X or Y".

Sheet fields

Field types: number, formula, text, longtext, resource, list, actions, track, slots, conditions.

Key Meaning
playerEdit the character's player may change it (the GM always may)
public anyone at the table may read it on a listed character
gmOnly only the GM reads or writes it, even on the player's own character; never public, never player-edited, and a GM can't make it public
roll / rollType / rollUnder / rollBands / rollVersus how the field rolls
boxes, ticksPerBox track only (stress, harm, progress)
capacity slots only: a formula for the number of slots
ladder a ladder id: the number shows its rung's name
fill what the builder writes into the field (below)

fill.from: stat, resource, derived, level, tag (1 if the character has the tag), tags (tags with a prefix, stripped), options (chosen options' labels from list, optionally only one step's picks via step), detail, equipment (needs an equipment step), money (the package's money plus any rolled money; needs an equipment step), rolls (the character's named rolls as action rows), none. fill.start: true marks a starting value that play then moves (momentum): the builder writes it when the character is made, and a level-up keeps whatever the sheet holds.

Builder steps

Steps run in order; when hides a step until every condition holds ({ option }, { tag }, { level }, { step }).

kind Asks for
choose count (a formula) options from list, or — with from — from an earlier step's picks (prepared spells). With roll: "1dN" it is a table: N must equal the list's length, count is 1, and the answer rollChoice has the server roll it
stats one of methods: pointBuy (budget, costs), array (assign values), roll (dice, count, inOrder?, swaps?), manual (min, max). inOrder puts the rolls on the stats in order; swaps (at most half the stats) is how many pairs a player may then exchange
equipment a package, or rolled money (money.dice × multiply); both: true takes a package and rolled money; a pack may give each calling its own step behind when — the first visible one is used
hitPoints first-level hit points rolled by the server; needs advancement.hp.roll (at most one such step)
details typed fields (key, label, max, required, long) — these pass the workspace word filter
review nothing; the summary

The server rolls. Rolled stats, rolled money and rolled hit points come only from the server's crypto random source; a client never sends a roll value. Each is rolled once (a pack's reroll_stats rule allows one reroll).

Who decides. A player builds and levels up only their own character. Earlier choices are locked at level-up (they may be added to, never reduced). Only the GM may pick a locked option, start above level 1, or save a build that breaks the rules — and such a character is flagged house-ruled.

Levelling and hit points

advancement.xp lists the xp for level 2, 3, …; null for milestone games. advancement.hp (or null for games without hit points): first is level 1's maximum (a formula over stats, derived numbers and hit_die); each later level rolls 1d<die> (or takes fixed) and adds add. dice sets the die by tag (a calling's "d10"). The hp_method rule chooses roll / fixed / max. roll ("NdM") rolls level 1's hit points on the server and adds them to first.

advancement.cost ({ per, have, pay, label }) prices each level from the sheet: a player may take as many levels as have (a number or formula field, such as experience left) covers at per each, checked when the level-up starts and again when it is saved, and the saved level-up adds the cost to pay (a number field, such as experience spent). Without a cost a player levels one level at a time; the GM may always grant more.

Initiative and damage

initiative.opening ({ stat, rollType }, side style only, a roll-under roll type) is a first-round roll each character makes: a failure loses their first turn (openingRound). damage (or null) is the pure damage.ts (applyHit): track is the resource damage comes off, armor the sheet number subtracted first (capped at armorMax), overflow the stat what's left goes to, save (rollType, condition) the save rolled against that stat after overflow damage (a failure gives the condition; no save once it reaches 0), exactZero a list whose row is named when damage takes the track exactly to 0 (row = damage taken, the last row past the end), and zero the condition a stat at 0 gives. rollDamage keeps the highest of several dice (or replaces them, an impaired attack).

Copied text (content.json)

A third-party pack's copied words sit in content.json (format: "ramphearth.packcontent/v1", lists.<list id>.<option id> with label, text and whatever the pack's lists carry — names, gear, tables). The bundler leaves it out and the app shows the pack's own neutral labels (by number) until the owner sets contentReviewed. Nothing reads it yet: once the review is done it is merged over pack.json's labels. The fifth-edition pack's (the SRD's spell descriptions) is the only one released so far (Nov 16 2026): it is bundled, credited like the rest of the pack, and waits for a screen.

Migrations

Bumping version needs a migration step from the previous version. Changes: rename a value key, default a new key, retire a key (moved under _retired, never deleted), mapValue (rewrite stored values), renameOption (rewrite the builder's stored picks). A migration never loses a value: a rename onto a key that already holds something retires the old value instead. Golden: generic-d20 v1 → v2 in test/systemPacks.test.ts.

Options

A pack's options are the knobs a GM turns for one campaign ({ id, label, help, type: "choice" | "number" | "flag", choices?, min?, max?, default }). The GM's choice is tabletop_campaigns.system_options (a JSON object of id → value, saved against system_version; a stale save is 409 with the current ones), changed only by PUT …/system/options, and read by everyone at the table:

Well-known option ids (WELL_KNOWN_RULES) the builder reads: stat_method, point_buy_budget, reroll_stats, hp_method, max_level, players_freeform, initiative_style, stat_swaps (caps a rolled-in-order step's swaps), tables_choose (off = players roll tables, only the GM picks). A pack may add its own options; anything the engine doesn't read is shown to the table as a written rule.

House rules

House rules have one format and one store: ramphearth.rules/v1 (houseRules.ts) in tabletop_house_rules (lib/tabletop/houseRules.ts, migration 436). A pack's rules are such a document; they are layered under the campaign's own (layerRules): the pack's run first, the campaign's after them, in the one list the House rules panel shows (a pack rule is listed as pack-<rule id> with a "From <system>" mark).

Licences

packages/web/third-party/tabletop-<pack-id>/review.json:

{ "pack": "<id>", "shownAs": "<pack name>", "compatibility": null,
  "origin": "ramphearth" | "third-party",
  "licence": "CC-BY-4.0", "shareAlike": false,
  "attribution": "<verbatim>", "notAffiliated": "Not affiliated with or endorsed by <licensor>.",
  "source": { "title": "…", "url": "https://…", "file": "https://…", "sha256": "<of the licensor's file>", "read": "YYYY-MM-DD" },
  "modifications": "What we changed.",
  "allowedWording": ["5E compatible"], "allowedWordingSource": "https://<the licensor's page>",
  "files": [{ "path": "pack.json", "sha256": "…" }, { "path": "LICENSE.md", "sha256": "…" }],
  "contentReviewed": false,
  "reviewed": "YYYY-MM-DD" }

packCreditProblems (run over the real files by packages/server/src/lib/tabletop/systemPacks.files.test.ts) refuses a missing review or LICENSE.md, a licence that disagrees with the pack, OGL / NC / ND, a changed attribution, a missing not-affiliated line, a mark in a name, unlisted files or a hash that doesn't match, and contentReviewed without the owner's legal look.

On the server

In the app

Tutorials ("Try it")

A tutorial is a short guided run of one system, played alone at a practice table: a campaign with tabletop_campaigns.sandbox (migration 442) that only its maker reaches. Owners and Admins don't moderate or list it, nobody can be invited, seated or put on air, and its live session takes none of the workspace's live-session places. Exit and delete removes the practice table, its channels, character and everything rolled there in one call, and deleting an account removes every practice table the person made (dropPracticeTablesOf, lib/account/deletion.ts).

Every bundled system has a script: Generic d20, Generic narrative, Fifth Edition (advantage, spell slots, saves, rests), Challenge Dice (action rolls against two challenge dice, momentum, progress tracks, the oracle), Aspect Ladder (skill rolls on the ladder, invokes and compels with Fate points, stress), Three Save (saves, attacks, damage to HP then STR) and 2d6 Moves (10+ / 7–9 / 6−, marking XP, soft moves). A script whose pack isn't in the build is simply not offered.

Adding a system — checklist

  1. Confirm the licence is on the accepted list and note the licensor's exact attribution and their page on compatibility wording. If anything is unclear, stop and ask the coordinator.
  2. Copy packs/generic-d20/ (crunchy) or packs/generic-narrative/ (light) to packs/<id>/. Rename everything in mechanics words.
  3. Fill in character, sheet, layout, builder, advancement, initiative, rest, conditions, table, rules. Put only short labels of our own in pack.json; copied rules prose goes in content.json.
  4. Mark anything only the GM should see gmOnly: true.
  5. Write LICENSE.md and review.json; run bundle-packs.mjs; fill in the hashes.
  6. Add goldens to packages/tabletop-engine/test/: one finished level-1 character (exact stats and sheet values), one level-up, each refusal your pack adds, and — if you bump version — the migration. The fuzz test in systemPacks.test.ts runs every bundled pack automatically.
  7. Mirror the engine to the server, then run pnpm --dir packages/tabletop-engine test and the server tests under src/lib/tabletop/ and src/routes/tabletop.visibility.test.ts.
  8. Add its tutorial script (see Tutorials above).
  9. Leave contentReviewed: false. Say in your report what text is waiting for the owner's legal look.