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.
- Format:
ramphearth.systempack/v1—packages/tabletop-engine/src/systemPack.ts(validateSystemPack). - Builder:
packages/tabletop-engine/src/builder.ts(pure; the server calls it with its own random source). - Options (the knobs a GM turns):
packages/tabletop-engine/src/packRules.ts. - House rules:
ramphearth.rules/v1—packages/tabletop-engine/src/houseRules.ts, the one rule format and store for the pack's rules and the campaign's (see "House rules"). - Migrations between pack versions:
packages/tabletop-engine/src/packMigrate.ts. - Licence checker:
packages/tabletop-engine/src/packCredits.ts(packCreditProblems). - Reference packs:
packages/tabletop-engine/packs/generic-d20/andpacks/generic-narrative/— copy one of these. - Third-party example:
packs/fifth-edition/("5E compatible", SRD 5.2.1 under CC-BY-4.0) — twelve classes to level 20, spell slots and the SRD spell list as data; itscontent.jsonholds the spell descriptions, released by the owner (contentReviewed, Nov 16 2026). Its goldens aretest/fifthEdition.test.ts. A sheet holds up to 200 fields and a rest up to 40 restores, for packs this size. - Third-party packs:
packs/2d6-moves/(CC BY 3.0; a move roll of 2d6 + stat, one gear step per playbook behindwhen, the experience rules as pack house rules; its copied text waits incontent.json).
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
- 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). - 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. - 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 separatecontent.jsonthat is never bundled or shown whilecontentReviewedisfalse. Only the owner flips it, after a lawyer has looked: the review then carriescontentReviewedBy: "owner"andlegalLook: "<date>", and the checker refusestruewithout both. Our own packs never have acontent.json. - Credit is verbatim.
licence.attributionis the licensor's exact statement;licence.notAffiliatedis "Not affiliated with or endorsed by <licensor>."; both travel with the pack (packCredit) and are shown wherever its sheet is. - 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:
- Unknown ids are refused; numbers must be whole and inside
min–max; a choice must be one of itschoices. - An option the GM never chose plays at its
default. Choosing another system resets the options to that system's.
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).
- The GM switches a pack rule off, or edits it, for one campaign: that writes a row in
tabletop_house_ruleswithpack_id+pack_rule_id(migration 439) holding only the change. Removing that row ("Use the system's version") puts the pack's own rule back; a pack rule itself can't be deleted (409pack_rule). - Players see only the rules that are on, as for the campaign's own.
- Switching system stops the old pack's rules and starts the new one's; the campaign's own house rules stay.
- A pack's extra conditions live in its
conditions; a GM adds more as house rules.
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
- A campaign's system:
tabletop_campaigns.system_pack_id, its optionssystem_options/system_version(migration 439). Choosing a pack (PUT …/system) puts new sheets on the built-in templatesys_<pack id>; existing characters keep theirs, nothing is deleted. Before a switch the GM seesGET …/system/preview?packId=(changes nothing): the sheet fields new sheets gain and lose, how many characters keep their sheets, the unfinished builds for the old system that are thrown away, the options that reset, the pack rules that stop and start, and the house rules kept. - Everyone at the table gets the thin
tabletop_system { campaignId }frame when the system or its options change. - Builder drafts:
tabletop_builder_drafts, sealed; routes under…/builder/drafts(start, answer, finish, discard). Every read and write islib/tabletop/characterBuilder.ts; the template wiring islib/tabletop/packTemplates.ts. - A finished character carries
pack_version,house_ruledand its sealed build (level-up starts from it). The sheet shows "House-ruled" to everyone who sees it, and the pack's credit under it.
In the app
- New campaign: an optional system next to the name. The campaign's Game system tab lists every bundled system with its credit word for word, the one in use and (GM) the switch with its preview, and the system's options.
- Characters: Build a character (GM and players) opens the step-by-step builder; a build is saved on every answer, so Carry on resumes it anywhere. Rolls are the server's. A refusal is shown in the server's words. The GM may Skip the rules and save it anyway (the sheet is then marked house-ruled). A built character's sheet offers Level up, the same builder from the character's earlier answers.
- Sheets draw the pack field types: tracks (boxes of ticks), slots (with the capacity worked out), conditions, numbers on a ladder, and the pack's column layout (phones stack in the pack's phone order).
- Gate:
routes/tabletop.visibility.test.ts("system packs + the builder").
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.
- A script is code, not a row:
server/src/lib/tabletop/tutorials/scripts/<pack>.ts(ramphearth.tutorial/v1), listed inscripts/index.ts. It names its pack, a ready-made character (answers to the pack's own builder, so the server builds and rolls it), a foe, a companion chair, a map, a handout and a cue, and two tracks: player (roll from the sheet, move a token, use an action, change a resource, grow) and gm (start combat, next turn, a condition, hide a token, fire a cue, show a handout, play the companion chair, Preview as). Words are our own — never the system's rules text. - Each step waits for one thing the server can see at the table (
waitFor:sheetRoll,roll,sheetChange,tokenMoved,combatStarted,turnAdvanced,conditionAdded,cueFired,handoutShown,tokenHidden,previewed,whispered,chairActed) or for nothing (read). The server compares the table with how it looked when the step began (rules.tssnapshotOf/stepDone) and moves the run on; Next can't end a step that waits for the table (409not_done), Skip and Back always can. checkScript(pure,rules.ts) checks a script against its pack: the character builds, every field and action it names exists on the pack's sheet, GM steps stay on the GM track, at least three steps do something, the last step reads, no trademark words. A script that fails is not offered.tutorials/rules.test.tsruns it over every script.- Routes:
GET/POST /org/:orgId/tabletop/tutorials,GET/DELETE …/:runId,POST …/:runId/move { back | skip | next }(session only; members, never Guests or Newcomers). Starting one resumes your run of that script; choosing the other track starts it again on the same table. - In the app: New here? Try a game on the Hearthtable home, Try a 5-minute tutorial under each system in the Game
system tab, and the coach on the practice table (
?tutorial=<runId>): one card with the step in plain words, a ring round the part of the table it's about (a side tab past the end of its strip is scrolled into view first), Back / Skip / Next / Hide / Exit, announced politely for screen readers. Words areTUTORIAL_WORDS(layout/hearthtableModel.ts); componentscomponents/hearthtable/tutorials/. - Gate:
routes/tabletopTutorials.visibility.test.ts(every script, both tracks, start to finish through the real table routes; nobody else reaches the practice table; the live-session cap; Exit and account deletion delete everything). - A new pack adds a script: copy
genericD20.ts(crunchy) orgenericNarrative.ts(light), point its steps at the pack's own fields and actions, add it toscripts/index.ts, and run the two tests above.
Adding a system — checklist
- 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.
- Copy
packs/generic-d20/(crunchy) orpacks/generic-narrative/(light) topacks/<id>/. Rename everything in mechanics words. - Fill in
character,sheet,layout,builder,advancement,initiative,rest,conditions,table,rules. Put only short labels of our own inpack.json; copied rules prose goes incontent.json. - Mark anything only the GM should see
gmOnly: true. - Write
LICENSE.mdandreview.json; runbundle-packs.mjs; fill in the hashes. - 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 bumpversion— the migration. The fuzz test insystemPacks.test.tsruns every bundled pack automatically. - Mirror the engine to the server, then run
pnpm --dir packages/tabletop-engine testand the server tests undersrc/lib/tabletop/andsrc/routes/tabletop.visibility.test.ts. - Add its tutorial script (see Tutorials above).
- Leave
contentReviewed: false. Say in your report what text is waiting for the owner's legal look.