# Tunable params

Pull the numbers that shape how your game feels out of the code and into typed params. You can tune them live, agents can read and adjust them safely, and scenarios can test them.

```ts playground
//+ import { Game } from "@debuffjp/core";
//+ import { devOverlay, devTools } from "@debuffjp/dev";
//+ import { Input } from "@debuffjp/input";
//+ const canvas = document.querySelector("#game")!;
//+ const game = new Game({ canvas, width: 320, height: 180, background: "#11140d" });
//+ const input = new Input(game, { bindings: { left: ["ArrowLeft", "KeyA"], right: ["ArrowRight", "KeyD"] } });
//+ const player = { x: 160, vx: 0 };
const tuning = game.params.define("player", {
  speed: { type: "number", default: 140, min: 0, max: 600, units: "px/s", description: "Run speed" },
  doubleJump: { type: "boolean", default: false },
});

//+ game.add({ id: "play", update(dt) {
//+ const dir = input.axis("left", "right");
// read every frame; it's a plain property lookup
player.vx = dir * tuning.values.speed;
//+ player.x = Math.max(12, Math.min(308, player.x + player.vx * dt));
//+ }, render(draw) {
//+ draw.rect(0, 150, 320, 30, "#1b2014");
//+ draw.rect(player.x - 12, 128, 24, 22, "#cffb2d");
//+ draw.text(`speed ${tuning.values.speed} px/s: open the dev panel (+), then tune`, 8, 8, { color: "#9ca78a" });
//+ } }).go("play");
//+ game.start();
//+ game.use(devTools({ input })).use(devOverlay());
```

- Values are validated: out-of-range or wrong-typed sets throw instead of silently clamping.
- `game.params.describe()` returns every schema and value as JSON.
- `game.params.onChange(fn)` notifies you of edits from anywhere.

## Tuning live

In dev, press ` for the overlay. Every param group gets sliders and toggles, a reset button, and **copy JSON** to save the values you like as a preset.

From the console, or from an agent:

```js
__DEBUFF_DEV__.setParam("player", "speed", 220);
```

In a scenario:

```json
{ "set": { "player.speed": 220 } }
```