Defensive Readiness
Defensive readiness is the owned-room survival layer introduced in milestone
0.3.8. CIA owns hostile facts and capability classification. DefenseManager
consumes the live RoomContext and converts those facts into policy; existing
subsystems execute it.
Postures
peace: no actionable ATTACK, RANGED_ATTACK, HEAL, WORK, or CLAIM capability.alert: an actionable hostile exists and tower capacity appears adequate.engaged: hostile pressure exceeds available tower and active-defender capacity, but critical infrastructure remains rampart-protected.critical: defense is inadequate and a spawn, tower, storage, or terminal is exposed.
Assessment reasons are stored under Memory.rooms[roomName].defense. The bot
keeps only compact current/transition state, not an event history.
Adequacy and towers
Hostile pressure weights active melee, ranged, dismantle, claim, healing, and boosted parts. Available tower damage uses the actual deterministic range falloff for energized towers. A defense is adequate when combined tower damage comfortably exceeds hostile healing and weighted destructive pressure.
All towers receive one deterministic shared hostile target. HEAL and destructive
capability raise target value, available tower damage favors a finishable target,
and creep id breaks ties. Towers may heal a friendly below 50% health before
attacking. Routine tower repair stops while actionable hostiles are present.
If an attacker loses every actionable body part while at or below 25% health,
the room remains in peace but towers retain a shared cleanup target so the
disabled hostile is not stranded indefinitely. Healthy noncombat foreign creeps
do not trigger this cleanup rule.
Logistics, spawning, and remote work
Spawn and extension energy remains first so the room can create survival roles.
Tower readiness rises from the normal hauling buffer to 800 energy in alert
and 900 in engaged/critical. Controller delivery is disabled during serious
combat. Population planning suppresses optional builders, upgrading, minerals,
scouting, colonization, and remote replacement demand during serious combat.
The defender demand is capped at one and appears only when tower defense is
inadequate or the room is critical. Bodies are deterministic melee tiers from a
190-energy emergency guard through bounded RCL 3 and RCL 4 guards. The defender
stays in its assigned owned room, uses a friendly rampart adjacent to the target
when available, and idles near the primary spawn after combat.
Critical ramparts
Infrastructure doctrine remains unchanged: critical ramparts protect spawns, towers, primary storage, and the terminal. Maintenance now treats only those ramparts as eligible and uses absolute targets:
- peace: 10,000 hits
- alert: 25,000 hits
- engaged or critical: 75,000 hits
This avoids percentage-based wall maintenance and enormous peaceful spending. When the economy authorizes surplus work, otherwise-idle towers may strengthen these critical ramparts further, up to 500,000 hits.
Safe mode and CPU
The configured policy is recommend by default. Recommendation requires a
critical posture with destructive capability. automatic, if deliberately
configured, additionally requires controller ownership, availability, no active
safe mode/cooldown/upgrade block, and a retry cooldown. disabled and
recommend never call activateSafeMode().
The peace path consumes already-collected hostiles, immediately returns when
none are actionable, and performs no room scan or pathfinding. Combat work is
bounded by hostile and tower counts and appears in the per-room defense CPU
profile section.
Defenders execute every tick in every CPU-governor posture. Local builders also
execute every tick while defense is engaged or critical, allowing urgent
critical-rampart jobs to proceed; outside active defense they retain the normal
recovery/emergency staggering applied to optional local roles.