Skip to main content

Module balance

Module balance 

Source
Expand description

An autobalance search: the game’s Knobs change a stage a little at a time (one more enemy, a weaker trap, a later ambush), the playtest runner replays it with the bots, and the search stops when every rate check is inside its band. autobalance does it all and says what it changed, in the knobs’ own words. autobalance_by is the same search with the caller playing each setting (on threads of its own) and saying when to stop (a time limit).

The bots never change. Only the stage does: the search takes the entrants and the checks as they are and has no way to reach their settings, since bots tuned until they pass would prove nothing.

The search is a pattern search over the knobs’ integer steps, scored by distance. Every run plays the same seeds, so settings are compared on the same luck, and the same inputs always give the same changes. What it finds is the smallest change set this search found, not one proved the smallest.

Structs§

BalanceSettings
How hard the search works.
Balanced
What the search found. Its Display says why it stopped, the changes one per line, then the reports before and after.
Change
One knob the search moved.

Enums§

Stop
Why the search stopped.

Traits§

Knob
One way the game lets the search change a stage definition S: a bounded integer step, 0 being the stage as authored.

Functions§

autobalance
Changes stage with knobs until every rate check of checks puts every one of entrants inside its band, as settings says. The entrants and the checks are never changed: only the stage is.
autobalance_by
autobalance’s search, each setting played by evaluate: the report of the stage it is given, played as the Tries it is given say, its checks judged (a caller with threads plays the seeds on them and playtest::judges them once). Its first error stops the search.
distance
How far report’s rates lie outside their bands: over every Check::Rate, max(0, min * count - successes * 100, successes * 100 - max * count), summed. 0 exactly when every rate is inside its band. A Check::Median doesn’t count: it is about the bots, not the stage.