Pages

Match rules in a game policy

How a game sets and locks match rules with host and fixed permissions, and how AEX enforces them.

A game's policy can give any registered match rule a default, and say who may change it. Use it when your game plays best with other rules than its base profile, or when a rule must be the same in every match.

The worked example

[match]
base = "beta-patch"

[[match.rules]]
key = "match.maxUnits"
value = "500"
permission = "host"

[[match.rules]]
key = "match.cheats"
value = "off"
permission = "fixed"

A new lobby opens with a 500-unit limit the host may change and cheats off, which nobody can turn on.

Keys, values and permissions

Rule keys and canonical string values come from the existing match-rule registry. host seeds a value the host may change; fixed seeds and locks it. player is invalid for a match rule: all participants execute the same rule set. The policy does not create another rule implementation or rule list. Numeric values the shared rule owner would clamp are rejected when authored, so the stored design matches its execution.

How defaults apply

The game's defaults are its base profile's rules with its own defaults over them (creator::gameDefaultRules). They apply to every rule of a new lobby the player has not chosen, with a verified legacy mod's match_defaults between the base and the game's own (creator::applyGameMatchDefaults); a host setting never overrides a rule the player chose in an earlier lobby, while a fixed one always applies. Explicit host or CLI choices may override host settings; conflicting fixed choices are refused.

How locks are enforced

Fixed rows are disabled in the Mechanics editor, and preset choices retain their locked values. Engine clients reject incoming lobby and match-start rules that violate their installed game's policy. The bridge rejects conflicting host requests and checks its final rules before starting. Runtime rule changes pass the same lock check before execution; the bridge also removes refused changes before broadcasting or recording them. Multiplayer runtime rule commands remain forbidden by the existing command validator.

Where the policy comes from

A policy is read from the active game's own folder or installed .aexmod through the shared VFS. Lower mod layers cannot donate a policy. Exported game policy bytes are part of the game's ordinary content identity. The selected rule values already participate in the match rules fingerprint and simulation hash.

Saved games and replays

Saved games and recorded replays retain their stored deterministic rules; the policy does not rewrite checkpoints or recorded commands. A network lobby whose stored rules conflict with the installed game's fixed choices is refused with a reason instead of silently changing those rules.

What goes wrong

A bad rule stops AEX at start-up with Cannot initialize game policy: followed by one of:

Unknown match rule: <key>
Match rule <key> cannot have player permission
Match rule <key> is outside its supported range

A choice that conflicts with a fixed rule is refused with:

Game fixes <key>=<value>; this choice is not permitted

The bridge logs the same reason when it refuses a host request:

[bridge] Refused game policy violation: Game fixes <key>=<value>; this choice is not permitted

Next