Expand description
Deterministic, bounded fight simulation engine.
Combat owns its scheduling: delayed combat events and the FightProgress
heartbeat live in the FightClock inside OverlordLogic,
not in the System delayed/cron plugins. The live game loop drains the
clock through OverlordLogic::collect_due_scheduled; this engine
drains the same clock directly. Both paths therefore run identical
combat machinery — the only difference is the driver.
Engine properties:
FightEngine::runexecutes at mostmax_game_tickssteps and always returns — there is no wall-clock timeout and no way to loop forever. A fight that doesn’t finish within the budget isFightResult::Undecided.- No DB, no async, no
System, noPureEventHandler: callers are PvP precalculation, balance simulations, and tests. EndFightis the fight boundary: the outcome is taken from the event and it is not processed, so progression side effects (rating, vassals, chapter advance) never run inside a simulation.
Structs§
- Breakdown
Accumulator - Per-fight totals, keyed by the fight INSTANCE so a delayed event that outlives its fight cannot land in the next one.
- Breakdown
Actor - Who a recorded amount is credited to. Resolved at record time, because the
entity may be dead and gone from
active_fight.entitiesby fight end. - Entity
Metrics - Per-entity summary line.
- Fight
Clock - Fight
Engine - Bounded, deterministic driver for fight simulations.
- Fight
Metrics - The collector. One instance per
FightSim. - Fight
Metrics Summary - Whole-fight structured summary. Serialize to JSON for the sim harness, or read the fields directly in tests.
- Fight
Outcome - Fight
Sim - A self-contained fight in progress. The scheduled work lives in the
engine handler’s
FightClock; the sim carries the simulated state and logical time. - Team
Metrics - Per-team aggregate.
Enums§
Constants§
- DEFAULT_
CASCADE_ MAX_ DEPTH - Default cap on events processed within a single step’s cascade. The same
wall the live
Systemapplies per root event — shared so the engine can never silently diverge from live combat on cascade depth. - DISPERSION_
IDLE_ SHARE_ THRESHOLD_ PCT - Dispersion criterion: no full 10 s window’s idle-in-contact share may exceed this percentage.
- GAME_
TICK_ TICKS - Ticker units per fight step. The system ticker counts milliseconds
(
TICKER_UNIT_DURATION_MS = 1), and the live game loop advances the ticker by 100 units per 100ms game tick — one step equals one game tick. - STUN_
UNTIL_ TICK_ ATTR - Absolute tick deadline stamped by the
EntityStunhandler. The single source of the name — the handler reads it from here, so the observer can never drift from the mechanic it observes.