> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ochrebound.ibrahimsultan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Settings and controls

> Seven settings domains so one option can never break another, and a controls ledger shared both ways between the web page and the game.

## The bug that started it

Changing a volume on the title page used to freeze the loading animation for a moment. Nothing about a volume should touch an animation, but every option change was announced to every system as "settings changed", and some of them reacted by rebuilding themselves.

The fix was a rule the whole project now follows: **changing one option must never disturb an unrelated system.**

## Seven domains

Every setting belongs to exactly one domain. When something changes, the game announces only the set of domains whose values actually changed, as bit flags, and each system listens only to its own.

```mermaid actions={false} theme={"system"}
%%{init: {'themeVariables': {'fontFamily': 'IBM Plex Sans', 'fontSize': '14px'}, 'flowchart': {'wrappingWidth': 240, 'nodeSpacing': 30, 'rankSpacing': 34}}}%%
flowchart TD
  O["An option changes in either menu"] --> S["SettingsService compares old and new values"]
  S --> F["It announces only the changed domains, as flags"]
  F --> L["Each system checks for its own flag and ignores the rest"]
```

| Domain | Flag | Owns |
| :- | :- | :- |
| Audio | 1 | Master, ambience, world and interface volumes; the soundtrack |
| Graphics | 2 | Quality tier, frame cap, render scale, print, motion density, Cool Laptop |
| Display | 4 | Full screen and resolution (desktop) |
| Controls | 8 | Key bindings |
| Hud | 16 | Interface scale |
| World | 32 | Hour of the Quarter, Basin Wind |
| Accessibility | 64 | Reduced Motion, sound captions and their size |

A volume never re-resolves the quality tier. A tier change never touches the audio buses or your keys. And the loader on the title page lives in its own sandbox, driven from one shared clock, so no option can restart it.

> [!NOTE]
>
> The settings file itself is plain `key=value` lines and is read tolerantly: unknown keys are ignored, damaged values fall back to defaults, and every number is clamped. A broken settings file cannot break the game.

## One controls ledger, two menus

You can rebind keys on the title page before the engine has loaded, or in the pause menu while you play. Both are the same ledger.

```mermaid actions={false} theme={"system"}
%%{init: {'themeVariables': {'fontFamily': 'IBM Plex Sans', 'fontSize': '14px'}, 'flowchart': {'wrappingWidth': 240, 'nodeSpacing': 30, 'rankSpacing': 34}}}%%
flowchart TD
  W["Web Title Options"] <--> L["Browser storage: a stable slot-id map"]
  L <--> U["Unity Pause Options"]
  U --> G["Live key glyphs in the street"]
```

The interesting decision is in how bindings are stored. Unity can save input overrides as JSON keyed by its internal action IDs, but for actions created in code those IDs are regenerated every run, so a saved binding would not survive a restart or cross from the page to the engine. Ochrebound stores its own map keyed by stable, readable slot names (`left`, `right`, `jump`, `climb`, `descend`, `interact`, `stitch`, `rest`, `beckon`, `hour`, `viewfinder`, `ledger`, `postcard`), which both the page's JavaScript and the game's C# read and write.

Rules both menus enforce:

* **Atomic swaps.** Binding a key that another action owns swaps the two in one step.
* **Secondary keys yield.** The arrow keys and <kbd>Tab</kbd> are default alternates; if you claim one as a primary key for another action, the alternate quietly steps aside.
* **Reserved keys are refused.** Shift, Caps Lock, Num Lock, the Windows, Command and menu keys, Print Screen and Pause are never bound, and Escape always pauses.
* **Physical keys, local labels.** Bindings are stored by key position and shown with your layout's letters.
* **Blur cancels.** Losing window focus mid-rebind cancels it.

> [!NOTE]
>
> `ControlsRebindTests` covers this with 21 EditMode tests. The PlayMode test `RebindingStitchKeyMovesStitchAndUpdatesGlyphs` rebinds the stitch live and checks that the street's glyphs follow, and `EachSettingTouchesOnlyItsOwnDomain` proves the domain rule end to end.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.