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
- Rules sorted by priority (descending)
- For each rule, select matching agents
- For each agent, evaluate condition
- 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 }
}