Rules
The clock, the harvest and the call at sundown. `GameRoot` calls `init(anchor)` once and `update(dt)` every frame; everything else here follows from that.
Rules — the round
The clock, the harvest and the call at sundown. GameRoot calls init(anchor)
once and update(dt) every frame; everything else here follows from that.
local Locust = require("locust.locustCore")
local rules = Locust.systems.rules -- always guard for nil
if rules then
local s = rules.summary()
-- { tonnage, mass, rivals = {{name, tonnage, mass, alive}, ...}, leader,
-- remaining, timeLeft, outcome, reason, exposure }
end
Rules.startRound()— restand the farm, reset the swarm, put the rivals and the dusters back on the board, emitroundStart.Rules.endRound("won" | "lost")— emitroundEndwith the summary.Rules.summary()— everything the HUD and the end card need, in one table.
The round ends at C.ROUND_SECONDS, or the moment the swarm falls below
C.SURVIVAL_MIN. Locust.state.outcomeReason says which of the four ways it
went: harvest (you out-ate the farm), outeaten (the bell rang with a rival
ahead), starved, sprayed. After C.POST_ROUND_SECONDS a new round starts.
The curve
Intake is geometric — the swarm eats the swath it sweeps, so a wider cloud takes
more and eating makes the cloud wider. Burn is a flat fraction of mass per
second and never stops: at C.BURN_PER_SEC a swarm that never eats falls from
START_MASS through SURVIVAL_MIN in about ninety seconds. Feeding over
standing crop returns roughly three times what burn takes.
Measured against four scripted pilots over a full 240 s round:
| pilot | outcome | tonnage | best rival |
|---|---|---|---|
| works fields in lanes, climbs out of spray | won (harvest) | 517 t | 411 t |
| same, but skittish — breaks off early and often | lost (outeaten) | 302 t | 355 t |
| same, but ignores the aircraft | lost (sprayed) at 131 s | 263 t | — |
| stays at travel altitude | lost (starved) at 91 s | 0 t | — |
What else lives in this folder
Rivals.module— the two rival hosts: field choice, travel, lane work, growth, and the dust column that makes them visible across the farm.Sprayers.module— the crop dusters, their spray trail, and the exposure field everything else asks about.Ledger.module— the shared survey of the thirty-six plots: what still stands, who has claimed it, and how hard it is being eaten right now.Marks.module— the meshes and materials those two put on the farm.
Scoped to this part · feeds back into the world's score.