Skip to content

Ruleset reference

This section documents every field of a WAGE ruleset and every kind of condition, action, initializer, and behavior node. It’s the authoritative companion to the Build a game tutorials — read the tutorials to learn the patterns, keep the reference open to look up the exact shape of a field.

WAGE rulesets are pure data validated against TypeScript types in the shared protocol package:

  • packages/wage-protocol/src/rules.tsRuleset, Condition, Action, Initializer, BotClass, BehaviorNode, ItemType, ItemSpawnSpec, InteractionSpec, VisibilityRule, and friends.
  • packages/wage-protocol/src/world.ts — the map types (MapDefinition, MapZone, Shape, MapPoint, MapAnnotation), Team, GameTheme, and the runtime World/Player/Item shapes.

This reference is hand-authored from those files. Where the two ever disagree, the TypeScript types win — they’re what the engine actually enforces.

  • Types are shown in a TypeScript-ish shorthand. ? marks an optional field.
  • Examples are YAML (the engine reads YAML or JSON interchangeably).
  • A selector is same / other / any / { byTeam: id } / { byId: id } — see Selectors & values.
  • A value is a literal or a { ref: "path" } — see Selectors & values.
SectionCovers
Top-level fieldsname, version, catalog, teams, player counts, playerJoinStates, countdownSeconds, and the field index
Map & zonesmap: zones, shapes, exclusions, points, annotations
ConditionsEvery when kind
ActionsEvery do kind
Selectors & valuessame/other/any/team/id, { ref }/{ lit }, bindings
Items & interactionsitemTypes, items, interactions
Bots & behavior treesbots, BehaviorNode, tunable, teamAssignment
Theme, objectives & visibilitytheme, objectives, visibility
onStart & initializersOne-shot setup steps

The smallest thing the engine will run is a name, a version, teams, a map, and a rules array (which may be empty):

name: My Game
version: 1
teams: []
map:
zones:
- id: play_area
name: Play area
placeable: true
required: true
shapes:
- { id: play_area-shape-0, kind: rectangle, from: { x: -100, y: -100 }, to: { x: 100, y: 100 } }
rules: []

Everything else — state, rules, items, bots, theme — is layered on top.