Make a game system

A game system is the data of one game: the fields of its character sheet, the formulas that work out its numbers, its counters and rests, its pages (creatures, items, classes) and its rules text, which the master looks up. A campaign plays one system. Where data is not enough, the system brings code too, in TypeScript: commands the master calls and widgets on the dashboard.

A system is an npm package named system-<name>, or @<you>/system-<name>. Campaigns know it by <name>: system-starforged is played as starforged, and its commands start with that name.

You need Node 24, npm, and RPG Engine (npm install -g rpg-engine). The engine does not rule: it keeps the sheet and the numbers, and the master applies the rules text. Put a mechanic in data or code only when the master gets that count wrong.

Steps

  1. Make the system. In a terminal, from the folder where you want it:

    rpg package new "Star Test" --kind system
    

    You should see:

    Made the game system Star Test in ...\system-star-test: system-star-test on npm, played as star-test.
    Next, in that folder: npm install, then npm test, which builds it and runs its tests.
    Then, in a campaign's folder, rpg package install "...\system-star-test" puts it on this computer for a new campaign: its setup offers it, or rpg init <folder> --system star-test makes one that plays it.
    

    Give a title, as here, or an npm name, as @me/system-starforged. The folder must be empty or new; --folder <path> puts it somewhere else. It holds a small game that works:

    File What it is
    system.yaml the fields, formulas, counters, rests and sheet; the other keys in comments
    rules/Basics.md a chapter of rules, which the master finds with rpg rules
    world/creatures/Wolf.md a page of the system, which every campaign that plays it sees
    instructions/play.md lines added to the master’s instructions while playing
    src/index.ts its code: a command, star-test-roll, that rolls 2d6 plus an ability
    test/system.test.ts its tests, on the engine’s test kit
    package.json its npm name, version, and rpg-engine: {kind: system, api}
    README.md, LICENSE.md, .github/workflows/ci.yml to fill in; CI runs the tests on Linux, Windows and macOS
    tsconfig.json, vitest.config.ts, .gitignore the build’s and the tests’ settings, as they are
  2. Build and test it, in its folder:

    cd system-star-test
    npm install
    npm test
    

    npm test builds dist/ and runs the tests: Tests 2 passed (2). The first test checks the data as the engine reads it (systemChecks): every page reads, every field is declared and fits its kind, every rule named exists. The second plays the roll in a campaign made for the test (testCampaign).

  3. Make it your game. Change system.yaml, rules/, world/ and instructions/, and the tests with them; run npm test after each change. Start from data: the reference lists every key of system.yaml. Then add in src/index.ts what data cannot say: commands, hooks on the game’s events, widgets on the dashboard, and in a page module the drawing of a group of the sheet (what code can do).

  4. Install it on your computer. Installing needs a campaign folder, so make one in free play to install from:

    rpg init test-campaign --system free
    cd test-campaign
    rpg package install "<path of system-star-test>"
    

    A window asks you to allow it, as for any package that is not ours: its code runs on your computer. Then:

    Installed the game system star-test 0.1.0, Star Test, not verified: at the player's risk. It is for a new campaign, chosen in its setup: this one plays free. Its code runs from the next start of the game's server.
    

    The system is now on this computer for every campaign: rpg package list names it under Game systems.

  5. Play it. A campaign still in setup can switch to it, as this one is:

    rpg config system star-test
    

    It answers system: star-test, Star Test (system-star-test 0.1.0), then lists the settings still to agree with the player: that list is for the master, not an error. Or make a new campaign that plays it: rpg init <folder> --system star-test. Then try it by hand:

    rpg write Kira --type character --set role=pc --set body=2 --set mind=1
    rpg show Kira
    rpg star-test-roll Kira body
    
    Kira rolls body: 2d6+2 = 7 [1, 4] + 2, a success.
    

    Your dice will differ. write also says which fields of the sheet Kira still lacks, here concept: a note, not an error. Then play a scene with your AI app in that folder: it is the only real test of the rules text and the instructions.

  6. Publish it on npm. Choose a licence (LICENSE.md and license in package.json), give the credit its text needs in attribution in system.yaml, write description in package.json, then:

    npm publish --access public
    

    --access public is needed only for a scoped name (@you/...). Keep the keyword rpg-engine-package in package.json: the dashboard’s Packages page lists the npm packages that have it.

What a player gets

A player installs your system from the dashboard’s Packages page, or by its npm name: rpg package install @you/system-star-test, or rpg package install npm:system-star-test for a name without a scope (a name alone means one of RPG Engine’s own). A window asks them to allow it first, since its code runs on their computer. It installs for every campaign on the computer, and a new campaign’s setup offers it. A campaign that already plays another system keeps it.

Update it

  • After a change, run npm test, then rpg package install "<its folder>" again in your campaign. The command line uses the new code at once. An AI app’s MCP server keeps the code it started with: start a new chat, or reconnect the server.
  • To release, raise version in package.json and npm publish. Players see the update in the Packages page.
  • rpg-engine.api in package.json is the version of the package API the system is written for. Raise it only when you use a key or a function that a newer API added: what each API number added. An older engine then asks its player to update, instead of misreading the system.
  • devDependencies names the RPG Engine your tests run on. Raise it to test with a newer engine.

When something fails

  • "star-test" is not an installed system: install it first (step 4).
  • There is no campaign here: run package install from a campaign folder (step 4).
  • There is already a game system named ..., from package new or package install: another system on this computer, or one of RPG Engine’s own, is played by the same name. Pick another title or name, or uninstall the other one. Titles may repeat; names may not.
  • ... is no npm package name or A game system's npm name ends in system- and its name: the npm name you gave does not work. package new takes a title, which it turns into a name, or an npm name such as system-starforged.
  • ... is not empty: package new needs an empty or new folder.
  • A test of systemChecks fails: the list it gives names the page, field or rule at fault.
  • The master does not see a change: rebuild, install again, and start a new chat.

To take it off the computer: rpg package uninstall star-test, from a campaign that does not play it.

Reference

  • Every key of system.yaml, the formulas, pages, rules, words and instructions: game-systems.md.
  • A system’s code (commands, hooks, widgets, the page module) has the same contract as an extension’s: extensions.md, Code.
  • The test kit, rpg-engine/testing: extensions.md, Tests.
  • A system that works in full, with code: the 5e.

© 2026 Stefano Caronia · code under the MIT license