Build

A package adds to RPG Engine without changing it: a game to play, something more for every game, a story, a look, a language. There are five kinds, each with its guide:

Kind What it adds Made of Shared on
Game system a game: its sheet, numbers, pages and rules text data and TypeScript npm
Extension commands, fields and widgets for any game data and TypeScript npm
Adventure a world to play: places, people, quests data GitHub, or a .zip
Theme how the dashboard looks data GitHub, or a .zip
Language the dashboard in a language, by hand data GitHub, or npm

rpg package new makes a new game system, extension or theme that already works: start from there. An adventure starts as a campaign you write in; a language starts from a translation the dashboard has.

Packages with code

A game system or an extension is an npm package with code. Its code runs on the player’s computer, so a player installs one that is not RPG Engine’s own only after allowing it in a window. Its code reaches the game only through what the engine gives it, and it is tested with the engine’s test kit, rpg-engine/testing.

Its package.json names the version of the package API it is written for, as "rpg-engine": {"kind": "extension", "api": 11}. The engine reads packages written for older APIs too; a package written for a newer one asks its player to update RPG Engine first. What each API number added.

The keyword rpg-engine-package in its package.json lists it on the dashboard’s Packages page.

What a package’s code can do

A game system and an extension have the same code: what one can do, the other can too. The engine keeps the sheet and the numbers and the master rules, so code is for what data cannot say. It can:

  • Add commands the master calls, on the command line and through MCP: weather tells the sky, lockpicking-pick plays an attempt at a lock.
  • Act on the game’s events: as time passes (timePassed, the weather’s new sky at each dawn), after a counter changes, a turn starts, a roll is made or an effect is added, and before the player is asked for a roll (asking, to word its buttons).
  • Ask the player for a roll, with the dashboard’s buttons, or their own dice told in the chat.
  • Write the game: any field of a page, a counter within its limits, an effect; and keep state of its own in the campaign.
  • Show widgets on the dashboard, declared in its system.yaml or extension.yaml and filled by its code: a chip at the top (the weather now), a card beside the rolls (the lock being picked), a card at the end of the scene, sheet, world or journal (today’s weather), a mark on each of the party (the 5e’s dying), or the card a roll is asked in (the 5e’s death save).
  • Draw in the page with a page module in Preact: figures inside its widgets (the lock’s tumblers), cards and pages of its own, a tab beside Party and Scene; a game system can also draw a group of its sheet in its own way.

Code reaches the game through game, the object the engine gives it: the engine’s dice, its time, its pages, so that the log and the dashboard follow what it does. The contract, with every hook and part: Reference: extensions and code.

Packages of data

An adventure, a theme or a language is a folder of files, with no code: no window asks the player. It is shared as a GitHub repository with a topic (rpg-engine-adventure, rpg-engine-theme, rpg-engine-language), which lists it on the Packages page, or as a .zip. A player installs it from the Packages page, or with rpg package install <link, .zip or folder>.

Working with an AI

The guides and the reference are written for your AI too. Give it this page and the guide of the kind you make, and work in the package’s folder: the package’s own README.md says where everything is. Test what the AI writes with npm test, and in a campaign.

Older versions

These pages describe the latest RPG Engine. The docs of an older version are in the repository at its tag: https://github.com/stefanocaronia/rpg-engine/tree/v<version>/docs, such as v0.35.0.

Help

Questions, and packages you made, go to the Discussions; a bug of the engine to an issue.


Table of contents


© 2026 Stefano Caronia · code under the MIT license