# Plugins

A **plugin** bundles field declarations, dials, hooks and events into one thing you can
switch off, edit, export, and install into another game.

Hunger, rest, stamina, mana, encumbrance and the NPC bonds are all plugins. **None of them
are engine code.**

## The bar

**Deleting a plugin must leave a coherent game.**

If your system cannot be switched off, it is engine code wearing a costume. That test is
worth applying while you design, not after: it forces you to decide what happens to a game
that never had your system, which is the same question as what happens when someone
uninstalls it.

## What a plugin declares

- **[Fields](/docs/fields)** — values that live on entities. A meter with a max, tier prose
  and a HUD bar, or a plain number.
- **[Dials](/docs/formulas)** — your tuning numbers, with the defaults your plugin ships.
  `$.dial('rate')` reads *your* plugin's dial; values are namespaced by plugin, so two
  plugins may both declare `baseRate` and mean different numbers.
- **[Hooks](/docs/hooks)** — the behaviour.
- **[Events](/docs/plugin-cooperation)** — what you offer *other* plugins a say in.
- **Sections** — a question your plugin adds to an engine LLM call, or prose it contributes.
- **[Seams](/docs/seams)** — the one thing that *replaces* rather than adds.

> **Image: `docs/plugins-step.png`**
> The Plugins step in `/create`, showing the installed plugin list with the shipped plugins
> (hunger, rest, stamina) and the editor panel for one of them open.

## Building one

Open the **Plugins** step, create a plugin, and declare a field. That is enough to see it
appear on a character sheet. Then add a hook that changes it.

The shipped plugins are ordinary plugins — open one in the code view and you have a
complete, working example of everything on this page.

## Sharing

Publish from the library with one click. Other authors find it under the Plugins step's
**Browse** tab, and importing makes a **copy** — edit freely, with no fear of breaking
someone else's game. Name collisions resolve automatically, because two people calling
their plugin "Hunger" is ordinary.

## Next

- [Fields](/docs/fields) — declaring values with tiers and prose
- [Cooperation](/docs/plugin-cooperation) — how plugins meet without depending on each other
- [Formulas and dials](/docs/formulas) — tuning numbers, and why never to freeze one
- [Seams](/docs/seams) — replacing an engine calculation outright
