Plugins
Bundle fields, hooks and dials into a system you can switch off, share and reuse.
A plugin bundles fields, dials, hooks and events into one system you can switch off, edit, share, and add to other games.
Hunger, rest, stamina, mana, encumbrance and NPC bonds are all plugins. None of them are engine code. Open one in code view for a complete working example.
The rule
Deleting a plugin must leave a working game.
If your system can't be switched off cleanly, it's engine code in disguise. Design for it from the start. What does a game look like without your plugin? That question matches what happens when someone uninstalls it.
What a plugin can declare
| Part | What it is |
|---|---|
| Fields | Values stored on things, like a meter with tiers and a HUD bar, or a plain number. |
| Dials | Tuning numbers, editable in the plugin's panel. |
| Tables | Lists of records your rules read with $.table() and $.row(). |
| Hooks | The behavior. |
| Actions | Something a player does that the plugin manages, such as probe, forage, or sense. |
| Events | Moments you let other plugins refuse. |
| Sections | A question the plugin adds to the model's turn, or prose it contributes. |
| Seams | Extension points that replace an engine calculation instead of adding to it. |
| Scene layers | What the plugin draws over the location: particles, fog, a color grade, a wash, a sound. |
| Tools | Generators that create new content during play. |
Actions and abilities
An action is something a player does that your plugin owns. The model can pick it from the
player's words like any built-in act, and when its roll resolves, its after roll statements run
with $.event.passed, $.event.crit and $.event.margin. Probing and foraging are actions.
An ability can perform an action instead. Set the ability's Performs to the action's key, and casting it runs that action's after roll on the cast's roll. An ability without a roll counts as passed. Two more values come with it:
| Value | What it holds |
|---|---|
$.event.ability |
The ability's name, such as "Detect Magic". |
$.event.abilityText |
Its description, which says what this use is for. |
Mark an action Ability only when nobody should do it without the ability. The model is then never offered it alone. That way, a character who lacks Detect Magic can't sense magic just by saying so.
Sensing is the worked example; open it in code view. Its one action, sense, is ability
only. On a passed cast it reads $.game for everything in the current place that carries rules
(an enchanted item lying there or carried by someone there, a power someone there holds, a
person with a quest), uncovers what's hidden there with $.reveal, and tells the narrator all of
it with the ability's description, so Detect Magic tells of the enchanted ring and Smell Poison
of the tainted cup. With nothing there, it says plainly the sense finds nothing.
Each entry in $.game has here: "seen" when it's in the current place or carried by
someone there, "hidden" when it's there but out of sight, and "" elsewhere.
Drawing on the scene
A scene layer puts something on screen. It names a world-state key your hooks write and one of your tables. The value at that key picks a row, and the row's presentation columns are what the scene shows:
| Column type | What it draws |
|---|---|
| Particles | Something falling or drifting, tuned against a live preview. |
| Grade | How the scene is colored: dimmer, drained, warmer, hazier. |
| Wash | Water streaking down the view. |
| Fog | Drifting fog, how thick and how much it veils. |
A row can also carry label and icon (shown in the scene's readout), sound and soundVolume
(an ambient loop), and overcast (dims the sky). A row leaves out whatever it doesn't draw.
Weather has two layers. The sky reads WEATHER from its conditions table, and fog reads
WEATHER_FOG from its fog table. Open it in code view to see them:
scene([
{ stateKey: "WEATHER", table: "conditions", outdoor: true },
{ stateKey: "WEATHER_FOG", table: "fog", outdoor: true }
])
Mark a layer outdoor when a roof should keep it out: in a location tagged indoor it isn't drawn,
and its sound is heard muffled. A value without a matching row produces no visuals, so "none" needs no row.
Asking the narrator
A question (a section, in the plugin panel) adds something to the model's turn. After the
turn is narrated, for example, it can ask "did the player accept the bargain?", offer fixed
Choices, and run statements on the answer as $.answer.<key>.
Act on the answer with plain branches, one per choice, such as
if ($.answer.choice === 'accepted') { $.setWorld({ key: 'bargain', value: 'accepted' }) }.
Give every question an Only ask when gate. An ungated question is asked on every turn of every session and costs tokens everywhere. A gated one is asked only while its gate holds: while a choice is still open, or while the person who offers it is present.
Your first plugin
- Open Plugins and create one.
- Declare a field. It shows up on the character sheet.
- Add a hook that changes it.
- Add something that changes it back.
- Play a few turns.
Then read Designing a plugin.
Sharing
Publish from your library. Other authors add it from the Assets step, which makes a copy. They can edit freely without affecting you, and name clashes are handled for you.
A plugin that uses what another plugin provides (its fields, tables, steps, tools, actions, or
the world flags and timers its hooks write) needs that plugin. Saving it to your library lists
the plugins it needs as fixed rows, and the saved bundle carries them. Guard a read with
$.hasPlugin to keep the dependency optional.
The editor warns when something a rule uses comes from a plugin that is off or missing, when nothing at all provides it, and when a rule builds a field or table name at run time, since no check can tell which plugin that name needs. Write names out.