Log inGet started
World

Escapement

Branchmain
Branchesmain
Commit7683e73a7f

README.md

units

The pieces on the board: what the five automata are built out of, how a wound spring is drawn on one, what a seized automaton looks like, what the rust-blight is made of, and the whole of the blight's turn.

local Units = require("game.units")

The five, and how to tell them apart

Every automaton is assembled from hard-surface parts in three surfaces — polished brass for what is alive and working, blackened iron for structure, and hot spring-gold for stored winding — and each is given one feature no other piece has, so the board is readable at a glance from the commander's camera.

AutomatonRead it by
GovernorThe tallest. Twin flyballs swinging off its crown, and a spire on top.
LanceThe long spar out front, with a bright tip and an iron vamplate.
AnvilThe widest, lowest and darkest — an iron block under a brass plate.
SparrowThe smallest, and the only one with wings.
WinderThe glowing key ring standing above its shoulders.

The winding gauge

Six coil rings climb the back of every automaton. The lit rings are the winding it still holds, out of Core.WINDING_MAX; spent coils go dark and shrink. It is deliberately the brightest thing on the model, because winding is the only resource in the game.

Seized

An automaton at zero winding is not wounded, it is stopped. Its whole body turns dead oxide, it slumps off true and sinks onto its base, and every coil goes out. It stops reading as a piece and starts reading as something in the way — which is exactly what it now is until an ally spends 2 to wind it back up.

The blight

Rust does not stand on the metal, it grows across it: a low crust of pitted lobes, spines leaning off the edges, a live bloom breathing at the heart, and brass slivers of the machine half-eaten and still poking out of the crust. A spore is a small patch, a creep spreads wide and low, a canker is taller and spikier. Struck blight shrinks as its crust comes off.

The blight's turn

Units.blightTurn(director)   -- the rust's entire turn; idempotent per tick

The rust wants the escapement.

  • It drains before it climbs. Anything an automaton-width away is bitten instead of walked past, and it bites to finish: the automaton this drain would seize outright, otherwise the one with the least winding left. A seized automaton is left alone — it is already terrain.
  • It climbs whenever the machine has opened a way inward. A cell is scored by its ring first and by its angle to the escapement gate second, so when no crossing is open the rust walks the ring toward where the gate will be, and takes the bridge the moment one lines up.
  • It never backs off. Only a strictly better cell is worth a move, so the rust never paces on the spot.
  • Reinforcements crawl in through a free vent on the outer ring every Units.BLIGHT_SPAWN_EVERY ticks, up to Units.BLIGHT_CAP on the board at once, and the waves get tougher the longer the hour runs.

The director argument only has to answer :spend(unitId, amount) and :finish(outcome, reason) — the referee's own calls — so the blight never writes game state behind the referee's back.

The rest of the surface

Units.muster(side, kind, ring, sector, root)  -- record in Core.state() + body in the world
Units.buildBody(unit, root)                   -- (re)build one body
Units.refreshWinding(unit)                    -- redraw the coil gauge
Units.refreshRust(unit)                       -- redraw a blight's crust
Units.applyFrozen(unit, frozen)               -- the seized look, on and off
Units.heading(unit)                           -- automata face outward, blight faces in
Units.describe(unit)                          -- one line naming a piece