Concepts

Rules

Logic that drives world evolution.

What is a Rule?

A Rule defines behavior in your world. Each tick, rules are evaluated against matching agents, and actions are executed when conditions are met.

Rule Structure

name
Human-readable identifier
priority
Execution order (higher = first)
selector
Which agents to target
condition
When to execute (optional)
action
What to do
params
Action parameters

Execution Order

  1. Rules sorted by priority (descending)
  2. For each rule, select matching agents
  3. For each agent, evaluate condition
  4. If condition passes, execute action

Example

{
  "name": "Wander",
  "priority": 1,
  "selector": { "type": "visitor" },
  "condition": {
    "op": ">",
    "left": { "prop": "energy" },
    "right": 20
  },
  "action": "wander",
  "params": { "speed": 2 }
}