Give the enemy a structured intent and a durable route queue (#127)
build / mod (push) Failing after 22s
release / windows (push) Failing after 2s

Stage 2 of #127. A smart drone now carries why it is aimed where it is
(Intent: plan, sead, react, replace) apart from the aim bookkeeping
(unit, since, switches, confidence). Assignments are throttled per
adaptive tick and per contact, a fresh disclosure replaces an aim only
after a hold, within a switch cap and when the change is worth a new
route, and a killed aim is replaced as a separate, lower-priority
decision. The queue is bounded and taken by priority (plan > sead >
react > replace); unknown land is no longer free in a replanned route.

The autosave now carries the air state: the drones in flight, the launch
queue, every pending job with its id, aim, unit, version, priority,
intent and relief version, the contacts the jobs were chosen from and
the relief snapshots they plan over. The format is a versioned `air 1`
section; older saves read as before, scenarios do not carry the sky,
stale, ghost and duplicate jobs are cancelled on load, and the section is
bounded (512 drones, 512 route points, 4096 contacts, 8 reliefs, 900 KB).
A periodic save waits while a raid is only being planned.

enemy_picture() now explains targets and pending jobs (aims, aimed_by,
pending_jobs, reason, work_per_tick) in English, and intel_bench records
the queue and intent evidence next to completion, losses and failures.
This commit is contained in:
2026-11-06 18:35:09 +03:00
parent 8fc10c07a1
commit e7934a1ebb
14 changed files with 2411 additions and 89 deletions
+26 -1
View File
@@ -25,7 +25,8 @@ pub mod record;
mod sight;
mod terrain;
mod ew;
pub use ew::{Confidence, ContactReport, EnemyPictureReport};
mod durable;
pub use ew::{AimReport, Confidence, ContactReport, EnemyPictureReport, Intent, PendingReport};
pub mod lights;
mod logistics;
mod orders;
@@ -732,6 +733,13 @@ pub struct Drone {
/// Its navigation error (#65): `target` is the nominal aim plus this, kept apart so a new aim (a retarget)
/// keeps the error this airframe was born with instead of becoming exact.
err: DVec3,
/// Why it is aimed where it is (#127): the structured intent a smart drone carries — the plan's
/// objective, a SEAD reaction to a disclosure, or a replacement after the picture killed the aim.
/// Kept apart from any random re-pick, reported by the diagnostics, and saved with the drone.
intent: ew::Intent,
/// What it aims at and how firmly (#127): the unit, when the aim was chosen and how often it has
/// changed. The switch throttle and the priority of its route job read this.
aim: ew::Aim,
/// Ticks held at the edge of blocks the game has not told of (#61); reset by a clear step.
hold: u16,
/// Its progress towards the aim: a flight that stops getting nearer runs out of fuel (see `Pace`).
@@ -792,6 +800,17 @@ impl Drone {
pub fn alive(&self) -> bool {
self.flight != Flight::Falling
}
/// Why it is aimed where it is (#127), and how often that aim has been changed.
pub fn intent(&self) -> ew::Intent {
self.intent
}
pub fn aim_switches(&self) -> u16 {
self.aim.switches
}
/// Sent by the smart enemy: it may be turned on what gives itself away.
pub fn smart(&self) -> bool {
self.smart
}
/// How much a system wants to shoot it: fast and heavy first, decoys look real.
fn threat(&self, from: DVec3) -> f64 {
self.threat_at(from, self.pos)
@@ -1340,6 +1359,9 @@ pub struct Sim {
/// The known land of the last smart raid's plan: its grid and cell heights (NaN unknown). New retarget
/// jobs take this `Arc` as their version; a later plan replaces the pointer, not a pending job's map (#127).
known_relief: Option<Arc<ew::KnownRelief>>,
/// The next route job's id (#127). A job keeps its id when it is replaced in place; the save writes
/// the counter so restored jobs keep theirs.
job_next: u32,
/// The vehicles' ground routes, and the jobs the trucks found out of reach (#94).
routes: route::Routes,
/// Each marked object's health, 0 to 100 (`targets`' order).
@@ -1421,6 +1443,7 @@ impl Sim {
plan: None,
retargets: VecDeque::new(),
known_relief: None,
job_next: 1,
routes: Default::default(),
target_health: Vec::new(),
wave: None,
@@ -1978,6 +2001,8 @@ impl Sim {
smart: false,
nav: Nav::default(),
err: DVec3::ZERO,
intent: ew::Intent::Plan,
aim: ew::Aim::point(0),
hold: 0,
pace: Pace::default(),
});