Skip to content

Variables

Variables are your world's game state. Numbers, text, flags, complex objects — any data that needs to persist across turns. The AI reads them, updates them through directives, and your automation can react to changes.

Just describe the variable itself, in plain language

In a variable's Behavior Rules, you only need to spell out, in plain words, what the variable is and when it should change. You don't need to mention syntax like [health: -1] — our engine has already taught the AI that part.

✅ Write this: "Decreases when the player takes physical damage, scaled by severity. A punch -5 to -10, a sword slash -15 to -25. Recovers slowly when resting."

In the editor, open the Variables section. Each variable has a name, type, default value, and Behavior Rules.

Variables section in the editor

The horror world from the entries page uses 5 variables: health (number, 0-5), energy (number, 0-8), day count (number, 1-14), game phase (string, "Night" or "Day"), and armed status (boolean). That's enough to run a full 14-night survival game.

Each turn, the AI reads the current values, writes directives like [health: -1] in its reply, and the engine extracts them and updates the state.

Variable Types

Number

Tracks quantities: health, gold, affinity, day count, hunger.

You can set min/max bounds, and the engine clamps to range automatically.

String

Tracks text state: location, mood, current quest, time of day.

Boolean

Tracks true/false flags: has a key, met the NPC, triggered an event.

JSON

Tracks complex structures: inventory arrays, NPC relationship objects, quest logs, map data.

JSON variables support dot-path updates — you can modify a nested field without rewriting the whole object.

Behavior Rules — The Most Important Part

Behavior Rules are plain-language instructions that teach the AI when and how to change a variable. Without them, the AI won't reliably use your variables.

(In the editor this field is labeled Behavior Rules. We call it Behavior Rules here to keep it distinct from the automation system the editor calls Behaviors.)

Good Behavior Rules

Variable: Health:

This is the player's health. 0 = death — describe a death scene and end the game. 1-20 = critical (bleeding, difficulty breathing). 20-50 = wounded (pain affects actions). 50-80 = bruised (minor discomfort). 80-100 = healthy.

Decrease on physical damage proportional to severity. A punch: -5 to -10. A sword slash: -15 to -25. A fall from height: -20 to -40. Recover slowly when resting (+5 per rest scene) or healing (+10 to +30). Never change by more than 30 in a single turn.

Patterns That Work

Numeric ranges — define what each range means narratively:

0 = game over. 1-25 = desperate. 26-50 = struggling. 51-75 = capable. 76-100 = confident.

Triggers — when should this change:

Increases when the player helps villagers, gives gifts, or protects them. Decreases on theft, threats, or broken promises.

Limits — prevent wild swings:

Never change by more than 10 in one turn. Minimum 0, maximum 100.

TIP

Two to four sentences is usually enough. If your Behavior Rules run longer than a short paragraph, it's time to trim. The AI is smart — give it the concept and the boundaries, not a 500-word essay.