Compare commits

..

30 Commits

Author SHA1 Message Date
chexit c525feb465 Merge pull request 'AirDef v0.3.x: enemy intelligence, cold launch, MP4 and stability' (#131) from kimi-work into main
build / mod (push) Failing after 23s
release / windows (push) Successful in 33m25s
2026-11-06 15:41:19 +00:00
chexit e7934a1ebb 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.
2026-11-06 18:36:20 +03:00
chexit 8fc10c07a1 Give the enemy a last-observation picture and observed-capability pricing (#127) 2026-11-06 18:00:08 +03:00
chexit 0b645d77e9 Normalize #129 measurements and pair the cold-launch capture
build / mod (push) Failing after 22s
Write both measurement CSVs with LF instead of CRLF so the range no longer
fails `git diff --check` on trailing whitespace; the parsed data is unchanged.

Add a matched before/after capture: one copied world, scenario and seed, the
same client/director and the same export command. The baseline hmod is built
from dc36d67 and the final one from the #129 code. Both launch shots start at
frame 94; the first centre illumination is frame 101 (0.233 s) before and
frame 121 (0.900 s) after, against the 0.25/1.00 s cold rules. Raw probe,
hashes and the measurement method are in issue-129-pair.json. The two MP4s
in docs are CRF26 storage copies; the CRF16 originals stay in the scratch
homes.

These are replay exports, not live footage. The capturing agent still has no
image input, so composition is left for human review; the frames before the
launch are not pixel-identical because these are two live sessions.

Co-Authored-By: Kimi Code <noreply@kimi.com>
2026-11-06 13:35:35 +03:00
chexit 56093b3a55 Record the #129 balance and the cold-launch capture
The stage contract and profiles are in 4b013fb. This commit adds the
measured balance (the #120 grid on identical seeds and the 12-seed raid),
the replay/export video with four stills, and updates the user and handoff
documentation. The visual files are provided for human review; the agent
that captured them has no image input and checked only the encoded
parameters, shot boundaries and the first large plume.

Co-Authored-By: Kimi Code <noreply@kimi.com>
2026-11-06 13:35:35 +03:00
chexit 1261c30724 Stage the cold launch and spool every interceptor's motor (#129)
The interceptor's launch is one sequence: the cap opens, the round is
thrown out unlit and slows under linear gas drag (`cold` ticks), the motor
lights where it has reached, it turns with a growing rate while thrust
spools up (`boost` ticks), and full guidance starts only at `cold + boost`.
A rail launch lights at once but spools over the same `boost` ticks; the
electric P1-SUN has no rocket spool or plume.

S-400/500 now hold the unlit ejection for 20/24 ticks (1.00/1.20 s at
20 Hz); IRIS-T/Tor keep shorter 8-tick throws. Ignition, its sound, flame
and recorded MotorIgnition event all use the missile's current position.
The RM48U strike follows the same 20-tick choreography, counts the throw
in its flight time and starts its recorded smoke at ignition.

Maximum speed, turn, accel, pk and every collision rule are unchanged.

Co-Authored-By: Kimi Code <noreply@kimi.com>
2026-11-06 13:35:35 +03:00
chexit a592ece6e3 fixup! Keep unfinished retarget routes in a bounded job queue (#127)
build / mod (push) Failing after 22s
The planner caches were keyed by (kind, relief Arc pointer, start, aim): two jobs with the same relief but different known-units snapshots could reuse each other's price grid and route. Key relief sampling by its Arc pointer but key prices and routes by the whole knowledge version: adaptive tick plus the known-units and relief Arc pointers. Regression creates two same-start, same-aim jobs on one relief with different known snapshots and checks their routes differ, while a third job of one version still reuses the route cache. Core release, adapter and WASM contract pass.
2026-11-06 12:57:36 +03:00
chexit a47812aadd fixup! Keep unfinished retarget routes in a bounded job queue (#127)
The relief snapshot was still global: a smart plan finishing while a retarget job waited could replace Sim::known_relief, so the pending route was planned on the newer map. RouteJob now carries Arc<KnownRelief> for its knowledge version; Sim::known_relief keeps the same Arc only to seed new jobs. retarget_relief reads the job's snapshot, and relief sampling, price grids and route caches are keyed by that version. The new regression makes a job wait, swaps the global relief for another grid with a wall, and checks the pending route and sample stay those of the original version; outside its grid is Unknown. Core release, adapter and WASM contract pass.
2026-11-06 12:57:36 +03:00
chexit 6f7b041c8b Keep unfinished retarget routes in a bounded job queue (#127)
A mass retarget used to clear every selected drone's route before the planner's per-tick work ran out: the rest flew straight for ever. Route jobs now carry the drone id, new aim, target unit, knowledge version and the intel snapshot, stay in a FIFO across ticks and are drained under the same WORK_PER_TICK. An old safe route is kept until its replacement is ready; a cancelled job falls back to a straight run. Jobs are replaced in place per drone, cancelled when the drone or unit is gone, and retarget routes reuse the original plan's known relief. An in-flight drone no longer turns to a unit behind its turning circle. Core release tests, adapter tests and the real WASM contract pass.
2026-11-06 12:57:36 +03:00
chexit dc36d67eb7 Unblock supply trucks from an impossible RM48U return (#128)
build / mod (push) Failing after 21s
step_supply sent every free truck into the return branch whenever any
S-400 had a pending ground_return, even when that return could not
proceed (the system moving, damaged, reloading or preparing, its round
already claimed by another truck, the route marked unreachable, or no
depot with room). The branch then found no target, cleared the job and
stopped the truck, so independent typed supply requests starved.

The return now keeps its priority only while it is executable: a
carrier holding a reserved round looks for a depot with room in reach,
an empty one for a system ready to hand a round over. Otherwise the
claim stays untouched and only real RM48U demand (a requesting system
with depot stock, or ground rounds aboard for one) pulls the truck
into the typed supply branch; without such demand it holds its watch
exactly as before. Redirecting a reserved round to a waiting request
clears return_cargo once the last one leaves the truck, and a stale
return_cargo with an empty hold no longer sends the truck to a depot
handover it cannot complete.

Regressions: three sim tests (moving claimant, pickup claimed by
another truck with damaged/save-restore phases, unreachable route) and
one full-drive lib test with a mid-flight state round trip; the rounds
are conserved in every phase and the actual return completes once the
claimant is back. All three sim tests fail on the old code.

Checks: core release 200 passed/8 ignored + 8 scenarios; adapter
67 unit + 1 boundary + 5 scenarios; real WASM test-wasm 30 steps.
2026-11-06 11:11:59 +03:00
chexit d45629ae29 Fix the UI-event fuel trap on a second large raid order
build / mod (push) Failing after 22s
The Windows log for #122 showed the mod stopping in the UI event
(fuel budget 1e9, remaining 0) with known_units <- order_raid <-
launch_wave <- ui_select: order_raid recomputed the planner snapshot
known_units() for every drone, and the snapshot itself rescanned the
whole force and the dedup list per intel entry. A second big Smart
order cost drones x intel-log x force-size inside one event.

Reproduced in actual WASM with measured per-callback fuel through the
exact ui_select(BTN_LAUNCH) handler (diagnostic guest, trigger.patch):
before, a 111-drone second order at revealed=13172/known=144 exhausted
exactly 1e9 and stopped the mod (an 11-drone order at the same state:
247805865); after, the same scenario passes with max command fuel
32946177/1e9, failures=0, and /stats at tick 2602 byte-identical.
A stacked single-point layout dies to one warhead (known=0, cheap
order), so the scenario deploys spread clusters with a moved player.

Fix: one known_units snapshot per order_raid passed to radar_strikes
and choose_target; known_units is a single O(log + force) set pass;
price_grid_on reuses its snapshot. Emitter/network targeting and
carrier choice semantics are unchanged (native equivalence test
against the former predicate; WASM checkpoint counters equal).
Limits unchanged; HD/recording untouched; wave size unrestricted.

Committed regressions: native snapshot-equivalence and
second-smart-order tests; the heavy WASM fixture now orders two Smart
raids through the wave screen's launch function (airdef preset +
airdef raid) with EW and a combat intel log, four accepted orders
asserted; the light contract covers preset and the empty-wave refusal.

Core release 195 + 8 scenarios; adapter 65 + 1 boundary + 5 scenarios;
light WASM 30 steps; heavy WASM 283 steps (tick max 182413686/300M,
command max 6939810/1e9, failures 0). Windows GUI acceptance remains
external and is not claimed.

Co-Authored-By: Kimi Code (Moonshot AI) <noreply@moonshot.cn>
2026-11-06 10:29:36 +03:00
chexit 61aaa0bf35 Record the Metal/offscreen camera picture acceptance
build / mod (push) Failing after 22s
The final engine 6a53a626c with the API30 AirDef build was run in the
real game (macOS, Apple M5, Metal, --offscreen, a clean HORIZON_HOME and
copied test worlds), not only in the sandbox: the monitor and the film's
main view report ready with the picture actually drawn (screenshots show
the panel and picture area, not a registered target), an empty set-views
drops the request, a world change bumps the generation and clears it, and
AirDef's next submission prepares the camera again in the new world.

Fixes nothing: no defect showed. It also records what the run does not
prove (a human visual check, Windows/other GPUs, two runs with the same
local id on the GPU, a mod reload on the GPU), the per-tick
set-views/set-main-view ordering that can honestly read awaiting-frame
between tick and note (not flicker), and that a title trip back into the
same world keeps the request because the generation is per world.

Co-Authored-By: Kimi Code <noreply@moonshot.cn>
2026-11-04 21:10:34 +03:00
chexit 9217f9a5cc Report camera readiness in /airdef capabilities
Pin the engine at 6a53a626c (API 30) and show render.camera-status: the
calling run's set-views cameras, whether the last noted frame was a world
frame, the request's world generation, each camera's reason and the run's
own main-view selection. As the other lines, this is a host milestone:
availability, request, preparation and why, not a GPU frame or a visible
picture. A unit test pins the line: readiness stays per camera and apart
from the run's main-view selection.

docs/ENGINE.md, the 4 November continuation and the status table now say
what prepared means (a picture encoded into the camera's target, or a
world frame drawn from it as this run's screen view, only for the run
whose selection the screen used), the per-run/per-world resets, and what
remains: GPU acceptance.

Verified: python3 tools/airdef.py check (gitlink, packer, mod needs 30,
fork 30, game 30); test-wasm 27 steps; airdef-mod 65 unit, 1 boundary and
5 scenarios; python3 -m unittest discover -s tools 28 tests.

Co-Authored-By: Kimi Code <noreply@moonshot.cn>
2026-11-04 21:08:23 +03:00
chexit 46d2274c8d Measure the #120 balance grid across batteries, ranges and target classes
Wider same-seed sampling of the finite-burn/coast change: baseline 2689d93
(pre-#120) against the current tree, 6 variants x 8 seeds of a 46-drone raid
(batt10/20/50, near200, far1500, hills20). Harness-only: Result carries the
tally's fuse/expired/orphaned/energy_lost counts and a new ignored
sim::balance::issue_120_grid test; no simulation parameters changed.

Findings: kills are equal or up and leaks equal or down in every variant;
fuse misses drop (far1500 70 -> 38 over 8 seeds); hills terrain losses fall
(scrubbed 6 -> 2). MotorEnergyLost never fires in the 48 scenarios and
expired stays <= 1: coast ends before drag reaches the 25% guidance
threshold. Leaks stay concentrated in the ballistic/fast classes
(Iskander/Kinzhal/Kh22/Zircon). No confirmed defect, so no tuning.

Full airdef-core suite: 193 + 8 passed, 0 failed (baseline side 169 + 4).

Co-Authored-By: Kimi Code <noreply@moonshot.cn>
2026-11-04 21:03:01 +03:00
chexit 325119b726 refactor: validate specs without a per-kind name list
The armed/support check in load_specs named the ten armed kinds, so a new
unit type would still have required a code edit and repeated the coupling
#91 is removing. Drop it: optional missile/gun rows are still validated
generically, and the existing kind-coverage check against content.json
already ties specs to the catalog.

validate_specs now takes the document, content identities and sound
events, and a test shows a hypothetical unit kind is accepted from a
specs row plus its content entry alone. No data or balance changes.

Verified: gen_catalog --check fresh, test_gen_assets 10 tests, core
release 195 passed + 8 scenarios (7 ignored), adapter 64 unit +
1 boundary + 5 scenarios, WASM contract 27 steps.
2026-11-04 21:00:35 +03:00
chexit 0937ac9e05 fix: keep the P1-SUN motor voice at its played 1.6 pitch
The old engine_voice returned early for flame == 0 with
(DRONE_LANCET, 0.8, 1.6), so the later `P1sun => 1.7` match arm was
unreachable. The catalog migration mistook that arm for the played value
and stored 1.7, which changed the interceptor drone's flight sound.
specs.json is back to 1.6 and specs_generated.rs is regenerated.

Adds missile_engine_voices_keep_their_played_values, pinning P1-SUN to
(DRONE_LANCET, 0.8, 1.6) and M48N6 to (MISSILE_FLIGHT, 1.0, 0.88).

The continuation and handoff text now describe the early return instead
of the dead arm, and tools/airdef_assets/catalog.py gets its final
newline back.

Verified: gen_catalog --check and test_gen_assets, core release
195 passed + 8 scenarios (7 ignored), adapter 64 unit + 1 boundary +
5 scenarios, WASM contract 27 steps.
2026-11-04 21:00:35 +03:00
chexit ead87343d2 feat: generate simulation numeric profiles from catalog/specs.json
catalog/specs.json is now the single copy of the numeric rows for
DroneSpec, MissileSpec and SamSpec: speed, guidance, warheads, models'
parts, RCS, seekers, launch and motor sounds, mount drives, gravity,
the Oreshnik split height and logistics limits, plus the named part
sets. tools/gen_catalog.py generates airdef-mod/src/sim/specs_generated.rs
(included by mod.rs, so the mod and airdef-core compile the same rows)
and unit_specs_generated.rs (included by units.rs). The hand-written
spec matches are gone; DroneKind::spec, MissileKind::spec and
SamKind::spec read the generated constants.

load_specs validates the schema, sound references, kind coverage against
content.json, named-part references and unused rows. gen_catalog.py
--check already runs in the CI generated-assets step, so a JSON/Rust
drift fails the build.

Every value was compared with the literals at 632061d field by field.
The only mismatch was the P1-SUN motor voice pitch in JSON (1.6 instead
of the actual 1.7, the flame == 0 branch in voices.rs); the JSON was
corrected and behaviour is unchanged. Save keys, raid order, RNG and
gameplay traces are untouched.

Verified: core release 194 passed + 8 scenarios (7 ignored), adapter
64 unit + 1 boundary + 5 scenarios, WASM contract 27 steps, catalog and
model generators fresh, asset/sound/model-bound/report tests pass.
2026-11-04 21:00:35 +03:00
chexit abf3d76fdb docs: record the real MP4 acoustics check (#96)
Pairs of the same replay exported with acoustics on and off on the
scratch world (no HORIZON_NO_AUDIO): acoustics and capture ownership
both ready. The open field has no reverb send by design, so it shows
occlusion/air absorption only; the stone court's on-track is quieter
and darker, and its residual after a gain fit is low-passed and
stereo-decorrelated, i.e. the wet path. A clean reverb tail/RT60 in a
real MP4, echoes alone and listening remain open. No code changes.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-04 20:52:11 +03:00
chexit e6a7000440 docs: record the engine cleanup for failed film takes
Engine 60cc7b11d removes a failed or cancelled take's video, raw sound
and log, carries the log's last lines in the error, and only creates
<name>.mp4 after a successful finish. A real failing encoder on the
scratch world left no temporaries and kept the earlier film byte for
byte; successful audio and no-audio control films still verified.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-04 20:19:51 +03:00
chexit cec7257ea1 Pin the engine that frees a failed film take's files
horizon 60cc7b11d (on top of 57f8b2853, API 29) removes a failed or
cancelled take's video, raw sound and log, carries the log's last lines
in the error, and only creates <name>.mp4 after a successful finish.

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-04 20:17:52 +03:00
chexit 503e6e29af Fix dynamic model lighting and document GPU comparison (#123)
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-04 17:53:10 +03:00
chexit 675967ce42 End the show when its world closes and verify the MP4 lifecycle (#89)
A frame hook ends an active film or export when the world is gone. The game
stops ticking at the title screen but keeps rendering, so an export used to
keep recording the title with its playback clock frozen (a sec=10 request
produced 3898 frames) and went on after re-entering the world. Session
cleanup runs once with WorldChange and cancels the capture.

Real short exports on a scratch home and world (pin 57f8b2853, API 29,
Metal): h264+AAC both 2.07 s with non-silent audio, reported frames equal
ffprobe nb_frames; cancel, SDK refusal, encoder failure and restart all
leave no capture running; 1920x1080 works. The engine still leaves
*.audio.raw and *.ffmpeg.log behind on an encoder error (game/film.rs).

Co-Authored-By: Kimi Code <noreply@moonshot.ai>
2026-11-04 17:44:28 +03:00
chexit 632061d2ad docs: archive clean API29 WASM fuel acceptance
build / mod (push) Failing after 20s
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:23:22 +03:00
chexit 56339b076e docs: hand off catalog, model, API29 and acoustics continuation
build / mod (push) Failing after 20s
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:21:29 +03:00
chexit c1a595b773 feat: expose light and sound processing diagnostics with isolated cameras
build / mod (push) Failing after 21s
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:19:06 +03:00
chexit 914f723d1f Verify aircraft models as lit mod instances
build / mod (push) Failing after 20s
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:16:47 +03:00
chexit d45d59df9f build: pin source-manager processing handshake
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:12:53 +03:00
chexit cfae0c1253 Refine cruise silhouette and document model comparisons
build / mod (push) Failing after 19s
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:09:14 +03:00
chexit 53669887dd Refine Lancet silhouette with swept X wings
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:09:14 +03:00
chexit 4c7c887917 build: pin point-light handshake and mass acoustics fixture
Co-Authored-By: Codex <noreply@openai.com>
2026-11-04 16:09:14 +03:00
94 changed files with 19330 additions and 1331 deletions
+15 -5
View File
@@ -31,6 +31,8 @@ python3 tools/airdef.py play # запустить (аргументы игр
```
`all` синхронизирует URL сабмодуля из `.gitmodules`, включая обновление со старого upstream.
Продолжение 4 ноября: [модели, границы ядра, общий каталог, API29 и массовая акустика](docs/CONTINUATION-2026-11-04.md).
Диагностика в игре: `/airdef capabilities` показывает доступность API, принятие запроса и
подготовку дыма, акустики и захвата именно этого мода. Подготовка не означает готовый GPU-кадр или MP4.
Для разработчика: `python3 tools/airdef.py test-wasm` — лёгкий ABI-тест;
@@ -88,6 +90,9 @@ CI: `.gitea/workflows/build.yml` на каждый пуш собирает то
**Сохранение.** Комплексы, объекты, их повреждения и настройки сохраняются отдельно для каждого мира (и для каждого
сервера); уничтоженный комплекс остаётся остовом и после перезахода, пока его не отремонтируют.
Налёт в воздухе тоже сохраняется: дроны, очередь их запуска и незавершённые задания на маршрут
восстанавливаются, и перезаход не обрывает перенацеливание. Ракеты-перехватчики в воздухе и площадки
запуска не сохраняются; сценарий — стартовое состояние и налёт не несёт.
**Сеть ПВО.** Единицы обмениваются измеренными треками в пределах игровой связи; повреждение связи
сокращает её дальность. Можно поставить несколько С-400/С-500 без собственной РЛС и общие радары
@@ -131,7 +136,9 @@ sandbox-сценария, `/airdef ground-load <С-400>` загружает од
**Умный противник учится.** Он запоминает, откуда его налёты сбивали, а откуда они прорывались, и следующий
налёт ведёт с лучшего направления; помнит комплексы, выдавшие себя пуском, и станции РЭБ, и во время налёта
перенацеливает ещё не взлетевшие Ланцеты и Шахеды на них; если цель-комплекс уничтожен, дроны идут к
следующему известному. Дроны под обстрелом прижимаются к земле.
следующему известному. Маршруты к новым целям достраиваются по бюджету планировщика в следующих тиках:
необработанное задание не теряется, старый безопасный участок остаётся до готовности нового, а дрон без
маршрута летит прямо только до ближайшего бюджета. Дроны под обстрелом прижимаются к земле.
**Ночь.** Исправные пушки с собственным свежим радарным сопровождением не теряют точность из-за темноты.
Цели освещают **прожекторы** (луч ведёт ближайшую
@@ -266,10 +273,13 @@ API мода `render.set-lights` (до 512, плавно интерполиру
«Герберы» выглядят для них как настоящие. Геометрия встречи проверяется по движению обоих объектов
за тик, а остаточный шанс учитывает фактическую скорость перехватчика.
**Энергетика перехватчика.** После холодного выброса ракета разгоняется, но двигатель работает
конечное игровое время. После выгорания ракета летит по инерции, теряет скорость и манёвренность;
при недостаточной скорости сопровождение срывается. Факел, звук двигателя и новый дым прекращаются
при выгорании и в live, и в повторе; уже созданный дым продолжает рассеиваться.
**Энергетика перехватчика.** Сначала ракета выходит из ТПК без двигателя: у С-400 это 1,0 с,
у С-500 — 1,2 с; только потом в её текущей точке зажигается факел, и тяга плавно нарастает.
После выброса ракета разгоняется, но двигатель работает конечное игровое время. После выгорания
ракета летит по инерции, теряет скорость и манёвренность; при недостаточной скорости сопровождение
срывается. Факел, звук двигателя и новый дым прекращаются при выгорании и в live, и в повторе;
уже созданный дым продолжает рассеиваться. У ракет с горячим (рельсовым) пуском тяга тоже
нарастает плавно, но холодного выброса нет; электрический P1-SUN не получает ракетную струю.
**Последний шанс** (`/airdef lastchance on|off`, по умолчанию вкл). Комплекс стреляет и по классу целей вне своих ролей
(С-400, С-500 и Patriot по умолчанию не бьют дроны), если цель долетит до своей точки меньше чем за 10 с и на ней ещё нет
+8
View File
@@ -0,0 +1,8 @@
//! The enemy-picture bench (#127) without building the Horizon SDK.
extern crate airdef_core as airdef;
#[path = "../../airdef-mod/examples/intel_bench.rs"]
mod bench;
fn main() {
bench::main();
}
+598 -54
View File
@@ -741,8 +741,8 @@
2.0
],
"to": [
22.0,
7.6,
13.55,
7.5,
11.0
],
"faces": {
@@ -750,8 +750,8 @@
"uv": [
0,
0,
11.5,
0.6999999999999993
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -759,8 +759,8 @@
"uv": [
0,
0,
11.5,
0.6999999999999993
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -769,7 +769,7 @@
0,
0,
9.0,
0.6999999999999993
0.5999999999999996
],
"texture": "#kh101"
},
@@ -778,7 +778,7 @@
0,
0,
9.0,
0.6999999999999993
0.5999999999999996
],
"texture": "#kh101"
},
@@ -786,7 +786,7 @@
"uv": [
0,
0,
11.5,
3.0500000000000007,
9.0
],
"texture": "#kh101"
@@ -795,7 +795,7 @@
"uv": [
0,
0,
11.5,
3.0500000000000007,
9.0
],
"texture": "#kh101_belly"
@@ -804,13 +804,13 @@
},
{
"from": [
-6.0,
2.4499999999999993,
6.9,
2.0
],
"to": [
5.5,
7.6,
7.5,
11.0
],
"faces": {
@@ -818,8 +818,8 @@
"uv": [
0,
0,
11.5,
0.6999999999999993
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -827,8 +827,8 @@
"uv": [
0,
0,
11.5,
0.6999999999999993
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -837,7 +837,7 @@
0,
0,
9.0,
0.6999999999999993
0.5999999999999996
],
"texture": "#kh101"
},
@@ -846,7 +846,7 @@
0,
0,
9.0,
0.6999999999999993
0.5999999999999996
],
"texture": "#kh101"
},
@@ -854,7 +854,7 @@
"uv": [
0,
0,
11.5,
3.0500000000000007,
9.0
],
"texture": "#kh101"
@@ -863,7 +863,7 @@
"uv": [
0,
0,
11.5,
3.0500000000000007,
9.0
],
"texture": "#kh101_belly"
@@ -872,22 +872,22 @@
},
{
"from": [
22.0,
13.5,
6.9,
5.0
2.65
],
"to": [
28.5,
7.4,
11.0
16.55,
7.5,
10.88
],
"faces": {
"north": {
"uv": [
0,
0,
6.5,
0.5
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -895,8 +895,8 @@
"uv": [
0,
0,
6.5,
0.5
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -904,8 +904,8 @@
"uv": [
0,
0,
6.0,
0.5
8.23,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -913,8 +913,8 @@
"uv": [
0,
0,
6.0,
0.5
8.23,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -922,8 +922,8 @@
"uv": [
0,
0,
6.5,
6.0
3.0500000000000007,
8.23
],
"texture": "#kh101"
},
@@ -931,8 +931,552 @@
"uv": [
0,
0,
6.5,
6.0
3.0500000000000007,
8.23
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
-0.5500000000000007,
6.9,
2.65
],
"to": [
2.5,
7.5,
10.88
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
8.23,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
8.23,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
8.23
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
8.23
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
16.5,
6.9,
3.3
],
"to": [
19.55,
7.5,
10.76
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
7.46,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
7.46,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
7.46
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
7.46
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
-3.5500000000000007,
6.9,
3.3
],
"to": [
-0.5,
7.5,
10.76
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
7.46,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
7.46,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
7.46
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
7.46
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
19.5,
6.9,
3.95
],
"to": [
22.55,
7.5,
10.64
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
6.69,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
6.69,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
6.69
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
6.69
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
-6.550000000000001,
6.9,
3.95
],
"to": [
-3.5,
7.5,
10.64
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
6.69,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
6.69,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
6.69
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
6.69
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
22.5,
6.9,
4.6
],
"to": [
25.55,
7.5,
10.52
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
5.92,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
5.92,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
5.92
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
5.92
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
-9.55,
6.9,
4.6
],
"to": [
-6.5,
7.5,
10.52
],
"faces": {
"north": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0500000000000007,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
5.92,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
5.92,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0500000000000007,
5.92
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0500000000000007,
5.92
],
"texture": "#kh101_belly"
}
}
},
{
"from": [
25.5,
6.9,
5.25
],
"to": [
28.5,
7.5,
10.4
],
"faces": {
"north": {
"uv": [
0,
0,
3.0,
0.5999999999999996
],
"texture": "#kh101"
},
"south": {
"uv": [
0,
0,
3.0,
0.5999999999999996
],
"texture": "#kh101"
},
"east": {
"uv": [
0,
0,
5.15,
0.5999999999999996
],
"texture": "#kh101"
},
"west": {
"uv": [
0,
0,
5.15,
0.5999999999999996
],
"texture": "#kh101"
},
"up": {
"uv": [
0,
0,
3.0,
5.15
],
"texture": "#kh101"
},
"down": {
"uv": [
0,
0,
3.0,
5.15
],
"texture": "#kh101_belly"
}
@@ -942,20 +1486,20 @@
"from": [
-12.5,
6.9,
5.0
5.25
],
"to": [
-6.0,
7.4,
11.0
-9.5,
7.5,
10.4
],
"faces": {
"north": {
"uv": [
0,
0,
6.5,
0.5
3.0,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -963,8 +1507,8 @@
"uv": [
0,
0,
6.5,
0.5
3.0,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -972,8 +1516,8 @@
"uv": [
0,
0,
6.0,
0.5
5.15,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -981,8 +1525,8 @@
"uv": [
0,
0,
6.0,
0.5
5.15,
0.5999999999999996
],
"texture": "#kh101"
},
@@ -990,8 +1534,8 @@
"uv": [
0,
0,
6.5,
6.0
3.0,
5.15
],
"texture": "#kh101"
},
@@ -999,8 +1543,8 @@
"uv": [
0,
0,
6.5,
6.0
3.0,
5.15
],
"texture": "#kh101_belly"
}
@@ -1551,4 +2095,4 @@
}
}
]
}
}
File diff suppressed because it is too large Load Diff
+57
View File
@@ -0,0 +1,57 @@
//! Enemy-picture outcomes on fixed seeds (#127): what changed for the raids, measured.
//!
//! Runs the standard scenarios over a fixed seed set and prints one JSON object with the
//! completion, losses and failure reasons of every run — the before/after comparison of the
//! honest EnemyPicture is judged on these, not on "it got smarter".
//!
//! cargo run --release --example intel_bench
#[path = "sim_run/harness.rs"]
mod harness;
use harness::{big_smart, ew_adaptive, logistics, Scenario};
fn esc(s: &str) -> String {
s.chars().flat_map(|c| match c {
'"' => "\\\"".chars().collect::<Vec<_>>(),
'\\' => "\\\\".chars().collect::<Vec<_>>(),
c => vec![c],
}).collect()
}
fn run(sc: &Scenario) -> String {
let r = harness::run(sc);
format!(
"{{\"scenario\":\"{}\",\"seed\":{},\"ticks_run\":{},\"raids_ordered\":{},\"raids_ended\":{},\"all_ended\":{},\"launched\":{},\"kills\":{},\"hits\":{},\"crashes\":{},\"sams_lost\":{},\"fired\":{},\"retargets_max\":{},\"air_bytes\":{},\"switches_max\":{},\"intents\":\"{}\",\"failures\":\"{}\"}}",
esc(&r.name),
r.seed,
r.ticks_run,
r.raids_ordered,
r.raids_ended,
r.all_ended,
r.launched,
r.kills,
r.hits,
r.crashes,
r.sams_lost,
r.fired,
r.retargets_max,
r.air_bytes,
r.switches_max,
esc(&r.intents),
esc(&r.failures),
)
}
pub fn main() {
let scenarios: Vec<fn() -> Scenario> = vec![big_smart, logistics, ew_adaptive];
let seeds = [1u64, 7, 42];
let mut rows = Vec::new();
for make in &scenarios {
for &seed in &seeds {
let mut sc = make();
sc.seed = seed;
rows.push(run(&sc));
}
}
println!("[{}]", rows.join(",\n"));
}
+35
View File
@@ -128,6 +128,25 @@ pub struct Report {
pub raids_ordered: usize,
pub raids_ended: usize,
pub all_ended: bool,
/// Systems the defence lost (destroyed units at the end).
pub sams_lost: u32,
/// The most retarget route jobs waiting at once (#127).
pub retargets_max: usize,
/// The largest air section a save would have taken, in bytes (#127).
pub air_bytes: usize,
/// The aims every drone ended with, by intent: "plan:1,sead:2,react:3,replace:0".
pub intents: String,
/// The most aim switches one drone went through.
pub switches_max: u16,
}
/// The last intent every smart drone of the run was seen carrying, as `name:count`.
fn intent_counts(seen: &HashMap<u32, &'static str>) -> String {
let mut counts = std::collections::BTreeMap::new();
for name in seen.values() {
*counts.entry(*name).or_insert(0usize) += 1;
}
["plan", "sead", "react", "replace"].iter().map(|k| format!("{k}:{}", counts.get(*k).copied().unwrap_or(0))).collect::<Vec<_>>().join(",")
}
fn finite(v: DVec3) -> bool {
@@ -162,6 +181,8 @@ pub fn run(sc: &Scenario) -> Report {
let mut ended = vec![false; sc.raids.len()];
// truck id -> (last position, ticks standing while busy)
let mut standing: HashMap<u32, (DVec3, u64)> = HashMap::new();
// drone id -> the last structured intent it carried (#127).
let mut intents_seen: HashMap<u32, &'static str> = HashMap::new();
let mut out = Out::default();
for now in 1..=sc.ticks {
// Raids come in order: one is ordered once the previous one has been sent.
@@ -194,6 +215,18 @@ pub fn run(sc: &Scenario) -> Report {
pending = wanted.into_iter().map(|(x, z)| (x, z, sc.terrain.height(x, z))).collect();
}
r.ticks_run = now;
r.retargets_max = r.retargets_max.max(sim.retargets_len());
r.switches_max = sim.drones.iter().chain(sim.queue.iter().map(|(_, d)| d)).map(|d| d.aim_switches()).max().unwrap_or(0).max(r.switches_max);
for d in sim.drones.iter().chain(sim.queue.iter().map(|(_, d)| d)) {
if d.alive() && d.smart() {
intents_seen.insert(d.id, d.intent().name());
}
}
// The air section a save would take, sampled when the sky is fullest (writing it every tick
// would distort the timings the bench measures).
if sim.drones.len() > r.air_bytes {
r.air_bytes = sim.air_text().map_or(0, |t| t.len());
}
// NaN check on everything with a position.
let bad = sim.drones.iter().filter(|d| !finite(d.pos) || !finite(d.vel)).count()
+ sim.missiles.iter().filter(|m| !finite(m.pos)).count()
@@ -227,6 +260,7 @@ pub fn run(sc: &Scenario) -> Report {
}
}
r.launched = sim.launched;
r.sams_lost = sim.sams.iter().filter(|s| !s.alive()).count() as u32;
r.kills = sim.kills;
r.hits = sim.hits;
r.fired = sim.sams.iter().map(|s| s.fired).sum();
@@ -236,6 +270,7 @@ pub fn run(sc: &Scenario) -> Report {
r.failures = sim.tally.text();
r.raids_ended = ended.iter().filter(|o| **o).count();
r.all_ended = r.raids_ended == sc.raids.len();
r.intents = intent_counts(&intents_seen);
r.tick_total = times.iter().sum();
times.sort();
if !times.is_empty() {
+2 -2
View File
@@ -173,10 +173,10 @@ e6cb3f578b875d3683d2a027f1ac34226b56c4db410fecc6479e2683485b8c3e assets/airdef/
449284669a58d71ae2de7e68cd7cf18ae21fec70ceb3124cd24fb4a09fc49909 assets/airdef/models/block/irist_tubes_burnt.json
be87037b84cd45b2c53d7fde6653f51769e782eea1b8586383afcfababf19ab6 assets/airdef/models/block/iskander.json
98d488ca797fb3d0193957b8a93a82f48376a89f8e091032e6365d1845016a90 assets/airdef/models/block/kalibr.json
be9eb1389e169a76732f16e604499260b147b524b4c929d2a4e77b580a032fb7 assets/airdef/models/block/kh101.json
20deb68dbba6eb64b7c51685497110ef7d1d3bf0aa7e7167c558e0a8e842e759 assets/airdef/models/block/kh101.json
ea7c9af888f1285502b2ca51114f226573311be6fb90b8d449b9f75cfbb6b885 assets/airdef/models/block/kh22.json
7b73015e33d85d4cef31660ef874ba8dcd6e07ae3a95416d0ead1d325bd0cb6c assets/airdef/models/block/kinzhal.json
911e55de28058e1723a61d15de80676789e57ab15bfc09fd75757cc85095fbcb assets/airdef/models/block/lancet.json
69135e90a1a7fb21d9f47b1854c5a3648e296136c2375acd9db5a48b0ad40887 assets/airdef/models/block/lancet.json
15c9884ce51311cf4b9b9d106e142e33d72c5ba18dc9236c5b51da01232f8e44 assets/airdef/models/block/launch_ramp.json
159fa5e3b6a096a1872dec2a550bfa30575d57519654a860607e20dab8f35f53 assets/airdef/models/block/launcher_truck.json
2069198ba24a932816f504fb52f53dc4bc740cacaf45637698a17d9175da851c assets/airdef/models/block/m48n6.json
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+94 -1
View File
@@ -59,10 +59,42 @@ fn line(
format!("{name}: API={available}, включено={enabled}, запрос={accepted}, подготовлено={prepared}, поколение={generation}, {why}")
}
fn camera_line(s: &render::CameraState) -> String {
let cameras: Vec<String> = s
.cameras
.iter()
.map(|c| {
let why = match c.reason {
render::CameraReason::AwaitingFrame => "awaiting-frame",
render::CameraReason::Ready => "ready",
};
format!("{}:{}", c.id, why)
})
.collect();
let main = match s.main_view {
Some(id) => id.to_string(),
None => "нет".into(),
};
format!(
"Камеры: API={}, включено={}, запрос={}, подготовлено={}, поколение={}, {}, main={}, [{}]",
s.available,
s.enabled,
s.request_accepted,
s.prepared,
s.generation,
reason(s.reason),
main,
cameras.join("; ")
)
}
pub fn diagnostics() -> String {
let smoke = render::smoke_status();
let acoustic = acoustics();
let capture = render::capture_owner_status();
let lights = render::point_lights_status();
let sources = render::sound_sources_status();
let cameras = render::camera_status();
let smoke_reason = match smoke.reason {
render::SmokeReason::AwaitingFrame => "awaiting-frame",
render::SmokeReason::Disabled => "disabled",
@@ -70,7 +102,7 @@ pub fn diagnostics() -> String {
render::SmokeReason::Ready => "ready",
};
[
"Возможности движка (API 27; подготовка не означает готовый GPU-кадр или файл):".into(),
"Возможности движка (API 30; подготовка не означает готовый GPU-кадр, слышимый звук или файл):".into(),
line(
"Дым",
smoke.generation,
@@ -89,6 +121,25 @@ pub fn diagnostics() -> String {
acoustic.prepared,
reason(acoustic.reason),
),
line(
"Точечный свет",
lights.generation,
lights.available,
lights.enabled,
lights.request_accepted,
lights.prepared,
reason(lights.reason),
),
line(
"Постоянные звуки",
sources.generation,
sources.available,
sources.enabled,
sources.request_accepted,
sources.prepared,
reason(sources.reason),
),
camera_line(&cameras),
line(
"Захват этого мода",
capture.generation,
@@ -144,4 +195,46 @@ mod tests {
s.reason = CapabilityReason::Failed;
assert!(capture_problem(&s).is_some());
}
fn camera(id: u32, prepared: bool) -> render::CameraReadiness {
render::CameraReadiness {
id,
request_accepted: true,
prepared,
reason: if prepared {
render::CameraReason::Ready
} else {
render::CameraReason::AwaitingFrame
},
}
}
#[test]
fn the_camera_line_separates_readiness_from_the_screens_selection() {
let line = camera_line(&render::CameraState {
generation: 5,
available: true,
enabled: true,
request_accepted: true,
prepared: true,
reason: CapabilityReason::Ready,
cameras: vec![camera(7, true), camera(8, false)],
main_view: Some(7),
});
assert_eq!(
line,
"Камеры: API=true, включено=true, запрос=true, подготовлено=true, поколение=5, \
ready, main=7, [7:ready; 8:awaiting-frame]"
);
// No accepted submission: no cameras, no main view, and the reason says so.
let line = camera_line(&render::CameraState {
generation: 5,
available: true,
enabled: false,
request_accepted: false,
prepared: false,
reason: CapabilityReason::NotRequested,
cameras: Vec::new(),
main_view: None,
});
assert!(line.ends_with("not-requested, main=нет, []"), "{line}");
}
}
+178 -3
View File
@@ -886,7 +886,13 @@ impl AirDef {
/// The state as text, lines of words: the autosave's format, and the body of a scenario.
/// `fresh`: every system and object whole, magazines full (a scenario to replay from the start).
/// The air state (the raid's drones, launch queue, retarget jobs and the picture behind them,
/// #127) belongs to the autosave only: a scenario is a start state, not a raid frozen mid-flight.
fn state_text(&self, fresh: bool, view: bool) -> String {
self.state_text_with(fresh, view, !fresh)
}
fn state_text_with(&self, fresh: bool, view: bool, air: bool) -> String {
let mut text = String::new();
for s in &self.sim.sams {
// Then its ammunition (missiles, bursts, out and waiting for a truck, reload ticks
@@ -939,11 +945,27 @@ impl AirDef {
for (i, s) in self.sim.sams.iter().enumerate().filter(|(_, s)| !s.doctrine.is_default()) {
text += &format!("doctrine {i} {}\n", s.doctrine.save_text());
}
// The enemy's air state, last: it names its own format version, so an older build (or an
// older save) reads the layout and ignores it (#127).
if air && let Some(a) = self.sim.air_text() {
text += &a;
}
text
}
fn save(&mut self) {
let text = self.state_text(false, true);
self.save_with(true);
}
/// Writes the state. `air`: include the enemy's air state (#127). A raid still being *planned* has
/// no durable form — its items, sites and routes are half made — so a periodic save waits for it
/// to be launched (at most `sites::SEARCH_TICKS`), while a world change takes the layout alone.
fn save_with(&mut self, air: bool) {
if air && self.sim.planning() {
self.next_save = self.sim.tick + 20;
return;
}
let text = if air { self.state_text(false, true) } else { self.state_text_with(false, true, false) };
// Clean only once written: a failed write is tried again after a pause.
match storage::set(&self.state_key(), text.as_bytes()) {
Ok(()) => {
@@ -993,7 +1015,15 @@ impl AirDef {
/// naming the line and field, and the scene stays as it was (#86).
fn apply_state(&mut self, text: &str) -> Result<(), String> {
let layout = layout::Layout::parse(text)?;
// The air section is checked before anything is touched, like the layout (#127).
let air = sim::Sim::parse_air(text)?;
self.commit_layout(layout);
if let Some(air) = air {
let cancelled = self.sim.restore_air(air);
if cancelled > 0 {
say(&format!("Воздушная обстановка восстановлена: отменено устаревших заданий {cancelled}"));
}
}
Ok(())
}
@@ -1134,6 +1164,10 @@ fn durable_mark(sim: &Sim) -> u64 {
.fold(sim.sams.len() as u64, |a, h| a.wrapping_mul(31).wrapping_add(h))
.wrapping_mul(31)
.wrapping_add(strikes)
// The air state's shape (#127): a launch, a loss, a new or finished route job makes the
// autosave take the raid as it stands, so a reload resumes it rather than an empty sky.
.wrapping_mul(31)
.wrapping_add(sim.air_mark())
}
impl AirDef {
@@ -1158,7 +1192,9 @@ impl AirDef {
/// Another world opened: the last one's state saved, a clean simulation with this one's loaded.
fn open_world(&mut self, world: Option<String>) {
if self.world.is_some() && self.dirty {
self.save();
// Leaving the world: the layout is kept, a raid still being planned is not (it would have
// no drones to resume and the world it belonged to is going).
self.save_with(false);
}
self.end_session(presentation::ExitCause::WorldChange);
let shader = self.sim.shader;
@@ -1839,7 +1875,7 @@ impl Mod for AirDef {
me.apply_far();
// Subcommands, typed arguments and the saved scenarios' names for the chat box (#98).
commands::register(&scenario::saved_names());
Ok((me, Registration::new().command("airdef").on_tick()))
Ok((me, Registration::new().command("airdef").on_tick().on_frame()))
}
fn tick(&mut self, tick: u64) {
@@ -2280,6 +2316,17 @@ impl Mod for AirDef {
self.menu = None;
}
/// A frame runs outside a world too (the title screen), where no tick does: a film or an
/// export still active there is ended, so its capture cannot go on recording the title.
fn frame(&mut self, _seconds: f32) {
if self.presentation.is_live() {
return;
}
if let Some(cleanup) = self.presentation.world_left(world_identity().as_deref()) {
cleanup.apply(self);
}
}
fn command(&mut self, _name: &str, args: &str) -> Result<Option<String>, String> {
let w: Vec<&str> = args.split_whitespace().collect();
let mut out = Out::default();
@@ -2380,6 +2427,12 @@ impl Mod for AirDef {
self.launch_wave(&mut out)?;
None
}
["preset", n] => {
// The wave screen's preset button for scripts: the same apply() the UI cycles.
let n = n.parse::<usize>().map_err(|_| "Номер готового состава: число".to_string())?;
self.wave.apply(n);
Some(format!("Готовый: {}", wave::PRESETS[self.wave.preset].name))
}
["sites"] => {
// The launch sites the radars have found, and the strike missiles (#101).
let p = player().ok_or("Нет игрока")?;
@@ -2725,6 +2778,75 @@ mod tests {
assert_eq!((after.sim.sams[0].air_48n6_stock, after.sim.sams[2].ground_stock, after.sim.sams[2].air_48n6_stock), (1, 0, 0));
}
/// #128 end to end: A declares a return and drives off, B waits for a round; the truck must
/// serve B anyway (a save/load mid-flight included), and once A is back the actual return
/// completes. Rounds are conserved throughout.
#[test]
fn a_moving_return_claim_drives_and_supplies_and_survives_a_state_round_trip() {
struct Flat;
impl sim::world::WorldSource for Flat {
fn solid(&self, _: i32, y: i32, _: i32) -> Option<bool> { Some(y < 64) }
}
let mut game = test_mod();
for (kind, x) in [(SamKind::Depot, 0.0), (SamKind::S400, 120.0), (SamKind::S400, 240.0), (SamKind::Tzm, 0.0)] {
let id = game.sim.id();
game.sim.sams.push(Sam::new(id, kind, DVec3::new(x, 64.0, 0.0), 0.0));
}
game.sim.sams[0].ground_stock = 2;
game.sim.sams[1].ground_rounds = 1;
game.sim.sams[1].missiles = 3;
game.sim.unload_ground_round(1).unwrap();
assert!(game.sim.sams[1].ground_return);
game.sim.sams[2].missiles = 3;
// B is out of the depot's reach: the load becomes a pending delivery request.
game.sim.load_ground_round(2).unwrap();
assert!(game.sim.sams[2].ground_request);
// A drives away: its return claim is impossible for a while.
assert!(game.sim.order_move(1, DVec3::new(420.0, 64.0, 0.0)));
let mut out = Out::default();
let mut restored_mid_flight = false;
let mut supplied = false;
for _ in 0..12000 {
let now = game.sim.tick;
let cols = game.ground.take_wanted().into_iter().map(|(x, z)| (x, z, 64)).collect();
game.ground.answer(cols, now);
let sections = game.ground.world.take_wanted(now);
game.ground.world.serve(&Flat, sections, now);
game.sim.step(&mut game.ground, None, &mut out);
if !restored_mid_flight && game.sim.sams[3].ground_stock == 1 {
// The truck took a round for B: save, reload, continue from the restored state.
let saved = game.state_text(false, false);
let mut restored = test_mod();
restored.apply_state(&saved).unwrap();
game = restored;
restored_mid_flight = true;
}
if game.sim.sams[2].ground_rounds == 1 { supplied = true; break; }
out = Out::default();
}
assert!(restored_mid_flight, "truck never picked up a round for B");
assert!(supplied, "B starved while A's return was impossible");
assert!(game.sim.sams[1].ground_return, "claim must survive the supply run");
assert_eq!(game.sim.sams[0].ground_stock + game.sim.sams[3].ground_stock + game.sim.sams[1].ground_rounds + game.sim.sams[2].ground_rounds, 3);
// A returns to its place; the waiting claim is then collected and driven to the depot.
assert!(game.sim.order_move(1, DVec3::new(120.0, 64.0, 0.0)));
let mut returned = false;
for _ in 0..12000 {
let now = game.sim.tick;
let cols = game.ground.take_wanted().into_iter().map(|(x, z)| (x, z, 64)).collect();
game.ground.answer(cols, now);
let sections = game.ground.world.take_wanted(now);
game.ground.world.serve(&Flat, sections, now);
game.sim.step(&mut game.ground, None, &mut out);
if game.sim.sams[0].ground_stock == 2 && game.sim.sams[1].ground_rounds == 0 { returned = true; break; }
out = Out::default();
}
assert!(returned);
assert!(!game.sim.sams[1].ground_return);
assert!(!game.sim.sams[3].return_cargo);
assert_eq!(game.sim.sams[0].ground_stock + game.sim.sams[3].ground_stock + game.sim.sams[1].ground_rounds + game.sim.sams[2].ground_rounds, 3);
}
/// #83: while an export records no other replay or film replaces it; after it, they may.
#[test]
fn typed_ammunition_changes_mark_the_state_dirty() {
@@ -2865,4 +2987,57 @@ mod tests {
sim.strikes.progress = sim::strike::TUNE.progress_save;
assert_ne!(durable_mark(&sim), checkpoint, "a refill checkpoint is not saved");
}
/// #127: the air section of a save is written and read by the adapter, and a save without it (an
/// older one) still loads as before. The section itself is checked in the core's own tests; here
/// the contract is that the text the game writes is the text the next load restores, and that a
/// state with a sky replaces a state without one rather than merging into it.
#[test]
fn the_air_section_of_a_save_is_written_and_read_by_the_adapter() {
let zeros = "0 ".repeat(24);
let air = format!(
"air 1 120 2 0 1 1 1 1\n\
airintel {zeros}\n\
airglobal -\n\
airrelief 0 0 0 16 8 u64\n\
aircontact 32 s400 0 70 0 100 emission - - 0\n\
airqueue 200 48 shahed 0 90 -600 0 1 0 0 70 0 cruise react 32 120 0 confirmed 0 0 0 0 0 0 false false true 0 - 0 - -\n\
airjob 1 48 0 70 0 32 120 1 react 0\n"
);
let saved = format!("sam {} 0 70 300 0\n{air}", SamKind::S400.key());
let mut game = test_mod();
game.apply_state(&saved).expect("a saved raid must load");
assert_eq!(game.sim.tick, 120);
assert_eq!(game.sim.queue.len(), 1, "the launch queue is not restored");
assert_eq!(game.sim.queue[0].0, 200);
assert_eq!(game.sim.drones.len(), 0);
let report = game.sim.enemy_picture();
assert_eq!(report.pending.len(), 1, "the pending route job is not restored");
assert_eq!(report.pending[0].intent, "react");
assert_eq!(report.pending[0].unit, 32);
assert_eq!(report.contacts.len(), 1);
// The game writes the same section back: what it read is what it saves.
let back = game.state_text(false, false);
assert!(back.contains("\nair 1 120 2 0 1 1 1 1\n"), "{back}");
assert!(back.contains("\nairjob 1 48 0.00 70.00 0.00 32 120 1 react 0\n"), "{back}");
assert!(back.contains("\nairqueue 200 48 "), "{back}");
// The air state is replaced, not merged: a save of a quiet world clears the sky.
let quiet = format!("sam {} 0 70 300 0\n", SamKind::S400.key());
let quiet = format!("{quiet}air 1 300 2 0 0 0 0 0\nairintel {zeros}\nairglobal -\n");
game.apply_state(&quiet).unwrap();
assert!(game.sim.queue.is_empty() && game.sim.enemy_picture().pending.is_empty(), "an empty sky merged with the loaded one");
// An older save has no section at all: it loads its layout and leaves the sky as it was.
let mut old = test_mod();
old.apply_state(&format!("sam {} 0 70 0 0\n", SamKind::S400.key())).unwrap();
assert_eq!(old.sim.sams.len(), 1);
assert!(sim::Sim::parse_air("sam s400 0 70 0 0\n").unwrap().is_none());
// A scenario's body is a start state: it does not carry the sky.
let scenario = game.scenario_text("t", false);
assert!(!scenario.contains("\nair 1 "), "a scenario carries the air state");
assert!(sim::Sim::parse_air(&scenario).unwrap().is_none());
}
}
+34
View File
@@ -286,6 +286,16 @@ impl<P, E> Session<P, E> {
Some(Cleanup { actions })
}
/// The world is gone (the title screen): the game stops ticking there, so an active export
/// would otherwise go on recording the title with its playback clock frozen. Nothing to do
/// in Live, and a world still open is not a leave.
pub fn world_left(&mut self, world: Option<&str>) -> Option<Cleanup> {
if self.is_live() || world.is_some() {
return None;
}
self.end(ExitCause::WorldChange)
}
/// A world change invalidates live work too. Active playback uses the normal cleanup path,
/// which advances generation exactly once; Live advances generation without host cleanup.
pub fn world_changed(&mut self) -> Option<Cleanup> {
@@ -466,6 +476,30 @@ mod tests {
assert_ne!(session.generation(), first);
}
#[test]
fn a_gone_world_ends_an_active_export_once() {
let mut session = Session::<(), ()>::default();
assert!(session.world_left(None).is_none(), "Live has nothing to clean up");
session.replay(());
assert!(session.world_left(Some("world:w")).is_none(), "the world is still open");
let State::Replay(playback) = session.take() else {
panic!("replay state lost")
};
session.export(playback, ());
let cleanup = session.world_left(None).expect("the title screen ends the export");
assert!(cleanup.actions.contains(&CleanupAction::CancelCapture));
let mut host = HostFixture::default();
host.apply(&cleanup);
let count = host.actions.len();
assert!(session.world_left(None).is_none(), "a second frame sees Live");
assert_eq!(host.actions.len(), count, "cleanup is not repeated");
assert_eq!(
host.actions.iter().filter(|a| **a == CleanupAction::CancelCapture).count(),
1
);
}
#[test]
fn end_and_restart_emit_cleanup_once_for_stop_unload_failure_and_success() {
for cause in [
+1 -1
View File
@@ -1210,7 +1210,7 @@ mod engine_tests {
assert_eq!(out.sounds.iter().map(|s| s.0).collect::<Vec<_>>(), vec!["airdef:launch.s400_eject"]);
assert!(out.engines.is_empty());
out = Out::default();
p.t = 16.0;
p.t = 10.0 + crate::sim::strike::EJECT_TICKS as f64 + 1.0;
p.sounds(&rec, DVec3::ZERO, &mut out);
p.engines(&rec, DVec3::ZERO, false, &mut out);
assert_eq!(out.sounds.iter().map(|s| s.0).collect::<Vec<_>>(), vec!["airdef:launch.s400"]);
+3 -2
View File
@@ -36,9 +36,10 @@ fn names() -> Vec<String> {
impl AirDef {
/// The scenario as text.
fn scenario_text(&self, name: &str, fresh: bool) -> String {
pub(crate) fn scenario_text(&self, name: &str, fresh: bool) -> String {
let mut text = format!("scenario {VERSION}\nname {name}\nworld {}\n", self.state_key());
text += &self.state_text(fresh, false);
// A scenario is a start state: its body is the layout, not the raid a save happened to catch.
text += &self.state_text_with(fresh, false, false);
text += &format!("seed {}\nwave {}\n", self.sim.rng.state(), self.wave.text());
text
}
+39
View File
@@ -54,6 +54,12 @@ pub(super) struct Result {
pub missed: u32,
/// Missiles fired by the heavy systems (S-400, S-500, Patriot).
pub heavy: u32,
/// Interceptors whose fuse ran without a kill; whose life ran out; that lost their target on the way;
/// and that fell below their guidance speed after motor burnout (#120's coast/energy tally).
pub fuse_missed: u32,
pub expired: u32,
pub orphaned: u32,
pub energy_lost: u32,
pub by_kind: Vec<(DroneKind, u32, u32)>,
pub tally: String,
/// Drones that vanished short of their aim without being shot down: kind, where, how far from the aim.
@@ -322,6 +328,10 @@ pub(super) fn fly(s: &Setup) -> Result {
result.crashes = sim.crashes;
result.blocked = sim.tally.blocked;
result.scrubbed = sim.tally.scrubbed;
result.fuse_missed = sim.tally.missed;
result.expired = sim.tally.expired;
result.orphaned = sim.tally.orphaned;
result.energy_lost = sim.tally.energy_lost;
result.leaked = sim.hits;
let mut kinds: HashMap<DroneKind, (u32, u32)> = HashMap::new();
for h in &gone_unkilled {
@@ -514,6 +524,35 @@ fn one_raid() {
}
}
/// Issue #120's wider sampling: battery sizes, launch-range bounds and the target classes of a raid
/// of 36, on the same seeds against the same cluster mix as `one_raid`. Prints CSV rows:
/// `variant,seed,sams,dist,sent,kills,leaked,missiles,heavy,ticks,blocked,scrubbed,crashes,fuse_miss,expired,orphaned,energy_lost,leaks_by_kind`.
/// `SEEDS=1-8 cargo test --release issue_120_grid -- --ignored --nocapture` (SEEDS overrides the seed range).
#[test]
#[ignore]
fn issue_120_grid() {
let seeds = match std::env::var("SEEDS") {
Ok(v) => {
let (a, b) = v.split_once('-').expect("SEEDS is a range like 1-8");
let a: u64 = a.parse().expect("SEEDS start");
let b: u64 = b.parse().expect("SEEDS end");
a..=b
}
Err(_) => 1..=8,
};
for (variant, sams, dist) in [("batt10", 10usize, 500.0), ("batt20", 20, 500.0), ("batt50", 50, 500.0), ("near200", 20, 200.0), ("far1500", 20, 1500.0), ("hills20", 20, 500.0)] {
for seed in seeds.clone() {
let mut s = Setup::new(sams, false, seed);
s.size = 36;
s.dist = dist;
s.hilly = variant == "hills20";
let r = fly(&s);
let kinds = r.by_kind.iter().map(|k| format!("{:?}:{}", k.0, k.1)).collect::<Vec<_>>().join(";");
eprintln!("{variant},{seed},{sams},{dist},{},{},{},{},{},{},{},{},{},{},{},{},{},{}", r.launched, r.kills, r.leaked, r.missiles, r.heavy, r.ticks, r.blocked, r.scrubbed, r.crashes, r.fuse_missed, r.expired, r.orphaned, r.energy_lost, kinds);
}
}
}
/// Far launches over mountains where only a disc round the player is known: who crashes, where and how often.
/// `cargo test --release far_table -- --ignored --nocapture` (DISC=300 sets the radius, 0 for all known).
#[test]
+15 -7
View File
@@ -285,7 +285,7 @@ mod tests {
mod emission_tests {
use super::*;
#[test]
fn silence_accepts_network_without_inventing_own_measurements_and_contacts_age() {
fn silence_discloses_nothing_and_contacts_age_and_channels_still_place_a_unit() {
let mut sim = Sim::new(121);
sim.tick = 20;
let mut source = Sam::new(1, SamKind::Radar, DVec3::ZERO, 0.0);
@@ -301,22 +301,30 @@ mod emission_tests {
assert_eq!(sim.sams[1].track(id).unwrap().own_tick, 0);
assert_eq!(sim.sams[1].track(id).unwrap().tick, 20);
assert!(!sim.sams[1].radar_up());
assert_eq!(sim.known_units(), vec![(1, DVec3::ZERO)]);
// The emitting source is fixed by the drone; the silent receiver is not.
let picture = sim.picture_of_defences();
assert_eq!(picture.len(), 1);
assert_eq!((picture[0].id, picture[0].at), (1, DVec3::ZERO));
assert_eq!(picture[0].seen, ew::Seen::Emission);
sim.sams[0].radar_on = false;
// The truth moving is not an observation: the contact keeps the observed place.
sim.sams[0].pos = DVec3::new(400.0, 0.0, 0.0);
sim.tick = 40;
sim.update_sight(&mut ground);
assert_eq!(sim.known_units(), vec![(1, DVec3::ZERO)]);
assert_eq!(sim.sams[1].track(id).unwrap().tick, 20);
let picture = sim.picture_of_defences();
assert_eq!(picture.len(), 1);
assert_eq!(picture[0].at, DVec3::ZERO, "a hidden move changed the picture");
// A fresh emission fix re-places it where seen then.
sim.sams[0].radar_on = true;
sim.tick = 60;
sim.update_sight(&mut ground);
assert_eq!(sim.known_units(), vec![(1, DVec3::new(400.0, 0.0, 0.0))]);
assert_eq!(sim.picture_of_defences()[0].at, DVec3::new(400.0, 0.0, 0.0));
sim.sams[0].radar_on = false;
// Other disclosure channels still reveal a silent unit.
sim.intel.revealed.push((2, DVec3::ZERO, 60));
assert!(Sim::enemy_knows(&sim.sams[1], &sim.known_units()));
sim.intel.observe(&sim.sams[1], 60, ew::Seen::Launch);
assert!(sim.known_live(2));
sim.tick = 6060;
assert!(sim.known_units().is_empty());
assert!(sim.picture_of_defences().is_empty(), "an unrefreshed contact never ages out");
}
}
+28
View File
@@ -172,4 +172,32 @@ mod tests {
assert_eq!(kinds, SamKind::ALL.into_iter().collect());
assert_eq!(&RAID_KINDS[..11], &[Gerbera, Shahed, Geran3, Lancet, Kh101, Kalibr, Kh22, Zircon, Iskander, Kinzhal, Oreshnik]);
}
/// The catalog is the only copy of the numbers: a kind without a row, or a row under
/// another kind, would be a silent balance change.
#[test]
fn generated_specs_cover_every_kind_and_keep_their_keys() {
let mut drones = HashSet::new();
let mut drone_keys = HashSet::new();
for (kind, key) in super::super::DRONE_SPEC_KEYS {
assert_eq!(kind.spec().key, key, "profile/key mismatch for {kind:?}");
assert!(drones.insert(kind), "duplicate drone profile {kind:?}");
assert!(drone_keys.insert(key), "duplicate drone save key {key}");
assert!(kind.spec().rcs > 0.0 && kind.spec().launch_sound.starts_with("airdef:"));
}
assert_eq!(drones, DroneKind::ALL.into_iter().collect());
let mut missiles = HashSet::new();
for (kind, model) in super::super::MISSILE_SPEC_MODELS {
assert_eq!(kind.spec().model, model, "profile/model mismatch for {kind:?}");
assert!(missiles.insert(kind), "duplicate missile profile {kind:?}");
}
let mut units = HashSet::new();
let mut unit_keys = HashSet::new();
for (kind, key) in super::super::units::UNIT_SPEC_KEYS {
assert_eq!(kind.spec().key, key, "profile/key mismatch for {kind:?}");
assert!(units.insert(kind), "duplicate unit profile {kind:?}");
assert!(unit_keys.insert(key), "duplicate unit save key {key}");
}
assert_eq!(units, SamKind::ALL.into_iter().collect());
}
}
+941
View File
@@ -0,0 +1,941 @@
//! The enemy's air state in the autosave (#127): the raid's drones, the launch queue, the retarget
//! jobs still waiting, the picture they were chosen from and the land they were planned over.
//!
//! A route job alone is not durable. Its drone may still be on the ground or already flying, and its
//! aim is only meaningful with the picture the adaptive tick chose it from and the relief snapshot of
//! that knowledge version. So the save writes the whole air state that a pending job depends on, and
//! the load rebuilds it: drones, launch queue, jobs (with their id, aim, unit, version, priority and
//! intent), the contacts, and each relief version a pending job still uses. Nothing of the live
//! picture is mixed into a replay: a recording keeps trajectories, and this section is written and
//! read for the live simulation only.
//!
//! The format is its own versioned section of `state_text` (`air 1 ...`). A save without the section
//! (every save made before #127) loads exactly as before: the layout, and an empty sky. Every value is
//! checked before anything is restored, like [`layout`](crate::layout): a bad line refuses the whole
//! save and names the line and the field. Everything is bounded — drones, queued launches, jobs,
//! contacts, route points and relief cells — so a saved air state can never grow the file without limit.
use super::*;
use std::collections::{BTreeMap, HashMap};
/// The section's format version. A different one is refused rather than half-read.
const VERSION: u32 = 1;
/// Drones in the air a save may hold. A raid is normally tens of drones; this bound keeps the
/// section far inside the host's per-write storage budget even if a scenario makes thousands.
const MAX_DRONES: usize = 512;
/// Bytes the section may take before further drones are left out (the host allows 1 MiB a write;
/// the layout and the headroom of the rest of the state stay clear of it).
const MAX_BYTES: usize = 900_000;
/// Route points one drone may have in a save.
const MAX_ROUTE: usize = 512;
/// Contacts (the picture, and a job's picture rebuilt from it) a save may hold.
const MAX_CONTACTS: usize = 4096;
/// Relief versions a save may hold, and the cells of each.
const MAX_RELIEFS: usize = 8;
const MAX_CELLS: usize = 40_000;
/// What the air section of a save holds, checked as a whole before the scene is touched.
pub struct AirSave {
tick: u64,
job_next: u32,
kills: [u32; ew::SECTORS],
hits: [u32; ew::SECTORS],
contacts: Vec<ew::Contact>,
drones: Vec<Drone>,
queue: Vec<(u64, Drone)>,
jobs: Vec<JobRec>,
/// The land new retarget jobs take as their version.
known_relief: Option<std::sync::Arc<ew::KnownRelief>>,
}
pub(crate) struct JobRec {
id: u32,
drone: u32,
aim: DVec3,
unit: u32,
version: u64,
intent: ew::Intent,
relief: Option<std::sync::Arc<ew::KnownRelief>>,
}
/// A saved line's words, with the line number for the refusal.
struct Line<'a> {
n: usize,
word: &'a str,
w: Vec<&'a str>,
}
impl Line<'_> {
fn bad(&self, field: &str, why: &str) -> String {
format!("строка {}: «{}», поле {field}: {why}", self.n, self.word)
}
fn word(&self, i: usize, field: &str) -> Result<&str, String> {
self.w.get(i).copied().ok_or_else(|| self.bad(field, "строка оборвана"))
}
fn count(&self, i: usize, field: &str, max: usize) -> Result<usize, String> {
let v = self.word(i, field)?;
let n: usize = v.parse().map_err(|_| self.bad(field, &format!("«{v}» не целое число")))?;
if n > max {
return Err(self.bad(field, &format!("{n} больше {max}")));
}
Ok(n)
}
fn int(&self, i: usize, field: &str, lo: i64, hi: i64) -> Result<i64, String> {
let v = self.word(i, field)?;
let n: i64 = v.parse().map_err(|_| self.bad(field, &format!("«{v}» не целое число")))?;
if n < lo || n > hi {
return Err(self.bad(field, &format!("{n} вне допустимого {lo}..{hi}")));
}
Ok(n)
}
fn flag(&self, i: usize, field: &str) -> Result<bool, String> {
match self.word(i, field)? {
"true" => Ok(true),
"false" => Ok(false),
v => Err(self.bad(field, &format!("«{v}»: нужно true или false"))),
}
}
fn num(&self, i: usize, field: &str) -> Result<f64, String> {
let v = self.word(i, field)?;
let x: f64 = v.parse().map_err(|_| self.bad(field, &format!("«{v}» не число")))?;
if !x.is_finite() || x.abs() > 3.0e7 {
return Err(self.bad(field, &format!("«{v}» не конечное допустимое число")));
}
Ok(x)
}
fn opt_tick(&self, i: usize, field: &str) -> Result<Option<u64>, String> {
if self.word(i, field)? == "-" {
return Ok(None);
}
Ok(Some(self.int(i, field, 0, 1 << 40)? as u64))
}
}
/// `x` as the save writes coordinates: centimetres are plenty for a flight, and keep the file small.
fn coord(x: f64) -> String {
format!("{x:.2}")
}
/// One run of the relief as the save writes it: `u<run>` for unknown land, `<height>x<run>` for known.
fn run_token(height: Option<i32>, run: usize) -> String {
height.map_or_else(|| format!("u{run}"), |h| format!("{h}x{run}"))
}
fn tick(x: Option<u64>) -> String {
x.map_or_else(|| "-".into(), |v| v.to_string())
}
fn intent_of(key: &str) -> Option<ew::Intent> {
ew::Intent::from_key(key)
}
fn flight_key(f: Flight) -> &'static str {
match f {
Flight::Cruise => "cruise",
Flight::Dive => "dive",
Flight::Ballistic => "ballistic",
Flight::Falling => "falling",
}
}
fn flight_of(key: &str) -> Option<Flight> {
[Flight::Cruise, Flight::Dive, Flight::Ballistic, Flight::Falling].into_iter().find(|f| flight_key(*f) == key)
}
impl Drone {
/// The drone as one line of the save: its flight, its aim and intent, and its route.
fn air_line(&self, word: &str, lead: &str) -> String {
let mut route = String::from("-");
if !self.route.is_empty() {
route = self.route.len().to_string();
for p in &self.route {
route += &format!(" {} {} {}", coord(p.x), coord(p.y), coord(p.z));
}
}
format!(
"{word} {lead}{id} {kind} {} {} {} {} {} {} {} {} {} {flight} {intent} {unit} {since} {switches} {conf} {} {} {} {age} {engaged} {sector} {low} {jammed} {smart} {hold} {} {} {} {route}",
coord(self.pos.x),
coord(self.pos.y),
coord(self.pos.z),
coord(self.vel.x),
coord(self.vel.y),
coord(self.vel.z),
coord(self.target.x),
coord(self.target.y),
coord(self.target.z),
coord(self.err.x),
coord(self.err.y),
coord(self.err.z),
if self.pace.best.is_finite() { coord(self.pace.best) } else { "-".into() },
self.pace.at,
if self.pace.route == usize::MAX { "-".to_string() } else { self.pace.route.to_string() },
kind = self.kind.spec().key,
flight = flight_key(self.flight),
intent = self.intent.key(),
unit = self.aim.unit,
since = self.aim.since,
switches = self.aim.switches,
conf = self.aim.confidence.map_or("-", |c| c.name()),
age = self.age,
engaged = self.engaged,
sector = self.sector,
low = self.low,
jammed = self.jammed,
smart = self.smart,
hold = self.hold,
id = self.id,
)
}
}
impl Sim {
/// A cheap shape of the air state for the autosave's dirty check: a launch, a loss, a new or
/// finished job changes it, a drone's own progress through the sky does not. A save takes the
/// air state at those moments, not on every tick of a flight (#127).
pub fn air_mark(&self) -> u64 {
let drones = self.drones.iter().filter(|d| d.alive()).count() as u64;
drones
^ (self.queue.len() as u64) << 12
^ (self.retargets.len() as u64) << 24
^ (self.intel.contacts().len() as u64) << 36
^ (self.job_next as u64) << 48
}
/// The air section of the state text: `None` when there is nothing to keep (an empty sky and no
/// picture), so a save of a quiet world does not grow. Every pending job's drone is written with
/// it, together with the picture and the relief versions the job still plans over (#127).
pub fn air_text(&self) -> Option<String> {
// What the parser accepts is what is written: a save this build writes always reads back.
let contacts: Vec<ew::Contact> = self.intel.contacts().values().copied().take(MAX_CONTACTS).collect();
let drones: Vec<&Drone> = self.drones.iter().filter(|d| d.alive()).take(MAX_DRONES).collect();
let queued: Vec<&(u64, Drone)> = self.queue.iter().take(MAX_DRONES).collect();
// The relief versions still referenced: the global one and every pending job's. They are
// resolved before the drone lines so the head is fixed while the body's size is measured.
let mut reliefs: Vec<std::sync::Arc<ew::KnownRelief>> = Vec::new();
let token_of = |r: &std::sync::Arc<ew::KnownRelief>, reliefs: &mut Vec<std::sync::Arc<ew::KnownRelief>>| -> Option<usize> {
let at = std::sync::Arc::as_ptr(r) as usize;
if let Some(i) = reliefs.iter().position(|x| std::sync::Arc::as_ptr(x) as usize == at) {
return Some(i);
}
if reliefs.len() >= MAX_RELIEFS {
return None;
}
reliefs.push(std::sync::Arc::clone(r));
Some(reliefs.len() - 1)
};
let global = self.known_relief.as_ref().and_then(|r| token_of(r, &mut reliefs));
let job_relief: Vec<Option<usize>> = self.retargets.iter().map(|j| j.relief.as_ref().and_then(|r| token_of(r, &mut reliefs))).collect();
let (kills, hits) = self.intel.sectors();
// The head, with the counts filled in later; its length is what the body is measured against.
let mut head = format!("air {VERSION} {} {} 0 0 0 {} {}\n", self.tick, self.job_next, contacts.len(), reliefs.len());
head += "airintel";
for v in kills.iter().chain(hits.iter()) {
head += &format!(" {v}");
}
head += "\n";
head += &format!("airglobal {}\n", global.map_or_else(|| "-".into(), |t| t.to_string()));
for (i, r) in reliefs.iter().enumerate() {
let g = r.grid();
let mut line = format!("airrelief {i} {} {} {} {} ", coord(g.min.x), coord(g.min.z), coord(g.cell), g.size);
let mut run: Option<(Option<i32>, usize)> = None;
for h in r.heights() {
let key = h.is_finite().then(|| h.round() as i32);
match run {
Some((k, n)) if k == key => run = Some((k, n + 1)),
Some((k, n)) => {
line += &format!("{} ", run_token(k, n));
run = Some((key, 1));
}
None => run = Some((key, 1)),
}
}
if let Some((k, n)) = run {
line += &run_token(k, n);
}
head += &line;
head += "\n";
}
for c in &contacts {
head += &format!(
"aircontact {} {} {} {} {} {} {} {} {} {}\n",
c.id,
c.kind.spec().key,
coord(c.at.x),
coord(c.at.y),
coord(c.at.z),
c.tick,
c.seen.name(),
tick(c.emission),
tick(c.destroyed),
c.launches
);
}
// The bodies go in while the section stays inside its byte bound; a drone left out takes its
// job with it (a job whose drone is not saved could never be restored).
let mut body = String::new();
let mut saved: std::collections::HashSet<u32> = std::collections::HashSet::new();
let fits = |head: &str, body: &str, line: &str| head.len() + 32 + body.len() + line.len() <= MAX_BYTES;
let mut drone_count = 0usize;
for d in &drones {
let line = d.air_line("airdrone", "");
if !fits(&head, &body, &line) {
break;
}
body += &line;
body += "\n";
saved.insert(d.id);
drone_count += 1;
}
let mut queued_count = 0usize;
for (at, d) in &queued {
let line = d.air_line("airqueue", &format!("{at} "));
if !fits(&head, &body, &line) {
break;
}
body += &line;
body += "\n";
saved.insert(d.id);
queued_count += 1;
}
let units: std::collections::HashSet<u32> = contacts.iter().map(|c| c.id).collect();
let jobs: Vec<(&ew::RouteJob, Option<usize>)> = self
.retargets
.iter()
.zip(job_relief)
.filter(|(j, _)| saved.contains(&j.drone) && (j.unit == 0 || units.contains(&j.unit)))
.collect();
if drone_count == 0 && queued_count == 0 && jobs.is_empty() && contacts.is_empty() {
return None;
}
let head = head.replacen(
&format!("air {VERSION} {} {} 0 0 0 ", self.tick, self.job_next),
&format!("air {VERSION} {} {} {drone_count} {queued_count} {} ", self.tick, self.job_next, jobs.len()),
1,
);
let mut text = head;
text += &body;
for (job, relief) in jobs {
text += &format!(
"airjob {} {} {} {} {} {} {} {} {} {}\n",
job.id,
job.drone,
coord(job.aim.x),
coord(job.aim.y),
coord(job.aim.z),
job.unit,
job.version,
job.priority(),
job.intent.key(),
relief.map_or_else(|| "-".into(), |t| t.to_string())
);
}
Some(text)
}
/// Reads the air section of `text` (the lines `air_text` writes). `None` when the text has none:
/// an older save, restored with an empty sky as before. Everything is checked before it is used.
pub fn parse_air(text: &str) -> Result<Option<AirSave>, String> {
let lines: Vec<(usize, Vec<&str>)> = text
.lines()
.enumerate()
.map(|(n, raw)| (n + 1, raw.split_whitespace().collect::<Vec<_>>()))
.collect();
let heads: Vec<&(usize, Vec<&str>)> = lines.iter().filter(|(_, w)| w.first() == Some(&"air")).collect();
let Some((head_n, head)) = heads.first().copied() else {
// Lines of a section whose header is gone are a corrupt file, not an old save.
if let Some((n, w)) = lines.iter().find(|(_, w)| w.first().is_some_and(|w| w.starts_with("air"))) {
return Err(format!("строка {n}: «{}», воздушная часть без заголовка air", w[0]));
}
return Ok(None);
};
if heads.len() > 1 {
return Err(format!("строка {}: воздушная часть записана дважды", heads[1].0));
}
let l = Line { n: *head_n, word: "air", w: head.clone() };
if head.len() != 9 {
return Err(l.bad("заголовок", "нужны версия, такт, счётчики и число версий рельефа"));
}
let version = l.int(1, "версия воздушной части", 0, 1 << 30)? as u32;
if version != VERSION {
return Err(l.bad("версия воздушной части", &format!("эта сборка читает только {VERSION}")));
}
let tick = l.int(2, "такт", 0, 1 << 40)?.max(0) as u64;
let job_next = l.int(3, "номер задания", 0, 1 << 30)? as u32;
let n_drones = l.count(4, "дроны", MAX_DRONES)?;
let n_queue = l.count(5, "очередь запуска", MAX_DRONES)?;
let n_jobs = l.count(6, "задания", ew::JOBS_MAX)?;
let n_contacts = l.count(7, "контакты", MAX_CONTACTS)?;
let n_reliefs = l.count(8, "версии рельефа", MAX_RELIEFS)?;
// Every line of the section, and nothing else: a truncated or foreign line is refused.
let mut intel: Option<[u32; ew::SECTORS * 2]> = None;
let mut global: Option<usize> = None;
let mut reliefs: Vec<Option<std::sync::Arc<ew::KnownRelief>>> = vec![None; n_reliefs];
let mut contacts: BTreeMap<u32, ew::Contact> = BTreeMap::new();
let mut drones: BTreeMap<u32, Drone> = BTreeMap::new();
let mut queue: Vec<(u64, Drone)> = Vec::new();
let mut jobs: Vec<JobRec> = Vec::new();
for (n, w) in &lines {
if w.first() == Some(&"air") {
continue;
}
let Some(&word) = w.first() else { continue };
if !word.starts_with("air") {
continue;
}
let l = Line { n: *n, word, w: w.clone() };
match word {
"airintel" => {
if w.len() != 1 + ew::SECTORS * 2 {
return Err(l.bad("счётчики секторов", &format!("нужны {} чисел", ew::SECTORS * 2)));
}
let mut v = [0u32; ew::SECTORS * 2];
for (i, slot) in v.iter_mut().enumerate() {
*slot = l.int(i + 1, "счётчики секторов", 0, 1 << 30)? as u32;
}
intel = Some(v);
}
"airglobal" => {
if w.len() != 2 {
return Err(l.bad("рельеф", "нужна одна ссылка на версию рельефа"));
}
let t = l.word(1, "рельеф")?;
if t != "-" {
let at = l.count(1, "рельеф", MAX_RELIEFS)?;
if at >= n_reliefs {
return Err(l.bad("рельеф", "ссылка на неписаную версию"));
}
global = Some(at);
}
}
"airrelief" => {
let at = l.count(1, "номер рельефа", MAX_RELIEFS)?;
if at >= n_reliefs {
return Err(l.bad("номер рельефа", "больше объявленных"));
}
let grid = raid::Grid {
min: DVec3::new(l.num(2, "рельеф X")?, 0.0, l.num(3, "рельеф Z")?),
cell: l.num(4, "размер клетки")?,
size: l.int(5, "сторона сетки", 1, 400)? as i32,
};
if grid.cell <= 0.0 {
return Err(l.bad("размер клетки", "должен быть больше нуля"));
}
let cells = (grid.size * grid.size) as usize;
if cells > MAX_CELLS {
return Err(l.bad("рельеф", &format!("{cells} клеток больше {MAX_CELLS}")));
}
let mut heights = Vec::with_capacity(cells);
for t in &w[6..] {
// `u<run>` is unknown land, `<height>x<run>` a known height repeated.
let (h, run) = if let Some(n) = t.strip_prefix('u') {
(f32::NAN, n)
} else {
let Some((head, n)) = t.split_once('x') else {
return Err(l.bad("рельеф", &format!("«{t}» не повтор высоты")));
};
let v: i32 = head.parse().map_err(|_| l.bad("рельеф", &format!("«{head}» не высота")))?;
(v as f32, n)
};
let run: usize = run.parse().map_err(|_| l.bad("рельеф", "длина повтора не число"))?;
if run == 0 || run > cells {
return Err(l.bad("рельеф", &format!("повтор {run} вне 1..{cells}")));
}
if heights.len() + run > cells {
return Err(l.bad("рельеф", "повторы длиннее сетки"));
}
heights.extend(std::iter::repeat_n(h, run));
}
if heights.len() != cells {
return Err(l.bad("рельеф", "повторы не покрывают сетку"));
}
if reliefs[at].is_some() {
return Err(l.bad("номер рельефа", "версия записана дважды"));
}
reliefs[at] = Some(std::sync::Arc::new(ew::KnownRelief::new(grid, heights)));
}
"aircontact" => {
if w.len() != 11 {
return Err(l.bad("контакт", "нужны 10 полей наблюдения"));
}
let id = l.int(1, "номер юнита", 0, 1 << 30)? as u32;
let kind = SamKind::from_key(l.word(2, "тип")?).ok_or_else(|| l.bad("тип", "неизвестный тип"))?;
let at = DVec3::new(l.num(3, "контакт X")?, l.num(4, "контакт Y")?, l.num(5, "контакт Z")?);
let seen = ew::Seen::from_key(l.word(7, "канал")?).ok_or_else(|| l.bad("канал", "launch, emission или jamming"))?;
let c = ew::Contact {
id,
kind,
at,
tick: l.int(6, "такт наблюдения", 0, tick as i64)? as u64,
seen,
emission: l.opt_tick(8, "фиксация эмиссии")?,
destroyed: l.opt_tick(9, "наблюдённое уничтожение")?,
launches: l.int(10, "наблюдённые пуски", 0, u16::MAX as i64)? as u16,
};
if contacts.insert(id, c).is_some() {
return Err(l.bad("номер юнита", "контакт записан дважды"));
}
}
"airdrone" | "airqueue" => {
let at = if word == "airqueue" { Some(l.int(1, "такт запуска", 0, 1 << 40)? as u64) } else { None };
let (d, end) = parse_drone(&l, if at.is_some() { 2 } else { 1 })?;
if w.len() != end {
return Err(l.bad("дрон", "лишние поля"));
}
if at.is_some() {
queue.push((at.unwrap(), d));
} else if drones.insert(d.id, d).is_some() {
return Err(l.bad("номер дрона", "дрон записан дважды"));
}
}
"airjob" => {
if w.len() != 11 {
return Err(l.bad("задание", "нужны 9 полей задания"));
}
let id = l.int(1, "номер задания", 0, 1 << 30)? as u32;
let drone = l.int(2, "дрон задания", 0, 1 << 30)? as u32;
let aim = DVec3::new(l.num(3, "цель X")?, l.num(4, "цель Y")?, l.num(5, "цель Z")?);
let unit = l.int(6, "юнит", 0, 1 << 30)? as u32;
let version = l.int(7, "версия знаний", 0, tick as i64)? as u64;
let priority = l.int(8, "приоритет", 0, 9)? as u8;
let intent = intent_of(l.word(9, "намерение")?).ok_or_else(|| l.bad("намерение", "plan, sead, react или replace"))?;
if priority != intent.priority() {
return Err(l.bad("приоритет", "не совпадает с намерением"));
}
let relief = match l.word(10, "рельеф")? {
"-" => None,
t => {
let at = t.parse::<usize>().map_err(|_| l.bad("рельеф", "не номер версии"))?;
if at >= n_reliefs {
return Err(l.bad("рельеф", "ссылка на неписаную версию"));
}
reliefs[at].clone()
}
};
jobs.push(JobRec { id, drone, aim, unit, version, intent, relief });
}
other => return Err(l.bad("строка", &format!("неизвестная строка воздушной части «{other}»"))),
}
}
// The counts are the file's own promise: a section cut short is refused, not half-restored.
if contacts.len() != n_contacts {
return Err(format!("воздушная часть: контактов {} вместо {n_contacts}", contacts.len()));
}
if drones.len() != n_drones {
return Err(format!("воздушная часть: дронов {} вместо {n_drones}", drones.len()));
}
if queue.len() != n_queue {
return Err(format!("воздушная часть: очередь {} вместо {n_queue}", queue.len()));
}
if jobs.len() != n_jobs {
return Err(format!("воздушная часть: заданий {} вместо {n_jobs}", jobs.len()));
}
if reliefs.iter().any(Option::is_none) {
return Err("воздушная часть: объявленная версия рельефа не записана".into());
}
let mut seen_drones: std::collections::HashSet<u32> = drones.keys().copied().collect();
for (_, d) in &queue {
if !seen_drones.insert(d.id) {
return Err("воздушная часть: дрон записан и в небе, и в очереди".into());
}
}
if let Some(g) = global && reliefs[g].is_none() {
return Err("воздушная часть: глобальный рельеф не записан".into());
}
let intel = intel.ok_or("воздушная часть: нет счётчиков секторов")?;
let mut kills = [0u32; ew::SECTORS];
let mut hits = [0u32; ew::SECTORS];
kills.copy_from_slice(&intel[..ew::SECTORS]);
hits.copy_from_slice(&intel[ew::SECTORS..]);
Ok(Some(AirSave {
tick,
job_next,
kills,
hits,
contacts: contacts.into_values().collect(),
drones: drones.into_values().collect(),
queue,
jobs,
known_relief: global.and_then(|g| reliefs[g].clone()),
}))
}
/// Puts a checked air section back: the drones, the launch queue, the jobs (with the picture and
/// relief of each version) and the contacts. Stale jobs are cancelled, the queue is bounded, and a
/// job whose drone, aim or unit no longer stands is dropped — a restored job is never a ghost.
/// The live air state is replaced, never merged: what the sky held before the load goes.
pub fn restore_air(&mut self, save: AirSave) -> u32 {
self.tick = save.tick;
// New jobs must not reuse an id a restored job already holds.
let highest = save.jobs.iter().map(|j| j.id).max().unwrap_or(0);
self.job_next = save.job_next.max(1).max(highest.saturating_add(1));
self.intel = ew::Intel::restore(save.contacts.clone(), save.kills, save.hits);
self.known_relief = save.known_relief;
self.drones = save.drones;
self.queue = save.queue;
self.retargets.clear();
// A job's picture is its version's: the contacts observed no later than it, plus its own
// target (whose last saved observation stands in for one made after the version).
let mut by_version: HashMap<u64, std::sync::Arc<Vec<ew::Contact>>> = HashMap::new();
for rec in save.jobs {
let known = by_version.entry(rec.version).or_insert_with(|| {
let picture: Vec<ew::Contact> = save
.contacts
.iter()
.filter(|c| c.tick <= rec.version || c.id == rec.unit)
.copied()
.collect();
std::sync::Arc::new(picture)
});
let job = ew::RouteJob::restored(rec.id, rec.drone, rec.aim, rec.unit, rec.version, rec.intent, std::sync::Arc::clone(known), rec.relief);
self.retargets.push_back(job);
}
// Jobs the saved picture no longer stands behind, and anything past the bound, go now.
self.prune_air()
}
}
/// One drone's line (after its word and, for the queue, its launch tick). Returns the drone and the
/// number of words the body took.
fn parse_drone(l: &Line, first: usize) -> Result<(Drone, usize), String> {
let id = l.int(first, "номер дрона", 1, 1 << 30)? as u32;
let kind = DroneKind::from_key(l.word(first + 1, "тип дрона")?).ok_or_else(|| l.bad("тип дрона", "неизвестный тип"))?;
let pos = DVec3::new(l.num(first + 2, "дрон X")?, l.num(first + 3, "дрон Y")?, l.num(first + 4, "дрон Z")?);
let vel = DVec3::new(l.num(first + 5, "скорость X")?, l.num(first + 6, "скорость Y")?, l.num(first + 7, "скорость Z")?);
let target = DVec3::new(l.num(first + 8, "цель X")?, l.num(first + 9, "цель Y")?, l.num(first + 10, "цель Z")?);
let flight = flight_of(l.word(first + 11, "полёт")?).ok_or_else(|| l.bad("полёт", "cruise, dive, ballistic или falling"))?;
let intent = intent_of(l.word(first + 12, "намерение")?).ok_or_else(|| l.bad("намерение", "plan, sead, react или replace"))?;
let unit = l.int(first + 13, "юнит намерения", 0, 1 << 30)? as u32;
let since = l.int(first + 14, "такт выбора цели", 0, 1 << 40)? as u64;
let switches = l.int(first + 15, "переключения", 0, u16::MAX as i64)? as u16;
let conf = match l.word(first + 16, "уверенность")? {
"-" => None,
key => Some(ew::Confidence::from_key(key).ok_or_else(|| l.bad("уверенность", "doubtful, probable или confirmed"))?),
};
let err = DVec3::new(l.num(first + 17, "ошибка X")?, l.num(first + 18, "ошибка Y")?, l.num(first + 19, "ошибка Z")?);
let age = l.int(first + 20, "возраст", 0, 1 << 30)? as u32;
let engaged = l.int(first + 21, "обстрелян", 0, 1 << 20)? as u32;
let sector = l.int(first + 22, "сектор", 0, ew::SECTORS as i64)? as u8;
let low = l.flag(first + 23, "низко")?;
let jammed = l.flag(first + 24, "подавлен")?;
let smart = l.flag(first + 25, "умный")?;
let hold = l.int(first + 26, "задержка", 0, u16::MAX as i64)? as u16;
let best = match l.word(first + 27, "лучшее приближение")? {
"-" => f64::INFINITY,
_ => l.num(first + 27, "лучшее приближение")?,
};
let pat = l.int(first + 28, "такт приближения", 0, 1 << 30)? as u32;
let proute = match l.word(first + 29, "точек приближения")? {
"-" => usize::MAX,
_ => l.count(first + 29, "точек приближения", MAX_ROUTE)?,
};
let mut at = first + 30;
let mut route = Vec::new();
if l.word(at, "маршрут")? != "-" {
let n = l.count(at, "точек маршрута", MAX_ROUTE)?;
at += 1;
for _ in 0..n {
route.push(DVec3::new(l.num(at, "маршрут X")?, l.num(at + 1, "маршрут Y")?, l.num(at + 2, "маршрут Z")?));
at += 3;
}
} else {
at += 1;
}
let drone = Drone {
id,
kind,
pos,
vel,
target,
flight,
roll: 0.0,
spin: 0.0,
age,
engaged,
route,
low,
jammed,
sector,
smart,
nav: Nav::default(),
err,
intent,
aim: ew::Aim { unit, since, switches, confidence: conf },
hold,
pace: Pace { best, at: pat, route: proute },
};
Ok((drone, at))
}
/// The jobs' priorities and intents as the report words them (tests and diagnostics).
#[cfg(test)]
impl Sim {
pub(super) fn pending_intents(&self) -> Vec<(u32, ew::Intent)> {
self.retargets.iter().map(|j| (j.id, j.intent)).collect()
}
}
#[cfg(test)]
mod durable_tests {
use super::*;
fn contact(id: u32, kind: SamKind, at: DVec3, tick: u64, seen: ew::Seen, launches: u16) -> ew::Contact {
ew::Contact { id, kind, at, tick, seen, emission: Some(tick), destroyed: None, launches }
}
/// A small force, a few known contacts and a relief version, as a smart raid leaves them.
fn raid_state(seed: u64) -> Sim {
let mut sim = Sim::new(seed);
let grid = raid::Grid { min: DVec3::new(-1024.0, 0.0, -1024.0), cell: 32.0, size: 64 };
let mut heights = vec![71.0f32; (grid.size * grid.size) as usize];
for i in 0..8 {
heights[(i * grid.size + 3) as usize] = f32::NAN;
}
sim.known_relief = Some(std::sync::Arc::new(ew::KnownRelief::new(grid, heights)));
let mut ids = Vec::new();
for (k, kind) in [SamKind::S400, SamKind::Radar, SamKind::Ew].into_iter().enumerate() {
let id = sim.id();
let at = DVec3::new(-400.0 + k as f64 * 400.0, 70.0, 0.0);
let c = contact(id, kind, at, 10, if kind == SamKind::Ew { ew::Seen::Jamming } else { ew::Seen::Emission }, k as u16);
sim.intel = ew::Intel::restore([c].to_vec(), [0; ew::SECTORS], [0; ew::SECTORS]);
ids.push(id);
}
sim.intel = ew::Intel::restore(
ids.iter().enumerate().map(|(k, id)| contact(*id, [SamKind::S400, SamKind::Radar, SamKind::Ew][k], DVec3::new(-400.0 + k as f64 * 400.0, 70.0, 0.0), 10, ew::Seen::Emission, k as u16)).collect(),
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
);
sim.tick = 120;
sim.job_next = 7;
// One drone in the air with a route and an aim, one still on the ground.
let mut flying = sim.make_drone(DroneKind::Kh22, DVec3::new(-900.0, 130.0, -300.0), DVec3::X, DVec3::new(-400.0, 70.0, 0.0));
flying.smart = true;
flying.intent = ew::Intent::React;
flying.aim = ew::Aim::unit(ids[0], 100, ew::Confidence::Confirmed);
flying.target = DVec3::new(-400.0, 70.0, 0.0) + flying.err;
flying.route = vec![DVec3::new(-900.0, 70.0, -300.0), DVec3::new(-600.0, 70.0, -100.0), DVec3::new(-400.0, 70.0, 0.0)];
flying.low = true;
flying.jammed = true;
flying.sector = 5;
flying.age = 77;
sim.drones.push(flying);
let mut queued = sim.make_drone(DroneKind::Geran3, DVec3::new(-1000.0, 90.0, 200.0), DVec3::X, DVec3::new(400.0, 70.0, 0.0));
queued.smart = true;
queued.intent = ew::Intent::Sead;
queued.aim = ew::Aim::unit(ids[1], 110, ew::Confidence::Probable);
queued.route = vec![DVec3::new(-1000.0, 70.0, 200.0), DVec3::new(400.0, 70.0, 0.0)];
let queued_id = queued.id;
sim.queue.push((300, queued));
// Two pending jobs: one of the plan, one a replacement, both with their own version.
let job = |id, drone, aim, unit, version, intent| {
ew::RouteJob::restored(id, drone, aim, unit, version, intent, std::sync::Arc::new(sim.intel.contacts().values().copied().collect()), sim.known_relief.clone())
};
sim.retargets.push_back(job(5, sim.drones[0].id, sim.drones[0].target, ids[0], 100, ew::Intent::React));
let queued_target = sim.queue[0].1.target;
sim.retargets.push_back(job(6, queued_id, queued_target, ids[1], 120, ew::Intent::Replace));
sim
}
#[test]
fn the_air_state_round_trips_every_job_field() {
let sim = raid_state(71);
let text = sim.air_text().expect("a raid state has something to keep");
let save = Sim::parse_air(&text).expect("the written section must read back").expect("the section is there");
let mut back = Sim::new(1);
back.restore_air(save);
assert_eq!(back.tick, sim.tick);
assert_eq!(back.job_next, sim.job_next);
assert_eq!(back.intel.sectors(), sim.intel.sectors());
assert_eq!(back.intel.contacts().len(), sim.intel.contacts().len());
for (id, c) in sim.intel.contacts() {
let b = back.intel.contacts().get(id).expect("a contact was lost");
assert_eq!(b.kind, c.kind);
assert!((b.at.distance(c.at)).abs() < 0.02 && b.tick == c.tick && b.seen == c.seen && b.launches == c.launches);
}
assert_eq!(back.drones.len(), 1);
let (a, b) = (&sim.drones[0], &back.drones[0]);
assert_eq!((a.id, a.kind, a.smart, a.intent, a.sector, a.age, a.low, a.jammed), (b.id, b.kind, b.smart, b.intent, b.sector, b.age, b.low, b.jammed));
assert_eq!((a.aim.unit, a.aim.since, a.aim.switches, a.aim.confidence), (b.aim.unit, b.aim.since, b.aim.switches, b.aim.confidence));
assert!(a.pos.distance(b.pos) < 0.02 && a.target.distance(b.target) < 0.02 && a.vel.distance(b.vel) < 0.02);
assert_eq!(a.route.len(), b.route.len());
assert!(a.route.iter().zip(&b.route).all(|(x, y)| x.distance(*y) < 0.02));
assert_eq!(back.queue.len(), 1);
assert_eq!(back.queue[0].0, 300);
let (qa, qb) = (&sim.queue[0].1, &back.queue[0].1);
assert_eq!((qa.id, qa.intent, qa.aim.unit), (qb.id, qb.intent, qb.aim.unit));
assert!(qa.route.iter().zip(&qb.route).all(|(x, y)| x.distance(*y) < 0.02));
// The jobs keep their ids, aims, units, versions, priorities and intents; so do their pictures
// (the same version shares one) and the land they plan over.
assert_eq!(back.retargets.len(), 2);
for (j, b) in sim.retargets.iter().zip(&back.retargets) {
assert_eq!((j.id, j.drone, j.unit, j.version, j.priority(), j.intent), (b.id, b.drone, b.unit, b.version, b.priority(), b.intent));
assert!(j.aim.distance(b.aim) < 0.02);
assert_eq!(j.relief.is_some(), b.relief.is_some());
}
let (ra, rb) = (sim.known_relief.as_ref().unwrap(), back.known_relief.as_ref().unwrap());
assert_eq!(ra.heights().len(), rb.heights().len());
assert!(ra.heights().iter().zip(rb.heights()).all(|(x, y)| (x.is_nan() && y.is_nan()) || x == y));
// Nothing is written for an empty sky.
assert!(Sim::new(3).air_text().is_none());
}
/// 40 smart drones, one adaptive tick, a bounded number of aims and jobs: the state a save is
/// taken in while routes are still being worked out.
fn pending_raid(seed: u64) -> Sim {
let mut sim = Sim::new(seed);
let mut contacts = Vec::new();
for k in 0..8 {
let id = sim.id();
contacts.push(contact(id, SamKind::S400, DVec3::new(-560.0 + k as f64 * 160.0, 70.0, -320.0), 0, ew::Seen::Emission, 0));
}
sim.intel = ew::Intel::restore(contacts, [0; ew::SECTORS], [0; ew::SECTORS]);
for i in 0..40 {
let from = DVec3::new(-1800.0, 100.0, -800.0 + i as f64 * 40.0);
let mut d = sim.make_drone(DroneKind::Kh22, from, DVec3::X, DVec3::new(1800.0, 70.0, 1800.0));
d.smart = true;
d.route = vec![from, DVec3::new(1800.0, 70.0, 1800.0)];
sim.queue.push((0, d));
}
sim.tick = 40;
sim.adapt();
sim
}
#[test]
fn a_pending_route_continues_after_a_save_and_a_load() {
let mut original = pending_raid(73);
assert!(!original.retargets.is_empty(), "the test no longer saves mid-queue");
let text = original.air_text().expect("a queued raid must be durable");
let mut restored = Sim::new(73);
restored.restore_air(Sim::parse_air(&text).unwrap().unwrap());
assert_eq!(restored.retargets.len(), original.retargets.len(), "the pending jobs did not survive the save");
assert_eq!(restored.retarget_route_state(), original.retarget_route_state(), "the restored jobs differ from the saved ones");
// Both go on: the same adaptive ticks, the same jobs finished, the same routes.
for _ in 0..400 {
original.tick += 1;
restored.tick += 1;
original.adapt();
restored.adapt();
assert_eq!(restored.retarget_route_state(), original.retarget_route_state(), "the restored queue drifted");
if original.retargets.is_empty() && restored.retargets.is_empty() && original.queue.iter().all(|(_, d)| d.aim.unit != 0) {
break;
}
}
assert!(original.retargets.is_empty() && restored.retargets.is_empty(), "the restored queue never finished");
// Every drone of the restored raid has a real route, and every aim it was given is one it planned.
assert!(restored.queue.iter().all(|(_, d)| !d.route.is_empty() && d.aim.unit != 0));
assert!(restored.queue.iter().all(|(_, d)| d.route.last().is_some_and(|p| p.distance(d.target) < 1e-6)));
}
// #127: the section has a byte bound of its own. A raid with more (and longer-routed) drones than a
// save can hold keeps as many as fit, and every job it writes belongs to a drone that was written.
#[test]
fn the_section_stays_inside_its_byte_bound() {
let mut sim = Sim::new(101);
for i in 0..600 {
let from = DVec3::new(-2000.0 + i as f64, 120.0, 0.0);
let mut d = sim.make_drone(DroneKind::Kh22, from, DVec3::X, DVec3::new(2000.0, 70.0, 0.0));
d.smart = true;
d.route = (0..200).map(|k| DVec3::new(-2000.0 + k as f64 * 20.0, 70.0, 0.0)).collect();
sim.drones.push(d);
}
let text = sim.air_text().expect("a sky full of drones is durable");
assert!(text.len() <= MAX_BYTES, "the section grew to {} bytes", text.len());
let save = Sim::parse_air(&text).expect("a bounded section must read back").unwrap();
assert!(save.drones.len() <= MAX_DRONES);
assert!(save.drones.len() > 100, "the bound left almost nothing");
}
#[test]
fn stale_ghost_and_duplicate_jobs_are_cancelled() {
let mut sim = pending_raid(79);
let kept = sim.retargets.len();
let some = sim.retargets[0].clone();
// A job for a drone that is not here.
sim.retargets.push_back(ew::RouteJob::restored(900, 999_999, DVec3::ZERO, 0, sim.tick, ew::Intent::Plan, std::sync::Arc::new(Vec::new()), None));
// A job whose aim is no longer its drone's.
let mut stale = some.clone();
stale.id = 901;
stale.aim += DVec3::X * 40.0;
sim.retargets.push_back(stale);
// An older duplicate for a drone that already has a newer job.
let mut older = some.clone();
older.id = 902;
older.version = sim.tick.saturating_sub(1);
sim.retargets.push_back(older);
// A job older than the TTL.
let mut old = sim.retargets[0].clone();
old.id = 903;
old.version = sim.tick.saturating_sub(ew::JOB_TTL + 1);
sim.retargets.push_back(old);
let cancelled = sim.prune_air();
assert_eq!(cancelled, 4, "the stale, ghost, duplicate and old jobs were not all cancelled");
assert_eq!(sim.retargets.len(), kept);
assert!(sim.retargets.iter().all(|j| j.id < 900));
}
#[test]
fn a_job_for_a_unit_the_picture_lost_is_cancelled_on_load() {
let sim = pending_raid(83);
let unit = sim.retargets[0].unit;
let text = sim.air_text().unwrap();
assert!(sim.intel.contacts().contains_key(&unit));
// Cut the job's unit out of the saved picture (and its count): the job cannot stand behind it.
let mut lines: Vec<String> = text.lines().map(str::to_string).collect();
let head = lines.iter().position(|l| l.starts_with("air ")).unwrap();
let mut w: Vec<String> = lines[head].split_whitespace().map(str::to_string).collect();
w[7] = (w[7].parse::<usize>().unwrap() - 1).to_string();
lines[head] = w.join(" ");
lines.retain(|l| !l.starts_with(&format!("aircontact {unit} ")));
let cut = lines.join("\n") + "\n";
let mut restored = Sim::new(83);
let cancelled = restored.restore_air(Sim::parse_air(&cut).expect("the cut section is still well formed").unwrap());
assert!(cancelled > 0, "a job for a unit the picture lost was kept");
assert!(restored.retargets.iter().all(|j| j.unit != unit), "the ghost job survived the load");
}
#[test]
fn a_damaged_air_section_is_refused_with_its_line_and_field() {
let sim = raid_state(89);
let text = sim.air_text().unwrap();
assert!(Sim::parse_air("sam s400 0 70 0 0\n").unwrap().is_none(), "an older save must read as an empty sky");
let e = Sim::parse_air(&text.replace("air 1 ", "air 2 ")).err().expect("a future version was accepted");
assert!(e.contains("версия"), "{e}");
let e = Sim::parse_air(&format!("{text}airbogus 1\n")).err().expect("a foreign line in the section was accepted");
assert!(e.contains("неизвестная строка"), "{e}");
// A count that does not match the lines is a cut-off file, refused rather than half restored.
let cut: String = text.lines().filter(|l| !l.starts_with("airjob ")).map(|l| format!("{l}\n")).collect();
let e = Sim::parse_air(&cut).err().expect("a cut-off section was accepted");
assert!(e.contains("заданий"), "{e}");
// A coordinate that is not a number, and a broken relief run, name their line.
let mut lines: Vec<String> = text.lines().map(str::to_string).collect();
let drone = lines.iter().position(|l| l.starts_with("airdrone ")).unwrap();
let mut w: Vec<String> = lines[drone].split_whitespace().map(str::to_string).collect();
w[3] = "NaN".into();
lines[drone] = w.join(" ");
let e = Sim::parse_air(&lines.join("\n")).err().expect("a non-finite coordinate was accepted");
assert!(e.contains(&format!("строка {}", drone + 1)) && e.contains("дрон X"), "{e}");
let e = Sim::parse_air(&text.replace("airrelief 0 ", "airrelief 0 x ")).err().expect("a broken relief line was accepted");
assert!(e.contains("рельеф"), "{e}");
}
}
#[cfg(test)]
impl Sim {
/// The pending jobs and the routes of their drones, for the save/restore comparison.
pub(super) fn retarget_route_state(&self) -> Vec<(u32, u32, u32, u64, u8, i64, Vec<(i64, i64, i64)>)> {
self.retargets
.iter()
.map(|j| {
let route = self
.queue
.iter()
.map(|(_, d)| d)
.chain(self.drones.iter())
.find(|d| d.id == j.drone)
.map(|d| d.route.iter().map(|p| ((p.x * 100.0).round() as i64, (p.y * 100.0).round() as i64, (p.z * 100.0).round() as i64)).collect())
.unwrap_or_default();
let q = |v: f64| (v * 100.0).round() as i64;
(j.id, j.drone, j.unit, j.version, j.priority(), q(j.aim.x), route)
})
.collect()
}
}
+1551 -77
View File
File diff suppressed because it is too large Load Diff
+218 -37
View File
@@ -4,14 +4,6 @@
//! reloads to the systems that wait, nearest first, and back.
use super::*;
/// How near a depot a system reloads straight from it.
const DEPOT_REACH: f64 = 60.0;
/// How near a truck must come to hand a reload over, or to load up at a depot.
const HANDOVER: f64 = 10.0;
/// What a truck carries.
const TRUCK_LOAD: u32 = 2;
const STOCK_LIMIT: u32 = 1_000_000;
impl Sim {
/// Whether ammunition is counted: a depot was set up (without one, magazines refill as
/// before). A destroyed depot still counts: losing the last one leaves the systems short,
@@ -127,41 +119,59 @@ impl Sim {
let at = truck.pos;
let truck_id = truck.id;
// A return is picked up physically; its cargo remains marked until a depot accepts it.
// The return keeps its priority only while it can actually proceed (#128): a carrier
// holding a reserved round needs a depot with room in reach, an empty one a system
// ready to hand a round over (whole, deployed, not claimed by another truck, a
// reachable route). A return that is merely claimed but impossible used to clear the
// job and stop the truck, starving independent supply requests; the claim now stays
// untouched and only real RM48U demand pulls the truck away from its watch.
let return_cargo = truck.return_cargo && truck.ground_stock > 0;
let can_pick = truck.ground_stock == 0 && truck.air_48n6_stock < TRUCK_LOAD;
let return_work = truck.return_cargo || (can_pick && self.sams.iter().any(|s| s.kind == SamKind::S400 && s.alive() && s.ground_return));
if return_work {
let taken: Vec<u32> = self.sams.iter().filter(|s| s.kind == SamKind::Tzm && s.alive() && s.id != truck_id).filter_map(|s| s.job).collect();
let target = if truck.return_cargo {
self.sams.iter().filter(|s| s.kind == SamKind::Depot && s.alive() && s.ground_stock < STOCK_LIMIT && !self.routes.out_of_reach(truck_id, s.id, now)).min_by(|a,b| a.pos.distance(at).total_cmp(&b.pos.distance(at)))
} else {
self.sams.iter().filter(|s| s.kind == SamKind::S400 && s.alive() && s.ground_return && s.ground_rounds > 0 && !s.moving() && s.preparing.is_none() && s.reloading == 0 && s.part(Part::Launcher) > 0.0 && !taken.contains(&s.id) && !self.routes.out_of_reach(truck_id, s.id, now)).min_by(|a,b| a.pos.distance(at).total_cmp(&b.pos.distance(at)))
}.map(|s| (s.id, s.pos));
self.sams[t].job = target.map(|x| x.0);
if let Some((id, to)) = target {
if at.distance(to) > HANDOVER {
let side = horizontal(at - to).normalize_or(DVec3::X) * (HANDOVER * 0.6);
self.order_move_near(t, to + side, 3.5);
} else if let Some(j) = self.sams.iter().position(|s| s.id == id) {
if self.sams[t].return_cargo {
self.sams[j].ground_stock += 1;
self.sams[t].ground_stock -= 1;
self.sams[t].return_cargo = false;
} else {
self.sams[j].ground_rounds -= 1;
self.sams[j].ground_return = false;
self.sams[t].ground_stock += 1;
self.sams[t].return_cargo = true;
if self.sams[t].air_48n6_stock > 0 && self.sams[j].missiles + self.sams[j].ground_rounds < self.sams[j].cells() {
self.sams[t].air_48n6_stock -= 1;
self.sams[j].missiles += 1;
}
let claim_pending = return_cargo || (can_pick && self.sams.iter().any(|s| s.kind == SamKind::S400 && s.alive() && s.ground_return));
let taken: Vec<u32> = self.sams.iter().filter(|s| s.kind == SamKind::Tzm && s.alive() && s.id != truck_id).filter_map(|s| s.job).collect();
let target = if return_cargo {
self.sams.iter().filter(|s| s.kind == SamKind::Depot && s.alive() && s.ground_stock < STOCK_LIMIT && !self.routes.out_of_reach(truck_id, s.id, now)).min_by(|a,b| a.pos.distance(at).total_cmp(&b.pos.distance(at)))
} else if can_pick {
self.sams.iter().filter(|s| s.kind == SamKind::S400 && s.alive() && s.ground_return && s.ground_rounds > 0 && !s.moving() && s.preparing.is_none() && s.reloading == 0 && s.part(Part::Launcher) > 0.0 && !taken.contains(&s.id) && !self.routes.out_of_reach(truck_id, s.id, now)).min_by(|a,b| a.pos.distance(at).total_cmp(&b.pos.distance(at)))
} else {
None
}.map(|s| (s.id, s.pos));
if let Some((id, to)) = target {
self.sams[t].job = Some(id);
if at.distance(to) > HANDOVER {
let side = horizontal(at - to).normalize_or(DVec3::X) * (HANDOVER * 0.6);
self.order_move_near(t, to + side, 3.5);
} else if let Some(j) = self.sams.iter().position(|s| s.id == id) {
if self.sams[t].return_cargo {
self.sams[j].ground_stock += 1;
self.sams[t].ground_stock -= 1;
self.sams[t].return_cargo = false;
} else {
self.sams[j].ground_rounds -= 1;
self.sams[j].ground_return = false;
self.sams[t].ground_stock += 1;
self.sams[t].return_cargo = true;
if self.sams[t].air_48n6_stock > 0 && self.sams[j].missiles + self.sams[j].ground_rounds < self.sams[j].cells() {
self.sams[t].air_48n6_stock -= 1;
self.sams[j].missiles += 1;
}
self.sams[t].job = None;
out.sound("minecraft:block.piston.extend", at, 1.5, 0.8);
}
self.sams[t].job = None;
out.sound("minecraft:block.piston.extend", at, 1.5, 0.8);
}
continue;
}
if claim_pending {
// The impossible return still outranks a mere stock run: without RM48U demand
// the truck holds its watch (and drops a stale job) exactly as before.
let supply_demand = (self.sams[t].ground_stock > 0 && self.sams.iter().any(|s| s.alive() && s.ground_request))
|| (self.sams.iter().any(|s| s.kind == SamKind::S400 && s.alive() && s.ground_request)
&& self.sams.iter().any(|s| s.kind == SamKind::Depot && s.alive() && s.ground_stock > 0));
if !supply_demand {
self.sams[t].job = None;
continue;
}
}
// Typed strike cargo takes precedence over generic reloads. Jobs are reconstructed
// after loading a save; the request and physical cargo survive independently.
let typed_work = truck.ground_stock > 0 || truck.air_48n6_stock > 0 ||
@@ -184,6 +194,8 @@ impl Sim {
let take = self.sams[t].ground_stock.min(STOCK_LIMIT - self.sams[j].ground_stock);
self.sams[j].ground_stock += take;
self.sams[t].ground_stock -= take;
// The last reserved round left the truck: nothing marks as return cargo any more.
if self.sams[t].ground_stock == 0 { self.sams[t].return_cargo = false; }
}
if self.sams[t].ground_stock == 0 && self.sams[j].ground_stock > 0 && self.sams[t].air_48n6_stock == 0 && self.sams.iter().any(|s| s.kind == SamKind::S400 && s.alive() && s.ground_request) {
self.sams[j].ground_stock -= 1;
@@ -196,6 +208,9 @@ impl Sim {
if self.sams[j].ground_rounds >= self.sams[j].cells() && self.sams[j].kind.spec().gun.is_none() { self.sams[j].empty = false; }
self.sams[j].ground_request = false;
self.sams[t].ground_stock -= 1;
// A round reserved for return redirected to a waiting request is no
// longer return cargo once the last one leaves the truck (#128).
if self.sams[t].ground_stock == 0 { self.sams[t].return_cargo = false; }
self.sams[t].air_48n6_stock += displaced;
out.sound("minecraft:block.piston.extend", at, 1.5, 0.8);
}
@@ -416,4 +431,170 @@ mod tests {
assert!(!sim.sams[1].ground_request);
}
/// Runs `step_supply`, jumping the truck beside its current job each tick so handovers
/// resolve without a full drive (movement itself is covered by the lib round-trip tests).
/// Fails after 200 ticks if `done` never holds.
fn serve_until(sim: &mut Sim, truck: usize, mut done: impl FnMut(&Sim) -> bool) {
let mut ok = false;
for _ in 0..200 {
if done(sim) { ok = true; break; }
if let Some(id) = sim.sams[truck].job()
&& let Some(j) = sim.sams.iter().position(|s| s.id == id)
{
sim.sams[truck].pos = sim.sams[j].pos;
}
sim.sams[truck].state = SamState::Search;
sim.tick += 1;
sim.step_supply(&mut Out::default());
}
assert!(ok, "condition not reached within 200 step_supply calls");
}
/// #128: a return that is claimed but cannot proceed (here: the returning system is on the
/// move) must not stop the free truck with job=None; an independent typed request is served.
/// The claim stays, the rounds are conserved, and once the system stops the return completes.
#[test]
fn a_moving_return_claim_does_not_starve_an_independent_supply_request() {
let mut sim = Sim::new(5);
for (kind, x) in [(SamKind::Depot, 0.0), (SamKind::S400, 40.0), (SamKind::S400, 160.0), (SamKind::Tzm, 0.0)] {
let id = sim.id(); sim.sams.push(Sam::new(id, kind, DVec3::new(x, 70.0, 0.0), 0.0));
}
let (depot, a, b, truck) = (0usize, 1usize, 2usize, 3usize);
let b_id = sim.sams[b].id;
sim.sams[depot].ground_stock = 2;
sim.sams[a].ground_rounds = 1;
sim.sams[a].missiles = 3;
sim.sams[a].ground_return = true;
sim.sams[b].ground_request = true;
assert!(sim.order_move(a, DVec3::new(400.0, 70.0, 0.0)));
// The free truck loads one RM48U at the depot and starts driving to B within 100 ticks;
// before the fix it entered the return branch, found the moving A impossible and idled.
let mut started = false;
for _ in 0..100 {
sim.tick += 1;
sim.step_supply(&mut Out::default());
if sim.sams[truck].job() == Some(b_id) { started = true; break; }
}
assert!(started, "truck never started the delivery to B");
// The claim and the rounds are untouched by the fallback.
assert!(sim.sams[a].ground_return);
assert_eq!(sim.sams[a].ground_rounds, 1);
assert_eq!((sim.sams[depot].ground_stock, sim.sams[truck].ground_stock), (1, 1));
assert_eq!(sim.sams[depot].ground_stock + sim.sams[truck].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
// Hand the round over to B; the full drive is exercised in the lib round-trip test.
serve_until(&mut sim, truck, |s| s.sams[b].ground_rounds == 1);
assert!(!sim.sams[b].ground_request);
assert_eq!((sim.sams[b].missiles, sim.sams[truck].air_48n6_stock), (3, 1));
assert_eq!(sim.sams[depot].ground_stock + sim.sams[truck].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
// No request is left, so the truck holds its watch (a stock run aside): the pending
// return still outranks it and the claim survives.
for _ in 0..20 { sim.tick += 1; sim.step_supply(&mut Out::default()); }
assert!(sim.sams[a].ground_return);
assert_eq!(sim.sams[a].ground_rounds, 1);
// A stops: the actual return is picked up and driven back to the depot.
sim.sams[a].state = SamState::Search;
sim.sams[a].dest = None;
serve_until(&mut sim, truck, |s| s.sams[truck].return_cargo);
assert!(!sim.sams[a].ground_return);
assert_eq!((sim.sams[a].ground_rounds, sim.sams[a].missiles), (0, 4));
assert_eq!((sim.sams[truck].ground_stock, sim.sams[truck].air_48n6_stock), (1, 0));
serve_until(&mut sim, truck, |s| s.sams[depot].ground_stock == 2);
assert!(!sim.sams[truck].return_cargo);
assert_eq!((sim.sams[depot].ground_stock, sim.sams[truck].ground_stock, sim.sams[b].ground_rounds), (2, 0, 1));
assert_eq!(sim.sams[depot].ground_stock + sim.sams[truck].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
}
/// #128 variant: the pickup is already claimed by another truck, so for this one the return
/// is impossible; it must turn to the waiting request instead of idling with job=None. A
/// dropped job (as after loading a save) is rebuilt, damaged trucks wait, and the repaired
/// claiming truck keeps the priority of the now executable return over the request.
#[test]
fn a_return_claimed_by_another_truck_leaves_the_supply_to_the_second_one() {
let mut sim = Sim::new(7);
for (kind, x) in [(SamKind::Depot, 0.0), (SamKind::S400, 160.0), (SamKind::S400, 200.0), (SamKind::Tzm, 0.0), (SamKind::Tzm, 150.0)] {
let id = sim.id(); sim.sams.push(Sam::new(id, kind, DVec3::new(x, 70.0, 0.0), 0.0));
}
let (depot, a, b, t2, t1) = (0usize, 1usize, 2usize, 3usize, 4usize);
let (a_id, b_id) = (sim.sams[a].id, sim.sams[b].id);
sim.sams[depot].ground_stock = 2;
sim.sams[a].ground_rounds = 1;
sim.sams[a].missiles = 3;
sim.sams[a].ground_return = true;
sim.sams[b].ground_request = true;
// The first truck claimed A's pickup earlier; both trucks start damaged: nothing
// moves, no round is lost, the claim waits.
sim.sams[t1].job = Some(a_id);
sim.sams[t1].comps.0[Part::Tracks as usize] = 0.0;
sim.sams[t2].comps.0[Part::Tracks as usize] = 0.0;
for _ in 0..30 { sim.tick += 1; sim.step_supply(&mut Out::default()); }
assert_eq!(sim.sams[t2].job(), None);
assert_eq!((sim.sams[depot].ground_stock, sim.sams[b].ground_rounds), (2, 0));
assert!(sim.sams[a].ground_return);
assert_eq!(sim.sams[depot].ground_stock + sim.sams[t1].ground_stock + sim.sams[t2].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
// Repaired, the second truck must not idle on the claimed return: depot first, then B.
sim.sams[t2].comps.0[Part::Tracks as usize] = 1.0;
let mut started = false;
for _ in 0..100 {
sim.tick += 1;
sim.step_supply(&mut Out::default());
if sim.sams[t2].job() == Some(b_id) { started = true; break; }
}
assert!(started, "second truck never started the delivery to B");
assert_eq!((sim.sams[depot].ground_stock, sim.sams[t2].ground_stock), (1, 1));
assert!(sim.sams[a].ground_return, "claimed return must survive the fallback");
// A save/load drops the job; the request and the cargo survive and the job is rebuilt.
sim.sams[t2].job = None;
serve_until(&mut sim, t2, |s| s.sams[t2].job() == Some(b_id));
// The claiming truck is repaired: the executable return has priority over the request,
// and the still-hauling second truck is not diverted from B.
sim.sams[t1].comps.0[Part::Tracks as usize] = 1.0;
serve_until(&mut sim, t1, |s| s.sams[t1].return_cargo);
assert!(!sim.sams[a].ground_return);
assert_eq!(sim.sams[a].ground_rounds, 0);
assert_eq!(sim.sams[t2].job(), Some(b_id), "hauling truck must keep its supply job");
// B gets its round; the displaced air round rides along.
serve_until(&mut sim, t2, |s| s.sams[b].ground_rounds == 1);
assert_eq!((sim.sams[b].missiles, sim.sams[t2].air_48n6_stock), (3, 1));
assert_eq!(sim.sams[depot].ground_stock + sim.sams[t1].ground_stock + sim.sams[t2].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
// And the picked-up return reaches the depot: everything is back except B's new round.
serve_until(&mut sim, t1, |s| s.sams[depot].ground_stock == 2);
assert!(!sim.sams[t1].return_cargo);
assert_eq!((sim.sams[depot].ground_stock, sim.sams[t1].ground_stock, sim.sams[b].ground_rounds), (2, 0, 1));
}
/// #128 variant: the route to the returning system is marked unreachable, so the return is
/// impossible for now; the truck serves the request, and the return completes once the
/// route is passable again and the system is still waiting with its claim.
#[test]
fn an_unreachable_route_falls_back_to_supply_until_it_expires() {
let mut sim = Sim::new(9);
for (kind, x) in [(SamKind::Depot, 0.0), (SamKind::S400, 40.0), (SamKind::S400, 160.0), (SamKind::Tzm, 0.0)] {
let id = sim.id(); sim.sams.push(Sam::new(id, kind, DVec3::new(x, 70.0, 0.0), 0.0));
}
let (depot, a, b, truck) = (0usize, 1usize, 2usize, 3usize);
let (a_id, b_id) = (sim.sams[a].id, sim.sams[b].id);
sim.sams[depot].ground_stock = 2;
sim.sams[a].ground_rounds = 1;
sim.sams[a].missiles = 3;
sim.sams[a].ground_return = true;
sim.sams[b].ground_request = true;
sim.routes.unreachable.insert((sim.sams[truck].id, a_id), u64::MAX);
let mut started = false;
for _ in 0..100 {
sim.tick += 1;
sim.step_supply(&mut Out::default());
if sim.sams[truck].job() == Some(b_id) { started = true; break; }
}
assert!(started, "truck never started the delivery to B");
assert!(sim.sams[a].ground_return, "claim must survive the blocked route");
serve_until(&mut sim, truck, |s| s.sams[b].ground_rounds == 1);
// The route is passable again: the waiting claim is picked up and returned.
sim.routes.unreachable.clear();
serve_until(&mut sim, truck, |s| s.sams[truck].return_cargo);
assert!(!sim.sams[a].ground_return);
serve_until(&mut sim, truck, |s| s.sams[depot].ground_stock == 2);
assert!(!sim.sams[truck].return_cargo);
assert_eq!(sim.sams[depot].ground_stock + sim.sams[truck].ground_stock + sim.sams[a].ground_rounds + sim.sams[b].ground_rounds, 3);
}
}
+124 -433
View File
@@ -7,7 +7,8 @@
//! (`DroneKind::spec`, `MissileKind::spec`, `SamKind::spec`) plus how its
//! parts are drawn (`Sim::draw_sam`).
use glam::{DQuat, DVec3};
use std::collections::HashMap;
use std::collections::{HashMap, VecDeque};
use std::sync::Arc;
pub mod battery;
pub mod launch;
@@ -24,6 +25,8 @@ pub mod record;
mod sight;
mod terrain;
mod ew;
mod durable;
pub use ew::{AimReport, Confidence, ContactReport, EnemyPictureReport, Intent, PendingReport};
pub mod lights;
mod logistics;
mod orders;
@@ -592,9 +595,6 @@ pub fn roles_text(mask: u8) -> String {
Class::ALL.iter().filter(|c| mask & c.bit() != 0).map(|c| c.letter()).collect::<Vec<_>>().join("")
}
/// Ballistic flight's gravity, blocks a tick².
const GRAVITY: f64 = 0.05;
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum DroneKind {
Shahed,
@@ -645,11 +645,15 @@ pub struct DroneSpec {
pub decoy: bool,
/// How hard it is to hit (1 normal).
stealth: f64,
/// Its radar cross-section (a Shahed's 0.3).
rcs: f64,
/// Its sound: event, pitch, every n ticks.
sound: (&'static str, f32, u32),
pub class: Class,
/// Ballistic: launched this far away on a raid, flying an arc.
pub ballistic: Option<f64>,
/// The sound of its launch from the ground.
launch_sound: &'static str,
}
impl DroneSpec {
@@ -680,280 +684,17 @@ impl DroneKind {
];
/// The sound of a launch from the ground: a light catapult shot, a rocket booster, a heavy ballistic launch.
pub fn launch_sound(self) -> &'static str {
match self {
DroneKind::Shahed | DroneKind::Geran3 | DroneKind::Lancet | DroneKind::Gerbera => sound::LAUNCH_S400_EJECT,
DroneKind::Kh101 | DroneKind::Kalibr | DroneKind::Kh22 => sound::LAUNCH_PATRIOT,
DroneKind::Zircon => sound::LAUNCH_S400,
DroneKind::Iskander | DroneKind::Kinzhal | DroneKind::Oreshnik | DroneKind::OreshnikBlock | DroneKind::OreshnikSub => {
sound::LAUNCH_S500
}
}
}
pub fn spec(self) -> &'static DroneSpec {
match self {
DroneKind::Shahed => &DroneSpec {
name: "Шахед-136",
key: "shahed",
model: "airdef:shahed",
speed: 0.6,
turn: 0.035,
cruise: 45.0,
clearance: 18.0,
dive: 32.0,
warhead: 3,
scale: 1.3,
engine: Engine::Prop(1.34, 1.0),
decoy: false,
stealth: 1.0,
sound: (sound::DRONE_SHAHED, 1.0, 48),
class: Class::Drone,
ballistic: None,
},
DroneKind::Geran3 => &DroneSpec {
name: "Герань-3",
key: "geran3",
model: "airdef:geran3",
speed: 1.6,
turn: 0.03,
cruise: 60.0,
clearance: 18.0,
dive: 50.0,
warhead: 2,
scale: 1.15,
engine: Engine::Jet(0.34, 1.55, 1.0),
decoy: false,
stealth: 1.1,
sound: (sound::DRONE_GERAN3, 1.0, 40),
class: Class::Jet,
ballistic: None,
},
DroneKind::Lancet => &DroneSpec {
name: "Ланцет-3",
key: "lancet",
model: "airdef:lancet",
speed: 1.1,
turn: 0.07,
cruise: 25.0,
clearance: 10.0,
dive: 38.0,
warhead: 1,
scale: 0.9,
engine: Engine::Prop(0.93, 0.55),
decoy: false,
stealth: 1.4,
sound: (sound::DRONE_LANCET, 1.0, 32),
class: Class::Drone,
ballistic: None,
},
DroneKind::Gerbera => &DroneSpec {
name: "Гербера",
key: "gerbera",
model: "airdef:gerbera",
speed: 0.5,
turn: 0.04,
cruise: 40.0,
clearance: 15.0,
dive: 30.0,
warhead: 0,
scale: 1.1,
engine: Engine::Prop(1.03, 0.9),
decoy: true,
stealth: 0.9,
sound: (sound::DRONE_SHAHED, 1.3, 40),
class: Class::Drone,
ballistic: None,
},
DroneKind::Kh101 => &DroneSpec {
name: "Х-101",
key: "kh101",
model: "airdef:kh101",
speed: 2.4,
turn: 0.025,
cruise: 0.0,
clearance: 12.0,
dive: 26.0,
warhead: 6,
scale: 1.6,
engine: Engine::Jet(-0.27, 1.4, 0.6),
decoy: false,
stealth: 1.5,
sound: (sound::DRONE_CRUISE, 1.0, 50),
class: Class::Cruise,
ballistic: None,
},
DroneKind::Kalibr => &DroneSpec {
name: "Калибр",
key: "kalibr",
model: "airdef:kalibr",
speed: 2.1,
turn: 0.025,
cruise: 0.0,
clearance: 15.0,
dive: 26.0,
warhead: 5,
scale: 1.5,
engine: Engine::Jet(-0.2, 1.5, 0.6),
decoy: false,
stealth: 1.3,
sound: (sound::DRONE_CRUISE, 1.2, 50),
class: Class::Cruise,
ballistic: None,
},
DroneKind::Kh22 => &DroneSpec {
name: "Х-22",
key: "kh22",
model: "airdef:kh22",
speed: 4.0,
turn: 0.03,
cruise: 140.0,
clearance: 40.0,
dive: 150.0,
warhead: 7,
scale: 1.8,
engine: Engine::Rocket(1.5, 1.3),
decoy: false,
stealth: 1.4,
sound: (sound::DRONE_ROCKET, 0.8, 46),
class: Class::Supersonic,
ballistic: None,
},
DroneKind::Zircon => &DroneSpec {
name: "Циркон",
key: "zircon",
model: "airdef:zircon",
speed: 5.5,
turn: 0.025,
cruise: 90.0,
clearance: 30.0,
dive: 110.0,
warhead: 6,
scale: 1.4,
engine: Engine::Rocket(1.5, 1.1),
decoy: false,
stealth: 2.0,
sound: (sound::DRONE_ROCKET, 1.35, 46),
class: Class::Supersonic,
ballistic: None,
},
DroneKind::Iskander => &DroneSpec {
name: "Искандер-М",
key: "iskander",
model: "airdef:iskander",
speed: 5.0,
turn: 0.04,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 8,
scale: 1.8,
engine: Engine::Rocket(1.5, 1.6),
decoy: false,
stealth: 1.6,
sound: (sound::DRONE_ROCKET, 0.7, 46),
class: Class::Ballistic,
ballistic: Some(1000.0),
},
DroneKind::Kinzhal => &DroneSpec {
name: "Кинжал",
key: "kinzhal",
model: "airdef:kinzhal",
speed: 7.5,
turn: 0.03,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 8,
scale: 1.7,
engine: Engine::Rocket(1.5, 1.5),
decoy: false,
stealth: 2.2,
sound: (sound::DRONE_ROCKET, 0.6, 46),
class: Class::Ballistic,
ballistic: Some(1500.0),
},
DroneKind::Oreshnik => &DroneSpec {
name: "Орешник",
key: "oreshnik",
model: "airdef:iskander",
speed: 9.0,
turn: 0.0,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 0,
scale: 2.6,
engine: Engine::Rocket(1.5, 2.4),
decoy: false,
stealth: 3.0,
sound: (sound::DRONE_ROCKET, 0.5, 46),
class: Class::Ballistic,
ballistic: Some(2600.0),
},
DroneKind::OreshnikBlock => &DroneSpec {
name: "Орешник: блок",
key: "oreshnik_block",
model: "airdef:reentry",
speed: 9.0,
turn: 0.0,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 4,
scale: 1.6,
engine: Engine::Rocket(1.0, 1.0),
decoy: false,
stealth: 3.5,
sound: (sound::DRONE_BALLISTIC, 0.8, 9999),
class: Class::Ballistic,
ballistic: None,
},
DroneKind::OreshnikSub => &DroneSpec {
name: "Орешник: суббоеприпас",
key: "oreshnik_sub",
model: "airdef:reentry",
speed: 9.0,
turn: 0.05,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 3,
scale: 1.1,
engine: Engine::Rocket(1.0, 1.0),
decoy: false,
stealth: 4.0,
sound: (sound::DRONE_BALLISTIC, 1.0, 9999),
class: Class::Ballistic,
ballistic: None,
},
}
self.spec().launch_sound
}
pub fn from_key(key: &str) -> Option<Self> {
Self::ALL.into_iter().find(|k| k.spec().key == key)
}
/// Its radar cross-section, a Shahed's 0.3: radars see it from as far as its fourth root allows.
pub fn rcs(self) -> f64 {
match self {
DroneKind::Shahed => 0.3,
DroneKind::Geran3 => 0.4,
DroneKind::Lancet => 0.08,
// Corner reflectors make the decoy look as big as a Shahed.
DroneKind::Gerbera => 0.4,
DroneKind::Kh101 => 0.05,
DroneKind::Kalibr => 0.15,
DroneKind::Kh22 => 1.0,
DroneKind::Zircon => 0.4,
DroneKind::Iskander => 0.6,
DroneKind::Kinzhal => 0.5,
DroneKind::Oreshnik => 2.0,
DroneKind::OreshnikBlock => 0.4,
DroneKind::OreshnikSub => 0.08,
}
self.spec().rcs
}
}
/// Height over the target where the Oreshnik's blocks release their submunitions.
const BLOCK_SPLIT: f64 = 300.0;
#[derive(PartialEq, Clone, Copy)]
enum Flight {
Cruise,
@@ -992,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`).
@@ -1052,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)
@@ -1066,7 +825,7 @@ impl Drone {
// ---------------------------------------------------------------- interceptors
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum MissileKind {
Pac3,
M57e6,
@@ -1085,10 +844,15 @@ struct MissileSpec {
speed: f64,
accel: f64,
turn: f64,
/// Ticks of straight flight before guidance.
/// Departure: ticks from ignition to full guidance (spool-up; a cold launch also captures
/// its course); full guidance starts at `cold + boost`.
boost: u32,
/// Thrown out of the tube by gas first; the motor lights this many ticks later.
/// Thrown out of the tube by gas first; the motor lights this many ticks later (#129).
cold: u32,
/// Gas-throw speed out of the tube, blocks a tick (cold-launched kinds only).
eject: f64,
/// The ejection's linear drag, blocks a tick² (cold-launched kinds only).
eject_drag: f64,
pk: f64,
fuse: f64,
life: u32,
@@ -1096,6 +860,37 @@ struct MissileSpec {
flame: f64,
/// The nozzle, model units behind the centre (z).
rear: f64,
/// How far its own seeker holds a target (blocks); 0: command guidance only.
seeker: f64,
/// The sound of its launch.
launch_sound: &'static str,
/// Its motor's voice: event, gain and pitch.
voice: (&'static str, f32, f32),
}
impl MissileSpec {
/// The launch choreography is one sequence of stages (#129): the cap opens on the ground
/// (`launch::OPEN_TICKS`), the round is thrown out of the tube unlit and slows under drag
/// (`age <= cold`), the motor lights where it has reached (`age == cold + 1`), it tips onto
/// its course with a growing rate while the motor spools up (`cold < age < cold + boost`),
/// and full guidance — terrain lofting, the seeker, full turn — runs from `age >= cold + boost`.
/// Rail-launched kinds (`cold == 0`) light at once but spool up over the same `boost` ticks:
/// their stages are ignition, departure, guidance.
fn guided(&self, age: u32) -> bool {
age >= self.cold + self.boost
}
/// The departure's course-capture rate as a share of the full turn (0..=1).
fn departure_ramp(&self, age: u32) -> f64 {
(age.saturating_sub(self.cold) as f64 / self.boost.max(1) as f64).clamp(0.0, 1.0)
}
/// The motor's spool-up as a share of the full acceleration (0..=1). A rail launch spools over
/// the same `boost` ticks its departure lasts; an electric kind has no rocket motor to light.
fn spool(&self, age: u32, guided: bool) -> f64 {
if guided || self.flame <= 0.0 {
return 1.0;
}
0.45 + 0.55 * self.departure_ramp(age)
}
}
impl MissileKind {
@@ -1106,149 +901,12 @@ impl MissileKind {
}
/// The sound of its launch.
pub fn launch_sound(self) -> &'static str {
match self {
MissileKind::Pac3 => sound::LAUNCH_PATRIOT,
MissileKind::M57e6 => sound::LAUNCH_PANTSIR,
MissileKind::M48n6 => sound::LAUNCH_S400_EJECT,
MissileKind::M77n6 => sound::LAUNCH_S500_EJECT,
MissileKind::IrisT | MissileKind::M9m338 => sound::LAUNCH_S400_EJECT,
MissileKind::Amraam | MissileKind::M9m317 => sound::LAUNCH_PATRIOT,
MissileKind::P1sun => sound::DRONE_LANCET,
}
}
fn spec(self) -> &'static MissileSpec {
match self {
MissileKind::Pac3 => &MissileSpec {
model: "airdef:pac3",
speed: 5.5,
accel: 0.35,
turn: 0.3,
boost: 8,
cold: 0,
pk: 0.9,
fuse: 4.0,
life: 240,
scale: 1.0,
flame: 1.0,
rear: 28.0,
},
MissileKind::M57e6 => &MissileSpec {
model: "airdef:m57e6",
speed: 5.0,
accel: 0.5,
turn: 0.32,
boost: 5,
cold: 0,
pk: 0.82,
fuse: 3.0,
life: 160,
scale: 0.85,
flame: 0.65,
rear: 28.0,
},
MissileKind::M48n6 => &MissileSpec {
model: "airdef:m48n6",
speed: 7.0,
accel: 0.5,
turn: 0.22,
boost: 8,
cold: 5,
pk: 0.9,
fuse: 5.0,
life: 300,
scale: 1.5,
flame: 1.4,
rear: 30.0,
},
MissileKind::M77n6 => &MissileSpec {
model: "airdef:m77n6",
speed: 9.0,
accel: 0.6,
turn: 0.22,
boost: 8,
cold: 5,
pk: 0.95,
fuse: 6.0,
life: 320,
scale: 1.7,
flame: 1.6,
rear: 32.0,
},
MissileKind::IrisT => &MissileSpec {
model: "airdef:irist_missile",
speed: 7.0,
accel: 0.5,
turn: 0.35,
boost: 6,
cold: 4,
pk: 0.9,
fuse: 4.0,
life: 260,
scale: 0.95,
flame: 0.9,
rear: 28.0,
},
MissileKind::Amraam => &MissileSpec {
model: "airdef:amraam_missile",
speed: 6.0,
accel: 0.45,
turn: 0.3,
boost: 6,
cold: 0,
pk: 0.85,
fuse: 4.0,
life: 260,
scale: 0.9,
flame: 0.9,
rear: 28.0,
},
MissileKind::M9m317 => &MissileSpec {
model: "airdef:m48n6",
speed: 6.5,
accel: 0.5,
turn: 0.25,
boost: 8,
cold: 0,
pk: 0.85,
fuse: 5.0,
life: 300,
scale: 1.1,
flame: 1.2,
rear: 32.0,
},
MissileKind::M9m338 => &MissileSpec {
model: "airdef:m57e6",
speed: 5.5,
accel: 0.6,
turn: 0.4,
boost: 4,
cold: 4,
pk: 0.9,
fuse: 3.0,
life: 160,
scale: 1.0,
flame: 0.8,
rear: 28.0,
},
MissileKind::P1sun => &MissileSpec {
model: "airdef:p1sun",
speed: 2.8,
accel: 0.12,
turn: 0.3,
boost: 4,
cold: 0,
pk: 0.8,
fuse: 3.0,
life: 900,
scale: 0.8,
// Electric: no flame.
flame: 0.0,
rear: 10.0,
},
}
self.spec().launch_sound
}
}
include!("specs_generated.rs");
pub struct Missile {
pub id: u32,
pub kind: MissileKind,
@@ -1308,15 +966,7 @@ impl Missile {
impl MissileKind {
/// How far its own seeker holds a target of average size (blocks); 0: command guidance only.
pub fn seeker(self) -> f64 {
match self {
MissileKind::M57e6 => 0.0,
MissileKind::Pac3 => 110.0,
MissileKind::M48n6 | MissileKind::M77n6 => 120.0,
MissileKind::IrisT | MissileKind::M9m317 => 90.0,
MissileKind::Amraam => 130.0,
MissileKind::M9m338 => 70.0,
MissileKind::P1sun => 60.0,
}
self.spec().seeker
}
}
@@ -1703,6 +1353,15 @@ pub struct Sim {
pub strikes: strike::Strikes,
/// A raid being planned.
plan: Option<raid::Plan>,
/// Routes still to work out after a mass retarget (#127): the drones were given a new aim, but the
/// planner's share of a tick ran out. They keep their old route until a new one is ready.
retargets: VecDeque<ew::RouteJob>,
/// 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).
@@ -1782,6 +1441,9 @@ impl Sim {
sites: sites::Sites::default(),
strikes: strike::Strikes::new(),
plan: None,
retargets: VecDeque::new(),
known_relief: None,
job_next: 1,
routes: Default::default(),
target_health: Vec::new(),
wave: None,
@@ -1891,6 +1553,8 @@ impl Sim {
self.queue.clear();
self.sites.clear();
self.plan = None;
self.retargets.clear();
self.known_relief = None;
self.wave = None;
// Ammunition still to cook off, flares in the sky.
self.later.clear();
@@ -2292,7 +1956,7 @@ impl Sim {
};
self.emit_combat_event(pos, record::EventKind::Crash { drone, kind, power });
}
for (drone, kind, pos, tnt) in impacts {
for &(drone, kind, pos, tnt) in &impacts {
if let Some(sector) = self.drones.iter().find(|x| x.id == drone).map(|x| x.sector as usize) {
self.learn(sector, false);
}
@@ -2309,6 +1973,10 @@ impl Sim {
let vel = self.drones.iter().find(|x| x.id == drone).map_or(DVec3::ZERO, |x| x.vel);
self.direct_hit(pos, vel, tnt, out);
}
// Battle damage assessment: a munition going down watches the fate of whatever it was
// sent at. Truth is read at this instant only — the one honest moment — and written
// into the picture as an observation; a unit missed by everything keeps its secret.
self.observe_outcomes(&impacts);
for (pos, warhead, small) in boom {
self.explode(pos, warhead, small, ground, player, out);
}
@@ -2333,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(),
});
@@ -2380,6 +2050,18 @@ impl Sim {
}
}
/// What the enemy's munitions just watched (#127): for every impact, the fate of each known
/// unit near it — dead or alive as the explosion showed, at the place it showed. Units the
/// blasts missed keep their contacts exactly as they were: unobserved is unobserved.
fn observe_outcomes(&mut self, impacts: &[(u32, DroneKind, DVec3, u32)]) {
let now = self.tick;
for &(_, _, pos, _) in impacts {
for s in self.sams.iter().filter(|s| s.pos.distance(pos) < 16.0) {
self.intel.outcome(s.id, s.alive(), s.pos, now);
}
}
}
/// A blast: a fireball, smoke, sound, a jolt for a near player, and (with
/// `damage`) primed TNT for the land.
fn explode(&mut self, pos: DVec3, tnt: u32, small: bool, ground: &mut Ground, player: Option<DVec3>, out: &mut Out) {
@@ -2920,9 +2602,9 @@ impl Sim {
t.ammo_waits += ammo_waits;
});
for (kind, muzzle, dir, target, sam) in launches {
// A launch gives the system away.
// A launch gives the system away: the enemy saw it fire, no more than that.
if let Some(s) = self.sams.iter().find(|s| s.id == sam) {
self.intel.revealed.push((sam, s.pos, self.tick));
self.intel.observe(s, self.tick, ew::Seen::Launch);
}
// It leaves with the track the system fired on (#66).
let fix = self
@@ -2933,7 +2615,7 @@ impl Sim {
.map(|tr| Fix { pos: tr.pos, vel: tr.vel, tick: tr.tick, seeker: false });
let spec = kind.spec();
let id = self.id();
let v0 = if spec.cold > 0 { 0.7 } else { 0.8 };
let v0 = if spec.cold > 0 { spec.eject } else { 0.8 };
self.missiles.push(Missile { id, kind, pos: muzzle, vel: dir * v0, target, sam, age: 0, hold: 0, fix, seen: 0 });
if spec.cold > 0 {
// Thrown out by gas: a puff, a thump; the motor lights later.
@@ -3002,10 +2684,15 @@ impl Sim {
if m.age == spec.cold + m.kind.burn_ticks() + 1 {
burnouts.push((m.pos, m.id, m.kind));
}
// The launch's stages (#129): ejection (unlit, gas drag), ignition (the motor lights
// where the round has reached), departure (spool-up and course capture) and guidance.
// Guidance never runs before ignition: it starts at `cold + boost`, the motor at `cold`.
let guided = spec.guided(m.age);
let speed = if m.age <= spec.cold {
(m.vel.length() * 0.97).max(0.4)
// The gas throw bleeds off linearly; the round is never left hanging still.
(m.vel.length() - spec.eject_drag).max(spec.eject * 0.25)
} else if lit {
(m.vel.length() + spec.accel).min(spec.speed)
(m.vel.length() + spec.accel * spec.spool(m.age, guided)).min(spec.speed)
} else {
m.vel.length() * 0.995
};
@@ -3017,8 +2704,7 @@ impl Sim {
m.fix = Some(Fix { pos: tr.pos, vel: tr.vel, tick: tr.tick, seeker: false });
}
if let Some(t) = target
&& m.age > spec.cold
&& m.age >= spec.boost
&& guided
&& m.kind.seeker() > 0.0
{
let range = m.kind.seeker() * t.kind.rcs().powf(0.25).clamp(0.6, 1.6);
@@ -3033,14 +2719,14 @@ impl Sim {
}
}
// Nothing new for too long and no seeker on it: the interceptor has lost its target.
if target.is_some() && m.fix.is_none_or(|f| now.saturating_sub(f.tick) > MAX_COAST) && m.age > spec.boost + 20 {
if target.is_some() && m.fix.is_none_or(|f| now.saturating_sub(f.tick) > MAX_COAST) && m.age > spec.cold + spec.boost + 20 {
expired += 1;
done.push((m.id, None, false, m.sam));
continue;
}
let aim = m.fix.map(|f| (f.est(now), f.vel));
let new = match aim {
Some((at, vel)) if m.age >= spec.boost => {
Some((at, vel)) if guided => {
// Time to go by the closing speed: head-on targets come to meet it.
let los = (at - m.pos).normalize_or_zero();
let closing = (speed - vel.dot(los)).max(1.0);
@@ -3064,8 +2750,13 @@ impl Sim {
}
turn(dir, want, spec.turn * if coast { (speed / spec.speed).clamp(0.15, 1.0) } else { 1.0 })
}
// After a cold launch it tips over towards the target while the motor burns.
Some((at, _)) if lit && spec.cold > 0 => turn(dir, at - m.pos, spec.turn * 0.5),
// Departure: after a cold launch it tips onto the target's course while the motor
// spools up, at a rate that grows into the full one — no snap from the vertical to
// the horizontal (#129). A rail launch already points along its rail; it keeps that
// course until guidance can loft it over the land, as before.
Some((at, _)) if lit && spec.cold > 0 => {
turn(dir, at - m.pos, spec.turn * (0.2 + 0.8 * spec.departure_ramp(m.age)))
}
_ => dir,
};
let before = m.pos;
+208 -74
View File
@@ -146,6 +146,7 @@ const LONGEST_WAIT: f64 = 12_000.0;
pub(super) const WORK_PER_TICK: usize = 40_000;
/// The planner's grid over a raid: its corner, its cells' size and how many a side.
#[derive(Clone, Copy)]
pub(super) struct Grid {
pub(super) min: DVec3,
pub(super) cell: f64,
@@ -157,22 +158,20 @@ impl Grid {
let n = self.size;
((((p.x - self.min.x) / self.cell) as i32).clamp(0, n - 1), (((p.z - self.min.z) / self.cell) as i32).clamp(0, n - 1))
}
fn centre(&self, (i, j): (i32, i32), y: f64) -> DVec3 {
pub(super) fn centre(&self, (i, j): (i32, i32), y: f64) -> DVec3 {
DVec3::new(self.min.x + (i as f64 + 0.5) * self.cell, y, self.min.z + (j as f64 + 0.5) * self.cell)
}
}
/// The cheapest way over `grid` from `from` to `to` by its prices (A*): points along it, `to` last.
pub(super) fn plan_route(grid: &Grid, prices: &[f32], from: DVec3, to: DVec3) -> (Vec<DVec3>, usize) {
plan_route_on(grid, prices, None, from, to)
}
/// The land a route crosses: its height under each cell (NaN unknown), the climb a kind holds for long
/// (rise a block), and the height above which the land forces a drone up from its low altitude.
/// (rise a block), and the height above which the land forces a drone up from its low altitude. Unknown
/// land costs `unknown` per cell on top of the open ground: zero for a plan routed over land it is still
/// mapping, more than free for a replanned retarget (#127).
pub(super) struct Relief<'a> {
pub heights: &'a [f32],
pub slope: f32,
pub floor: f32,
pub unknown: f32,
}
/// [`plan_route`] over relief: a climb steeper than the kind holds is dear (a cliff or a ridge it would have to
@@ -219,6 +218,9 @@ pub(super) fn plan_route_on(grid: &Grid, prices: &[f32], relief: Option<&Relief>
price += (slope - r.slope) * 20.0 * len;
}
}
} else if r.unknown > 0.0 {
// Unmapped land is not free: the route prefers what the plan actually knew.
price += len * r.unknown;
}
}
let ng = g + price;
@@ -278,6 +280,10 @@ impl Sim {
return 0;
}
let smart = order.aim == Aim::Smart;
// The planner's picture of the layout: one snapshot for the whole order. It is
// read-only while the plan is built, and taking it per drone made a big second order
// quadratic in the force's size (#122); a map of contacts makes it linear in them (#127).
let picture = self.picture_of_defences();
// A smart enemy comes from where its raids got through best.
let bearing = if smart { self.best_bearing() } else { self.rng.f() * TAU };
// The raid's sides (1, 2, or 4-5): its launch sites go there (#100).
@@ -290,7 +296,7 @@ impl Sim {
let grid = Grid { min: centre - DVec3::new(span, 0.0, span), cell, size: (2.0 * span / cell) as i32 + 1 };
let mut items = Vec::new();
// A smart raid goes for the radars too (a few strikers each); the others pick as they always did.
let radar_jobs = if smart { self.radar_strikes(&order.kinds) } else { Vec::new() };
let radar_jobs = if smart { self.radar_strikes(&order.kinds, &picture) } else { Vec::new() };
let mut index = 0usize;
for (group, &(kind, count)) in order.kinds.iter().enumerate() {
let spec = kind.spec();
@@ -306,7 +312,7 @@ impl Sim {
index += 1;
let (target, at_sam) = match job {
Some((at, id)) => (at, Some(id)),
None => self.choose_target(kind, object, order.aim),
None => self.choose_target(kind, object, order.aim, &picture),
};
let aim = target + DVec3::new(self.rng.s() * 4.0, 0.0, self.rng.s() * 4.0);
let dist = spec.ballistic.map_or(order.dist, |far| far.max(order.dist)) + self.rng.f() * 50.0;
@@ -314,6 +320,16 @@ impl Sim {
// Where it starts is provisional: the site's pad, once the site is placed.
let from = centre + DVec3::new(a.sin() * dist, height + self.rng.s() * 6.0, a.cos() * dist);
let mut d = self.make_drone(kind, from, horizontal(aim - from), aim);
// The plan's own decision, recorded as such (#127): a radar job is SEAD, a unit
// chosen for the raid is the plan's objective, anything else is a marked object.
if let Some(id) = at_sam {
let confidence = picture.iter().find(|c| c.id == id).map(|c| c.confidence(self.tick));
d.intent = if job.is_some() { ew::Intent::Sead } else { ew::Intent::Plan };
d.aim = confidence.map_or_else(|| ew::Aim::point(self.tick), |c| ew::Aim::unit(id, self.tick, c));
} else {
d.intent = ew::Intent::Plan;
d.aim = ew::Aim::point(self.tick);
}
let range = spec.ballistic.map_or(order.dist, |far| far.max(order.dist));
let want = sites::want_index(&mut wants, centre, side, a, sites::SiteClass::of(kind), range, order.dist.max(120.0));
let pad = wants[want].jobs;
@@ -445,6 +461,7 @@ impl Sim {
heights: &plan.heights,
slope: (kind.climb_pitch().tan() * 0.5) as f32,
floor: (aim.y + spec.clearance) as f32,
unknown: 0.0,
});
let (r, cost) = plan_route_on(&plan.grid, &plan.prices[&kind], relief.as_ref(), from, aim);
work += cost;
@@ -480,6 +497,11 @@ impl Sim {
}
self.queue.push((now + wait.clamp(0.0, LONGEST_WAIT) as u64, d));
}
// Keep the land this plan was worked out over (#127): a retarget later is planned over the same
// known relief, not over ground mapped since.
if plan.smart && !plan.heights.is_empty() {
self.known_relief = Some(std::sync::Arc::new(ew::KnownRelief::new(plan.grid, std::mem::take(&mut plan.heights))));
}
self.wave = Some(WaveStats {
kills: self.kills,
hits: self.hits,
@@ -500,6 +522,18 @@ impl Sim {
self.plan.is_some()
}
/// The plan's drones and the structured intent each was given (#127; tests and diagnostics).
#[cfg(test)]
pub(super) fn planned_intents(&self) -> Vec<(u32, ew::Intent)> {
self.plan.as_ref().map(|p| p.items.iter().map(|i| (i.d.id, i.d.intent)).collect()).unwrap_or_default()
}
/// The plan's unit aims and their intent: the same list, keyed by what the drone goes for.
#[cfg(test)]
pub(super) fn planned_aims(&self) -> Vec<(u32, ew::Intent)> {
self.plan.as_ref().map(|p| p.items.iter().map(|i| (i.d.aim.unit, i.d.intent)).collect()).unwrap_or_default()
}
/// A drone ready to fly from `from`, not yet in the sky.
pub(super) fn make_drone(&mut self, kind: DroneKind, from: DVec3, dir: DVec3, target: DVec3) -> Drone {
let id = self.id();
@@ -534,6 +568,8 @@ impl Sim {
smart: false,
nav: Nav::default(),
err,
intent: ew::Intent::Plan,
aim: ew::Aim::point(0),
hold: 0,
pace: Pace::default(),
}
@@ -542,9 +578,12 @@ impl Sim {
/// The strikes a smart raid sends at observed radars: for drones of `kinds` in order,
/// the last observed place and id for those that go for one. Each radar
/// gets two or three, the fast strikers first, and all together no more than about a quarter of the raid.
pub(super) fn radar_strikes(&self, kinds: &[(DroneKind, u32)]) -> Vec<Option<(DVec3, u32)>> {
let mut radars: Vec<(u32, DVec3)> = self.known_units().into_iter()
.filter(|(id, _)| self.sams.iter().any(|s| s.id == *id && s.alive() && s.kind == SamKind::Radar))
/// Only contacts the picture still trusts: a doubtful one (aged, never re-seen) is not worth a missile.
pub(super) fn radar_strikes(&self, kinds: &[(DroneKind, u32)], picture: &[ew::Contact]) -> Vec<Option<(DVec3, u32)>> {
let mut radars: Vec<(u32, DVec3)> = picture
.iter()
.filter(|c| c.kind == SamKind::Radar && c.confidence(self.tick) >= ew::Confidence::Probable)
.map(|c| (c.id, c.at))
.collect();
radars.sort_by_key(|(id, _)| *id);
let flat: Vec<DroneKind> = kinds.iter().flat_map(|&(k, n)| std::iter::repeat_n(k, n as usize)).collect();
@@ -566,49 +605,40 @@ impl Sim {
jobs
}
/// What a drone goes for: an object, or (by its kind and the raid's aim) a system. Returns the
/// point and the system's id.
fn choose_target(&mut self, kind: DroneKind, object: DVec3, aim: Aim) -> (DVec3, Option<u32>) {
let alive: Vec<&Sam> = self.sams.iter().filter(|s| s.alive()).collect();
if alive.is_empty() || kind.spec().decoy || aim == Aim::Objects {
/// What a drone goes for: an object, or (by its kind and the raid's aim) a unit. Returns the
/// point and the unit's id. The planner has only the picture (#93, #127): what it knows of a
/// unit is the last observation — the place seen then, the type identified then — never where
/// the unit actually is or what it has become since.
fn choose_target(&mut self, kind: DroneKind, object: DVec3, aim: Aim, picture: &[ew::Contact]) -> (DVec3, Option<u32>) {
if picture.is_empty() || kind.spec().decoy || aim == Aim::Objects {
return (object, None);
}
let pick = |list: &[&Sam], r: f64| -> Option<(DVec3, u32)> {
(!list.is_empty()).then(|| {
let s = list[(r * list.len() as f64) as usize % list.len()];
(s.pos, s.id)
})
let pick = |list: &[ew::Contact], r: f64| -> Option<(DVec3, u32)> {
let c = list.get((r * list.len() as f64) as usize)?;
Some((c.at, c.id))
};
let r = self.rng.f();
let roll = self.rng.f();
if aim == Aim::ObjectsAndSams {
return if roll < 0.33 { pick(&alive, r).map_or((object, None), |(p, id)| (p, Some(id))) } else { (object, None) };
return if roll < 0.33 { pick(picture, r).map_or((object, None), |(p, id)| (p, Some(id))) } else { (object, None) };
}
// Smart: each kind at what it is good against; what gave itself away first (a jamming
// station, a radar, a system that fired).
// The planner has only what the enemy knows (#93): the radars (they emit) and the units that gave
// themselves away; the rest of the player's layout is not in its hands.
let known = self.known_units();
let alive: Vec<&Sam> = alive.iter().copied().filter(|s| Self::enemy_knows(s, &known)).collect();
let pick_known = |list: &[&Sam], r: f64| -> Option<(DVec3, u32)> {
let s = *list.get((r * list.len() as f64) as usize)?;
known.iter().find(|(id, _)| *id == s.id).map(|(_, pos)| (*pos, s.id))
};
let known_ew: Vec<&Sam> = alive.iter().copied().filter(|s| s.kind == SamKind::Ew).collect();
let known_ew: Vec<ew::Contact> = picture.iter().copied().filter(|c| c.kind == SamKind::Ew).collect();
if matches!(kind, DroneKind::Lancet | DroneKind::Kh22) && !known_ew.is_empty() && roll < 0.6 {
let s = known_ew[(r * known_ew.len() as f64) as usize % known_ew.len()];
return (known.iter().find(|(id, _)| *id == s.id).unwrap().1, Some(s.id));
let c = known_ew[(r * known_ew.len() as f64) as usize % known_ew.len()];
return (c.at, Some(c.id));
}
// Short-range systems (guns, Tor, P1-SUN) for the Lancets; long-range ones and the radars
// that feed them for the fast missiles.
let guns: Vec<&Sam> = alive.iter().copied().filter(|s| s.kind.armed() && s.kind.range() <= 300.0).collect();
let long: Vec<&Sam> =
alive.iter().copied().filter(|s| s.kind.range() >= 450.0 || s.kind == SamKind::Radar).collect();
let guns: Vec<ew::Contact> = picture.iter().copied().filter(|c| c.kind.armed() && c.kind.range() <= 300.0).collect();
let long: Vec<ew::Contact> =
picture.iter().copied().filter(|c| c.kind.range() >= 450.0 || c.kind == SamKind::Radar).collect();
let choice = match kind {
DroneKind::Lancet if roll < 0.75 => pick_known(&guns, r).or_else(|| pick_known(&alive, r)),
DroneKind::Kh22 | DroneKind::Zircon if roll < 0.45 => pick_known(&long, r),
DroneKind::Iskander | DroneKind::Kinzhal if roll < 0.3 => pick_known(&long, r),
DroneKind::Shahed | DroneKind::Geran3 if roll < 0.2 => pick_known(&alive, r),
DroneKind::Lancet if roll < 0.75 => pick(&guns, r).or_else(|| pick(picture, r)),
DroneKind::Kh22 | DroneKind::Zircon if roll < 0.45 => pick(&long, r),
DroneKind::Iskander | DroneKind::Kinzhal if roll < 0.3 => pick(&long, r),
DroneKind::Shahed | DroneKind::Geran3 if roll < 0.2 => pick(picture, r),
_ => None,
};
choice.map_or((object, None), |(p, id)| (p, Some(id)))
@@ -616,51 +646,59 @@ impl Sim {
/// The price of each cell of `grid` for this kind flying low: 1, and much more where a
/// system sees it there (its radar's reach for it, the land) and can shoot it.
#[cfg(test)]
pub(super) fn price_grid(&self, grid: &Grid, kind: DroneKind) -> (Vec<f32>, usize) {
self.price_grid_on(grid, kind, None)
}
/// The same over known land: a cell's drone flies `height` over the land there, not over the system's feet,
/// so what a radar sees and what a hill hides follow the relief.
/// The same over the picture this moment holds: a smart plan's own prices are priced on the
/// picture the plan was ordered with (#127). Later observations change nothing here.
pub(super) fn price_grid_on(&self, grid: &Grid, kind: DroneKind, land: Option<&[f32]>) -> (Vec<f32>, usize) {
self.price_grid_known(grid, kind, land, &self.picture_of_defences())
}
/// The same over a picture of the defences: a retarget is priced on the picture its target was
/// chosen from, so the jobs of one adaptive tick do not each see a different world (#127). Every
/// capability read here is the contact's published kind and the contact's own observations —
/// never the unit's actual switch settings, damage, roles, link health or magazine.
pub(super) fn price_grid_known(&self, grid: &Grid, kind: DroneKind, land: Option<&[f32]>, picture: &[ew::Contact]) -> (Vec<f32>, usize) {
let mut cost = 0;
let spec = kind.spec();
let height = spec.clearance.max(6.0);
let known_now = self.known_units();
let n = grid.size;
let now = self.tick;
let mut prices = vec![1.0f32; (n * n) as usize];
// Known jamming stations: drones that navigate by satellite keep away.
if kind.jammable() {
let known = self.known_units();
for s in self.sams.iter().filter(|s| s.kind == SamKind::Ew && s.alive() && known.iter().any(|k| k.0 == s.id)) {
let pos = known.iter().find(|(id, _)| *id == s.id).unwrap().1;
let (ci, cj) = grid.index(pos);
let r = (EW_RADIUS / grid.cell).ceil() as i32;
for c in picture.iter().filter(|c| c.kind == SamKind::Ew) {
let (ci, cj) = grid.index(c.at);
let r = (ew::EW_RADIUS / grid.cell).ceil() as i32;
for i in (ci - r).max(0)..=(ci + r).min(n - 1) {
for j in (cj - r).max(0)..=(cj + r).min(n - 1) {
if horizontal(grid.centre((i, j), pos.y) - pos).length() < EW_RADIUS {
if horizontal(grid.centre((i, j), c.at.y) - c.at).length() < ew::EW_RADIUS {
prices[(i * n + j) as usize] += 12.0;
}
}
}
}
}
// Only the systems the enemy knows of are priced in (#93): a hidden one is flown into.
for s in self.sams.iter().filter(|s| s.alive() && s.roles & spec.class.bit() != 0 && Self::enemy_knows(s, &known_now)) {
let pos = known_now.iter().find(|(id, _)| *id == s.id).unwrap().1;
let sp = s.kind.spec();
// Only the systems the picture holds are priced in (#93): a hidden one is flown into.
for c in picture.iter().filter(|c| c.kind.spec().roles & spec.class.bit() != 0) {
let pos = c.at;
let sp = c.kind.spec();
let (lo, hi) = sp.missile.as_ref().map_or((0.0, 0.0), |m| (m.min, m.max));
let gun = sp.gun.as_ref().map_or(0.0, |g| g.range);
// A gun needs its own radar; a missile also flies on the tracks of any radar within data-link range.
let own = sight::reach(s, kind, height);
let net = self.sams.iter().filter_map(|r| {
let at = known_now.iter().find(|(id, _)| *id == r.id)?.1;
(r.id != s.id && at.distance(pos) <= sight::LINK).then(|| sight::reach(r, kind, height))
}).fold(0.0, f64::max);
// A gun needs its own radar; a missile also flies on the tracks of any radar the picture
// holds within data-link range of the unit's observed place. What those radars are set to
// (role, switch, damage) is not observable: a live contact of one is assumed to feed.
let own = if c.believes_own_sensor(now) { ew::published_reach(c.kind, kind, height) } else { 0.0 };
let net = picture
.iter()
.filter(|d| d.kind == SamKind::Radar && d.id != c.id && d.at.distance(pos) <= sight::LINK)
.map(|d| ew::published_reach(d.kind, kind, height))
.fold(0.0, f64::max);
let (hi, gun) = (hi.min(own.max(net)), gun.min(own));
let far = hi.max(gun);
let at = pos + (sight::antenna(s) - s.pos);
let horizon = (pos == s.pos).then(|| self.horizons.get(&s.id)).flatten();
// Only the cells round it.
let (ci, cj) = grid.index(pos);
let r = (far / grid.cell).ceil() as i32 + 1;
@@ -677,9 +715,6 @@ impl Sim {
if !(missile || d < gun) {
continue;
}
if horizon.is_some_and(|h| h.hides(at, p)) {
continue;
}
prices[(i * n + j) as usize] += if missile { 30.0 } else { 18.0 };
}
}
@@ -975,20 +1010,27 @@ mod tests {
fn sead_uses_only_unexpired_observations_at_the_last_known_position() {
let mut sim = Sim::new(121);
let old = DVec3::new(100.0, 70.0, 200.0);
let mut radar = Sam::new(1, SamKind::Radar, old, 0.0);
radar.radar_on = false;
let radar = Sam::new(1, SamKind::Radar, old, 0.0);
sim.sams.push(radar);
let kinds = [(DroneKind::Kh22, 8)];
assert!(sim.radar_strikes(&kinds).iter().all(Option::is_none));
let none = Vec::new();
assert!(sim.radar_strikes(&kinds, &none).iter().all(Option::is_none));
sim.tick = 20;
sim.intel.revealed.push((1, old, sim.tick));
sim.intel.observe(&sim.sams[0], sim.tick, ew::Seen::Emission);
// The truth moving after the fix is not an observation: the strike goes to the seen place.
sim.sams[0].pos = DVec3::new(900.0, 70.0, 900.0);
sim.tick = 40;
let jobs = sim.radar_strikes(&kinds);
let picture = sim.picture_of_defences();
let jobs = sim.radar_strikes(&kinds, &picture);
assert_eq!(jobs.iter().flatten().count(), 2);
assert!(jobs.iter().flatten().all(|job| *job == (old, 1)));
// An old contact is not worth a strike either.
sim.tick = 3021;
let picture = sim.picture_of_defences();
assert!(sim.radar_strikes(&kinds, &picture).iter().all(Option::is_none), "a doubtful contact was struck");
sim.tick = 6020;
assert!(sim.radar_strikes(&kinds).iter().all(Option::is_none));
let picture = sim.picture_of_defences();
assert!(sim.radar_strikes(&kinds, &picture).iter().all(Option::is_none));
}
#[test]
@@ -998,9 +1040,10 @@ mod tests {
for (i, at) in [(-300.0, -200.0), (250.0, -250.0), (50.0, 300.0)].into_iter().enumerate() {
let id = sim.id();
let p = DVec3::new(at.0, 70.0, at.1);
sim.sams.push(Sam::new(id, SamKind::Radar, p, i as f64));
let sam = Sam::new(id, SamKind::Radar, p, i as f64);
sim.intel.observe(&sam, sim.tick, ew::Seen::Emission);
sim.sams.push(sam);
radars.push((id, p));
sim.intel.revealed.push((id, p, sim.tick));
}
let ew = sim.id();
sim.sams.push(Sam::new(ew, SamKind::Ew, DVec3::new(0.0, 70.0, 0.0), 0.0));
@@ -1036,7 +1079,7 @@ mod tests {
// The first strikers are the fast ones.
assert!(radars.iter().any(|(_, p)| aimed_at(&sim, *p).iter().any(|k| matches!(k, DroneKind::Kh22 | DroneKind::Zircon | DroneKind::Iskander | DroneKind::Kinzhal))));
// The enemy has learnt of the jamming station and re-aims what it can: not these.
sim.intel.revealed.push((ew, DVec3::new(0.0, 70.0, 0.0), sim.tick));
sim.intel.observe(&sim.sams.iter().find(|s| s.id == ew).unwrap(), sim.tick, ew::Seen::Jamming);
for _ in 0..160 {
serve(&mut ground, &land, sim.tick);
sim.step(&mut ground, None, &mut out);
@@ -1044,6 +1087,97 @@ mod tests {
check(&sim, "after adapting");
}
/// The picture the planner works from: one contact per unit, the newest observation
/// winning, the forgotten and the watched-dead out, the order deterministic — and it
/// never reads the force itself, so a contact of a unit that no longer exists stays
/// until its observations age out.
#[test]
fn picture_is_newest_per_unit_and_reads_no_truth() {
let mut sim = Sim::new(9);
let mut ids = Vec::new();
for (i, kind) in [SamKind::S400, SamKind::Ew, SamKind::Radar, SamKind::Tor, SamKind::Patriot].into_iter().enumerate() {
let id = sim.id();
sim.sams.push(Sam::new(id, kind, DVec3::new(i as f64 * 100.0, 70.0, -50.0), 0.0));
ids.push(id);
}
sim.tick = 7000;
let (a, b, c, d, e) = (ids[0], ids[1], ids[2], ids[3], ids[4]);
// A long fight: repeated observations (newest wins), one unit watched dying, one
// never seen, one id the force does not have, and one observation that aged out.
for t in 0..200u64 {
sim.intel.observe(&sim.sams[0], 1000 + t, ew::Seen::Launch);
sim.intel.observe(&sim.sams[2], 1000 + t, ew::Seen::Emission);
if t % 7 == 0 { sim.intel.observe(&sim.sams[1], 1000 + t, ew::Seen::Jamming); }
if t % 11 == 0 { sim.intel.observe(&sim.sams[3], 1000 + t, ew::Seen::Launch); }
if t % 13 == 0 {
sim.intel.note(999_999, SamKind::Radar, DVec3::new(1.0, 70.0, 0.0), true, 1000 + t, ew::Seen::Emission);
}
}
sim.intel.note(e, SamKind::Patriot, DVec3::new(15.0, 70.0, 0.0), true, 2, ew::Seen::Launch); // aged out at tick 7000
// The EW station is watched dying by a strike: observed, and so out of the targets.
sim.intel.outcome(b, false, sim.sams[1].pos, 1349);
let picture = sim.picture_of_defences();
let got: Vec<u32> = picture.iter().map(|c| c.id).collect();
// a and c were both seen last at tick 1199 (tie: the newer id first); d at 1198; the
// fake at 1195. The watched-dead b, the never-seen e and the aged-out are out.
assert_eq!(got, vec![c, a, d, 999_999]);
assert_eq!(picture[0].at, DVec3::new(200.0, 70.0, -50.0), "the observed place is the unit's own");
assert_eq!(picture[0].seen, ew::Seen::Emission);
assert_eq!(picture[1].kind, SamKind::S400);
assert!(picture.iter().all(|c| c.id != b && c.id != e));
assert_eq!(sim.picture_of_defences(), picture, "the picture is not deterministic");
}
/// The reported Windows stop (#122): the second big order from the UI path, with a fat
/// intel log and a large surviving force, must be accepted and launched like the first.
/// (The old per-drone planner snapshot was correct but quadratic; its cost is pinned by
/// the actual-WASM fuel measurements in docs/measurements/issue-122-ui-fuel.)
#[test]
fn a_second_smart_order_with_a_fat_intel_log_is_accepted_and_launched() {
let mut sim = Sim::new(31);
let mut ids = Vec::new();
for i in 0..48 {
let id = sim.id();
sim.sams.push(Sam::new(id, [SamKind::S400, SamKind::Patriot, SamKind::Nasams, SamKind::Pantsir][i % 4], DVec3::new((i % 8 * 40) as f64, 70.0, (i / 8 * 40) as f64), 0.0));
ids.push(id);
}
// A fought-off first raid leaves a long observation history: launches, emitting
// radars, stations. Its entries sit in the past of the sim clock, like real ones.
sim.tick = 4000;
for t in 0..3000u64 {
let sam = &sim.sams[(t as usize) % ids.len()];
sim.intel.observe(sam, 1001 + t, if t % 3 == 0 { ew::Seen::Emission } else { ew::Seen::Launch });
}
sim.targets.push(DVec3::new(160.0, 70.0, 160.0));
sim.target_health.push(100.0);
let mut ground = Ground::default();
let land = Land(|_, _| 64);
let mut out = Out::default();
for _ in 0..20 {
serve(&mut ground, &land, sim.tick);
sim.step(&mut ground, None, &mut out);
}
let mut order = RaidOrder::mix(36, 300.0);
order.aim = Aim::Smart;
order.approach = Approach::AllSides;
let total: u32 = order.kinds.iter().map(|k| k.1).sum();
let first = sim.order_raid(&order, &sim.targets.clone(), &mut out);
assert_eq!(first, total);
while sim.planning() {
serve(&mut ground, &land, sim.tick);
sim.step(&mut ground, None, &mut out);
}
assert!(sim.queue.len() + sim.launched as usize >= total as usize, "the first order queued or launched every drone (queue {}, launched {})", sim.queue.len(), sim.launched);
// The second order — the path that stopped the mod on Windows — is accepted too.
let second = sim.order_raid(&order, &sim.targets.clone(), &mut out);
assert_eq!(second, total);
while sim.planning() {
serve(&mut ground, &land, sim.tick);
sim.step(&mut ground, None, &mut out);
}
assert!(sim.queue.len() + sim.launched as usize >= 2 * total as usize, "both orders queued or launched their drones (queue {}, launched {})", sim.queue.len(), sim.launched);
}
#[test]
fn systems_ready_together_send_one_missile_at_a_drone() {
let mut sim = Sim::new(3);
+544 -9
View File
@@ -54,9 +54,9 @@ fn network_launcher_must_contribute_to_route_risk() {
// The planner prices only observed units; neither unit is known initially.
let (prices,_)=sim.price_grid(&grid,DroneKind::Shahed);
assert!(prices.iter().all(|p|*p==1.),"an unknown launcher must not be priced");
sim.intel.revealed.push((sim.sams[0].id,DVec3::new(0.,70.,0.),0));
// Both the launcher and its supporting radar have been observed.
sim.intel.revealed.push((sim.sams[1].id,DVec3::new(0.,70.,0.),0));
// The launcher is seen firing without a sensor of its own; the radar is fixed emitting.
sim.intel.observe(&sim.sams[0],0,ew::Seen::Launch);
sim.intel.observe(&sim.sams[1],0,ew::Seen::Emission);
let (prices,_)=sim.price_grid(&grid,DroneKind::Shahed);
assert!(prices.iter().any(|p|*p>1.),"armed launcher with a network radar is invisible to route risk");
}
@@ -131,11 +131,14 @@ fn retargeted_smart_drone_gets_a_route_round_the_defences() {
sim.sams.push(Sam::new(id, SamKind::Radar, DVec3::new(0.0, 70.0, 0.0), 0.0));
let goal = sim.id();
sim.sams.push(Sam::new(goal, SamKind::Ew, DVec3::new(0.0, 70.0, 1000.0), 0.0));
sim.intel.revealed.push((goal, DVec3::new(0.0, 70.0, 1000.0), 0));
// Its first target, a system that is destroyed by now.
sim.intel.observe(&sim.sams[2], 0, ew::Seen::Jamming);
// Its first target: a system the picture watched die — seen firing, then the enemy's
// munition watched the wreck. A unit destroyed unobserved would keep the drone coming.
let id = sim.id();
let mut wreck = Sam::new(id, SamKind::Patriot, DVec3::new(3000.0, 70.0, -1000.0), 0.0);
sim.intel.observe(&wreck, 0, ew::Seen::Launch);
wreck.health = 0.0;
sim.intel.outcome(wreck.id, false, wreck.pos, 0);
sim.sams.push(wreck);
sim.add_drone(DroneKind::Shahed, DVec3::new(0.0, 100.0, -1000.0), DVec3::Z, DVec3::new(3000.0, 70.0, -1000.0));
sim.drones[0].pos = DVec3::new(0.0, 100.0, -1000.0);
@@ -147,6 +150,276 @@ fn retargeted_smart_drone_gets_a_route_round_the_defences() {
assert!(d.route.len() > 1, "no route after the new target: it flies straight through the defences");
}
// #127: a mass retarget works its route jobs out over the following ticks. No drone is left without a
// route by the budget, old safe routes are kept until their replacements are ready, and the queue never
// grows or repeats a drone.
#[cfg(test)]
fn mass_retarget_sim(seed: u64) -> (Sim, HashMap<u32, Vec<DVec3>>, u32) {
let mut sim = Sim::new(seed);
for i in 0..8 {
for j in 0..5 {
let at = DVec3::new(-560.0 + i as f64 * 160.0, 70.0, -320.0 + j as f64 * 160.0);
let id = sim.id();
let sam = Sam::new(id, SamKind::S400, at, 0.0);
// Every system is on the picture, its radar fixed emitting once.
sim.intel.observe(&sam, 0, ew::Seen::Emission);
sim.sams.push(sam);
}
}
let mut old = HashMap::new();
let mut empty = 0;
for i in 0..40 {
let from = DVec3::new(-1800.0, 100.0, -800.0 + i as f64 * 40.0);
let mut d = sim.make_drone(DroneKind::Kh22, from, DVec3::X, DVec3::new(1800.0, 70.0, 1800.0));
d.smart = true;
d.route = vec![from, DVec3::new(1800.0, 70.0, 1800.0)];
// The last drone starts with no route at all (a drone whose route was lost): its job must wait its
// budget, not be dropped, and must give it a route in the end.
if i == 39 {
d.route.clear();
empty = d.id;
}
old.insert(d.id, d.route.clone());
sim.queue.push((0, d));
}
(sim, old, empty)
}
#[cfg(test)]
fn flight_state(sim: &Sim) -> Vec<(u32, u64, u64, u64, Vec<(u64, u64, u64)>)> {
sim.queue
.iter()
.map(|(_, d)| {
let route = d.route.iter().map(|p| (p.x.to_bits(), p.y.to_bits(), p.z.to_bits())).collect();
(d.id, d.target.x.to_bits(), d.target.y.to_bits(), d.target.z.to_bits(), route)
})
.collect()
}
#[test]
fn mass_retarget_finishes_its_route_jobs_over_the_budget() {
let (mut sim, old, empty) = mass_retarget_sim(7);
sim.tick = 40;
sim.adapt();
let pending = sim.retarget_ids();
assert!(!pending.is_empty(), "the budget planned all 40 routes: the test no longer covers the queue");
assert_eq!(pending.len(), pending.iter().collect::<std::collections::HashSet<_>>().len(), "duplicate jobs");
// Assignments are throttled too: one adaptive tick hands out a bounded number of new aims,
// and the rest of the force is sent on the following adaptive ticks (#127).
assert!(pending.len() <= super::ew::ASSIGN_PER_TICK, "one adaptive tick assigned {} drones", pending.len());
for id in &pending {
let d = &sim.queue.iter().find(|(_, d)| d.id == *id).unwrap().1;
assert_eq!(&d.route, old.get(id).unwrap(), "an old safe route was replaced before the new one was ready");
}
let mut left = pending.len();
for _ in 0..400 {
sim.tick += 1;
sim.adapt();
if sim.tick % 40 == 0 {
// A new adaptive tick: more drones may be sent, still within the throttle.
let now = sim.retarget_ids().len();
assert!(now <= left + super::ew::ASSIGN_PER_TICK, "an adaptive tick assigned more than {} drones", super::ew::ASSIGN_PER_TICK);
left = now;
} else if left > 0 {
assert!(sim.retargets.len() < left, "a budget tick made no progress: {left} jobs left");
left = sim.retargets.len();
}
let still = sim.retarget_ids();
assert!(
// A drone the throttle has not sent yet is still on its own plan's route or has none to lose;
// one already sent at a unit whose route is empty must have a job that will fill it.
sim.queue.iter().all(|(_, d)| !d.route.is_empty() || still.contains(&d.id) || d.aim.unit == 0),
"a route is still empty with no job left to fill it"
);
}
assert_eq!(sim.retargets.len(), 0, "route jobs were never finished");
// No drone is left with an empty route for ever, and every new route ends at its aim. The drone
// that started with no route at all got one too: its job waited for the budget, not for ever.
for (_, d) in &sim.queue {
assert!(!d.route.is_empty(), "a drone was left with no route");
assert!(d.route.last().is_some_and(|p| p.distance(d.target) < 1e-6), "the new route does not end at the new aim");
assert!(d.aim.unit != 0, "a drone was never sent at a unit");
}
let empty = sim.queue.iter().find(|(_, d)| d.id == empty).unwrap().1.clone();
assert!(!empty.route.is_empty(), "the drone that started with no route never got one");
}
#[test]
fn mass_retarget_is_deterministic_and_never_duplicates_a_drone() {
let (mut a, _, _) = mass_retarget_sim(11);
let (mut b, _, _) = mass_retarget_sim(11);
a.tick = 40;
b.tick = 40;
a.adapt();
b.adapt();
assert_eq!(a.retarget_ids(), b.retarget_ids(), "the same seed left a different queue");
assert_eq!(flight_state(&a), flight_state(&b), "the same seed planned different routes");
for _ in 0..80 {
a.adapt();
b.adapt();
let ids = a.retarget_ids();
assert_eq!(ids.len(), ids.iter().collect::<std::collections::HashSet<_>>().len(), "a drone has two jobs");
assert_eq!(a.retarget_ids(), b.retarget_ids(), "the queues drifted apart");
assert_eq!(flight_state(&a), flight_state(&b), "the routes drifted apart");
if ids.is_empty() {
break;
}
a.tick += 1;
b.tick += 1;
// Another adaptive tick while the queue is still being worked: a known aim must not enqueue again.
if a.tick % 40 == 0 {
a.adapt();
b.adapt();
let ids = a.retarget_ids();
assert_eq!(ids.len(), ids.iter().collect::<std::collections::HashSet<_>>().len(), "a repeat adapt duplicated a job");
}
}
}
#[cfg(test)]
fn relief_grid() -> Grid {
Grid { min: DVec3::new(-2560.0, 0.0, -2560.0), cell: 32.0, size: 160 }
}
#[cfg(test)]
fn flat_relief() -> std::sync::Arc<super::ew::KnownRelief> {
let g = relief_grid();
std::sync::Arc::new(super::ew::KnownRelief::new(g, vec![70.0; (g.size * g.size) as usize]))
}
#[cfg(test)]
fn wall_relief() -> std::sync::Arc<super::ew::KnownRelief> {
let g = relief_grid();
let mut h = vec![70.0; (g.size * g.size) as usize];
for i in 0..g.size {
for j in 0..g.size {
let x = g.min.x + (f64::from(i) + 0.5) * g.cell;
let z = g.min.z + (f64::from(j) + 0.5) * g.cell;
if (x + 1000.0).abs() < 80.0 && z.abs() < 420.0 {
h[(i * g.size + j) as usize] = 1000.0;
}
}
}
std::sync::Arc::new(super::ew::KnownRelief::new(g, h))
}
#[cfg(test)]
fn finish_retargets(sim: &mut Sim) {
for _ in 0..200 {
if sim.retargets.is_empty() {
return;
}
sim.tick += 1;
sim.adapt();
}
panic!("the retarget queue did not finish");
}
#[cfg(test)]
fn retarget_route(sim: &Sim, id: u32) -> Vec<DVec3> {
sim.queue.iter().find(|(_, d)| d.id == id).unwrap().1.route.clone()
}
#[test]
fn pending_retarget_keeps_its_relief_version_after_a_new_plan() {
let flat = flat_relief();
let wall = wall_relief();
let outside = Grid { min: DVec3::new(3000.0, 0.0, 3000.0), cell: 32.0, size: 8 };
assert!(flat.sampled_on(&outside).is_none(), "land outside the plan must be Unknown");
let edge = Grid { min: DVec3::new(2500.0, 0.0, 2500.0), cell: 32.0, size: 8 };
let edge_flat = flat.sampled_on(&edge).unwrap();
assert!(edge_flat.iter().any(|h| h.is_nan()) && edge_flat.iter().any(|h| *h == 70.0));
let prepare = |relief| {
let (mut sim, _, _) = mass_retarget_sim(7);
sim.known_relief = Some(relief);
sim.tick = 40;
sim.adapt();
sim
};
let mut control = prepare(flat.clone());
let mut test = prepare(flat.clone());
let id = *test.retarget_ids().last().unwrap();
assert!(test.pending_relief(id).is_some(), "the chosen job is not waiting");
// Another smart plan finishes while the job waits: the global snapshot is the wall now.
test.known_relief = Some(wall.clone());
let bits = |v: Option<Vec<f32>>| v.map(|x| x.into_iter().map(f32::to_bits).collect::<Vec<_>>());
assert_eq!(
bits(test.pending_relief(id).unwrap().sampled_on(&edge)),
bits(flat.sampled_on(&edge)),
"a pending job's relief changed with the global snapshot"
);
finish_retargets(&mut control);
finish_retargets(&mut test);
assert_eq!(retarget_route(&control, id), retarget_route(&test, id), "the pending route used the newer relief");
let mut walled = prepare(wall);
finish_retargets(&mut walled);
assert_ne!(retarget_route(&control, id), retarget_route(&walled, id), "the test does not distinguish the relief versions");
}
#[test]
fn same_relief_different_known_snapshots_do_not_share_prices_or_routes() {
let flat = flat_relief();
let mut sim = Sim::new(3);
let start = DVec3::new(-1000.0, 100.0, 0.0);
let aim = DVec3::new(1000.0, 70.0, 0.0);
let threat = sim.id();
let threat_at = DVec3::new(0.0, 70.0, 0.0);
sim.sams.push(Sam::new(threat, SamKind::S400, threat_at, 0.0));
let target = sim.id();
sim.sams.push(Sam::new(target, SamKind::S400, aim, 0.0));
let contact = |id: u32, at: DVec3| super::ew::Contact {
id,
kind: SamKind::S400,
at,
tick: 0,
seen: super::ew::Seen::Emission,
emission: Some(0),
destroyed: None,
launches: 0,
};
let known_all = std::sync::Arc::new(vec![contact(threat, threat_at), contact(target, aim)]);
let known_target = std::sync::Arc::new(vec![contact(target, aim)]);
// The picture holds both units: a job's unit is alive only while the picture believes in it.
for c in known_all.iter() {
sim.intel.note(c.id, c.kind, c.at, true, 0, super::ew::Seen::Emission);
}
let mut add = |known: std::sync::Arc<Vec<super::ew::Contact>>, version: u64| -> u32 {
let mut d = sim.make_drone(DroneKind::Kh22, start, DVec3::X, aim);
d.smart = true;
d.err = DVec3::ZERO;
d.target = aim;
d.route = vec![start, aim];
let id = d.id;
sim.queue.push((0, d));
sim.retargets.push_back(super::ew::RouteJob::for_test(id, aim, target, version, known, Some(flat.clone())));
id
};
// Same relief, same start and aim. Version 1 knows the threat on the direct line; version 2 does not.
let first = add(known_all.clone(), 1);
let other = add(known_target, 2);
// A second job of version 1: it may reuse the first one's price grid and route.
let same = add(known_all, 1);
sim.tick = 1;
for _ in 0..10 {
if sim.retargets.is_empty() {
break;
}
sim.adapt();
sim.tick += 1;
}
assert!(sim.retargets.is_empty(), "the jobs were not finished");
let route = |id| sim.queue.iter().find(|(_, d)| d.id == id).unwrap().1.route.clone();
let (r1, r2, r3) = (route(first), route(other), route(same));
assert_ne!(r1, r2, "jobs with different known snapshots shared a route");
assert_eq!(r1, r3, "jobs of one knowledge version did not reuse their route cache");
}
// #31: a big cache of fresh columns is not scanned on every answer
#[test]
fn big_ground_cache_is_swept_rarely() {
@@ -1316,7 +1589,7 @@ fn raids_have_the_same_strike_accuracy_as_manual_launches() {
let mut sim = Sim::new(3);
let id = sim.id();
sim.sams.push(Sam::new(id, SamKind::Ew, DVec3::new(0.0, 70.0, 900.0), 0.0));
sim.intel.revealed.push((id, DVec3::new(0.0, 70.0, 900.0), 0));
sim.intel.observe(&sim.sams[0], 0, ew::Seen::Jamming);
let order = RaidOrder { kinds: vec![(DroneKind::Zircon, 20)], approach: Approach::Sector, dist: 400.0, aim: Aim::Objects };
sim.order_raid(&order, &[DVec3::new(0.0, 70.0, 0.0)], &mut Out::default());
// (The raid's launch sites need land the game has told of: a flat one is served.)
@@ -1969,6 +2242,8 @@ fn spent_motor_has_less_maneuver_at_low_speed() {
assert!(powered.x > coast.x && coast.x > 0.0, "{powered:?} {coast:?}");
}
// #129: the staged launch's exact speed rules: gas-drag ejection with a floor, a spooled
// departure that grows into full acceleration, full power at guidance, the coast drag after.
#[test]
fn cold_ejection_power_and_coast_use_their_own_speed_rules() {
let kind = MissileKind::M48n6;
@@ -1984,10 +2259,270 @@ fn cold_ejection_power_and_coast_use_their_own_speed_rules() {
sim.step_missiles(&mut Ground::default(), &mut Out::default());
sim.missiles[0].vel.length()
};
assert!((fly(0, 2.0) - 2.0 * 0.97).abs() < 1e-9, "cold ejection drag");
assert!((fly(spec.cold, 2.0) - (2.0 + spec.accel)).abs() < 1e-9, "powered acceleration");
assert!((fly(0, spec.eject) - (spec.eject - spec.eject_drag)).abs() < 1e-9, "cold ejection drag");
assert!((fly(spec.cold - 1, 0.1) - spec.eject * 0.25).abs() < 1e-9, "cold ejection floor near ignition");
assert!((fly(0, 0.2) - spec.eject * 0.25).abs() < 1e-9, "cold ejection floor");
let spool0 = 0.45 + 0.55 / f64::from(spec.boost);
assert!((fly(spec.cold, 2.0) - (2.0 + spec.accel * spool0)).abs() < 1e-9, "ignition spool-up");
assert!((fly(spec.cold + spec.boost - 1, 2.0) - (2.0 + spec.accel)).abs() < 1e-9, "powered acceleration");
assert!((fly(spec.cold + kind.burn_ticks(), 2.0) - 2.0 * 0.995).abs() < 1e-9, "coast drag");
assert!((fly(0, 0.2) - 0.4).abs() < 1e-9, "cold ejection minimum");
}
// ---- #129: the staged cold launch. Ejection (unlit gas throw) → ignition where the round has
// reached → departure (spool-up and course capture at a growing rate) → guidance at cold + boost.
/// Every cold-launched kind walks its stages in order; before ignition there is no motor voice,
/// no flame and no steering, the speed is continuous across ignition, and the turn each tick
/// never exceeds what the stage allows.
#[test]
fn cold_launch_stages_run_in_order_and_guidance_follows_ignition() {
for &kind in &[MissileKind::M48n6, MissileKind::M77n6, MissileKind::IrisT, MissileKind::M9m338] {
let spec = kind.spec();
let mut sim = Sim::new(120);
// A still target well off the vertical: the tip-over has somewhere to turn.
let target_pos = DVec3::new(300.0, 120.0, 300.0);
sim.add_drone(DroneKind::Shahed, target_pos, DVec3::ZERO, target_pos);
let (target, id) = (sim.drones[0].id, sim.id());
sim.missiles.push(Missile { id, kind, pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::Y * spec.eject, target, sam: 999, age: 0, hold: 0,
fix: Some(Fix { pos: target_pos, vel: DVec3::ZERO, tick: 0, seeker: false }), seen: 0 });
sim.begin_recording_if_active();
let mut previous_speed = spec.eject;
let mut previous_dir = DVec3::Y;
let mut saw_ignition = false;
for age in 1..=(spec.cold + spec.boost + 2) {
sim.tick += 1;
let mut out = Out::default();
sim.step_missiles(&mut Ground::default(), &mut out);
let m = sim.missiles.iter().find(|m| m.id == id).unwrap_or_else(|| panic!("{kind:?} age {age}"));
let speed = m.vel.length();
let dir = m.vel.normalize_or(DVec3::Y);
let voice = out.engines.iter().any(|e| e.key == (0x4000_0000 | id));
let flame = out.particles.iter().any(|p| p.kind == "minecraft:flame");
assert_eq!(voice, m.engine_lit(), "{kind:?} age {age}: the motor voice runs only when lit");
if !m.engine_lit() {
assert!(!voice && !flame, "{kind:?} age {age}: powered effects before ignition");
assert!((speed - (previous_speed - spec.eject_drag)).abs() < 1e-9, "{kind:?} age {age}: ejection drag");
assert!(dir.angle_between(DVec3::Y) < 1e-9, "{kind:?} age {age}: steering before ignition");
} else if !saw_ignition {
saw_ignition = true;
assert_eq!(m.age, spec.cold + 1, "{kind:?}: ignition one tick after the ejection ends");
assert!(speed > previous_speed - 1e-9, "{kind:?}: speed jumps down across ignition ({previous_speed} -> {speed})");
assert!(out.sounds.iter().any(|s| s.0 == sound::LAUNCH_S400 || s.0 == sound::LAUNCH_S500), "{kind:?}: ignition sound");
let events = sim.rec.as_ref().unwrap().scene.as_ref().unwrap().events();
assert!(events.iter().any(|e| matches!(e.kind, record::SceneKind::MotorIgnition { missile, .. } if missile == id)), "{kind:?}: ignition recorded");
}
let allowed = if spec.guided(m.age) {
spec.turn
} else if m.engine_lit() {
// Departure: the rate grows into the full one; no snap at the boundary.
spec.turn * (0.2 + 0.8 * spec.departure_ramp(m.age))
} else {
0.0
};
assert!(previous_dir.angle_between(dir) <= allowed + 1e-9, "{kind:?} age {age}: turned past the stage's rate");
previous_speed = speed;
previous_dir = dir;
}
assert!(saw_ignition, "{kind:?}: never lit");
let m = sim.missiles.iter().find(|m| m.id == id).unwrap();
assert!(m.vel.normalize().angle_between(DVec3::Y) > 0.3, "{kind:?}: still vertical after guidance started");
}
}
/// The invariant the issue is about: with a longer ignition delay the old `age >= boost` guidance
/// would have switched on before the motor existed. Now guidance implies ignition, for every
/// profile and every age, and the seeker opens with guidance, not with the raw boost counter.
#[test]
fn guidance_never_starts_before_ignition_for_any_profile() {
for kind in [
MissileKind::Pac3, MissileKind::M57e6, MissileKind::M48n6, MissileKind::M77n6, MissileKind::IrisT,
MissileKind::Amraam, MissileKind::M9m317, MissileKind::M9m338, MissileKind::P1sun,
] {
let spec = kind.spec();
for age in 0..=spec.life.min(2000) {
assert!(!spec.guided(age) || age > spec.cold, "{kind:?} age {age}: guidance before ignition (cold {})", spec.cold);
}
}
}
/// Across the whole staging the speed changes smoothly (no jumps beyond the stage's own drag or
/// full acceleration) and the per-tick turn never exceeds the profile's rate, for every kind.
/// A rocket's first powered tick is a throttled one for rail and cold launches alike (#129).
#[test]
fn launch_accel_and_turn_stay_continuous_for_every_interceptor() {
for kind in [
MissileKind::Pac3, MissileKind::M57e6, MissileKind::M48n6, MissileKind::M77n6, MissileKind::IrisT,
MissileKind::Amraam, MissileKind::M9m317, MissileKind::M9m338, MissileKind::P1sun,
] {
let spec = kind.spec();
let mut sim = Sim::new(120);
let target_pos = DVec3::new(400.0, 140.0, 400.0);
sim.add_drone(DroneKind::Shahed, target_pos, DVec3::ZERO, target_pos);
let (target, id) = (sim.drones[0].id, sim.id());
let v0 = if spec.cold > 0 { spec.eject } else { 0.8 };
sim.missiles.push(Missile { id, kind, pos: DVec3::new(0.0, 64.0, 0.0), vel: DVec3::Y * v0, target, sam: 999, age: 0, hold: 0,
fix: Some(Fix { pos: target_pos, vel: DVec3::ZERO, tick: 0, seeker: false }), seen: 0 });
let mut previous_speed = v0;
let mut previous_dir = DVec3::Y;
let mut first_power: Option<f64> = None;
for _ in 0..120 {
sim.tick += 1;
sim.step_missiles(&mut Ground::default(), &mut Out::default());
let Some(m) = sim.missiles.iter().find(|m| m.id == id) else { break };
let speed = m.vel.length();
let dir = m.vel.normalize_or(DVec3::Y);
assert!(speed - previous_speed <= spec.accel + 1e-9, "{kind:?}: speed jumped up {previous_speed} -> {speed}");
let allowed_down = spec.eject_drag + previous_speed * 0.005;
assert!(speed >= previous_speed - allowed_down - 1e-9, "{kind:?}: speed jumped down {previous_speed} -> {speed}");
assert!(previous_dir.angle_between(dir) <= spec.turn + 1e-9, "{kind:?}: turned past the profile's rate");
if m.engine_lit() && first_power.is_none() {
first_power = Some(speed - previous_speed);
}
previous_speed = speed;
previous_dir = dir;
}
if spec.flame > 0.0 {
let gain = first_power.unwrap_or_else(|| panic!("{kind:?}: the motor never lit"));
let spooled = spec.accel * (0.45 + 0.55 / f64::from(spec.boost.max(1)));
assert!(gain > 0.0 && gain <= spooled + 1e-9, "{kind:?}: the motor reached full thrust at once ({gain} > {spooled})");
}
}
}
/// The electric P1-SUN is not a rocket: it keeps no flame, no powered smoke and its own voice.
#[test]
fn p1sun_stays_a_ramming_drone_without_a_plume() {
let kind = MissileKind::P1sun;
let spec = kind.spec();
assert_eq!(spec.flame, 0.0);
assert_eq!(spec.cold, 0);
let mut sim = Sim::new(120);
let target_pos = DVec3::new(200.0, 64.0, 0.0);
sim.add_drone(DroneKind::Shahed, target_pos, DVec3::ZERO, target_pos);
let (target, id) = (sim.drones[0].id, sim.id());
sim.missiles.push(Missile { id, kind, pos: DVec3::ZERO, vel: DVec3::X * 0.8, target, sam: 999, age: 0, hold: 0,
fix: Some(Fix { pos: target_pos, vel: DVec3::ZERO, tick: 0, seeker: false }), seen: 0 });
for _ in 0..40 {
sim.tick += 1;
let mut out = Out::default();
sim.step_missiles(&mut Ground::default(), &mut out);
assert!(!out.particles.iter().any(|p| p.kind == "minecraft:flame"), "P1-SUN grew a rocket plume");
if let Some(m) = sim.missiles.iter().find(|m| m.id == id) {
assert!(m.engine_lit(), "the electric interceptor's motor state is wrong");
let (event, _, _) = kind.engine_voice();
assert!(out.engines.iter().any(|e| e.key == (0x4000_0000 | id) && e.event == event));
} else {
break;
}
}
}
/// A real S-400 launch records the ejection and the ignition `cold` ticks apart; the replay's lit
/// state follows the recorded ignition, so a seek across it shows one flame and one voice sequence.
#[test]
fn recorded_ignition_is_cold_ticks_after_ejection_and_replay_follows_it() {
let mut sim = Sim::new(0x129);
let sam = sim.id();
sim.sams.push(Sam::new(sam, SamKind::S400, DVec3::new(0.0, 64.0, 0.0), 0.0));
sim.sams[0].cooldown = 0;
let mut out = Out::default();
sim.launch(DroneKind::Kh101, DVec3::new(0.0, 160.0, -600.0), DVec3::Z, DVec3::new(0.0, 64.0, 0.0), &mut out);
let mut ground = Ground::default();
for _ in 0..200 {
// The firing system's own measurement, fresh this tick (as `why::radar_sees` feeds it):
// the test is about the launch stages, not about the scan's chance.
let now = sim.tick;
let tracks: Vec<sight::Track> = sim.drones.iter().filter(|d| d.alive())
.map(|d| sight::Track { id: d.id, kind: d.kind, pos: d.pos, vel: d.vel, tick: now, own_tick: now, ttl: 400, hits: 3, locked: false })
.collect();
sim.sams[0].tracks.retain(|t| !tracks.iter().any(|n| n.id == t.id));
sim.sams[0].tracks.extend(tracks);
let wanted = ground.take_wanted();
ground.answer(wanted.into_iter().map(|(x, z)| (x, z, 64)).collect(), sim.tick);
out = Out::default();
sim.step(&mut ground, None, &mut out);
if sim.replays.iter().chain(sim.rec.iter()).flat_map(|r| r.scene.iter().flat_map(|s| s.events())).any(|e| matches!(e.kind, record::SceneKind::MotorIgnition { .. })) {
break;
}
}
let rec = sim.rec.as_ref().or_else(|| sim.replays.last()).expect("a recording");
let scene = rec.scene.as_ref().unwrap();
let launch = scene.events().iter().find(|e| matches!(e.kind, record::SceneKind::MissileLaunch { .. })).expect("the ejection is recorded");
let missile = match launch.kind { record::SceneKind::MissileLaunch { missile, .. } => missile, _ => unreachable!() };
let spec = MissileKind::M48n6.spec();
let ignition = rec.missile_ignition(missile).expect("the ignition is recorded");
assert_eq!(ignition.at - launch.at, spec.cold, "ignition {} ticks after the ejection", spec.cold);
let track = rec.track(missile).expect("the interceptor's track");
for t in [ignition.at as f64 - 1.0, ignition.at as f64 - 0.1] {
assert!(!rec.missile_is_lit(track, t, spec.cold), "lit before the recorded ignition at {t}");
}
for t in [ignition.at as f64, ignition.at as f64 + 5.0] {
assert!(rec.missile_is_lit(track, t, spec.cold), "not lit at the recorded ignition ({t})");
}
assert!(!rec.missile_is_lit(track, ignition.at as f64 + spec.cold as f64 + f64::from(MissileKind::M48n6.burn_ticks()) + 2.0, spec.cold), "lit past the recorded burnout");
}
/// The physical RM48U strike ejects unlit and slow, then lights at `EJECT_TICKS` where it has
/// reached: no motor voice or flame before, one ignition sound at the hand-over.
#[test]
fn rm48u_strike_ejects_before_ignition_on_its_own_path() {
use super::sites::testland::{Land, serve};
use super::sites::{LaunchSite, SiteClass};
use super::strike::{Estimate, Known, SiteState};
use glam::DVec2;
let land = Land(|_, _| 64);
let mut sim = Sim::new(11);
// A fixed site the strike needs no scouting for; its launches are queued far ahead, so a wave
// boundary does not retire it while the test runs.
let id = sim.sites.add(LaunchSite {
id: 0, side: 0, sector: 0, bearing: 0.0, class: SiteClass::Ramp,
pos: DVec3::new(0.0, 64.0, 400.0), range: 400.0, water: false,
stock: 4, planned: 4, alive: true, next_free: 0, offmap: false,
});
for i in 0..4 {
let site = sim.sites.get(id).unwrap().clone();
let d = sim.make_drone(DroneKind::Shahed, site.muzzle(i), -DVec3::Z, DVec3::new(0.0, 70.0, 0.0));
sim.sites.job(d.id, id);
sim.queue.push((20_000 + u64::from(i), d));
}
sim.strikes.known.push(Known {
site: id, class: SiteClass::Ramp, obs: Vec::new(),
est: Some(Estimate { pos: DVec2::new(0.0, 400.0), radius: 5.0, fix: true, bearing: 0.0, bearing_err: 0.01, origin: DVec2::ZERO }),
launches: 1, last: 0, state: SiteState::Active, aimed: false,
});
let carrier = sim.id();
let mut sam = Sam::new(carrier, SamKind::S400, DVec3::new(0.0, 64.0, 0.0), 0.0);
sam.missiles = 2;
sam.ground_rounds = 2;
sam.cooldown = 0;
sim.sams.push(sam);
let mut out = Out::default();
sim.order_strike(id, DVec3::ZERO, &mut out).unwrap();
let (mut ground, mut heard_ignition) = (Ground::default(), 0);
let mut saw_voice_before = false;
let mut saw_flame_before = false;
let mut rise = 0.0f64;
let mut all_messages = Vec::new();
for _ in 0..(launch::OPEN_TICKS as usize + strike::EJECT_TICKS as usize + 6) {
serve(&mut ground, &land, sim.tick);
out = Out::default();
sim.step(&mut ground, None, &mut out);
all_messages.append(&mut out.messages);
if let Some(f) = sim.strikes.flights.first() {
let age = sim.tick - f.start;
if age < strike::EJECT_TICKS {
saw_voice_before |= out.engines.iter().any(|e| e.key == 0x7500_0000 + f.id * PARTS);
saw_flame_before |= out.models.iter().any(|m| m.name == "airdef:flame" && m.id == 0x7500_0000 + f.id * PARTS + 1);
rise = rise.max(f.pos.y - f.from.y);
}
if age == strike::EJECT_TICKS {
heard_ignition = out.sounds.iter().filter(|s| s.0 == sound::LAUNCH_S400).count();
}
}
}
assert!(rise > 10.0, "the ejection rose only {rise} blocks");
assert!(!saw_voice_before && !saw_flame_before, "powered effects during the unlit ejection");
assert_eq!(heard_ignition, 1, "exactly one ignition sound at the hand-over: {all_messages:?}");
}
#[test]
+3 -3
View File
@@ -29,9 +29,9 @@ pub(super) const GUN_PICK_AGE: u64 = 40;
/// A track older than this is shown as a forecast.
pub const FORECAST_AGE: u64 = 20;
/// Radio horizon: `HORIZON * (√mast + √height)` blocks.
const HORIZON: f64 = 35.0;
pub(super) const HORIZON: f64 = 35.0;
/// Anything this near is seen (and heard), whatever hides it.
const NEAR: f64 = 24.0;
pub(super) const NEAR: f64 = 24.0;
pub(super) struct Horizon {
/// Per ray, per sample out: the steepest rise of the land so far (tan of its elevation).
@@ -471,7 +471,7 @@ impl Sim {
if now % 20 == 0 {
for s in self.sams.iter().filter(|s| s.radar_up()) {
if self.drones.iter().any(|d| d.alive() && d.pos.distance(s.pos) <= 1600.0) {
self.intel.revealed.push((s.id, s.pos, now));
self.intel.observe(s, now, ew::Seen::Emission);
}
}
}
+542
View File
@@ -0,0 +1,542 @@
// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.
// Game-scale values, not real weapon data; the catalog is the only copy.
/// Share of the old slew speed a launcher keeps when it has no rate of its own.
const DRIVE_SCALE: f64 = 0.4;
/// Ticks a drive takes to reach its top speed (and to stop from it).
const DRIVE_RAMP: f64 = 8.0;
const DRIVE_TRAINABLE: (f64, f64) = (0.12, 0.0);
const DRIVE_VERTICAL: (f64, f64) = (0.15, 0.0);
const DRIVE_OTHER: (f64, f64) = (0.05, 0.05);
/// Ballistic flight's gravity, blocks a tick².
const GRAVITY: f64 = 0.05;
/// Height over the target where the Oreshnik's blocks release their submunitions.
const BLOCK_SPLIT: f64 = 300.0;
/// How near a depot a system reloads straight from it.
const DEPOT_REACH: f64 = 60.0;
/// How near a truck must come to hand a reload over, or to load up at a depot.
const HANDOVER: f64 = 10.0;
/// What a truck carries.
const TRUCK_LOAD: u32 = 2;
const STOCK_LIMIT: u32 = 1000000;
const DRONE_SPEC_SHAHED: DroneSpec = DroneSpec {
name: "Шахед-136",
key: "shahed",
model: "airdef:shahed",
speed: 0.6,
turn: 0.035,
cruise: 45.0,
clearance: 18.0,
dive: 32.0,
warhead: 3,
scale: 1.3,
engine: Engine::Prop(1.34, 1.0),
decoy: false,
stealth: 1.0,
rcs: 0.3,
sound: (sound::DRONE_SHAHED, 1.0, 48),
class: Class::Drone,
ballistic: None,
launch_sound: sound::LAUNCH_S400_EJECT,
};
const DRONE_SPEC_GERAN3: DroneSpec = DroneSpec {
name: "Герань-3",
key: "geran3",
model: "airdef:geran3",
speed: 1.6,
turn: 0.03,
cruise: 60.0,
clearance: 18.0,
dive: 50.0,
warhead: 2,
scale: 1.15,
engine: Engine::Jet(0.34, 1.55, 1.0),
decoy: false,
stealth: 1.1,
rcs: 0.4,
sound: (sound::DRONE_GERAN3, 1.0, 40),
class: Class::Jet,
ballistic: None,
launch_sound: sound::LAUNCH_S400_EJECT,
};
const DRONE_SPEC_LANCET: DroneSpec = DroneSpec {
name: "Ланцет-3",
key: "lancet",
model: "airdef:lancet",
speed: 1.1,
turn: 0.07,
cruise: 25.0,
clearance: 10.0,
dive: 38.0,
warhead: 1,
scale: 0.9,
engine: Engine::Prop(0.93, 0.55),
decoy: false,
stealth: 1.4,
rcs: 0.08,
sound: (sound::DRONE_LANCET, 1.0, 32),
class: Class::Drone,
ballistic: None,
launch_sound: sound::LAUNCH_S400_EJECT,
};
const DRONE_SPEC_GERBERA: DroneSpec = DroneSpec {
name: "Гербера",
key: "gerbera",
model: "airdef:gerbera",
speed: 0.5,
turn: 0.04,
cruise: 40.0,
clearance: 15.0,
dive: 30.0,
warhead: 0,
scale: 1.1,
engine: Engine::Prop(1.03, 0.9),
decoy: true,
stealth: 0.9,
rcs: 0.4,
sound: (sound::DRONE_SHAHED, 1.3, 40),
class: Class::Drone,
ballistic: None,
launch_sound: sound::LAUNCH_S400_EJECT,
};
const DRONE_SPEC_KH101: DroneSpec = DroneSpec {
name: "Х-101",
key: "kh101",
model: "airdef:kh101",
speed: 2.4,
turn: 0.025,
cruise: 0.0,
clearance: 12.0,
dive: 26.0,
warhead: 6,
scale: 1.6,
engine: Engine::Jet(-0.27, 1.4, 0.6),
decoy: false,
stealth: 1.5,
rcs: 0.05,
sound: (sound::DRONE_CRUISE, 1.0, 50),
class: Class::Cruise,
ballistic: None,
launch_sound: sound::LAUNCH_PATRIOT,
};
const DRONE_SPEC_KALIBR: DroneSpec = DroneSpec {
name: "Калибр",
key: "kalibr",
model: "airdef:kalibr",
speed: 2.1,
turn: 0.025,
cruise: 0.0,
clearance: 15.0,
dive: 26.0,
warhead: 5,
scale: 1.5,
engine: Engine::Jet(-0.2, 1.5, 0.6),
decoy: false,
stealth: 1.3,
rcs: 0.15,
sound: (sound::DRONE_CRUISE, 1.2, 50),
class: Class::Cruise,
ballistic: None,
launch_sound: sound::LAUNCH_PATRIOT,
};
const DRONE_SPEC_KH22: DroneSpec = DroneSpec {
name: "Х-22",
key: "kh22",
model: "airdef:kh22",
speed: 4.0,
turn: 0.03,
cruise: 140.0,
clearance: 40.0,
dive: 150.0,
warhead: 7,
scale: 1.8,
engine: Engine::Rocket(1.5, 1.3),
decoy: false,
stealth: 1.4,
rcs: 1.0,
sound: (sound::DRONE_ROCKET, 0.8, 46),
class: Class::Supersonic,
ballistic: None,
launch_sound: sound::LAUNCH_PATRIOT,
};
const DRONE_SPEC_ZIRCON: DroneSpec = DroneSpec {
name: "Циркон",
key: "zircon",
model: "airdef:zircon",
speed: 5.5,
turn: 0.025,
cruise: 90.0,
clearance: 30.0,
dive: 110.0,
warhead: 6,
scale: 1.4,
engine: Engine::Rocket(1.5, 1.1),
decoy: false,
stealth: 2.0,
rcs: 0.4,
sound: (sound::DRONE_ROCKET, 1.35, 46),
class: Class::Supersonic,
ballistic: None,
launch_sound: sound::LAUNCH_S400,
};
const DRONE_SPEC_ISKANDER: DroneSpec = DroneSpec {
name: "Искандер-М",
key: "iskander",
model: "airdef:iskander",
speed: 5.0,
turn: 0.04,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 8,
scale: 1.8,
engine: Engine::Rocket(1.5, 1.6),
decoy: false,
stealth: 1.6,
rcs: 0.6,
sound: (sound::DRONE_ROCKET, 0.7, 46),
class: Class::Ballistic,
ballistic: Some(1000.0),
launch_sound: sound::LAUNCH_S500,
};
const DRONE_SPEC_KINZHAL: DroneSpec = DroneSpec {
name: "Кинжал",
key: "kinzhal",
model: "airdef:kinzhal",
speed: 7.5,
turn: 0.03,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 8,
scale: 1.7,
engine: Engine::Rocket(1.5, 1.5),
decoy: false,
stealth: 2.2,
rcs: 0.5,
sound: (sound::DRONE_ROCKET, 0.6, 46),
class: Class::Ballistic,
ballistic: Some(1500.0),
launch_sound: sound::LAUNCH_S500,
};
const DRONE_SPEC_ORESHNIK: DroneSpec = DroneSpec {
name: "Орешник",
key: "oreshnik",
model: "airdef:iskander",
speed: 9.0,
turn: 0.0,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 0,
scale: 2.6,
engine: Engine::Rocket(1.5, 2.4),
decoy: false,
stealth: 3.0,
rcs: 2.0,
sound: (sound::DRONE_ROCKET, 0.5, 46),
class: Class::Ballistic,
ballistic: Some(2600.0),
launch_sound: sound::LAUNCH_S500,
};
const DRONE_SPEC_ORESHNIKBLOCK: DroneSpec = DroneSpec {
name: "Орешник: блок",
key: "oreshnik_block",
model: "airdef:reentry",
speed: 9.0,
turn: 0.0,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 4,
scale: 1.6,
engine: Engine::Rocket(1.0, 1.0),
decoy: false,
stealth: 3.5,
rcs: 0.4,
sound: (sound::DRONE_BALLISTIC, 0.8, 9999),
class: Class::Ballistic,
ballistic: None,
launch_sound: sound::LAUNCH_S500,
};
const DRONE_SPEC_ORESHNIKSUB: DroneSpec = DroneSpec {
name: "Орешник: суббоеприпас",
key: "oreshnik_sub",
model: "airdef:reentry",
speed: 9.0,
turn: 0.05,
cruise: 0.0,
clearance: 0.0,
dive: 0.0,
warhead: 3,
scale: 1.1,
engine: Engine::Rocket(1.0, 1.0),
decoy: false,
stealth: 4.0,
rcs: 0.08,
sound: (sound::DRONE_BALLISTIC, 1.0, 9999),
class: Class::Ballistic,
ballistic: None,
launch_sound: sound::LAUNCH_S500,
};
const MISSILE_SPEC_PAC3: MissileSpec = MissileSpec {
model: "airdef:pac3",
speed: 5.5,
accel: 0.35,
turn: 0.3,
boost: 8,
cold: 0,
eject: 0.0,
eject_drag: 0.0,
pk: 0.9,
fuse: 4.0,
life: 240,
scale: 1.0,
flame: 1.0,
rear: 28.0,
seeker: 110.0,
launch_sound: sound::LAUNCH_PATRIOT,
voice: (sound::MISSILE_FLIGHT, 1.0, 1.0),
};
const MISSILE_SPEC_M57E6: MissileSpec = MissileSpec {
model: "airdef:m57e6",
speed: 5.0,
accel: 0.5,
turn: 0.32,
boost: 5,
cold: 0,
eject: 0.0,
eject_drag: 0.0,
pk: 0.82,
fuse: 3.0,
life: 160,
scale: 0.85,
flame: 0.65,
rear: 28.0,
seeker: 0.0,
launch_sound: sound::LAUNCH_PANTSIR,
voice: (sound::MISSILE_FLIGHT, 1.0, 1.12),
};
const MISSILE_SPEC_M48N6: MissileSpec = MissileSpec {
model: "airdef:m48n6",
speed: 7.0,
accel: 0.5,
turn: 0.22,
boost: 8,
cold: 20,
eject: 2.4,
eject_drag: 0.07,
pk: 0.9,
fuse: 5.0,
life: 300,
scale: 1.5,
flame: 1.4,
rear: 30.0,
seeker: 120.0,
launch_sound: sound::LAUNCH_S400_EJECT,
voice: (sound::MISSILE_FLIGHT, 1.0, 0.88),
};
const MISSILE_SPEC_M77N6: MissileSpec = MissileSpec {
model: "airdef:m77n6",
speed: 9.0,
accel: 0.6,
turn: 0.22,
boost: 8,
cold: 24,
eject: 2.6,
eject_drag: 0.07,
pk: 0.95,
fuse: 6.0,
life: 320,
scale: 1.7,
flame: 1.6,
rear: 32.0,
seeker: 120.0,
launch_sound: sound::LAUNCH_S500_EJECT,
voice: (sound::MISSILE_FLIGHT, 1.0, 0.8),
};
const MISSILE_SPEC_IRIST: MissileSpec = MissileSpec {
model: "airdef:irist_missile",
speed: 7.0,
accel: 0.5,
turn: 0.35,
boost: 6,
cold: 8,
eject: 1.8,
eject_drag: 0.1,
pk: 0.9,
fuse: 4.0,
life: 260,
scale: 0.95,
flame: 0.9,
rear: 28.0,
seeker: 90.0,
launch_sound: sound::LAUNCH_S400_EJECT,
voice: (sound::MISSILE_FLIGHT, 1.0, 1.05),
};
const MISSILE_SPEC_AMRAAM: MissileSpec = MissileSpec {
model: "airdef:amraam_missile",
speed: 6.0,
accel: 0.45,
turn: 0.3,
boost: 6,
cold: 0,
eject: 0.0,
eject_drag: 0.0,
pk: 0.85,
fuse: 4.0,
life: 260,
scale: 0.9,
flame: 0.9,
rear: 28.0,
seeker: 130.0,
launch_sound: sound::LAUNCH_PATRIOT,
voice: (sound::MISSILE_FLIGHT, 1.0, 1.05),
};
const MISSILE_SPEC_M9M317: MissileSpec = MissileSpec {
model: "airdef:m48n6",
speed: 6.5,
accel: 0.5,
turn: 0.25,
boost: 8,
cold: 0,
eject: 0.0,
eject_drag: 0.0,
pk: 0.85,
fuse: 5.0,
life: 300,
scale: 1.1,
flame: 1.2,
rear: 32.0,
seeker: 90.0,
launch_sound: sound::LAUNCH_PATRIOT,
voice: (sound::MISSILE_FLIGHT, 1.0, 0.9),
};
const MISSILE_SPEC_M9M338: MissileSpec = MissileSpec {
model: "airdef:m57e6",
speed: 5.5,
accel: 0.6,
turn: 0.4,
boost: 4,
cold: 8,
eject: 1.6,
eject_drag: 0.1,
pk: 0.9,
fuse: 3.0,
life: 160,
scale: 1.0,
flame: 0.8,
rear: 28.0,
seeker: 70.0,
launch_sound: sound::LAUNCH_S400_EJECT,
voice: (sound::MISSILE_FLIGHT, 1.0, 1.15),
};
const MISSILE_SPEC_P1SUN: MissileSpec = MissileSpec {
model: "airdef:p1sun",
speed: 2.8,
accel: 0.12,
turn: 0.3,
boost: 4,
cold: 0,
eject: 0.0,
eject_drag: 0.0,
pk: 0.8,
fuse: 3.0,
life: 900,
scale: 0.8,
flame: 0.0,
rear: 10.0,
seeker: 60.0,
launch_sound: sound::DRONE_LANCET,
voice: (sound::DRONE_LANCET, 0.8, 1.6),
};
impl DroneKind {
/// Its row of numbers from `catalog/specs.json`.
pub fn spec(self) -> &'static DroneSpec {
match self {
DroneKind::Shahed => &DRONE_SPEC_SHAHED,
DroneKind::Geran3 => &DRONE_SPEC_GERAN3,
DroneKind::Lancet => &DRONE_SPEC_LANCET,
DroneKind::Gerbera => &DRONE_SPEC_GERBERA,
DroneKind::Kh101 => &DRONE_SPEC_KH101,
DroneKind::Kalibr => &DRONE_SPEC_KALIBR,
DroneKind::Kh22 => &DRONE_SPEC_KH22,
DroneKind::Zircon => &DRONE_SPEC_ZIRCON,
DroneKind::Iskander => &DRONE_SPEC_ISKANDER,
DroneKind::Kinzhal => &DRONE_SPEC_KINZHAL,
DroneKind::Oreshnik => &DRONE_SPEC_ORESHNIK,
DroneKind::OreshnikBlock => &DRONE_SPEC_ORESHNIKBLOCK,
DroneKind::OreshnikSub => &DRONE_SPEC_ORESHNIKSUB,
}
}
}
impl MissileKind {
fn spec(self) -> &'static MissileSpec {
match self {
MissileKind::Pac3 => &MISSILE_SPEC_PAC3,
MissileKind::M57e6 => &MISSILE_SPEC_M57E6,
MissileKind::M48n6 => &MISSILE_SPEC_M48N6,
MissileKind::M77n6 => &MISSILE_SPEC_M77N6,
MissileKind::IrisT => &MISSILE_SPEC_IRIST,
MissileKind::Amraam => &MISSILE_SPEC_AMRAAM,
MissileKind::M9m317 => &MISSILE_SPEC_M9M317,
MissileKind::M9m338 => &MISSILE_SPEC_M9M338,
MissileKind::P1sun => &MISSILE_SPEC_P1SUN,
}
}
}
/// Save keys by kind; a rename needs an explicit migration.
#[cfg(test)]
pub(super) const DRONE_SPEC_KEYS: [(DroneKind, &str); 13] = [
(DroneKind::Shahed, "shahed"),
(DroneKind::Geran3, "geran3"),
(DroneKind::Lancet, "lancet"),
(DroneKind::Gerbera, "gerbera"),
(DroneKind::Kh101, "kh101"),
(DroneKind::Kalibr, "kalibr"),
(DroneKind::Kh22, "kh22"),
(DroneKind::Zircon, "zircon"),
(DroneKind::Iskander, "iskander"),
(DroneKind::Kinzhal, "kinzhal"),
(DroneKind::Oreshnik, "oreshnik"),
(DroneKind::OreshnikBlock, "oreshnik_block"),
(DroneKind::OreshnikSub, "oreshnik_sub"),
];
#[cfg(test)]
pub(super) const MISSILE_SPEC_MODELS: [(MissileKind, &str); 9] = [
(MissileKind::Pac3, "airdef:pac3"),
(MissileKind::M57e6, "airdef:m57e6"),
(MissileKind::M48n6, "airdef:m48n6"),
(MissileKind::M77n6, "airdef:m77n6"),
(MissileKind::IrisT, "airdef:irist_missile"),
(MissileKind::Amraam, "airdef:amraam_missile"),
(MissileKind::M9m317, "airdef:m48n6"),
(MissileKind::M9m338, "airdef:m57e6"),
(MissileKind::P1sun, "airdef:p1sun"),
];
+27 -6
View File
@@ -25,7 +25,16 @@ use glam::DVec2;
/// Minecraft presentation profile; neither dimensions nor timing reproduce a real weapon.
pub const ROUND_MODEL: &str = "airdef:rm48u";
pub const ROUND_SCALE: f64 = 1.5;
pub const EJECT_TICKS: u64 = 5;
/// Ticks the gas throw takes before the motor lights: the same staged cold launch as the
/// interceptor's `cold` (#129), so a physical strike shows the unlit ejection too.
pub const EJECT_TICKS: u64 = 20;
/// The unlit ejection's height at flight age `age`: a gas throw of 2.2 blocks a tick with a
/// linear drag of 0.09 a tick², integrated (game scale, like the interceptor's `eject`).
fn eject_rise(age: u64) -> f64 {
let a = age as f64;
(2.2 * a - 0.045 * a * a).max(0.0)
}
/// Shared live/replay appearance, including the unlit cold-ejection phase.
pub(super) fn round_visual(out: &mut Out, id: u32, pos: DVec3, rot: DQuat, lit: bool) {
@@ -581,10 +590,18 @@ impl Sim {
let end = DVec3::new(f.land.x, below.unwrap_or(f.from.y), f.land.y);
let t = ((now - f.start) as f64 / (f.arrive - f.start).max(1) as f64).clamp(0.0, 1.0);
let age = now.saturating_sub(f.start);
let arc = |t: f64| TUNE.height * (std::f64::consts::PI * t).sin().max(0.0).sqrt();
let planned = if f.carrier.is_some() && age < EJECT_TICKS {
f.from + DVec3::Y * (age as f64 * 0.7)
// The unlit gas throw: it rises and slows, no motor yet (#129).
f.from + DVec3::Y * eject_rise(age)
} else if f.carrier.is_some() {
// From where the ejection reached, onto the cruise arc: the plan is continuous
// at ignition, and the flight time counted at the order includes the ejection.
let top = f.from + DVec3::Y * eject_rise(EJECT_TICKS);
let t = ((age - EJECT_TICKS) as f64 / (f.arrive - f.start).saturating_sub(EJECT_TICKS).max(1) as f64).clamp(0.0, 1.0);
top.lerp(end, t) + DVec3::Y * arc(t)
} else {
f.from.lerp(end, t) + DVec3::Y * (TUNE.height * (std::f64::consts::PI * t).sin().max(0.0).sqrt())
f.from.lerp(end, t) + DVec3::Y * arc(t)
};
let from = f.pos;
// Time spent waiting for world data must not accumulate into a faster step.
@@ -750,10 +767,13 @@ impl Sim {
sam.launched = 12;
sam.fired += 1;
let dist = (p.aim - DVec2::new(sam.pos.x, sam.pos.z)).length();
self.intel.revealed.push((p.carrier, sam.pos, self.tick));
// The launch betrays the carrier: the enemy saw it fire, no more than that.
self.intel.observe(&self.sams[i], self.tick, ew::Seen::Launch);
self.strikes.fired += 1;
self.strikes.next += 1;
let ticks = (dist / TUNE.speed).ceil().max(20.0) as u64;
// The counted flight includes the unlit ejection: the missile is honest about
// arriving a second later (#129).
let ticks = (dist / TUNE.speed).ceil().max(20.0) as u64 + EJECT_TICKS;
let (gx, gz) = (gauss(self.seed, self.strikes.next as u64, p.site as u64, 7), gauss(self.seed, self.strikes.next as u64, p.site as u64, 8));
self.strikes.flights.push(Flight { id: self.strikes.next, site: p.site, carrier: Some(p.carrier), from: start, pos: start, aim: p.aim,
land: p.aim + DVec2::new(gx, gz) * TUNE.cep, start: self.tick, arrive: self.tick + ticks, snap, hold: 0 });
@@ -790,7 +810,8 @@ impl Sim {
self.strikes.stock -= 1;
self.strikes.fired += 1;
self.strikes.next += 1;
let ticks = (dist / TUNE.speed).ceil().max(20.0) as u64;
// The counted flight includes the unlit ejection (#129).
let ticks = (dist / TUNE.speed).ceil().max(20.0) as u64 + EJECT_TICKS;
let start = from + DVec3::Y * 1.5;
// Its own scatter at the aim, rolled once here: the flight and its outcome name one point.
let (gx, gz) = (gauss(self.seed, self.strikes.next as u64, id as u64, 7), gauss(self.seed, self.strikes.next as u64, id as u64, 8));
+424
View File
@@ -0,0 +1,424 @@
// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.
// Game-scale values, not real weapon data; the catalog is the only copy.
const NAMED_BATTERY_RADAR: &[(&str, f64, f64)] = &[("airdef:radar_trailer", 0.0, 4.2)];
const NAMED_BATTERY_SPINNER: Option<(&str, f64, f64, f64, f64)> = Some(("airdef:radar_panel", 0.9, 4.2, 0.9, -0.3));
const NAMED_TUBE_PIVOT: DVec3 = DVec3::new(0.0, -0.5, 1.5);
const UNIT_SPEC_PATRIOT: SamSpec = SamSpec {
name: "Patriot",
key: "patriot",
missile: Some(MissileLoad { kind: MissileKind::Pac3, magazine: 4, min: 10.0, max: 450.0, interval: 16 }),
gun: None,
reload: 220,
scale: 1.3,
rest_pitch: 0.66,
roles: 30,
family: Family::Trainable,
parts: Parts {
body: "airdef:patriot_trailer",
launcher: Some("airdef:patriot_launcher"),
pack: None,
dish: None,
fixed: &[("airdef:patriot_truck", 0.0, -3.0), ("airdef:patriot_radar", 0.0, 3.6)],
spinner: None,
},
mount: (0.69, 1.2),
pivot: DVec3::new(0.0, -0.5, 1.375),
muzzle: Muzzle::Patriot,
sensor: 585.0,
mast: 5.0,
};
const UNIT_SPEC_GEPARD: SamSpec = SamSpec {
name: "Гепард",
key: "gepard",
missile: None,
gun: Some(GunSpec { range: 135.0, track: 195.0, p: 0.3, bursts: 160, shell: 10.0, slew: (0.22, 0.16) }),
reload: 160,
scale: 1.25,
rest_pitch: 0.0,
roles: 7,
family: Family::Gun,
parts: Parts {
body: "airdef:gepard_hull",
launcher: Some("airdef:gepard_turret"),
pack: Some("airdef:gepard_guns"),
dish: Some(("airdef:gepard_dish", 0.95, 0.6, 0.0)),
fixed: &[],
spinner: None,
},
mount: (1.55, 0.25),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 255.0,
mast: 3.0,
};
const UNIT_SPEC_PANTSIR: SamSpec = SamSpec {
name: "Панцирь-С1",
key: "pantsir",
missile: Some(MissileLoad { kind: MissileKind::M57e6, magazine: 12, min: 25.0, max: 225.0, interval: 14 }),
gun: Some(GunSpec { range: 90.0, track: 135.0, p: 0.25, bursts: 140, shell: 9.0, slew: (0.25, 0.18) }),
reload: 280,
scale: 1.3,
rest_pitch: 0.0,
roles: 15,
family: Family::Turret,
parts: Parts {
body: "airdef:pantsir_truck",
launcher: Some("airdef:pantsir_turret"),
pack: Some("airdef:pantsir_pack"),
dish: Some(("airdef:pantsir_dish", 0.85, 0.3, 0.3)),
fixed: &[],
spinner: None,
},
mount: (1.35, 0.69),
pivot: DVec3::ZERO,
muzzle: Muzzle::Pantsir,
sensor: 292.0,
mast: 4.0,
};
const UNIT_SPEC_S400: SamSpec = SamSpec {
name: "С-400",
key: "s400",
missile: Some(MissileLoad { kind: MissileKind::M48n6, magazine: 4, min: 30.0, max: 720.0, interval: 20 }),
gun: None,
reload: 420,
scale: 1.5,
rest_pitch: HALF_PI - 0.02,
roles: 30,
family: Family::Vertical,
parts: Parts {
body: "airdef:s400_chassis",
launcher: Some("airdef:s400_tubes"),
pack: None,
dish: None,
fixed: NAMED_BATTERY_RADAR,
spinner: NAMED_BATTERY_SPINNER,
},
mount: (0.7, 1.45),
pivot: NAMED_TUBE_PIVOT,
muzzle: Muzzle::Grid(2, 2, 7.0),
sensor: 936.0,
mast: 5.0,
};
const UNIT_SPEC_S500: SamSpec = SamSpec {
name: "С-500",
key: "s500",
missile: Some(MissileLoad { kind: MissileKind::M77n6, magazine: 2, min: 40.0, max: 1050.0, interval: 20 }),
gun: None,
reload: 520,
scale: 1.6,
rest_pitch: HALF_PI - 0.02,
roles: 24,
family: Family::Vertical,
parts: Parts {
body: "airdef:s500_chassis",
launcher: Some("airdef:s500_tubes"),
pack: None,
dish: None,
fixed: NAMED_BATTERY_RADAR,
spinner: NAMED_BATTERY_SPINNER,
},
mount: (0.7, 1.45),
pivot: NAMED_TUBE_PIVOT,
muzzle: Muzzle::Grid(2, 1, 9.5),
sensor: 1365.0,
mast: 5.0,
};
const UNIT_SPEC_IRIST: SamSpec = SamSpec {
name: "IRIS-T SLM",
key: "irist",
missile: Some(MissileLoad { kind: MissileKind::IrisT, magazine: 8, min: 15.0, max: 600.0, interval: 10 }),
gun: None,
reload: 300,
scale: 1.4,
rest_pitch: HALF_PI - 0.02,
roles: 15,
family: Family::Vertical,
parts: Parts {
body: "airdef:irist_chassis",
launcher: Some("airdef:irist_tubes"),
pack: None,
dish: None,
fixed: NAMED_BATTERY_RADAR,
spinner: NAMED_BATTERY_SPINNER,
},
mount: (0.7, 1.45),
pivot: NAMED_TUBE_PIVOT,
muzzle: Muzzle::Grid(4, 2, 4.0),
sensor: 780.0,
mast: 5.0,
};
const UNIT_SPEC_NASAMS: SamSpec = SamSpec {
name: "NASAMS",
key: "nasams",
missile: Some(MissileLoad { kind: MissileKind::Amraam, magazine: 6, min: 10.0, max: 450.0, interval: 14 }),
gun: None,
reload: 260,
scale: 1.3,
rest_pitch: 0.5,
roles: 14,
family: Family::Trainable,
parts: Parts {
body: "airdef:nasams_trailer",
launcher: Some("airdef:nasams_launcher"),
pack: None,
dish: None,
fixed: &[("airdef:radar_trailer", 0.0, 3.4)],
spinner: Some(("airdef:radar_panel", 0.9, 3.4, 0.6, -0.3)),
},
mount: (0.62, 0.4),
pivot: NAMED_TUBE_PIVOT,
muzzle: Muzzle::Grid(3, 2, 4.0),
sensor: 585.0,
mast: 5.0,
};
const UNIT_SPEC_BUK: SamSpec = SamSpec {
name: "Бук-М2",
key: "buk",
missile: Some(MissileLoad { kind: MissileKind::M9m317, magazine: 4, min: 20.0, max: 675.0, interval: 18 }),
gun: None,
reload: 400,
scale: 1.4,
rest_pitch: 0.0,
roles: 14,
family: Family::Turret,
parts: Parts {
body: "airdef:buk_chassis",
launcher: Some("airdef:buk_turret"),
pack: Some("airdef:buk_rails"),
dish: None,
fixed: &[],
spinner: None,
},
mount: (1.55, 0.2),
pivot: DVec3::ZERO,
muzzle: Muzzle::Rails(&[-9.0, -3.0, 13.0, 19.0]),
sensor: 878.0,
mast: 4.0,
};
const UNIT_SPEC_TOR: SamSpec = SamSpec {
name: "Тор-М2",
key: "tor",
missile: Some(MissileLoad { kind: MissileKind::M9m338, magazine: 8, min: 8.0, max: 240.0, interval: 8 }),
gun: None,
reload: 300,
scale: 1.3,
rest_pitch: 0.0,
roles: 15,
family: Family::Vertical,
parts: Parts {
body: "airdef:tor_chassis",
launcher: Some("airdef:tor_turret"),
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (1.5, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::Cells,
sensor: 315.0,
mast: 3.5,
};
const UNIT_SPEC_P1SUN: SamSpec = SamSpec {
name: "P1-SUN",
key: "p1sun",
missile: Some(MissileLoad { kind: MissileKind::P1sun, magazine: 8, min: 5.0, max: 675.0, interval: 12 }),
gun: None,
reload: 240,
scale: 1.1,
rest_pitch: 0.35,
roles: 1,
family: Family::Trainable,
parts: Parts {
body: "airdef:nasams_trailer",
launcher: Some("airdef:p1sun_launcher"),
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (0.6, 0.3),
pivot: NAMED_TUBE_PIVOT,
muzzle: Muzzle::Grid(4, 2, 3.0),
sensor: 0.0,
mast: 2.0,
};
const UNIT_SPEC_RADAR: SamSpec = SamSpec {
name: "РЛС дальнего обнаружения",
key: "radar",
missile: None,
gun: None,
reload: 0,
scale: 1.5,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts {
body: "airdef:radar_truck",
launcher: None,
pack: None,
dish: None,
fixed: &[],
spinner: Some(("airdef:radar_panel", 1.2, 1.2, 1.5, -0.25)),
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 2550.0,
mast: 16.0,
};
const UNIT_SPEC_DEPOT: SamSpec = SamSpec {
name: "Склад боеприпасов",
key: "depot",
missile: None,
gun: None,
reload: 0,
scale: 1.5,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts {
body: "airdef:depot",
launcher: None,
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 1.0,
};
const UNIT_SPEC_TZM: SamSpec = SamSpec {
name: "ТЗМ",
key: "tzm",
missile: None,
gun: None,
reload: 0,
scale: 1.3,
rest_pitch: 0.0,
roles: 0,
family: Family::Truck,
parts: Parts {
body: "airdef:tzm_truck",
launcher: None,
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 2.0,
};
const UNIT_SPEC_EW: SamSpec = SamSpec {
name: "Станция РЭБ",
key: "ew",
missile: None,
gun: None,
reload: 0,
scale: 1.3,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts {
body: "airdef:ew_truck",
launcher: None,
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 3.0,
};
const UNIT_SPEC_LIGHT: SamSpec = SamSpec {
name: "Прожектор",
key: "light",
missile: None,
gun: None,
reload: 0,
scale: 1.2,
rest_pitch: 0.6,
roles: 0,
family: Family::Light,
parts: Parts {
body: "airdef:searchlight",
launcher: Some("airdef:searchlight_head"),
pack: None,
dish: None,
fixed: &[],
spinner: None,
},
mount: (0.85, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 1.5,
};
impl SamKind {
/// Its row of numbers from `catalog/specs.json`.
pub fn spec(self) -> &'static SamSpec {
match self {
SamKind::Patriot => &UNIT_SPEC_PATRIOT,
SamKind::Gepard => &UNIT_SPEC_GEPARD,
SamKind::Pantsir => &UNIT_SPEC_PANTSIR,
SamKind::S400 => &UNIT_SPEC_S400,
SamKind::S500 => &UNIT_SPEC_S500,
SamKind::IrisT => &UNIT_SPEC_IRIST,
SamKind::Nasams => &UNIT_SPEC_NASAMS,
SamKind::Buk => &UNIT_SPEC_BUK,
SamKind::Tor => &UNIT_SPEC_TOR,
SamKind::P1sun => &UNIT_SPEC_P1SUN,
SamKind::Radar => &UNIT_SPEC_RADAR,
SamKind::Depot => &UNIT_SPEC_DEPOT,
SamKind::Tzm => &UNIT_SPEC_TZM,
SamKind::Ew => &UNIT_SPEC_EW,
SamKind::Light => &UNIT_SPEC_LIGHT,
}
}
}
/// Save keys by kind; a rename needs an explicit migration.
#[cfg(test)]
pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); 15] = [
(SamKind::Patriot, "patriot"),
(SamKind::Gepard, "gepard"),
(SamKind::Pantsir, "pantsir"),
(SamKind::S400, "s400"),
(SamKind::S500, "s500"),
(SamKind::IrisT, "irist"),
(SamKind::Nasams, "nasams"),
(SamKind::Buk, "buk"),
(SamKind::Tor, "tor"),
(SamKind::P1sun, "p1sun"),
(SamKind::Radar, "radar"),
(SamKind::Depot, "depot"),
(SamKind::Tzm, "tzm"),
(SamKind::Ew, "ew"),
(SamKind::Light, "light"),
];
+4 -368
View File
@@ -107,11 +107,6 @@ pub(super) struct Drive {
pub pitch: (f64, f64),
}
/// The drives are this share of the speeds they had before they had a speed of their own.
const DRIVE_SCALE: f64 = 0.4;
/// Ticks a drive takes to reach its top speed (and to stop from it).
const DRIVE_RAMP: f64 = 8.0;
pub struct SamSpec {
pub name: &'static str,
pub key: &'static str,
@@ -140,20 +135,16 @@ impl SamSpec {
pub(super) fn drive(&self) -> Drive {
let (yaw, pitch) = match (&self.gun, self.family) {
(Some(g), _) => g.slew,
(None, Family::Trainable) => (0.12, 0.0),
(None, Family::Vertical) => (0.15, 0.0),
(None, _) => (0.05, 0.05),
(None, Family::Trainable) => DRIVE_TRAINABLE,
(None, Family::Vertical) => DRIVE_VERTICAL,
(None, _) => DRIVE_OTHER,
};
let axis = |speed: f64| (speed * DRIVE_SCALE, speed * DRIVE_SCALE / DRIVE_RAMP);
Drive { yaw: axis(yaw), pitch: axis(pitch) }
}
}
const NO_PARTS: Parts = Parts { body: "", launcher: None, pack: None, dish: None, fixed: &[], spinner: None };
/// The battery radar trailer behind a vertical launcher.
const BATTERY_RADAR: &[(&str, f64, f64)] = &[("airdef:radar_trailer", 0.0, 4.2)];
const BATTERY_SPINNER: Option<(&str, f64, f64, f64, f64)> = Some(("airdef:radar_panel", 0.9, 4.2, 0.9, -0.3));
const TUBE_PIVOT: DVec3 = DVec3::new(0.0, -0.5, 1.5);
include!("unit_specs_generated.rs");
impl SamKind {
pub const ALL: [SamKind; super::catalog::UNIT_COUNT] = super::catalog::UNIT_KINDS;
@@ -170,361 +161,6 @@ impl SamKind {
SamKind::Tor,
SamKind::P1sun,
];
pub fn spec(self) -> &'static SamSpec {
match self {
SamKind::Patriot => {
const S: SamSpec = SamSpec {
name: "Patriot",
key: "patriot",
missile: Some(MissileLoad { kind: MissileKind::Pac3, magazine: 4, min: 10.0, max: 450.0, interval: 16 }),
gun: None,
reload: 220,
scale: 1.3,
rest_pitch: 0.66,
roles: 30,
family: Family::Trainable,
parts: Parts {
body: "airdef:patriot_trailer",
launcher: Some("airdef:patriot_launcher"),
fixed: &[("airdef:patriot_truck", 0.0, -3.0), ("airdef:patriot_radar", 0.0, 3.6)],
..NO_PARTS
},
mount: (0.69, 1.2),
pivot: DVec3::new(0.0, -0.5, 1.375),
muzzle: Muzzle::Patriot,
sensor: 585.0,
mast: 5.0,
};
&S
}
SamKind::Gepard => {
const S: SamSpec = SamSpec {
name: "Гепард",
key: "gepard",
missile: None,
gun: Some(GunSpec { range: 135.0, track: 195.0, p: 0.3, bursts: 160, shell: 10.0, slew: (0.22, 0.16) }),
reload: 160,
scale: 1.25,
rest_pitch: 0.0,
roles: 7,
family: Family::Gun,
parts: Parts {
body: "airdef:gepard_hull",
launcher: Some("airdef:gepard_turret"),
pack: Some("airdef:gepard_guns"),
dish: Some(("airdef:gepard_dish", 0.95, 0.6, 0.0)),
..NO_PARTS
},
mount: (1.55, 0.25),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 255.0,
mast: 3.0,
};
&S
}
SamKind::Pantsir => {
const S: SamSpec = SamSpec {
name: "Панцирь-С1",
key: "pantsir",
missile: Some(MissileLoad { kind: MissileKind::M57e6, magazine: 12, min: 25.0, max: 225.0, interval: 14 }),
gun: Some(GunSpec { range: 90.0, track: 135.0, p: 0.25, bursts: 140, shell: 9.0, slew: (0.25, 0.18) }),
reload: 280,
scale: 1.3,
rest_pitch: 0.0,
roles: 15,
family: Family::Turret,
parts: Parts {
body: "airdef:pantsir_truck",
launcher: Some("airdef:pantsir_turret"),
pack: Some("airdef:pantsir_pack"),
dish: Some(("airdef:pantsir_dish", 0.85, 0.3, 0.3)),
..NO_PARTS
},
mount: (1.35, 0.69),
pivot: DVec3::ZERO,
muzzle: Muzzle::Pantsir,
sensor: 292.0,
mast: 4.0,
};
&S
}
SamKind::S400 => {
const S: SamSpec = SamSpec {
name: "С-400",
key: "s400",
missile: Some(MissileLoad { kind: MissileKind::M48n6, magazine: 4, min: 30.0, max: 720.0, interval: 20 }),
gun: None,
reload: 420,
scale: 1.5,
rest_pitch: HALF_PI - 0.02,
roles: 30,
family: Family::Vertical,
parts: Parts {
body: "airdef:s400_chassis",
launcher: Some("airdef:s400_tubes"),
fixed: BATTERY_RADAR,
spinner: BATTERY_SPINNER,
..NO_PARTS
},
mount: (0.7, 1.45),
pivot: TUBE_PIVOT,
muzzle: Muzzle::Grid(2, 2, 7.0),
sensor: 936.0,
mast: 5.0,
};
&S
}
SamKind::S500 => {
const S: SamSpec = SamSpec {
name: "С-500",
key: "s500",
missile: Some(MissileLoad { kind: MissileKind::M77n6, magazine: 2, min: 40.0, max: 1050.0, interval: 20 }),
gun: None,
reload: 520,
scale: 1.6,
rest_pitch: HALF_PI - 0.02,
roles: 24,
family: Family::Vertical,
parts: Parts {
body: "airdef:s500_chassis",
launcher: Some("airdef:s500_tubes"),
fixed: BATTERY_RADAR,
spinner: BATTERY_SPINNER,
..NO_PARTS
},
mount: (0.7, 1.45),
pivot: TUBE_PIVOT,
muzzle: Muzzle::Grid(2, 1, 9.5),
sensor: 1365.0,
mast: 5.0,
};
&S
}
SamKind::IrisT => {
const S: SamSpec = SamSpec {
name: "IRIS-T SLM",
key: "irist",
missile: Some(MissileLoad { kind: MissileKind::IrisT, magazine: 8, min: 15.0, max: 600.0, interval: 10 }),
gun: None,
reload: 300,
scale: 1.4,
rest_pitch: HALF_PI - 0.02,
roles: 15,
family: Family::Vertical,
parts: Parts {
body: "airdef:irist_chassis",
launcher: Some("airdef:irist_tubes"),
fixed: BATTERY_RADAR,
spinner: BATTERY_SPINNER,
..NO_PARTS
},
mount: (0.7, 1.45),
pivot: TUBE_PIVOT,
muzzle: Muzzle::Grid(4, 2, 4.0),
sensor: 780.0,
mast: 5.0,
};
&S
}
SamKind::Nasams => {
const S: SamSpec = SamSpec {
name: "NASAMS",
key: "nasams",
missile: Some(MissileLoad { kind: MissileKind::Amraam, magazine: 6, min: 10.0, max: 450.0, interval: 14 }),
gun: None,
reload: 260,
scale: 1.3,
rest_pitch: 0.5,
roles: 14,
family: Family::Trainable,
parts: Parts {
body: "airdef:nasams_trailer",
launcher: Some("airdef:nasams_launcher"),
fixed: &[("airdef:radar_trailer", 0.0, 3.4)],
spinner: Some(("airdef:radar_panel", 0.9, 3.4, 0.6, -0.3)),
..NO_PARTS
},
mount: (0.62, 0.4),
pivot: TUBE_PIVOT,
muzzle: Muzzle::Grid(3, 2, 4.0),
sensor: 585.0,
mast: 5.0,
};
&S
}
SamKind::Buk => {
const S: SamSpec = SamSpec {
name: "Бук-М2",
key: "buk",
missile: Some(MissileLoad { kind: MissileKind::M9m317, magazine: 4, min: 20.0, max: 675.0, interval: 18 }),
gun: None,
reload: 400,
scale: 1.4,
rest_pitch: 0.0,
roles: 14,
family: Family::Turret,
parts: Parts {
body: "airdef:buk_chassis",
launcher: Some("airdef:buk_turret"),
pack: Some("airdef:buk_rails"),
..NO_PARTS
},
mount: (1.55, 0.2),
pivot: DVec3::ZERO,
muzzle: Muzzle::Rails(&[-9.0, -3.0, 13.0, 19.0]),
sensor: 878.0,
mast: 4.0,
};
&S
}
SamKind::Tor => {
const S: SamSpec = SamSpec {
name: "Тор-М2",
key: "tor",
missile: Some(MissileLoad { kind: MissileKind::M9m338, magazine: 8, min: 8.0, max: 240.0, interval: 8 }),
gun: None,
reload: 300,
scale: 1.3,
rest_pitch: 0.0,
roles: 15,
family: Family::Vertical,
parts: Parts { body: "airdef:tor_chassis", launcher: Some("airdef:tor_turret"), ..NO_PARTS },
mount: (1.5, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::Cells,
sensor: 315.0,
mast: 3.5,
};
&S
}
SamKind::P1sun => {
const S: SamSpec = SamSpec {
name: "P1-SUN",
key: "p1sun",
missile: Some(MissileLoad { kind: MissileKind::P1sun, magazine: 8, min: 5.0, max: 675.0, interval: 12 }),
gun: None,
reload: 240,
scale: 1.1,
rest_pitch: 0.35,
roles: 1,
family: Family::Trainable,
parts: Parts { body: "airdef:nasams_trailer", launcher: Some("airdef:p1sun_launcher"), ..NO_PARTS },
mount: (0.6, 0.3),
pivot: TUBE_PIVOT,
muzzle: Muzzle::Grid(4, 2, 3.0),
// No radar of its own: it fires on the network's tracks.
sensor: 0.0,
mast: 2.0,
};
&S
}
SamKind::Radar => {
const S: SamSpec = SamSpec {
name: "РЛС дальнего обнаружения",
key: "radar",
missile: None,
gun: None,
reload: 0,
scale: 1.5,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts {
body: "airdef:radar_truck",
spinner: Some(("airdef:radar_panel", 1.2, 1.2, 1.5, -0.25)),
..NO_PARTS
},
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 2550.0,
mast: 16.0,
};
&S
}
SamKind::Depot => {
const S: SamSpec = SamSpec {
name: "Склад боеприпасов",
key: "depot",
missile: None,
gun: None,
reload: 0,
scale: 1.5,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts { body: "airdef:depot", ..NO_PARTS },
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 1.0,
};
&S
}
SamKind::Tzm => {
const S: SamSpec = SamSpec {
name: "ТЗМ",
key: "tzm",
missile: None,
gun: None,
reload: 0,
scale: 1.3,
rest_pitch: 0.0,
roles: 0,
family: Family::Truck,
parts: Parts { body: "airdef:tzm_truck", ..NO_PARTS },
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 2.0,
};
&S
}
SamKind::Ew => {
const S: SamSpec = SamSpec {
name: "Станция РЭБ",
key: "ew",
missile: None,
gun: None,
reload: 0,
scale: 1.3,
rest_pitch: 0.0,
roles: 0,
family: Family::Static,
parts: Parts { body: "airdef:ew_truck", ..NO_PARTS },
mount: (0.0, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 3.0,
};
&S
}
SamKind::Light => {
const S: SamSpec = SamSpec {
name: "Прожектор",
key: "light",
missile: None,
gun: None,
reload: 0,
scale: 1.2,
rest_pitch: 0.6,
roles: 0,
family: Family::Light,
parts: Parts { body: "airdef:searchlight", launcher: Some("airdef:searchlight_head"), ..NO_PARTS },
mount: (0.85, 0.0),
pivot: DVec3::ZERO,
muzzle: Muzzle::None,
sensor: 0.0,
mast: 1.5,
};
&S
}
}
}
pub fn name(self) -> &'static str {
self.spec().name
}
+15 -14
View File
@@ -18,23 +18,24 @@ impl MissileKind {
/// The sound of its motor, its gain and its pitch: a rocket's roar, or the electric whine of
/// a motor without a flame.
pub fn engine_voice(self) -> (&'static str, f32, f32) {
if self.spec().flame == 0.0 {
return (super::catalog::sound::DRONE_LANCET, 0.8, 1.6);
}
let pitch = match self {
MissileKind::Pac3 => 1.0,
MissileKind::M57e6 => 1.12,
MissileKind::M48n6 => 0.88,
MissileKind::M77n6 => 0.8,
MissileKind::IrisT | MissileKind::Amraam => 1.05,
MissileKind::M9m317 => 0.9,
MissileKind::M9m338 => 1.15,
MissileKind::P1sun => 1.7,
};
(super::catalog::sound::MISSILE_FLIGHT, 1.0, pitch)
self.spec().voice
}
/// Ticks from the launch until the motor lights (a cold launch throws it out of the tube first).
pub fn lit_after(self) -> u32 {
self.spec().cold
}
}
#[cfg(test)]
mod tests {
use super::*;
use super::super::catalog::sound;
/// The catalog holds the voice that is actually played. P1-SUN has no flame, so it uses the
/// Lancet voice at 1.6; its old `P1sun => 1.7` match arm was unreachable behind `flame == 0`.
#[test]
fn missile_engine_voices_keep_their_played_values() {
assert_eq!(MissileKind::P1sun.engine_voice(), (sound::DRONE_LANCET, 0.8, 1.6));
assert_eq!(MissileKind::M48n6.engine_voice(), (sound::MISSILE_FLIGHT, 1.0, 0.88));
}
}
+8 -6
View File
@@ -608,13 +608,15 @@ mod tests {
#[test]
fn recorded_physical_strike_trail_starts_at_ignition_not_at_the_muzzle() {
use crate::sim::record::{Recording, What};
let mut rec = Recording::blank(40);
rec.straight(1, What::StrikeCarrier(77), 10, 30, DVec3::ZERO, DVec3::Z * 20.0);
let ignite = 10.0 + crate::sim::strike::EJECT_TICKS as f64;
let mut rec = Recording::blank(120);
rec.straight(1, What::StrikeCarrier(77), 10, 90, DVec3::ZERO, DVec3::Z * 80.0);
assert!(replay_smoke(&rec, 14.0).is_empty());
let segments = replay_smoke(&rec, 18.0);
assert_eq!(segments.len(), 1);
assert!((segments[0].az - 5.0).abs() < 1e-6);
assert!((segments[0].bz - 8.0).abs() < 1e-6);
assert!(replay_smoke(&rec, (ignite - 2.0).max(30.0)).is_empty(), "no trail before the ignition");
let segments = replay_smoke(&rec, ignite + 12.0);
assert_eq!(segments.len(), 2);
assert!((segments[0].az - 20.0).abs() < 1e-6 && (segments[0].bz - 24.0).abs() < 1e-6, "the trail begins at the recorded ignition");
assert!((segments[1].az - 24.0).abs() < 1e-6 && (segments[1].bz - 32.0).abs() < 1e-6);
}
#[test]
@@ -1017,3 +1017,48 @@ frames = 10
[[step]]
command = "airdef stats"
expect.feedback = "В воздухе: 184, ракет: 10, ПВО: 64, сбито: 777, поражений: 1499, разбились о препятствия: 0; удары по ПУ: пущено 0, уничтожено 0, подавлено 0, промахов 0, сбито ПВО 0; мир: 5353 секций (250 КБ), запросов 14405, неизвестно 0, лучей 327428 (ударов 6746, неизв. 213), клеток 2282312; взрывы в блоках: 1586 (подтверждено 0, без перемен 175, нет чанка 1330), чужих ответов 0"
# The Windows #122 path: a Smart order through the UI launch function (`airdef raid`
# is the wave screen's ПУСК button handler) with a fat intel log and EW up — twice.
[[step]]
command = "airdef deploy ew"
[[step]]
command = "airdef deploy ew"
[[step]]
command = "airdef deploy ew"
[[step]]
command = "airdef deploy ew"
[[step]]
command = "airdef ew on"
[[step]]
command = "airdef preset 1"
expect.feedback = "Готовый: Массированный удар"
[[step]]
command = "airdef raid"
expect.chat = []
[[step]]
ticks = 400
frames = 50
[[step]]
command = "airdef preset 1"
expect.feedback = "Готовый: Массированный удар"
[[step]]
command = "airdef raid"
expect.chat = []
[[step]]
ticks = 800
frames = 100
[[step]]
command = "airdef stats"
expect.feedback = "В воздухе: 11, ракет: 3, ПВО: 68, сбито: 936, поражений: 1853, разбились о препятствия: 0; удары по ПУ: пущено 0, уничтожено 0, подавлено 0, промахов 0, сбито ПВО 0; мир: 6643 секций (311 КБ), запросов 17355, неизвестно 0, лучей 393828 (ударов 9283, неизв. 978), клеток 2953257; взрывы в блоках: 1961 (подтверждено 0, без перемен 234, нет чанка 1727), чужих ответов 0"
+13
View File
@@ -73,6 +73,19 @@ expect.error = "У комплекса нет активной РЛС"
[[step]]
command = "airdef deploy s500_launcher"
# The wave screen's preset button through the command boundary; an empty wave cannot launch.
[[step]]
command = "airdef preset 0"
expect.feedback = "Готовый: Рой Шахедов"
[[step]]
command = "airdef preset 6"
expect.feedback = "Готовый: Пусто"
[[step]]
command = "airdef raid"
expect.error = "Налёт пуст: выберите типы и число"
[[step]]
command = "airdef wave mix 40 1500"
+869
View File
@@ -0,0 +1,869 @@
{
"shared": {
"mobility": {
"drive_scale": 0.4,
"drive_ramp": 8.0,
"trainable": [0.12, 0.0],
"vertical": [0.15, 0.0],
"other": [0.05, 0.05]
},
"flight": {
"gravity": 0.05,
"block_split": 300.0
},
"logistics": {
"depot_reach": 60.0,
"handover": 10.0,
"truck_load": 2,
"stock_limit": 1000000
}
},
"drones": [
{
"kind": "Shahed",
"key": "shahed",
"name": "Шахед-136",
"model": "airdef:shahed",
"speed": 0.6,
"turn": 0.035,
"cruise": 45.0,
"clearance": 18.0,
"dive": 32.0,
"warhead": 3,
"scale": 1.3,
"engine": {"type": "prop", "back": 1.34, "size": 1.0},
"decoy": false,
"stealth": 1.0,
"sound": {"event": "drone.shahed", "pitch": 1.0, "interval": 48},
"class": "drone",
"ballistic": null,
"rcs": 0.3,
"launch_sound": "launch.s400_eject"
},
{
"kind": "Geran3",
"key": "geran3",
"name": "Герань-3",
"model": "airdef:geran3",
"speed": 1.6,
"turn": 0.03,
"cruise": 60.0,
"clearance": 18.0,
"dive": 50.0,
"warhead": 2,
"scale": 1.15,
"engine": {"type": "jet", "up": 0.34, "back": 1.55, "size": 1.0},
"decoy": false,
"stealth": 1.1,
"sound": {"event": "drone.geran3", "pitch": 1.0, "interval": 40},
"class": "jet",
"ballistic": null,
"rcs": 0.4,
"launch_sound": "launch.s400_eject"
},
{
"kind": "Lancet",
"key": "lancet",
"name": "Ланцет-3",
"model": "airdef:lancet",
"speed": 1.1,
"turn": 0.07,
"cruise": 25.0,
"clearance": 10.0,
"dive": 38.0,
"warhead": 1,
"scale": 0.9,
"engine": {"type": "prop", "back": 0.93, "size": 0.55},
"decoy": false,
"stealth": 1.4,
"sound": {"event": "drone.lancet", "pitch": 1.0, "interval": 32},
"class": "drone",
"ballistic": null,
"rcs": 0.08,
"launch_sound": "launch.s400_eject"
},
{
"kind": "Gerbera",
"key": "gerbera",
"name": "Гербера",
"model": "airdef:gerbera",
"speed": 0.5,
"turn": 0.04,
"cruise": 40.0,
"clearance": 15.0,
"dive": 30.0,
"warhead": 0,
"scale": 1.1,
"engine": {"type": "prop", "back": 1.03, "size": 0.9},
"decoy": true,
"stealth": 0.9,
"sound": {"event": "drone.shahed", "pitch": 1.3, "interval": 40},
"class": "drone",
"ballistic": null,
"rcs": 0.4,
"launch_sound": "launch.s400_eject"
},
{
"kind": "Kh101",
"key": "kh101",
"name": "Х-101",
"model": "airdef:kh101",
"speed": 2.4,
"turn": 0.025,
"cruise": 0.0,
"clearance": 12.0,
"dive": 26.0,
"warhead": 6,
"scale": 1.6,
"engine": {"type": "jet", "up": -0.27, "back": 1.4, "size": 0.6},
"decoy": false,
"stealth": 1.5,
"sound": {"event": "drone.cruise", "pitch": 1.0, "interval": 50},
"class": "cruise",
"ballistic": null,
"rcs": 0.05,
"launch_sound": "launch.patriot"
},
{
"kind": "Kalibr",
"key": "kalibr",
"name": "Калибр",
"model": "airdef:kalibr",
"speed": 2.1,
"turn": 0.025,
"cruise": 0.0,
"clearance": 15.0,
"dive": 26.0,
"warhead": 5,
"scale": 1.5,
"engine": {"type": "jet", "up": -0.2, "back": 1.5, "size": 0.6},
"decoy": false,
"stealth": 1.3,
"sound": {"event": "drone.cruise", "pitch": 1.2, "interval": 50},
"class": "cruise",
"ballistic": null,
"rcs": 0.15,
"launch_sound": "launch.patriot"
},
{
"kind": "Kh22",
"key": "kh22",
"name": "Х-22",
"model": "airdef:kh22",
"speed": 4.0,
"turn": 0.03,
"cruise": 140.0,
"clearance": 40.0,
"dive": 150.0,
"warhead": 7,
"scale": 1.8,
"engine": {"type": "rocket", "back": 1.5, "size": 1.3},
"decoy": false,
"stealth": 1.4,
"sound": {"event": "drone.rocket", "pitch": 0.8, "interval": 46},
"class": "supersonic",
"ballistic": null,
"rcs": 1.0,
"launch_sound": "launch.patriot"
},
{
"kind": "Zircon",
"key": "zircon",
"name": "Циркон",
"model": "airdef:zircon",
"speed": 5.5,
"turn": 0.025,
"cruise": 90.0,
"clearance": 30.0,
"dive": 110.0,
"warhead": 6,
"scale": 1.4,
"engine": {"type": "rocket", "back": 1.5, "size": 1.1},
"decoy": false,
"stealth": 2.0,
"sound": {"event": "drone.rocket", "pitch": 1.35, "interval": 46},
"class": "supersonic",
"ballistic": null,
"rcs": 0.4,
"launch_sound": "launch.s400"
},
{
"kind": "Iskander",
"key": "iskander",
"name": "Искандер-М",
"model": "airdef:iskander",
"speed": 5.0,
"turn": 0.04,
"cruise": 0.0,
"clearance": 0.0,
"dive": 0.0,
"warhead": 8,
"scale": 1.8,
"engine": {"type": "rocket", "back": 1.5, "size": 1.6},
"decoy": false,
"stealth": 1.6,
"sound": {"event": "drone.rocket", "pitch": 0.7, "interval": 46},
"class": "ballistic",
"ballistic": 1000.0,
"rcs": 0.6,
"launch_sound": "launch.s500"
},
{
"kind": "Kinzhal",
"key": "kinzhal",
"name": "Кинжал",
"model": "airdef:kinzhal",
"speed": 7.5,
"turn": 0.03,
"cruise": 0.0,
"clearance": 0.0,
"dive": 0.0,
"warhead": 8,
"scale": 1.7,
"engine": {"type": "rocket", "back": 1.5, "size": 1.5},
"decoy": false,
"stealth": 2.2,
"sound": {"event": "drone.rocket", "pitch": 0.6, "interval": 46},
"class": "ballistic",
"ballistic": 1500.0,
"rcs": 0.5,
"launch_sound": "launch.s500"
},
{
"kind": "Oreshnik",
"key": "oreshnik",
"name": "Орешник",
"model": "airdef:iskander",
"speed": 9.0,
"turn": 0.0,
"cruise": 0.0,
"clearance": 0.0,
"dive": 0.0,
"warhead": 0,
"scale": 2.6,
"engine": {"type": "rocket", "back": 1.5, "size": 2.4},
"decoy": false,
"stealth": 3.0,
"sound": {"event": "drone.rocket", "pitch": 0.5, "interval": 46},
"class": "ballistic",
"ballistic": 2600.0,
"rcs": 2.0,
"launch_sound": "launch.s500"
},
{
"kind": "OreshnikBlock",
"key": "oreshnik_block",
"name": "Орешник: блок",
"model": "airdef:reentry",
"speed": 9.0,
"turn": 0.0,
"cruise": 0.0,
"clearance": 0.0,
"dive": 0.0,
"warhead": 4,
"scale": 1.6,
"engine": {"type": "rocket", "back": 1.0, "size": 1.0},
"decoy": false,
"stealth": 3.5,
"sound": {"event": "drone.ballistic", "pitch": 0.8, "interval": 9999},
"class": "ballistic",
"ballistic": null,
"rcs": 0.4,
"launch_sound": "launch.s500"
},
{
"kind": "OreshnikSub",
"key": "oreshnik_sub",
"name": "Орешник: суббоеприпас",
"model": "airdef:reentry",
"speed": 9.0,
"turn": 0.05,
"cruise": 0.0,
"clearance": 0.0,
"dive": 0.0,
"warhead": 3,
"scale": 1.1,
"engine": {"type": "rocket", "back": 1.0, "size": 1.0},
"decoy": false,
"stealth": 4.0,
"sound": {"event": "drone.ballistic", "pitch": 1.0, "interval": 9999},
"class": "ballistic",
"ballistic": null,
"rcs": 0.08,
"launch_sound": "launch.s500"
}
],
"units": [
{
"kind": "Patriot",
"key": "patriot",
"name": "Patriot",
"missile": {"kind": "Pac3", "magazine": 4, "min": 10.0, "max": 450.0, "interval": 16},
"gun": null,
"reload": 220,
"scale": 1.3,
"rest_pitch": 0.66,
"roles": 30,
"family": "trainable",
"parts": {
"body": "airdef:patriot_trailer",
"launcher": "airdef:patriot_launcher",
"pack": null,
"dish": null,
"fixed": [["airdef:patriot_truck", 0.0, -3.0], ["airdef:patriot_radar", 0.0, 3.6]],
"spinner": null
},
"mount": [0.69, 1.2],
"pivot": [0.0, -0.5, 1.375],
"muzzle": {"type": "patriot"},
"sensor": 585.0,
"mast": 5.0
},
{
"kind": "Gepard",
"key": "gepard",
"name": "Гепард",
"missile": null,
"gun": {"range": 135.0, "track": 195.0, "p": 0.3, "bursts": 160, "shell": 10.0, "slew": [0.22, 0.16]},
"reload": 160,
"scale": 1.25,
"rest_pitch": 0.0,
"roles": 7,
"family": "gun",
"parts": {
"body": "airdef:gepard_hull",
"launcher": "airdef:gepard_turret",
"pack": "airdef:gepard_guns",
"dish": ["airdef:gepard_dish", 0.95, 0.6, 0.0],
"fixed": [],
"spinner": null
},
"mount": [1.55, 0.25],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 255.0,
"mast": 3.0
},
{
"kind": "Pantsir",
"key": "pantsir",
"name": "Панцирь-С1",
"missile": {"kind": "M57e6", "magazine": 12, "min": 25.0, "max": 225.0, "interval": 14},
"gun": {"range": 90.0, "track": 135.0, "p": 0.25, "bursts": 140, "shell": 9.0, "slew": [0.25, 0.18]},
"reload": 280,
"scale": 1.3,
"rest_pitch": 0.0,
"roles": 15,
"family": "turret",
"parts": {
"body": "airdef:pantsir_truck",
"launcher": "airdef:pantsir_turret",
"pack": "airdef:pantsir_pack",
"dish": ["airdef:pantsir_dish", 0.85, 0.3, 0.3],
"fixed": [],
"spinner": null
},
"mount": [1.35, 0.69],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "pantsir"},
"sensor": 292.0,
"mast": 4.0
},
{
"kind": "S400",
"key": "s400",
"name": "С-400",
"missile": {"kind": "M48n6", "magazine": 4, "min": 30.0, "max": 720.0, "interval": 20},
"gun": null,
"reload": 420,
"scale": 1.5,
"rest_pitch": {"half_pi": -0.02},
"roles": 30,
"family": "vertical",
"parts": {
"body": "airdef:s400_chassis",
"launcher": "airdef:s400_tubes",
"pack": null,
"dish": null,
"fixed": {"ref": "battery_radar"},
"spinner": {"ref": "battery_spinner"}
},
"mount": [0.7, 1.45],
"pivot": {"ref": "tube_pivot"},
"muzzle": {"type": "grid", "cols": 2, "rows": 2, "size": 7.0},
"sensor": 936.0,
"mast": 5.0
},
{
"kind": "S500",
"key": "s500",
"name": "С-500",
"missile": {"kind": "M77n6", "magazine": 2, "min": 40.0, "max": 1050.0, "interval": 20},
"gun": null,
"reload": 520,
"scale": 1.6,
"rest_pitch": {"half_pi": -0.02},
"roles": 24,
"family": "vertical",
"parts": {
"body": "airdef:s500_chassis",
"launcher": "airdef:s500_tubes",
"pack": null,
"dish": null,
"fixed": {"ref": "battery_radar"},
"spinner": {"ref": "battery_spinner"}
},
"mount": [0.7, 1.45],
"pivot": {"ref": "tube_pivot"},
"muzzle": {"type": "grid", "cols": 2, "rows": 1, "size": 9.5},
"sensor": 1365.0,
"mast": 5.0
},
{
"kind": "IrisT",
"key": "irist",
"name": "IRIS-T SLM",
"missile": {"kind": "IrisT", "magazine": 8, "min": 15.0, "max": 600.0, "interval": 10},
"gun": null,
"reload": 300,
"scale": 1.4,
"rest_pitch": {"half_pi": -0.02},
"roles": 15,
"family": "vertical",
"parts": {
"body": "airdef:irist_chassis",
"launcher": "airdef:irist_tubes",
"pack": null,
"dish": null,
"fixed": {"ref": "battery_radar"},
"spinner": {"ref": "battery_spinner"}
},
"mount": [0.7, 1.45],
"pivot": {"ref": "tube_pivot"},
"muzzle": {"type": "grid", "cols": 4, "rows": 2, "size": 4.0},
"sensor": 780.0,
"mast": 5.0
},
{
"kind": "Nasams",
"key": "nasams",
"name": "NASAMS",
"missile": {"kind": "Amraam", "magazine": 6, "min": 10.0, "max": 450.0, "interval": 14},
"gun": null,
"reload": 260,
"scale": 1.3,
"rest_pitch": 0.5,
"roles": 14,
"family": "trainable",
"parts": {
"body": "airdef:nasams_trailer",
"launcher": "airdef:nasams_launcher",
"pack": null,
"dish": null,
"fixed": [["airdef:radar_trailer", 0.0, 3.4]],
"spinner": ["airdef:radar_panel", 0.9, 3.4, 0.6, -0.3]
},
"mount": [0.62, 0.4],
"pivot": {"ref": "tube_pivot"},
"muzzle": {"type": "grid", "cols": 3, "rows": 2, "size": 4.0},
"sensor": 585.0,
"mast": 5.0
},
{
"kind": "Buk",
"key": "buk",
"name": "Бук-М2",
"missile": {"kind": "M9m317", "magazine": 4, "min": 20.0, "max": 675.0, "interval": 18},
"gun": null,
"reload": 400,
"scale": 1.4,
"rest_pitch": 0.0,
"roles": 14,
"family": "turret",
"parts": {
"body": "airdef:buk_chassis",
"launcher": "airdef:buk_turret",
"pack": "airdef:buk_rails",
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [1.55, 0.2],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "rails", "xs": [-9.0, -3.0, 13.0, 19.0]},
"sensor": 878.0,
"mast": 4.0
},
{
"kind": "Tor",
"key": "tor",
"name": "Тор-М2",
"missile": {"kind": "M9m338", "magazine": 8, "min": 8.0, "max": 240.0, "interval": 8},
"gun": null,
"reload": 300,
"scale": 1.3,
"rest_pitch": 0.0,
"roles": 15,
"family": "vertical",
"parts": {
"body": "airdef:tor_chassis",
"launcher": "airdef:tor_turret",
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [1.5, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "cells"},
"sensor": 315.0,
"mast": 3.5
},
{
"kind": "P1sun",
"key": "p1sun",
"name": "P1-SUN",
"missile": {"kind": "P1sun", "magazine": 8, "min": 5.0, "max": 675.0, "interval": 12},
"gun": null,
"reload": 240,
"scale": 1.1,
"rest_pitch": 0.35,
"roles": 1,
"family": "trainable",
"parts": {
"body": "airdef:nasams_trailer",
"launcher": "airdef:p1sun_launcher",
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [0.6, 0.3],
"pivot": {"ref": "tube_pivot"},
"muzzle": {"type": "grid", "cols": 4, "rows": 2, "size": 3.0},
"sensor": 0.0,
"mast": 2.0
},
{
"kind": "Radar",
"key": "radar",
"name": "РЛС дальнего обнаружения",
"missile": null,
"gun": null,
"reload": 0,
"scale": 1.5,
"rest_pitch": 0.0,
"roles": 0,
"family": "static",
"parts": {
"body": "airdef:radar_truck",
"launcher": null,
"pack": null,
"dish": null,
"fixed": [],
"spinner": ["airdef:radar_panel", 1.2, 1.2, 1.5, -0.25]
},
"mount": [0.0, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 2550.0,
"mast": 16.0
},
{
"kind": "Depot",
"key": "depot",
"name": "Склад боеприпасов",
"missile": null,
"gun": null,
"reload": 0,
"scale": 1.5,
"rest_pitch": 0.0,
"roles": 0,
"family": "static",
"parts": {
"body": "airdef:depot",
"launcher": null,
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [0.0, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 0.0,
"mast": 1.0
},
{
"kind": "Tzm",
"key": "tzm",
"name": "ТЗМ",
"missile": null,
"gun": null,
"reload": 0,
"scale": 1.3,
"rest_pitch": 0.0,
"roles": 0,
"family": "truck",
"parts": {
"body": "airdef:tzm_truck",
"launcher": null,
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [0.0, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 0.0,
"mast": 2.0
},
{
"kind": "Ew",
"key": "ew",
"name": "Станция РЭБ",
"missile": null,
"gun": null,
"reload": 0,
"scale": 1.3,
"rest_pitch": 0.0,
"roles": 0,
"family": "static",
"parts": {
"body": "airdef:ew_truck",
"launcher": null,
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [0.0, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 0.0,
"mast": 3.0
},
{
"kind": "Light",
"key": "light",
"name": "Прожектор",
"missile": null,
"gun": null,
"reload": 0,
"scale": 1.2,
"rest_pitch": 0.6,
"roles": 0,
"family": "light",
"parts": {
"body": "airdef:searchlight",
"launcher": "airdef:searchlight_head",
"pack": null,
"dish": null,
"fixed": [],
"spinner": null
},
"mount": [0.85, 0.0],
"pivot": [0.0, 0.0, 0.0],
"muzzle": {"type": "none"},
"sensor": 0.0,
"mast": 1.5
}
],
"missiles": [
{
"kind": "Pac3",
"model": "airdef:pac3",
"speed": 5.5,
"accel": 0.35,
"turn": 0.3,
"boost": 8,
"cold": 0,
"eject": 0.0,
"eject_drag": 0.0,
"pk": 0.9,
"fuse": 4.0,
"life": 240,
"scale": 1.0,
"flame": 1.0,
"rear": 28.0,
"seeker": 110.0,
"launch_sound": "launch.patriot",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 1.0}
},
{
"kind": "M57e6",
"model": "airdef:m57e6",
"speed": 5.0,
"accel": 0.5,
"turn": 0.32,
"boost": 5,
"cold": 0,
"eject": 0.0,
"eject_drag": 0.0,
"pk": 0.82,
"fuse": 3.0,
"life": 160,
"scale": 0.85,
"flame": 0.65,
"rear": 28.0,
"seeker": 0.0,
"launch_sound": "launch.pantsir",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 1.12}
},
{
"kind": "M48n6",
"model": "airdef:m48n6",
"speed": 7.0,
"accel": 0.5,
"turn": 0.22,
"boost": 8,
"cold": 20,
"eject": 2.4,
"eject_drag": 0.07,
"pk": 0.9,
"fuse": 5.0,
"life": 300,
"scale": 1.5,
"flame": 1.4,
"rear": 30.0,
"seeker": 120.0,
"launch_sound": "launch.s400_eject",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 0.88}
},
{
"kind": "M77n6",
"model": "airdef:m77n6",
"speed": 9.0,
"accel": 0.6,
"turn": 0.22,
"boost": 8,
"cold": 24,
"eject": 2.6,
"eject_drag": 0.07,
"pk": 0.95,
"fuse": 6.0,
"life": 320,
"scale": 1.7,
"flame": 1.6,
"rear": 32.0,
"seeker": 120.0,
"launch_sound": "launch.s500_eject",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 0.8}
},
{
"kind": "IrisT",
"model": "airdef:irist_missile",
"speed": 7.0,
"accel": 0.5,
"turn": 0.35,
"boost": 6,
"cold": 8,
"eject": 1.8,
"eject_drag": 0.1,
"pk": 0.9,
"fuse": 4.0,
"life": 260,
"scale": 0.95,
"flame": 0.9,
"rear": 28.0,
"seeker": 90.0,
"launch_sound": "launch.s400_eject",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 1.05}
},
{
"kind": "Amraam",
"model": "airdef:amraam_missile",
"speed": 6.0,
"accel": 0.45,
"turn": 0.3,
"boost": 6,
"cold": 0,
"eject": 0.0,
"eject_drag": 0.0,
"pk": 0.85,
"fuse": 4.0,
"life": 260,
"scale": 0.9,
"flame": 0.9,
"rear": 28.0,
"seeker": 130.0,
"launch_sound": "launch.patriot",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 1.05}
},
{
"kind": "M9m317",
"model": "airdef:m48n6",
"speed": 6.5,
"accel": 0.5,
"turn": 0.25,
"boost": 8,
"cold": 0,
"eject": 0.0,
"eject_drag": 0.0,
"pk": 0.85,
"fuse": 5.0,
"life": 300,
"scale": 1.1,
"flame": 1.2,
"rear": 32.0,
"seeker": 90.0,
"launch_sound": "launch.patriot",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 0.9}
},
{
"kind": "M9m338",
"model": "airdef:m57e6",
"speed": 5.5,
"accel": 0.6,
"turn": 0.4,
"boost": 4,
"cold": 8,
"eject": 1.6,
"eject_drag": 0.1,
"pk": 0.9,
"fuse": 3.0,
"life": 160,
"scale": 1.0,
"flame": 0.8,
"rear": 28.0,
"seeker": 70.0,
"launch_sound": "launch.s400_eject",
"voice": {"event": "missile.flight", "gain": 1.0, "pitch": 1.15}
},
{
"kind": "P1sun",
"model": "airdef:p1sun",
"speed": 2.8,
"accel": 0.12,
"turn": 0.3,
"boost": 4,
"cold": 0,
"eject": 0.0,
"eject_drag": 0.0,
"pk": 0.8,
"fuse": 3.0,
"life": 900,
"scale": 0.8,
"flame": 0.0,
"rear": 10.0,
"seeker": 60.0,
"launch_sound": "drone.lancet",
"voice": {"event": "drone.lancet", "gain": 0.8, "pitch": 1.6}
}
],
"named": {
"battery_radar": {
"kind": "fixed",
"value": [["airdef:radar_trailer", 0.0, 4.2]]
},
"battery_spinner": {
"kind": "spinner",
"value": ["airdef:radar_panel", 0.9, 4.2, 0.9, -0.3]
},
"tube_pivot": {
"kind": "pivot",
"value": [0.0, -0.5, 1.5]
}
}
}
+44
View File
@@ -1,5 +1,12 @@
# Акустика AirDef: реализация, проверки и разбор Sound Physics Remastered (#96)
4 ноября добавлен opt-in массовый offline capture fixture: 100 движущихся двигателей и до
16 импульсных источников, настоящие `Audio::tick_acoustics`/`film_mix`, две одинаковые дорожки,
сброс хвоста при новом capture. Release на Apple M5: p50 3.55 мс, p95 4.30 мс, max 5.57 мс
на 50 мс аудио. Геометрия и сэмплы синтетические; это не полный игровой CPU/GPU/FPS и не MP4.
[Команда, результат и оставшаяся приёмка](CONTINUATION-2026-11-04.md),
[JSON и SHA дорожки](measurements/mass-acoustics-2026-11-04.json).
Сначала приведён текущий статус реализации. Разбор SPR и первоначальный план ниже сохранены как
история решений; формулировки будущего времени в плане не заменяют текущий статус. При расхождении прав код.
@@ -48,6 +55,43 @@ GPL-файлы три: `acoustics/spr_occlusion.rs`, (стадия 2) `acoustics
выстрел 1.5 с на 60 блоках, стена камня в 2 блока: ниже 300 Гц -5.2 дБ (SPR: gain 0.55), 300-1500 -7.4, 1500-5000 -19.7, выше 5000 -40.0 дБ.
Тесты: `cargo test -p horizon-client --lib acoustics` (формулы, неизвестное, щель, кеш, инвалидация, детерминизм, рабочий поток) и `audio`.
### Настоящий MP4 с включённой акустикой (4 ноября, pin `73b9d3070`, API 29)
Пары настоящих экспортов одного и того же повтора, с акустикой и без: кнопка мода «Акустика
(преграды, эхо)», затем тот же `/airdef replay export` (640×360, 30 fps, crf 20), offscreen Metal,
ffmpeg 9.0.1, scratch `HORIZON_HOME`/мир (не сохранения игрока). `HORIZON_ACOUSTICS=1` без
`HORIZON_NO_AUDIO`. В сохранённом мире значение акустики хранится в состоянии мода, поэтому env
задаёт только начальное значение: в проверке её включали и выключали кнопкой.
Статусы в игре во время и после экспорта: `Акустика: API=true, включено=true, запрос=true,
подготовлено=true, ready`; `Захват этого мода: запрос=true, подготовлено=true, ready`. Контроль
`HORIZON_ACOUSTICS=1` + `HORIZON_NO_AUDIO=1`: `включено=true, запрос=true, подготовлено=false,
awaiting-backend` — ожидаемое отсутствие offline-микшера, не замена звуковому MP4.
| Сцена | ON: кадры/с | OFF: кадры/с | RMS ON/OFF | пик ON/OFF | L/R corr ON/OFF | centroid ON/OFF | HF>4k ON/OFF |
|---|---|---|---|---|---|---|---|
| поле, 3 события, `sec=4` | 123/4.100 | 124/4.133 | −23.53/−23.26 | −7.18/−5.60 | 0.675/0.627 | 1089/1382 Гц | 0.071/0.095 |
| поле, 1 событие, весь фильм | 351/11.700 | 352/11.733 | −32.18/−16.19 | −12.41/−2.65 | 0.829/0.963 | 1157/1862 Гц | 0.075/0.138 |
| каменный двор 80×100×30 (стены), весь фильм | 430/14.333 | 430/14.333 | −22.06/−20.09 | −5.97/−5.76 | 0.915/0.985 | 232/652 Гц | 0.005/0.039 |
Все пары — `h264` + AAC 48 кГц stereo, без обрезки звука; файлы `airdef-films/{ac,one,court}_{on,off}.mp4`
в scratch. Уже это показывает, что акустика реально обрабатывает дорожку фильма: в каменном дворе
OFF почти моно (L/R 0.985–1.000), ON декоррелирован (0.915); centroid и доля >4 кГц падают, как и
ожидается от окклюзии/воздушного поглощения; в поле ON тише OFF до 16 дБ по RMS за рельефом.
Реверб/эхо: в каменном дворе отрезок 9–14 с (после склейки) описывается ON ≈ g·OFF, g = −2.03 дБ
(лучшее совмещение −32 сэмпла = 0.67 мс). Остаток −25.18 dBFS при сигнале −17.61 dBFS (на 7.6 дБ
ниже), centroid 546 Гц, доля >4 кГц 0.009, L/R corr 0.495: низкочастотный диффузный
декоррелированный компонент — это wet-путь (реверб/эхо), а не масштаб сухого сигнала. В открытом
поле send реверба равен нулю по построению (`acoustics/room.rs`: `a field has no send`), поэтому
поле показывает только окклюзию/поглощение, а реверб — только в замкнутой геометрии.
Ограничения: чистый хвост/RT60 в настоящем MP4 не выделен — в замкнутом зале ON-дорожка была на
30–40 дБ тише (сильная окклюзия), а в открытом дворе длинный сэмпл взрыва (`blast_big`, 15 с; его
21 Гц тон виден в дорожке) маскирует хвост; камеру в комнате с источником и тишиной после него в
этом проходе получить не удалось. Ранние отражения отдельно не измерены. Субъективного
прослушивания не было; 10-минутный экспорт, Windows/Linux и полный бой не проверялись.
### Стадия 2: эхо (сделано)
Что игрок получает: взрыв в ущелье или между домами отвечает настоящим эхо от тех стен, что там есть, с задержкой по
+34
View File
@@ -0,0 +1,34 @@
# Модели летательных аппаратов (#115)
Это промежуточные игровые стилизации. У «Ланцета» две пары Х-образных крыльев получили ступенчатые стреловидные кромки, переработан нос и добавлены детали корпуса. У Х-101 изменена стреловидность развёрнутых крыльев; корпус, хвост и подфюзеляжный элемент сохранены. Идентификаторы, положение винта и состав частей не изменены. Число элементов: «Ланцет» 17 → 49, Х-101 22 → 30. Влияние на производительность не измерено.
| Модель | До | После |
|---|---|---|
| Ланцет | ![Ланцет до](media/aircraft-pass/lancet-before-top.png) | ![Ланцет после](media/aircraft-pass/lancet-after-top.png) |
| Х-101 | ![Х-101 до](media/aircraft-pass/kh101-before-top.png) | ![Х-101 после](media/aircraft-pass/kh101-after-top.png) |
Дополнительные ракурсы: [Ланцет до](media/aircraft-pass/lancet-before-nose.png), [Ланцет после](media/aircraft-pass/lancet-after-nose.png), [Х-101 до](media/aircraft-pass/kh101-before-nose.png), [Х-101 после](media/aircraft-pass/kh101-after-nose.png).
## Проверка игрового инстанса
| До | После |
|---|---|
| ![Инстанс до](media/aircraft-pass/lancet-instance-before-nose.png) | ![Инстанс после](media/aircraft-pass/lancet-instance-after-nose.png) |
[Ракурс сверху до](media/aircraft-pass/lancet-instance-before-top.png) · [ракурс сверху после](media/aircraft-pass/lancet-instance-after-top.png).
Проверочный мод `tools/model-preview` выставляет модель через игровой `render.set-models` с `glow=false` и HD-освещением в открытом воздухе. На этих кадрах видны цвет, крылья и нос; это статичный инстанс, полёт и анимация не проверены. Различия яркости наклонных сегментов на старых кадрах исправлены в #123.
## Исправление нормалей (#123)
| До | После |
|---|---|
| ![Осевые нормали](media/aircraft-pass/lancet-instance-normal-before.png) | ![Геометрические нормали](media/aircraft-pass/lancet-instance-normal-fix.png) |
[Сверху после исправления](media/aircraft-pass/lancet-instance-normal-fix-top.png) · [ночь после исправления](media/aircraft-pass/lancet-instance-normal-fix-night.png).
Пара «до/после» снята в одном scratch-мире, с одинаковыми координатами камеры, временем и погодой на Apple M5/Metal. Динамический block-model путь теперь вычисляет нормаль из неколлинеарных вершин квада и использует прежний осевой fallback только для вырожденной геометрии. Unit-тест покрывает оба знака наклона 45°, другие углы, осевые и вырожденные квады. Массовая производительность и полёт этой проверкой не измерялись.
Остальные снимки выше показывают модели как установленные блоки в изолированных мирах Horizon, offscreen, без звука, при времени 6000 и ясной погоде, со светящейся платформой и одинаковыми координатами камеры. В пакетах одинаковы код и остальные ресурсы; для варианта «до» заменены два JSON модели на версии d410e2c. Оба блока после установки проверены через `block`. Ландшафт и состояние подгрузки различаются; снимки не ретушированы. Непрозрачный установленный блок местами выглядит почти чёрным, поэтому его снимки нельзя использовать для оценки освещения игровых инстансов. В исходной серии ночное освещение не проверялось; ночной кадр Lancet после #123 представлен выше. Массовая производительность не проверена; художественная приёмка остаётся открытой.
Редактируемые источники — `airdef-mod/source-assets/assets/airdef/models/block/{lancet,kh101}.json`. Для переэкспорта запустите `python3 tools/aircraft_models.py`, затем `python3 tools/gen_models.py` для установки ресурсов и пересчёта габаритов.
+95 -15
View File
@@ -69,13 +69,26 @@
1. Подготовка резервирует конкретную ячейку. Отдельная крышка ТПК открывается; ракета ещё не расходуется.
2. При потере цели или неисправности/сворачивании носителя до выброса подготовка отменяется.
3. Ракета выбрасывается из фактического muzzle. Боекомплект уменьшается один раз; использованный ТПК остаётся открытым.
4. В фазе выброса отсутствуют факел, непрерывный звук двигателя и его дымовой след.
5. После зажигания включаются эффекты, ракета разгоняется и начинает поворот по существующей игровой логике.
4. Выброс идёт без двигателя: ракета поднимается и линейно теряет скорость под газовым сопротивлением.
Длительность считается от выброса, а не от открытия крышки: у С-400 (`M48n6`) 20 тиков — 1,00 с,
у С-500 (`M77n6`) 24 тика — 1,20 с, у IRIS-T и Тора (`IrisT`/`M9m338`) 8 тиков — 0,40 с.
В этой фазе нет факела, непрерывного звука двигателя, моторного света и powered smoke; остаётся
только отдельный газовый хлопок/клуб.
5. Зажигание — отдельное событие в текущей точке ракеты, а не у оставленной ПУ: там же появляются
вспышка, факел, звук и запись `MotorIgnition`. Оно наступает после `cold` тиков выброса.
6. После зажигания начинается departure: тяга плавно нарастает от 45% к 100%, а допустимый темп
поворота — от 20% к полному за `boost` тиков. Полное наведение (включая самонаведение и облёт
рельефа) включается только при `age >= cold + boost`; при увеличении `cold` оно не может
включиться раньше мотора. Максимальная скорость, `pk`, `turn` и правила столкновений не менялись.
Это действует для зенитных С-400/С-500 и подготовленного ударного RM48U у С-400.
У ручного удара носитель и ячейка резервируются до пуска; изменение состояния отменяет подготовку
без расхода. Для RM48U добавлен плавный разгон после выброса. Задержанный ручной приказ
не возобновляется после загрузки мира: незапущенный боеприпас остаётся в носителе.
без расхода. RM48U использует ту же 20-тиковую хореографию: неосвещённый выброс, зажигание в текущей
точке, затем разгон; насчитанное время полёта включает выброс, а записанный дым начинается у точки
зажигания. Задержанный ручной приказ не возобновляется после загрузки мира: незапущенный боеприпас
остаётся в носителе. Ракеты с рельсовым (горячим) пуском тоже получили плавное нарастание тяги за
свой `boost`, но не холодный выброс; электрический P1-SUN сохраняет постоянный разгон и не получает
ракетную струю.
В записи сохраняются конфигурация машины, использованные ячейки и положение крышки;
повтор восстанавливает их по своей временной шкале. Записанный дым начинается у точки зажигания,
@@ -92,17 +105,30 @@
## Проверка в игре и тестами
Исходный код батареи и команды опубликованы в `966b52f`. Для этой контрольной точки прошли
169 тестов ядра и 4 сценария (7 отдельных тестов помечены ignored), а также 53 теста адаптера,
проверка границы с ядром и ещё 4 сценария. Настоящий собранный WASM-пакет прошёл 21 шаг
`wasm_contract.toml`, включая конфигурацию батареи и развёртывание новых пресетов.
Генератор моделей не обнаружил различий с исходниками.
Историческая контрольная точка батареи и команд — `966b52f`: 169 тестов ядра и 4 сценария
(7 ignored), 53 теста адаптера, проверка границы с ядром и ещё 4 сценария; настоящий WASM-пакет
прошёл 21 шаг `wasm_contract.toml`, генератор моделей не нашёл различий.
Отдельный тест симуляции проверяет открытие до расхода, отмену при повреждении,
однократное списание при выбросе, отсутствие голоса двигателя до зажигания и последующий рост скорости.
Тест повтора проверяет перемотку состояния крышек и конфигурации пусковой туда и обратно.
Контрольная точка #129 — `4b013fb7f30dbaa87a266b27a31911937fc523b4` (ветка
`agent/issue-129-cold-launch`): core release **206 + 8 сценариев** (8 ignored), адаптер
**67 + 1 boundary + 5 сценариев**, настоящий WASM **30 шагов**, `gen_catalog.py --check` без
расхождений, `gen_models.py --check` без различий, `test_gen_assets.py` — 10 тестов.
Ниже — исходные кадры из изолированного тестового мира Horizon, Metal, 2560×1440.
Отдельные тесты проверяют открытие до расхода, отмену при повреждении, однократное списание при
выбросе, отсутствие голоса/факела до зажигания, записанное зажигание через `cold` тиков после
выброса, плавные ограничения скорости и поворота для всех профилей, а также RM48U без powered
эффектов до зажигания. Тест повтора проверяет перемотку состояния крышек и конфигурации ПУ туда и
обратно и отсутствие дыма до записанного зажигания.
Сравнительная выборка #129 (те же seed, что у сетки #120; 6 вариантов × 8 seed, 2208 целей на
сторону): сбито 1988 → 1939, прорывов 216 → 258, ракет 3461 → 3467; `energy_lost` 0 → 0,
`expired` 1 → 0, сорванных о рельеф 2 → 4. Близкие (`near200`) 318 → 311 сбитых, дальние
(`far1500`) 338 → 334, холмы (`hills20`) 334 → 319. Отдельные 12 seed `SAMS=20 SIZE=12`:
203 → 201 сбитых, 1 → 3 прорыва, 355 → 360 ракет. Это ожидаемое следствие более длинного старта,
а не скрытая компенсация: `pk`, максимальные скорости и столкновения не менялись. Данные:
[сетка](measurements/issue-129-grid.csv), [рейды](measurements/issue-129-balance.csv).
Ниже — исходные кадры крышек из изолированного тестового мира Horizon, Metal, 2560×1440.
На первом четыре малые крышки ТПК закрыты; на втором одна поднята, остальные закрыты.
Большая прямоугольная панель позади труб — навесная РЛС конфигурации `integrated`.
@@ -114,5 +140,59 @@
`3fae616902563b01e6463a32687c062d5983c4e94bd357f8f8129744d859f4d7`;
геометрия крышек и их преобразования совпадают с опубликованной версией.
Сохранение после пуска содержит 3 оставшиеся ракеты С-400 и маску использованной ячейки `1`.
Эти кадры подтверждают положение крышек, но не являются видеопроверкой всех стадий полёта:
сам выброс и момент зажигания крупным планом снять не удалось.
### Парная съёмка #129: до и после
Оба ролика сняты на одном и том же scratch-мире `ColdLaunch129` (плоский тестовый рельеф,
`--creative`), одном сохранении мира, одном сценарии `pair129` и одном seed
`965460218386186365`. Сценарий: С-400 в точке `1.5 72 8.5`, роли `31`, один Х-22, налёт с 900.
Оба прогона — один и тот же клиент/движок `278f356aa` (API30), одни ресурсы, Metal/offscreen,
`HORIZON_NO_AUDIO=1`, одна команда режиссёра
`/airdef replay export <имя> best fps=30 size=1280x720 crf=16 sec=24`.
| | До (`dc36d67`) | После (`4b013fb`; hmod `00f0209`) |
|---|---|---|
| `.hmod` SHA-256 | `2d828aa8…` | `ca3bdd30…` |
| исходный MP4 | 17 268 968 Б, 403 кадра | 17 832 718 Б, 412 кадров |
| длительность | 13,433 с | 13,733 с |
| поток | h264 1280×720 30 fps + AAC 48 кГц | то же |
| план «Пуск» | кадры 94–151 | кадры 94–160 |
| первое освещение центра | кадр 101 = 0,233 с | кадр 121 = 0,900 с |
| `cold` профиля | 5 тиков = 0,25 с | 20 тиков = 1,00 с |
«Первое освещение» — прокси зажигания/факела: первый кадр, где средняя яркость центрального
окна 100×120 px (`x 590..689`, `y 300..419`) превышает 100/255. До (`dc36d67`) это кадр 101, через 7 кадров
после начала плана «Пуск» (кадр 94) — 0,233 с при `cold=5` (0,25 с). После — кадр 121, через
27 кадров — 0,900 с при `cold=20` (1,00 с); к кадру 124 окно выходит на устойчивую яркость
≈198. Разница 0,667 с совпадает с разницей `cold` 15 тиков = 0,75 с в пределах 2–3 кадров
(30 fps). Аудиодорожка даёт тот же сдвиг: RMS (окно 50 мс) впервые превышает 0,03 на 3,45 с
до и 4,15 с после при старте плана 3,10 с, то есть через 0,35 и 1,05 с; это атака звука, а не
кадр зажигания. Полные числа и хэши:
[issue-129-pair.json](measurements/issue-129-pair.json).
Оба MP4 лежат в `docs/media/cold-launch`: [до](media/cold-launch/cold-launch-129-before.mp4) и
[после](media/cold-launch/cold-launch-129-after.mp4), в перекодировке h264 CRF26 для хранения;
число кадров, 30 fps, длительность и AAC сохранены. Исходные файлы с CRF16 и их SHA-256
записаны в JSON.
Это **replay/export**, не live-видео: живые кадры в MP4 не писались (`--offscreen` не даёт окна
для сторонней записи, встроенной live-записи у мода нет). Звук сведён офлайн, живое
прослушивание не выполнялось.
Парные кадры (слева — до, справа — после), один и тот же кадр фильма:
![Общий план перед пуском, кадр 60](media/cold-launch/cold-launch-129-pair-general.png)
![0,53 с после начала плана «Пуск»: до уже с факелом, после ещё без него](media/cold-launch/cold-launch-129-pair-0.5s.png)
![1,0 с: у «после» факел уже горит (начало — кадр 121)](media/cold-launch/cold-launch-129-pair-1.0s.png)
![1,53 с: обе ракеты под тягой](media/cold-launch/cold-launch-129-pair-1.5s.png)
**Ограничение приёмки.** Агент, выполнивший прогон, не имеет ввода изображений и не может сам
оценить композицию, читаемость и красоту кадров. Проверены факт и параметры съёмки, одинаковый
старт плана «Пуск» (кадр 94), яркость центра и её сдвиг по времени; парные кадры приложены для
человеческого просмотра. Кадры до/после не пиксельно идентичны: это два отдельных живых прогона,
камера общего плана движется, листва/трава анимированы, поэтому в предпусковых кадрах остаётся
разница в несколько уровней яркости. Совпадают мир, сохранение, сценарий, seed, метод камеры и
команда экспорта, а не каждый пиксель. Отдельный очень крупный статичный план выброса у самой ПУ
не снят; план «Пуск» — боковой с 46 блоков. Это не полная визуальная приёмка #129.
+328 -4
View File
@@ -4,7 +4,110 @@
Рабочая ветка `kimi-work`; issues не закрывать, публиковать комментарии с коммитом и проверками.
Движок — отдельный `chexit/horizon-airdef`, ветка `airdef`, подключён точным gitlink `horizon/`.
## Текущее состояние: 3 ноября 2026
## Текущее состояние: 4 ноября 2026
Последнее продолжение пяти задач: [CONTINUATION-2026-11-04.md](CONTINUATION-2026-11-04.md).
Движок `57f8b2853c4443f7e3ff5701600cbb262b53118f`, API29. В этом файле ниже сохранён
исторический журнал предыдущих серий; старые SHA и числа тестов не заменяют новую контрольную точку.
След #91 продолжен: `catalog/specs.json` — единственная копия числовых строк дронов, ракет и
комплексов; `python3 tools/gen_catalog.py` генерирует `specs_generated.rs` и
`unit_specs_generated.rs`, `--check` (CI) валит расхождение. Числа не менялись; сверка с литералами
подтвердила 1.6 как фактический голос P1-SUN (недостижимый `P1sun => 1.7` в старом match не в счёт);
на это добавлена Rust-регрессия. Остаток: варианты комплексов и игровая приёмка.
### Продолжение #129: стадии холодного пуска и разгон (6 ноября 2026)
Ветка `agent/issue-129-cold-launch`, кодовый коммит `4b013fb7f30dbaa87a266b27a31911937fc523b4`
(документация, измерения и кадры — следующим коммитом этой же ветки).
Игра/движок не менялись: pin `278f356aa604fa21c2d15d0081823bbe0f891df2`, API30. Push не выполнялся,
issues не закрывались.
**Контракт стадий.** У `MissileSpec` появились `eject` и `eject_drag`; `cold` — тики физического
выброса, `boost` — тики departure. `guided(age) = age >= cold + boost`; основная ветка наведения,
самонаведение и облёт рельефа больше не могут включиться до зажигания (раньше было `age >= boost`,
что при большом `cold` включало наведение до мотора). Зажигание — по-прежнему `age > cold`;
событие `MotorIgnition`, звук, факел и голос используют текущую позицию ракеты. `departure_ramp`
растёт 0→1 за `boost`; темп поворота в departure — `turn·(0.2 + 0.8·ramp)`. Тяга ракетных
профилей — `accel·(0.45 + 0.55·ramp)`, на guidance — полная. P1-SUN (`flame=0`) сохраняет
полный разгон без ракетной струи.
**Профили.** `M48n6`: `cold=20`, `eject=2.4`, `eject_drag=0.07` — 1,00 с; `M77n6`: `cold=24`,
`eject=2.6`, `eject_drag=0.07` — 1,20 с; `IrisT`/`M9m338`: `cold=8`, `eject=1.8/1.6`,
`eject_drag=0.1` — 0,40 с. Рельсовые профили (`cold=0`) получили только spool тяги; ранний
поворот на рельсовом пуске был проверен и отменён: он уводил Pac3 в землю на холмах и валил
`an_interceptor_over_rolling_land_does_not_hit_the_ground`. `speed`, `accel`, `turn`, `pk`,
`fuse` и правила столкновений не менялись.
**RM48U.** `EJECT_TICKS` 5 → 20. Выброс неосвещённый и замедляется; зажигание на `EJECT_TICKS`,
факел/звук/голос с этого момента; насчитанное время полёта включает выброс; дым в записи
начинается от точки зажигания, а не от горловины. Live, repeat и export читают одно и то же
состояние `lit`/записанное `MotorIgnition`.
**Проверки.** core release **206 + 8 сценариев**, 8 ignored; адаптер **67 + 1 boundary +
5 сценариев**; настоящий `.hmod` — **30 шагов** `wasm_contract.toml`; `gen_catalog.py --check` и
`gen_models.py --check` без расхождений; `test_gen_assets.py` — 10 тестов; `git diff --check` чист.
Новые регрессии: стадии по порядку и отсутствие powered-эффектов до зажигания; `guided` не раньше
`cold` для всех профилей; непрерывность скорости/поворота и throttled первый powered тик; P1-SUN
без факела; записанное зажигание через `cold` тиков и `missile_is_lit` по нему; RM48U без
голоса/факела до зажигания и ровно один звук зажигания.
**Баланс.** Сетка #120 (6 вариантов × 8 seed, 2208 целей на сторону, baseline `dc36d67`):
сбито 1988 → 1939, прорывов 216 → 258, ракет 3461 → 3467; `near200` 318 → 311, `far1500`
338 → 334, `hills20` 334 → 319; `energy_lost` 0 → 0, `expired` 1 → 0, scrub 2 → 4.
`SAMS=20 SIZE=12`, 12 seed: 203 → 201 сбитых, 1 → 3 прорыва, 355 → 360 ракет. Отдельные CSV:
[сетка](measurements/issue-129-grid.csv), [рейды](measurements/issue-129-balance.csv).
Это намеренное следствие более длинного старта; скрытого повышения `pk` или максимальной скорости нет.
**Парная съёмка.** Один scratch-мир `ColdLaunch129`, одно сохранение, сценарий `pair129`,
seed `965460218386186365`, один клиент/движок API30, один режиссёр
(`/airdef replay export … best fps=30 size=1280x720 crf=16 sec=24`), Metal/offscreen.
Сценарий: С-400 `1.5 72 8.5`, роли `31`, один Х-22 с 900; мод до — `dc36d67`, после — `4b013fb`.
Оба MP4: h264 1280×720 30 fps + AAC 48 кГц; до — 403 кадра/13,433 с, после — 412/13,733 с.
План «Пуск» стартует на кадре 94 в обоих; первое освещение центра (окно 100×120, порог 100)
до — кадр 101 (0,233 с после старта, `cold=5` = 0,25 с), после — кадр 121 (0,900 с,
`cold=20` = 1,00 с); к 124 кадру устойчиво ≈198. Это подтверждает сдвиг холодной паузы на
≈0,67 с между сборками. MP4 в `docs/media/cold-launch` перекодированы в CRF26 для хранения;
исходные файлы, их SHA-256, ffprobe и логика измерения — в
[issue-129-pair.json](measurements/issue-129-pair.json). **Ограничение:** у агента нет ввода
изображений; проверены параметры, старт плана, яркость центра и парные кадры, но композицию и
красоту кадров человеком ещё нужно оценить. Предпусковые кадры не пиксельно идентичны (живой
прогон, движение камеры, анимация листвы); совпадают мир/сейв/сценарий/seed/метод камеры.
Отдельный very-close статичный план и live-MP4 не сняты (`--offscreen` без окна). Это не полная
визуальная приёмка.
### Продолжение #122 (второй налёт из UI)
Точный лог Windows: `stopped in UI event (fuel budget 1000000000, remaining Some(0))`,
backtrace `known_units ← order_raid ← launch_wave ← ui_select` — другой класс, чем тик
`1f28f83`. Причина: `order_raid` пересчитывал снимок известных комплексов на каждом дроне,
а сам снимок был квадратичен по журналу и группировке. Исправление: один снимок на приказ
(+ O(журнал+группировка) через множества, `price_grid_on` переиспользует свой снимок);
семантика целеуказания и выбора носителей не менялась, сверка с прежним предикатом в
нативном тесте, `/stats` в WASM совпал побайтово. Лимиты не трогали, HD/запись не отключали,
размер волны не ограничивали.
Воспроизведение в настоящем WASM (измеренный fuel): до — второй приказ 111 дронов исчерпывает
ровно 1e9 в событии (failures=1), тот же приказ 11 дронов — 247805865; после — тот же сценарий
целиком: max command 32946177/1e9, tick 236581288/300M, ошибок 0. Диагностический гость
(`trigger.patch` вызывает обработчик `ui_select(BTN_LAUNCH)`) и точный сценарий:
[issue-122-ui-fuel](measurements/issue-122-ui-fuel/summary.json). Воспроизвести удалось только
с разнесённой группировкой: стек в одной точке гибнет от одной боеголовки (`known=0`, приказ
дёшев) — у пользователя силы дожили до второго приказа.
Закреплённые регрессии: нативные «эквивалентность снимка» и «второй умный приказ с толстым
журналом принят и запущен»; тяжёлый WASM fixture расширен двумя умными приказами через
`airdef preset` + `airdef raid` (функция кнопки ПУСК) — 4 принятых приказа, SHA fixture
обновлён; лёгкий контракт 30 шагов с `preset` и отказом пустой волны. Новая команда
`airdef preset <n>` — script-эквивалент кнопки готового состава.
Последний общий прогон: core release **195 + 8 сценариев** / 7 ignored; адаптер **65 + 1
boundary + 5 сценариев**; лёгкий WASM **30 шагов**; тяжёлый WASM **283 шага** (tick max
182413686/300M, command max 6939810/1e9, failures=0), отчёт
[flat-wasm-raid-budget](measurements/flat-wasm-raid-budget.json); 6 тестов отчёта budget
и build-тест прошли. Ни одно issue не закрыто; пуш не выполнялся.
### Контрольная точка 3 ноября
Код предыдущих четырёх задач интегрирован до `6e2d661`. Продолжение #102/обратного вывоза
опубликовано до `aab3e78`; последнее продолжение расследования налётов — `2932364`.
@@ -64,8 +167,9 @@ awaiting-backend. Выход через quit подтверждён. Это не
## Двойные налёты и плотность следов
Перед продолжением читать [RAID-STABILITY.md](RAID-STABILITY.md): один соответствующий класс
отключения теперь воспроизведён и исправлен (`1f28f83`), приёмка конкретного Windows-сеанса остаётся.
Перед продолжением читать [RAID-STABILITY.md](RAID-STABILITY.md): два соответствующих класса
отключения теперь воспроизведены и исправлены — тик (`1f28f83`) и событие UI на втором
приказе (#122, `order_raid`/known_units); приёмка конкретного Windows-сеанса остаётся.
Текущий исправленный WASM stress проверяет две принятые волны, обслуживаемую плоскую геометрию
и 184 воздушные цели в конкретный момент; новый [JSON](measurements/flat-wasm-raid-budget.json)
заменяет прежнее недостаточное доказательство покрытия. Лимиты fuel/memory не увеличивались.
@@ -214,6 +318,30 @@ baseline — 202 сбитых, 2 прорыва, 367 ракет; новое —
Это небольшой регрессионный ориентир, не доказательство баланса всех типов/дальностей.
Данные каждого seed: [CSV](measurements/issue-120-balance.csv).
Расширенная сетка остатка #120 (ветка `agent/issue-120-balance`, коммит см. в git):
baseline `2689d93` против текущего `e6a7000` (то есть с #118/#119/#121 и сменами движка, не только #120),
6 вариантов × 8 одинаковых seed, рейд `SIZE=36` (46 целей: Gerbera 10, Shahed 13, Geran3 5, Х-101 5,
«Калибр» 4, Х-22 2, «Циркон» 1, «Искандер» 4, «Кинжаль» 2; «Орешник» harness исключает, как в `one_raid`):
`batt10/20/50` (10/20/50 ЗРК, дистанция 500), `near200` (20 ЗРК, пуск в 200), `far1500` (20 ЗРК, пуск в 1500),
`hills20` (20 ЗРК, холмы, 500). Кластер тот же `MIX` из 10 систем: `SAMS=10` — по одному комплексу каждого типа.
Итого 2208 целей на сторону, 96 строк: [CSV](measurements/issue-120-grid.csv). Команда (игнорируемый тест
`sim::balance::issue_120_grid`, только harness-поля в `Result`, поведение симуляции не менялось):
```sh
SEEDS=1-8 cargo test --release --manifest-path airdef-core/Cargo.toml issue_120_grid -- --ignored --nocapture
```
Факты сетки (суммы по 8 seed каждого варианта, baseline → текущий): сбитые 297→301 (batt10), 331→334 (batt20),
357→363 (batt50), 313→318 (near200), 328→338 (far1500), 328→334 (hills20); прорывы 70→66, 37→34, 11→5,
53→48, 40→30, 39→33. Промахов по взрывателю заметно меньше (например far1500: 70→38). Расход ракет близок
(516→504 … 597→583). На холмах потери у рельефа: разбито 14 и 14, самоуничтожений у хребта 6→2.
Прорывы во всех вариантах — преимущественно баллистические и быстрые классы («Искандер», «Кинжаль», Х-22,
«Циркон»); у медленных Shahed/Gerbera прорывов почти нет (0–2 на вариант), у ложных Gerbera — ноль ни разу.
`MotorEnergyLost` не сработал ни в одном из 48 сценариев текущего кода, `expired` ≤ 1 на вариант: coast
существует, но бои на этих дистанциях заканчиваются раньше, чем сопротивление 0.995/тик опустит скорость
ниже порога 25% (и раньше выработки ресурса). Это измеренное свойство профиля, не подтверждённый дефект,
поэтому параметры не менялись. Путь потери энергии покрыт юнит-тестом регресса (`regress.rs`), а не этой сеткой.
```sh
SAMS=20 SIZE=12 cargo test --release --manifest-path airdef-core/Cargo.toml sim::balance::one_raid -- --ignored --nocapture
```
@@ -298,13 +426,209 @@ Unknown, stale и слишком старые секции считаются **
Unknown и поздний ответ без повторного урона/запросов; прямое попадание; устаревшая геометрия;
пропуск исходного блока. Все четыре прошли в объединённом наборе.
### #127: устойчивая очередь маршрутов после массового перенацеливания
Реализована только узкая часть issue: `sim::ew::RouteJob` — задание с ID дрона, новой целью,
ID цели-юнита, версией знаний и общим для тика снимком `known_units` (`Arc`). `adapt` по-прежнему
выбирает новые цели раз в 40 тиков, но маршруты теперь достраивает `replan_retargets` **каждый
тик**: одно задание или несколько, пока не исчерпан `WORK_PER_TICK`. Незавершённое задание
остаётся в `Sim::retargets` (FIFO) и не теряется; повторный выбор того же дрона заменяет задание
на месте, поэтому очередь не растёт.
Старый маршрут не очищается при перенацеливании: дрон следует готовому безопасному участку,
пока новое задание не получит маршрут. Если задание отменяется (дрон погиб, цель изменена снова,
юнит уничтожен), маршрут очищается как fallback — дрон летит прямо до следующего адаптивного тика.
Lancet, баллистика и decoy, как и раньше, летят прямо: для них задание не создаётся. В полёте
следующая известная цель берётся только если до неё есть разворот; цель сзади внутри радиуса
разворота пропускается, и дрон завершает текущий заход, а не получает невыполнимый маршрут.
Повторный план использует снимок разведки исходного выбора цели и известный рельеф **той же версии
задания**: `KnownRelief` (сетка и высоты) лежит в `Arc` внутри `RouteJob`, `Sim::known_relief` хранит
тот же `Arc` только для новых заданий. Завершение другой умной волны заменяет глобальный указатель,
но не снимок ожидающего job. Выборка рельефа, цены и кэш маршрутов в `replan_retargets` ключуются
версией знаний целиком — adapt tick плюс указатели на снимки known units и рельефа, — а не только
рельефом: два job с одинаковым рельефом, но разными known units, не делят price/route grid. За
пределами известной сетки — Unknown, новая карта не раскрывается.
Очередь этапа 1 была рантайм-состоянием планировщика: дроны и очередь запуска в `state_text` не
входили, поэтому durable-очередью она не была. Этап 2 (ниже) сохраняет её вместе с дронами, очередью
запуска, картиной и версиями рельефа. Регрессии этапа 1 остаются: `mass_retarget_finishes_its_route_jobs_over_the_budget`
(40+ ретаргетов, прогресс каждый бюджетный тик, старый маршрут до нового, нет пустых маршрутов)
и `mass_retarget_is_deterministic_and_never_duplicates_a_drone` (тот же seed — те же цели и
маршруты; повторный `adapt` не создаёт дублей).
### #127, этап 1: честная EnemyPicture
Журнал `intel.revealed: Vec<(id, место, тик)>` заменён картой контактов: `Intel.contacts: BTreeMap<u32, Contact>`,
одна запись на юнита, последнее наблюдение побеждает. Контакт пишется только в момент раскрытия и
читает истину только тогда: пуск (mod.rs/strike.rs) → `Seen::Launch`; фиксация излучения
радаром рядом с чужим аппаратом (sight.rs, каждые 20 тиков, 1600 блоков) → `Seen::Emission`
(отдельно помечается `emission` — вера в собственный сенсор опирается только на неё); работающая
РЭБ (ew.rs) → `Seen::Jamming`; четвёртый канал — BSA: падение собственной боеголовки рядом с
известным юнитом (`Sim::observe_outcomes`, радиус 16) фиксирует `destroyed` либо обновляет «жив»
и место. Пока юнит незамечен, его перемещения, выключение радара, смена ролей/режима, расход БК,
урон и гибель картину не меняют — это метаморфные тесты `sim::ew::picture_tests`.
Из контактов решается всё: снимок `picture_of_defences()` на приказ и на адаптивный тик (newest first,
при равном тике — больший id, как у старого reversed-журнала), цели `choose_target` и SEAD
(`radar_strikes` — только Probable и свежее), ретаргет в полёте (цель «мертва» лишь по контакту с
`destroyed`; забытого контакта дрон не замечает), живость задания очереди (`job_live` — по картине,
не по истине). Уверенность — функция одного возраста: Confirmed ≤ 600, Probable ≤ 3000, Doubtful до
TTL 6000 тиков (`Confidence`, диагностика и SEAD её используют, цены — нет: консервативно считаются
все живые контакты).
Модель возможностей в `price_grid_known` читает только картину: роли — published `kind.spec().roles`
(смена `/airdef roles` невидима), дальности — `ew::published_reach` (без урона, фактора роли и
мачт истины), донор — любой живой контакт вида Radar в link range от наблюдённого места (роль
донора не наблюдаема: рабочий контакт РЛС предполагается кормящим сеть — это допущение, а не
знание; разрыв связи/гибель донора незамеченными картину не меняют). Собственный сенсор верится,
пока жива фиксация эмиссии; пуск при нуля эмиссионных фиксаций у С-400/С-500 читается как
launcher-only: без донорского контакта такая ПУ в ценовой сетке «слепа», с ним бьёт на дальность
донора. Горизонт РЛС игрока (`self.horizons`) из чужого планировщика убран: маскировка рельефа —
тайна обороны, цены по ней консервативнее и объяснимее.
Диагностика без GUI: `Sim::enemy_picture() -> EnemyPictureReport` (англ.): по каждому контакту —
наблюдение (канал, место, возраст), уверенность, живость, наблюдённое уничтожение, вера в сенсор,
наличие донора и текстовое «что планировщик из этого делает». Адаптация по-прежнему ограничена
статистикой секторов (`best_bearing` по kills/hits): новых всеведущих данных и усиления
характеристик нет.
Форматы этапа 1 не менялись: intel оставался рантаймом (save хранил Layout, replay — траектории);
durable-очередь появилась на этапе 2, ниже. Измерения до/после на одних seed: `docs/measurements/issue-127-enemy-picture-baseline.json`
(0b645d77e) и `issue-127-enemy-picture-result.json` (эта ветка), bench — `cargo run --release --example intel_bench`.
big-smart и logistics побайтово совпали с базой; ew-adaptive изменился (kills 62→59/61→59/61→56,
hits 3→7/5→7/7→8, потери ЗРК 1→3/4→3/4→4) — фиксируется как факт перехода на честную картину,
балансные параметры не трогали. Регрессии: метаморфные `hidden_changes_do_not_move_the_picture_or_its_decisions`,
`a_new_observation_is_what_updates_the_picture`, `launcher_only_is_blind_in_the_picture_without_a_donor`
(донор любой роли; разрыв связи наблюдённый/нет), `destruction_moves_the_picture_only_when_watched`,
`confidence_is_a_function_of_age_alone`, `enemy_picture_report_describes_observation_and_belief`,
`an_impact_watches_the_kill_and_updates_only_the_picture` (BSA end-to-end), обновлённые SEAD/#4/#21/#122
и обе регрессии очереди. Остаток #127 после этапа 1: durable save queue, structured intent, GUI.
### #127, этап 2: structured intent, durable queue и объяснимость
**Намерение отделено от цели.** У дрона теперь два поля: `ew::Intent` — почему он летит туда — и
`ew::Aim` — юнит, когда цель выбрана, сколько раз менялась и уверенность контакта. `Intent`:
`Plan` (собственная цель плана: объект или юнит, выбранный при заказе), `Sead` (плановый удар по РЛС
из `radar_strikes`), `React` (реакция на раскрытие: станция показала себя уже в воздухе) и `Replace`
(картинка увидела гибель/забвение прежней цели). Случайный выбор цели (`choose_target`) больше не
смешивается с реакцией: при заказе налёта intent фиксируется, а `adapt` помечает свои решения явно.
Приоритет очереди — из намерения: Plan 3, Sead 2, React 1, Replace 0.
**Throttle.** `SWITCH_HOLD = 160` тиков (8 с): свежее раскрытие может сменить цель только после
выдержки; `SWITCH_CAP = 3` смены на дрон за жизнь; `ASSIGN_PER_TICK = 16` новых целей за адаптивный
тик и `ASSIGN_PER_CONTACT = 6` на один контакт за тик — массовый ретаргет растягивается на следующие
адаптивные тики, а не переписывает все маршруты сразу. Смена возможна, только если контакт показался
позже текущей цели (`tick > aim.since`), он не Doubtful, и он либо достовернее текущего, либо ближе
на `SWITCH_GAIN = 120` блоков: смена выбрасывает готовый маршрут и стоит планировщику нового, поэтому
маргинальная не делается. Замена убитой цели выдержку не ждёт (цели уже нет), но упирается в тот же
cap. В полёте, как и раньше, цель меняется только когда картинка её убила или забыла.
**Явные игровые реакции без скрытых данных.** Реакции читают только поля контакта, записанные каналом
наблюдения: выключенный радар остаётся в картине таким, каким его видели (эмиссия не фиксировалась —
собственный сенсор не верится), разделённая батарея читается как пуск без эмиссии (launcher-only,
без донора «слепа»), конечный БК наблюдается только как пуски (`Contact.launches`: счётчик увиденных
пусков; остаток магазина в картину не входит никогда), энергия/нагрев РЭБ — своё состояние станции,
а не раскрытие. Метаморфный тест `hidden_changes_do_not_move_the_picture_or_its_decisions` расширен:
скрытые перемещение, off, роли, режим, БК, урон, гибель и нагрев/замок/выключение РЭБ не двигают ни
картинку, ни цены, ни намерения/aims/очередь заданий. Повторное наблюдение двигает всё — как и должно.
**Неизвестная земля не бесплатна.** `raid::Relief` получил поле `unknown`; у плана умной волны оно
0 (поведение этапа 1 сохранено), у повторного планирования задания — `UNKNOWN_LAND = 6` сверх базовой
цены клетки 1. Задание, чья версия рельефа ничего не знает, планируется по полностью неизвестной
земле с той же ценой, а не «как по свободной»: маршрут держится размеченной части, если она есть.
Тест `unknown_land_is_not_free_in_a_replanned_route` сравнивает маршрут с ценой 0 и с ценой 6 на одной
сетке: бесплатный срезает через неразмеченное, платный идёт по размеченному.
**Durable queue: формат save.** `state_text` (автосейв) дописывает версионированную секцию
(`sim::durable`, формат `air 1`):
```
air 1 <такт> <номер следующего задания> <дронов> <в очереди> <заданий> <контактов> <версий рельефа>
airintel <12 kills> <12 hits>
airglobal <версия рельефа|->
airrelief <номер> <minX> <minZ> <клетка> <сторона> <RLE: u<n> | <высота>x<n> ...>
aircontact <id> <тип> <x> <y> <z> <такт наблюдения> <канал> <эмиссия|-> <гибель|-> <пусков>
airdrone <id> <тип> ... <полёт> <намерение> <юнит> <since> <смены> <уверенность> ... <маршрут: n x y z ...|->
airqueue <такт запуска> <то же тело дрона>
airjob <id> <дрон> <x> <y> <z> <юнит> <версия> <приоритет> <намерение> <рельеф|->
```
Секция пишется только автосейвом: сценарий — это стартовое состояние, его тело её не несёт
(`scenario_text` → `state_text_with(..., air = false)`). Старые saves без секции читаются как прежде
(пустое небо); старые сборки новые saves читают как Layout, игнорируя `air*` (Layout пропускает
неизвестные строки). Всё проверяется до применения: битая строка отказывает save целиком с номером
строки и полем, счётчики в заголовке сверяются с числом строк (обрезанный файл отвергается), чужая
строка внутри секции — тоже. Границы: 512 дронов, 512 точек маршрута, 4096 контактов, 8 версий
рельефа, 40 000 клеток; координаты пишутся до 0.01 блока (полёт этого не замечает), рельеф — RLE
целых высот. Секция дополнительно ограничена 900 КБ (хост разрешает 1 МиБ на одну запись): дрон,
который не влез, не пишется, и его задание тоже (восстановить его было бы нельзя). Измеренный размер секции в bench: 4.0–8.8 КБ для logistics/ew-adaptive и 61–62 КБ для
big-smart (38 дронов в воздухе).
**Что именно восстанавливается.** Дроны в воздухе (живые; падающие обломки — эффект, их нет),
очередь запуска с тактами, задания (`id`, дрон, цель, юнит, версия, приоритет, намерение, версия
рельефа), контакты картины (счётчики секторов, пуски), глобальный снимок рельефа и `job_next`.
Картина задания восстанавливается «на свою версию»: контакты, наблюдённые не позже версии, плюс
собственная цель задания (её последнее сохранённое наблюдение заменяет более позднее — иначе цель
исчезла бы из своей же картины). Устаревшие задания отменяются при загрузке (`prune_air`): дрон
исчез/погиб, цель уже другая, юнит наблюдённо уничтожен или забыт, дубль по дрону, версия старше
`JOB_TTL = 1200` тиков (60 с). Маршрут отменённого «по устареванию/дублю» задания сохраняется (он
ведёт к той же цели), отменённого из-за смены цели — очищается.
`apply_state` сначала проверяет Layout и секцию, затем применяет обе; секция заменяет воздушное
состояние, а не сливается с ним. `durable_mark` включает `air_mark` (число дронов/очереди/заданий/
контактов и `job_next`): автосейв берётся на запуске, потере, новом/завершённом задании и новом/забытом
контакте, а не каждый тик полёта. Пока налёт *планируется*, периодический save откладывается (план не
имеет durable-формы; поиск площадок ограничен `sites::SEARCH_TICKS = 400`); при смене мира пишется
только Layout. Replay по-прежнему хранит траектории: секция пишется и читается только для живого
`Sim`, записи не смешиваются с ней.
Остаток и ограничения: ракеты-перехватчики в воздухе, пусковые площадки (`sites`), промежуточный
план, статистика волны и состояние RNG не сохраняются — после загрузки перехваты начнутся заново,
очередь стартует без площадки (свободный слот), отчёт волны не придёт, а случайные броски идут от
нового генератора мира; сама воздушная обстановка (дроны, цели, задания, картина) восстанавливается
точно. GUI поверх отчёта не делался.
**Объяснимость.** `EnemyPictureReport` расширен без русского текста в core: у контакта — `launches`,
`aimed_by` (сколько дронов на него нацелено) и `pending_jobs`; добавлены `aims` (дрон, юнит, intent,
since, switches, confidence) и `pending` (id задания, дрон, юнит, точка, версия, приоритет, intent,
`relief_known`, `reason` словами: ждёт бюджета / ждёт бюджета, земля неизвестна и стоит дороже /
устарело), плюс `work_per_tick`. Тест `the_report_explains_aims_and_pending_jobs_in_english`
проверяет и ASCII-only диагностику.
**Измерения (baseline 8fc10c07a → эта ветка, `cargo run --release --example intel_bench`, seeds 1/7/42):**
`docs/measurements/issue-127-intent-queue-baseline.json` и `issue-127-intent-queue-result.json`.
big-smart: завершение у всех, launched 38, kills 38, hits 0, потери 0 — как в базе; ticks 1716→1676
(seed 1) и 1542/1433 без изменений, fired 49→60, 48→68, 49→71 (больше пусков ПВО). logistics: все
поля совпали (27 запусков, 11/12/12 сбито, 8/7/8 прорвалось, 18 ракет, 0 потерь). ew-adaptive:
kills 59→58, 59→58, 56→63; hits 7→7, 7→9, 8→3; потери ЗРК 3→3, 3→4, 4→2; ticks 8084→7146, 8193→7650,
7916→7243; fired 69→76, 81→98, 69→82. Это следствие throttle назначений и приоритетной очереди, а не
подкрутки баланса: параметры ПВО/дронов не менялись, числа фиксируются как факт. В result-файле есть
новые поля (`retargets_max`, `air_bytes`, `switches_max`, `intents`), у baseline их нет.
**Регрессии этапа 2.** Core: `the_plan_records_sead_separately_from_its_objective`,
`assignments_are_throttled_per_tick_and_per_contact`, `a_fresh_disclosure_switches_an_aim_only_after_the_hold`,
`a_watched_kill_replaces_the_aim_and_queues_a_lower_priority_route`,
`launched_rounds_are_observed_but_the_magazine_is_not`, `unknown_land_is_not_free_in_a_replanned_route`,
`the_route_queue_is_bounded_and_refuses_a_worthless_job`, `the_same_seed_chose_the_same_intents_and_jobs`,
`the_report_explains_aims_and_pending_jobs_in_english`, `the_air_state_round_trips_every_job_field`,
`a_pending_route_continues_after_a_save_and_a_load` (save/load посреди незавершённой очереди: та же
очередь, те же маршруты, обе кампании доводят задания, пустых маршрутов нет),
`stale_ghost_and_duplicate_jobs_are_cancelled`, `a_job_for_a_unit_the_picture_lost_is_cancelled_on_load`,
`a_damaged_air_section_is_refused_with_its_line_and_field`, `the_section_stays_inside_its_byte_bound`
(600 дронов с длинными маршрутами: секция ≤ 900 КБ, записанные задания принадлежат записанным дронам),
обновлённые массовые ретаргеты (40+ дронов:
прогресс на бюджетном тике, throttle назначений, у дрона, стартовавшего без маршрута, маршрут
появляется). Adapter: `the_air_section_of_a_save_is_written_and_read_by_the_adapter` (запись/чтение
секции, замена не слияние, старый save без секции, сценарий без воздуха).
## Что следующему агенту проверить в первую очередь
1. На Windows: обновление сабмодуля через `all`, сохранение/перезаход, рабочий цикл игры.
2. В GUI: полный холодный пуск крупным планом; карточка On/Off; маршрут ТЗМ по сложной местности;
разрушение стены одним взрывом и защита от того же взрыва по исходной геометрии.
3. Прослушать прекращение голоса двигателя при burnout и seek/экспорт вокруг этой границы.
4. Расширить баланс #120 на разные батареи, пределы дальности и классы целей; исходная CSV — ориентир.
4. Расширенная балансировка #120 (батареи/дальности/классы) записана в `measurements/issue-120-grid.csv`;
остаются прослушивание голоса мотора и платформенная приёмка.
5. Продолжить оставшиеся архитектурные #87/#88/#89/#91/#102 и художественный #115 по статусной таблице.
Это незавершённая платформенная/визуальная приёмка, а не отсутствие перечисленного выше кода.
+126
View File
@@ -0,0 +1,126 @@
# Продолжение 4 ноября: #115, #87, #91, #102, #96
Рабочая ветка `kimi-work`. Все issues оставлены открытыми. Работа выполнена Codex с GPT-6.1 Terra.
Движок опубликован в `horizon-airdef:airdef`, текущий pin
`57f8b2853c4443f7e3ff5701600cbb262b53118f`, API **29**.
## Изменения
- **#115:** authored-модели «Ланцета» и Х-101: сегментные стреловидные крылья,
детали носа/корпуса. Элементы 17→49 и 22→30 соответственно; игровые параметры не менялись.
`5366988`, `cfae0c1`, `914f723`. [Кадры и ограничения](AIRCRAFT-MODELS.md).
`tools/model-preview` воспроизводит реальный `set-models`, `glow=false`; установленный
stone-template блок не подходит для оценки света динамической модели. Полосы яркости
на наклонных сегментах вынесены в [#123](https://gitea.maoniao.team/chexit/airdef/issues/123).
- **#87:** `375fdf2`, `cb73cb7`, `0c870c1`: типизированный `BatteryStatus`, отчёт кэша мира
и причины повреждений отделены от русского форматирования. Команда/карта/монитор используют
адаптеры `battery_view`, `world_view`, `why_view`. Порядок и тексты сохранены.
Это постепенное разделение: `CheckReason::Text`, сообщения `Out` и часть представления в ядре остаются.
- **#91:** `eea1b36`, `1553976`, `daa9ed7`: `catalog/content.json` — идентичности техники,
предметы и метаданные иконок; `catalog/sounds.json` — звуковые события, дальности и far-варианты.
`gen_catalog.py` создаёт Rust-константы, Python-регистрации читают тот же источник;
CI проверяет актуальность. Сохранены порядок позиционных сейвов, все 35 звуковых событий,
OGG и порядок общего RNG синтезатора. Числовые `DroneSpec`/`SamSpec` остаются типизированным
источником в Rust; полного переноса всех характеристик в JSON не было.
Продолжение переноса чисел — ниже.
- **#102:** `63aefc7`: `test-budgets` включает настоящий `--fuel-profile` и сохраняет
`measured_fuel.callbacks`, включая ошибки. Отсутствие запрошенных счётчиков запрещает success.
В движке `6230ec703`/`d8fa77b00` добавлены API28 point-lights-status и API29 sound-sources-status.
Свет: заявка → cache → обработка main-view HD списка; звук: заявка → фактический apply
source manager при live/offline output. Отдельные run/world/source epochs, clear/reload и
отсутствие output проверены настоящими Wasmtime-гостями. Это не обещание пикселя/слышимости.
`/airdef capabilities` показывает оба состояния (`c1a595b`).
`57f8b2853` также устраняет коллизию камер: texture targets, scheduler, HUD/canvas/corner и
main-view адресуются `(run_serial, local_id)`. Проверены два настоящих гостя с одинаковым ID,
поиск target и scheduler, компиляция клиента.
`efe017ffb`/`278f356aa` добавляют API30 `camera-status`: `prepared` — закодированный в target
кадр камеры или кадр мира с её main-view, причём milestone получает только тот запуск, чей выбор
экран реально использовал (чужой тот же local ID и чужая картинка его не готовят). `enabled` —
последний отмеченный кадр был кадром мира, не заголовком. Пустая `set-views` и смена мира
очищают заявку/выбор/готовность, reload начинает заново; главный вид теряет picture target до
нового кадра. Проверено настоящими Wasmtime-гостями. Итоговый engine `278f356aa` с AirDef API30
проверен и в запущенной игре на Metal/offscreen (Apple M5, чистый `HORIZON_HOME`, копии тестовых
миров): monitor даёт `ready` с нарисованной картинкой (по снимкам), film-main-view — `ready` с
main-view (на экране карточка подготовки фильма), пустая заявка
и смена мира — `not-requested` с новым поколением, после deploy+monitor камера снова готова;
команды и ограничения — в [ENGINE.md](ENGINE.md#gpu-приёмка-картинки-камер-metaloffscreen).
- **#96:** engine `e44ad82a9`: opt-in `audio::tests::export_moving_mass_raid` проводит
100 движущихся двигателей и 16 импульсных источников через настоящие `Audio::tick_acoustics`
и `film_mix`: эхо/реверб, камера, инвалидация и смена epoch, новый capture без старого хвоста.
Два 6-секундных прогона дают одинаковые float-сэмплы; ненулевая дорожка, finite/peak и reset
проверяются assertions. Сэмплы и геометрия синтетические, устройство звука не открывается.
Release на Apple M5: step+mix на 50 мс аудио — p50 **3.55 мс**, p95 **4.30 мс**, max **5.57 мс**.
[Отчёт и SHA дорожки](measurements/mass-acoustics-2026-11-04.json).
Это не замер полного игрового CPU/GPU, не Windows FPS и не готовый MP4.
## Продолжение #91: один источник чисел
`catalog/specs.json` теперь единственная копия числовых строк симуляции: 13 дронов
(`DroneKind::spec`), 9 ракет (включая `seeker`, звук пуска и голос мотора), 15 комплексов
(`SamKind::spec`, включая части моделей и именованные наборы), общие константы гравитации,
высоты раскрытия «Орешника», приводов и логистики. `tools/gen_catalog.py` генерирует
`airdef-mod/src/sim/specs_generated.rs` и `unit_specs_generated.rs`; `include!` встраивает их в
`mod.rs` и `units.rs`, поэтому мод и `airdef-core` компилируют одни и те же строки. Прежние
`match`-литералы удалены; `DroneKind::spec`, `MissileKind::spec`, `SamKind::spec` и их производные
(RCS, seeker, звуки, голос) читают сгенерированные константы.
`load_specs` проверяет схему, звуковые ссылки, совпадение набора kinds с `content.json`, ссылки на
именованные части и то, что каждая строка кем-то используется; `gen_catalog.py --check` уже в
CI-шаге «Проверка generated assets», поэтому расхождение JSON и Rust валит сборку.
Сверка перед переносом: JSON сравнивался с литералами `632061d` по всем полям. Голос P1-SUN —
тонкое место: фактически играет ранний возврат `flame == 0` в старом `voices.rs`
(`(DRONE_LANCET, 0.8, 1.6)`), а `P1sun => 1.7` в `match` недостижим. Первая версия сверки ошибочно
приняла недостижимую ветку за факт и поставила в JSON 1.7 — это меняло звук перехватчика; fixup
вернул 1.6 и добавил регрессию `missile_engine_voices_keep_their_played_values` (P1-SUN и M48N6).
После генерации строки сверены с прежними литералами поле-в-поле (включая части моделей и
именованные refs) — расхождений нет. Порядок raid/save, ключи `sam`/дронов, RNG и тексты не менялись.
Проверки этого этапа: `cargo test --release` ядра — **194 passed, 7 ignored** + **8 сценариев**;
адаптер — **64 unit**, **1 boundary**, **5 сценариев**; `gen_catalog.py --check`, `gen_models.py --check`,
тесты генераторов/звука/границ моделей; настоящий WASM `test-wasm` — **27 шагов**, 1 скрипт.
GUI/MP4 и варианты комплексов (разные ракеты/профили по батареям) в этот этап не входили.
## Проверки и продолжение
Объединённый core release: **193 unit**, 7 ignored, **8 сценариев**; адаптер: **64 unit**,
**1 boundary**, **5 сценариев**. Генераторы catalog/models, asset pipeline, sound references,
границы моделей и 6 тестов provenance/failure отчёта проверяются отдельно. Лёгкий WASM — 27 шагов.
Тяжёлый default fixture — 271 шаг с двумя принятыми налётами; его текущий отчёт пишет
`python tools/airdef.py test-budgets` в `.horizon-cache/wasm-budget-report.json`.
Чистый финальный прогон `56339b0` с API29 сохранён в
[api29-wasm-budget.json](measurements/api29-wasm-budget.json): tick max 106132646/300000000,
command max 1013387/1000000000, ошибок 0, build identity совпал.
Не завершены: субъективное прослушивание, настоящий MP4 с акустикой, полный 10-минутный
replay/export, расширенная модельная/ночная/FPS приёмка, визуальная/Windows-GPU приёмка
camera-ready картинки и полные query/voice/peak-memory бюджеты.
Старый допуск broadband RT60 35% не ужесточался до 15%.
Попытка живого MP4 в этом проходе не дала проверенного файла и за приёмку не считается;
изолированные процессы закрыты. Продолжать с текущего pin, не с временных пакетов агентов.
Обновление Windows прежнее: `git switch kimi-work`, `git pull --ff-only`,
`python tools/airdef.py all`, `python tools/airdef.py play`.
## Обновление #89 (4 ноября, после этого прохода)
Живой короткий MP4 получен и проверен на pin `57f8b2853` (API 29) на scratch `HORIZON_HOME`/мире:
h264 + AAC, отчёт мода совпадает с `ffprobe nb_frames`, отмена/ошибка SDK/ошибка энкодера/повторный
запуск проходят. Найден и исправлен дефект: выход в заголовок во время экспорта оставлял захват
записывать заголовок (запрос `sec=10` дал 3898 кадров); теперь показ завершается по кадровому хуку.
Подробности и проверенные ограничения — [HD-RENDERER](HD-RENDERER.md) (раздел про кинорежиссёра)
и [ENGINE](ENGINE.md) (раздел про захват). Очистка временных файлов при ошибке энкодера
исправлена в движке `73b9d3070`: лог удаляется, его последние строки входят в текст ошибки, а
готовый MP4 прежнего экспорта с тем же именем сохраняется. Акустика проверена отдельно в настоящем
MP4 (пары on/off одного повтора, статусы ready, диффузный wet-остаток в каменном дворе); чистый
хвост/RT60 и прослушивание остаются — [ACOUSTICS](ACOUSTICS.md). 10-минутный экспорт и Windows/Linux
по-прежнему не проверены.
## Обновление #123
Engine `45b43f00d`: dynamic block models используют геометрическую нормаль квада вместо осевого
`facing`; для вырожденных вершин сохранён прежний fallback. Unit-тест покрывает `±45°`, другие
наклоны, осевые и вырожденные квады. На реальном Lancet-инстансе через `set-models`, `glow=false`
и HD получены парные кадры до/после в одном мире и ракурсе, а также вид сверху и ночью; полосы
осевого освещения устранены. [Кадры и ограничения](AIRCRAFT-MODELS.md). Массовый FPS и полёт не
измерялись.
+107 -3
View File
@@ -63,7 +63,8 @@ runtime закреплённого движка. Используется вре
## Акустика и владение захватом (API 27)
Текущий pin: `f95f03c08ec2916a0e5bd3b2d4a2a790e7937b47` (API 27). Новые
Текущий pin: `278f356aa604fa21c2d15d0081823bbe0f891df2` (API 30; поверх API29 — нормали моделей
и очистка неудачного захвата). Акустические
`render.acoustics-status` и `render.capture-owner-status` возвращают поколение,
`available`, `enabled`, `request-accepted`, `prepared` и причину. В игре всё это показывает
`/airdef capabilities`. Отсутствие запроса, выключение, ожидание backend и ошибка различаются.
@@ -81,6 +82,19 @@ AirDef не принимает чужие Recording/Done за свой эксп
сбрасывает готовность. Уже переданный writer файл на Encoding может всё же завершиться:
это запрос отмены, не гарантия удаления файла.
Проверено на реальном экспорте 4 ноября (pin `57f8b2853`; очистка ошибки в `73b9d3070`):
- Смена мира доходит до движка только через снимок мода (`set_snapshot`). На экране заголовка тики
не вызываются, поэтому мод без хука `frame` не сообщает о закрытии мира, и захват продолжает
писать заголовок. AirDef теперь просит `frame` и завершает показ по `game.world-id = none`.
- При ошибке энкодера временные файлы этого захвата (`<имя>.video.mp4`, `<имя>.audio.raw`,
`<имя>.ffmpeg.log`) удаляются, а последние строки лога переносятся в текст ошибки: ссылки на
уже удалённый лог больше нет. Кодировщик всегда пишет `<имя>.video.mp4`, а `<имя>.mp4`
появляется только после успешного mux или переименования, поэтому неудачный, отменённый или
беззвучный захват не перезаписывает и не удаляет готовый фильм прежнего экспорта с тем же
именем. Исправлено в `73b9d307048fc44d7f21fa3c829fc5a855d144a6` (`game/film.rs`), проверено
реальной ошибкой ffmpeg и контрольным MP4.
## Отдельный тяжёлый WASM tier
```sh
@@ -108,6 +122,13 @@ GPU не имитируется. Проверяются два принятых
frame hook; эти вызовы не являются нагрузкой на GPU или измерением 10M frame fuel мода.
Точный отчёт: [flat-world budget](measurements/flat-wasm-raid-budget.json).
С 4 ноября (#122) fixture расширен хвостом умных приказов через UI-путь: 4 РЭБ, `airdef preset 1`
(та же `apply()`, что у кнопки готового состава) и два `airdef raid` — это та же функция
`launch_wave`, что у кнопки ПУСК (`ui_select`), с боевым журналом разведки и EW; оба приказа
приняты (`expect.chat = []`), итого 4 принятых приказа, финальный `/stats` закреплён строкой.
Прогон исправления #122: 283 шага, 3302 tick; max fuel tick 182413686/300M, command 6939810/1e9,
ошибок 0. Отчёт: [flat-world budget](measurements/flat-wasm-raid-budget.json).
Fixture копируется из тех же байтов, чей SHA записан до сборки. Проверенные 2 принятия и точка
184/2102 заносятся только после success и совпадения `BUDGET_ASSERTED_SHA256` с точной версией файла.
После изменения fixture нужно повторно проверить её и обновить SHA/метаданные; простой список
@@ -123,16 +144,90 @@ API/WIT/артефакт, проверку build identity, сценарий, Was
Отсутствие запрошенных счётчиков делает проверку неуспешной, даже если сценарий завершился.
Это не время host/GPU и не peak memory; невызывавшиеся callbacks, включая init до включения профиля,
не получают выдуманного нуля. Первый прогон: tick 2102 вызова, max 106132646/300000000;
command 69 вызовов, max 1013370/1000000000; ошибок нет.
command 69 вызовов, max 1013370/1000000000; ошибок нет. Прогон исправления #122 (283 шага,
включая два умных UI-приказа): tick 3302 вызова, max 182413686/300M; command 79 вызовов,
max 6939810/1e9; ошибок нет.
Исторический отчёт без измерения fuel:
[API27 budget report с поправкой покрытия](measurements/api27-wasm-budget.json).
Актуальный чистый API29-прогон с измерением:
[271 шаг, fuel и build identity](measurements/api29-wasm-budget.json).
Актуальный прогон с умными UI-приказами #122 и build identity:
[flat-world budget](measurements/flat-wasm-raid-budget.json).
Проверены реальный WASM guest с переходами состояний/владельца/мира, сборка клиента и два коротких
offscreen-профиля Metal. При `HORIZON_ACOUSTICS=1` + `HORIZON_NO_AUDIO=1` в игре получено
enabled/request=true, prepared=false, awaiting-backend; HD smoke переходит в ready после подготовки
основного кадра. Это не замер производительности и не прослушивание.
Остаток #102: аналогичные статусы света/камер/источников звука, полные query/voice/peak budgets,
API28/29 добавляют отдельные `point-lights-status` и `sound-sources-status`: свет подтверждается
после cache/main-view HD обработки, звук — после source-manager apply с live/offline output.
Заявки привязаны к запуску мода и поколению мира; звук также к source epoch. Clear/reload/выход
снимают подтверждение. Это не GPU fence, загрузка сэмпла, наличие голоса или слышимость.
Камеры и их targets изолированы по `(run_serial, local_id)` вместо глобального ID.
API30 добавляет `camera-status` для камер `set-views` вызывающего запуска: доступность API,
включение пути картинок в последнем отмеченном кадре, принятие заявки поколения и поштучная
готовность каждой камеры. `prepared` означает, что рендерер закодировал кадр камеры в её
texture target, либо кадр мира отрендерен с неё как main-view **этого** запуска: если одинаковый
local ID выбрали два мода, экран использует выбор первого, и milestone получает только он; чужая
картинка с тем же ID чужую камеру не готовит. `enabled` — последний отмеченный кадр был кадром
мира (не заголовок/загрузка). Это не регистрация target и не GPU fence: видимый пиксель,
представление кадра и обход ротации per-frame бюджета не гарантируются. Пустая `set-views`
снимает заявку и готовность; смена мира очищает заявку, выбор main-view и готовность (камеры
другого мира не рисуются), перезагрузка мода начинает заново, а повторная отправка и камера,
отданная в main-view, ждут нового кадра (у такой камеры нет своего picture target).
Проверено двумя настоящими Wasmtime-гостями с одинаковым local ID, пустой заявкой, сменой мира
и reload. `/airdef capabilities` показывает строку камер.
### GPU-приёмка картинки камер (Metal/offscreen)
Итоговый engine `278f356aa` с AirDef API30 проверен в запущенной игре, а не только в песочнице:
macOS, Apple M5 (Metal, IntegratedGpu), `--offscreen`, `HORIZON_NO_AUDIO=1`, чистый
`HORIZON_HOME=/tmp/airdef-camera-accept` и копии тестовых миров из scratch-папки прежних прогонов
(`AirDefenseLab`, `Polygon`), ресурсы лаунчера v0.2.91. `.hmod` — из этого дерева
(`python3 tools/airdef.py mod`, API30), не из основного дерева.
```
tools/airdef.py install # HORIZON_HOME=<scratch>
horizon-ctl --socket $H/ctl.sock launch --game horizon/target/fast/horizon-client \
--world AirDefenseLab --creative --offscreen --wait --resources <26.3>
# мод-команды клиентские: ctl command/chat уходят в консоль сервера, поэтому — через поле чата
horizon-ctl key t tap; horizon-ctl type "/airdef capabilities"; horizon-ctl key enter tap
horizon-ctl screenshot <png>
```
Наблюдения (строки `/airdef capabilities`, `поколение` = generation):
| Когда | Камеры |
| --- | --- |
| камер нет | `API=true, включено=true, запрос=false, подготовлено=false, поколение=1, not-requested, main=нет, []` |
| `/airdef deploy s400` + `/airdef monitor` | `... запрос=true, подготовлено=true, поколение=1, ready, main=нет, [32:ready]` |
| `/airdef monitor` (пустая заявка) | `... запрос=false, ... not-requested, main=нет, []` |
| `/airdef replay film best` | `... main=1996488705, [1996488705:ready]`, затем `main=1996488707` на следующем плане |
| другой мир (AirDefenseLab → Polygon) | `поколение=2, запрос=false, ... not-requested, main=нет, []` |
| там же deploy+monitor | `поколение=2, запрос=true, подготовлено=true, ready, [32:ready]` |
Снимки подтверждают, что `prepared` — нарисованная картинка, а не регистрация (число различных
цветов, выборка каждого 6-го пикселя): при взгляде в небо (кадр однородный) включение монитора
добавляло панель и picture-область — 477→4867 цветов на кадре; в том же мире A/B
«монитор выключен/включён» в области панели: 199→2080 цветов,
доля тёмной панели 1.2%→48.7%, а в области картинки 110→1771 цветов с доминирующим небом (рисуется
сцена с камеры С-400, а не плоская заглушка «НЕТ СВЯЗИ»). В film-режиме экран показывал карточку
«Готовлю кадры…» (фильм готовит планы), при этом main-view milestone был `ready` — это API-отметка
и отрисовка кадров рендерером, не проверка пикселей фильма.
`title → тот же мир` не меняет поколение: заявка и milestone сохраняются (смена поколения — это
смена мира), а `enabled` сбрасывается кадром заголовка (note с `world=false`), поэтому `ready`
требует нового кадра мира после возврата; он и наступает (наблюдалось). 8 из 8 запросов при
работающем мониторе дали `ready`. `set_views`/`set_main_view` вызываются модом каждый tick, то есть каждый
tick начинает ожидание нового кадра: выборка между tick и note может честно показать
`awaiting-frame` по порядку вызовов — это не flicker, а порядок tick → render → note.
Остаток этой приёмки: визуальная оценка человеком, Windows/другие GPU, два запуска с одинаковым
local ID на GPU (покрыто Wasmtime-гостями), reload мода на GPU (покрыт host-тестом), fence/представление
кадров не проверялись.
Остаток #102: полные query/voice/peak budgets,
GPU/готовый MP4 и платформенная приёмка. Эти результаты текущими тестами не объявляются выполненными.
## Измеренный fuel и массовые взрывы
@@ -150,3 +245,12 @@ GPU/готовый MP4 и платформенная приёмка. Эти ре
3602 тика прошли, max tick fuel = 135273690/300M, failures=0. Лимиты не менялись.
Диагностический гость содержит только временный способ запуска точного меню-состава;
это не исходный пользовательский Windows-сеанс. [Данные и воспроизведение](RAID-STABILITY.md).
С профилем воспроизведён и второй класс — остановка в **событии UI** (не тике) на втором
крупном приказе: переснимок `known_units` на каждом дроне приказа давал `дроны × журнал ×
группировка` за одно событие, 1e9 исчерпаны ровно (max command fuel 1000000000/1e9,
failures=1; состояние: 13172 записей журнала, 144 известных живых комплекса). Исправление
(#122, одним снимком на приказ и O(журнал+группировка) за проход) доводит тот же сценарий
до max command fuel 32946177/1e9, failures=0, `/stats` на тике 2602 совпал побайтово.
Это гостевые инструкции, не прирост FPS; приёмка Windows-сеанса внешняя.
[Данные и воспроизведение](RAID-STABILITY.md).
+6
View File
@@ -66,3 +66,9 @@
`ground-unload` у склада выгружает одну RM48U сразу; вдали резервирует её и вызывает ТЗМ для
вывоза. `ground-cancel` отменяет ещё ожидающую доставку/вывоз. Уже забранная ракета находится
в ТЗМ и продолжает путь на склад; команда не телепортирует её обратно в ПУ.
Возврат имеет приоритет, только пока он выполним: ПУ исправна и развёрнута, маршрут доступен,
ракету ещё не забирает другая ТЗМ, а у склада есть место. Заявка при этом сохраняется, но
невыполнимый вывоз не блокирует ТЗМ: свободная машина исполняет независимые заявки на доставку
RM48U, а как только вывоз снова становится выполнимым, он встаёт в приоритет. Проверено
регрессиями #128, включая консервацию боеприпасов и save-restore посреди маршрута.
+34
View File
@@ -368,6 +368,40 @@ HORIZON_HD_TAA=0 --out run-home-bench/out/taa-off` — A/B; `--baseline run-home
- Мод-HUD (`set-hud`) теперь рисуется и при `set-main-view` (титры, леттербокс фильма); ванильный HUD по-прежнему скрыт.
- Режиссура: `airdef-mod/src/film.rs` (план по записи, варианты ракурсов, проверка рельефа по высотам `Ground::land_state`, ускорение/замедление времени).
### Проверенный жизненный цикл MP4 (4 ноября, pin `57f8b2853`, очистка ошибки энкодера — `73b9d3070`, API 29)
Реальный короткий экспорт на scratch `HORIZON_HOME`/мире (не на сохранениях игрока), Apple M5, Metal,
ffmpeg 9.0.1. `/airdef replay export` с записанного налёта (4 цели, 4 перехвата), 640×360:
- готовый файл: h264 + AAC 48 кГц stereo, длительность видео = длительность звука; звук не пустой
(mean −29.4 dB, max −18.0 dB); 2 с при 30 fps — 62 кадра, `sec=1` — 32, `noaudio` — 33 кадра без
звуковой дорожки, `sec=0.01` — 3 кадра; 1920×1080 `sec=1` — 32 кадра. Число кадров в отчёте мода
всегда совпадает с `ffprobe nb_frames`: очередь не теряет кадры на остановке.
- 2–3 кадра сверх `sec` — это кадры, уже находившиеся в полёте на момент остановки (движок их
дописывает); это не потеря хвоста. Отчёт и файл сходятся.
- отмена во время записи (`/airdef replay stop`): сообщение «Экспорт отменён», файла и процессов
ffmpeg не остаётся; сразу после отмены новый экспорт проходит.
- отказ SDK (`size=10000x10000`): сообщение об ошибке, захват не остаётся, следующий экспорт проходит.
- ошибка энкодера (подставной `HORIZON_FFMPEG`, отвечающий на `-encoders`, но падающий при записи):
«Экспорт не удался: … Broken pipe …: fake encoder failed: no such codec»; временных файлов и
процесса нет, а последние строки лога теперь в самом тексте ошибки (сам лог удалён). Готовый
`keep.mp4` прежнего экспорта с тем же именем остался байт-в-байт (sha256), как и беззвучный
`keepnone.mp4` после неудачного `noaudio`-экспорта с тем же именем. Движок `73b9d3070` всегда
пишет `<имя>.video.mp4`; `<имя>.mp4` появляется только после успешного mux/переименования.
Контрольный `ctrl` на итоговой сборке `73b9d3070` — h264 + AAC, 33 кадра, временных файлов нет;
`keep` (h264 + AAC, 32 кадра) и `keepnone` (только h264, 32 кадра) проверялись на той же правке.
- акустика в MP4: пары on/off одного повтора (кнопка мода) со статусами `Акустика … ready` и
`Захват … ready`; в открытом поле send реверба нулевой по построению, в каменном дворе ON тише и
глуше, а остаток после вычитания масштабированного сухого сигнала низкочастотный и
декоррелированный (wet-путь). Цифры, статусы и ограничения — [ACOUSTICS.md](ACOUSTICS.md).
- **выход в заголовок во время экспорта** (до исправления): игра перестаёт тикать на экране
заголовка, но продолжает кадры, поэтому захват писал заголовок; запрос `sec=10` дал 3898 кадров
(129.9 с), временные `video.mp4`/`audio.raw` и ffmpeg оставались, а после возврата в тот же мир
экспорт продолжался. Мод получает кадры и вне мира (`Mod::frame`), поэтому `Session::world_left`
завершает показ с `ExitCause::WorldChange` и одним `CancelCapture`: после исправления при выходе
в заголовок ffmpeg и временные файлы исчезают, повторный вход и следующий экспорт проходят.
Пропуск мира виден по `game.world-id = none`; тик мода вне мира не вызывается.
## Цветные тени, рябь, кино-пост: что знать преемнику
- **Цветные тени.** Ближний каскад (c = 0) рисуется `fs_shadow_near` (листва `MAT_LEAVES` отброшена), потом проход `hd shadow colour` (`Hd::shadow_tint_pass`, цель `Shadows::tint`, очистка в белое) рисует листву (`shadow_tint_leaves`, твёрдые квады, `SHADOW_SOLID`) и полупрозрачные квады секций (`shadow_tint_glass`, по отсортированным индексам; вода не рисуется) тем же `fs_shadow_tint`: rgb умножаются (blend `Dst*src`), альфа = `(расстояние от света − 320)/160` с blend Min — ближайший такой квад. Приёмник в `shadow_tint` (`light.wgsl`, привязка 22) окрашивается, если квад ближе к свету, чем он; 8 точек Vogel радиусом 0.4 блока размывают листву в «пятна». Дальний каскад по-прежнему рисует листву полностью (на границе 36 блоков шов: ближе листва светлее). Цвет не доходит до лучей тумана, воды и дальнего каскада. Цена: `hd shadow colour` 0.25–0.35 мс (Mac, малая сцена).
+25 -7
View File
@@ -1,18 +1,26 @@
# Состояние исходных 16 задач
Ветка `kimi-work`, 3 ноября 2026. Issues остаются открытыми по просьбе владельца.
Ветка `kimi-work`, 6 ноября 2026. Issues остаются открытыми по просьбе владельца.
«Реализовано» ниже означает проверенный объём кода, а не закрытие issue и не подтверждение всех платформ.
Новый проверенный объём: [продолжение пяти задач 4 ноября](CONTINUATION-2026-11-04.md).
#87: typed battery/world/damage diagnostics и адаптеры текста; #91: общий content/sound catalog
для Rust и Python; #102: измеренный fuel, API29 light/source milestones, API30 camera-status
и изоляция камер; #96: массовый deterministic offline capture; #115: authored Lancet/Х-101
и кадры инстансов.
Текущий engine pin — API30; старые номера/числа ниже описывают предыдущие этапы.
Проблема нормалей модели #123 исправлена в engine `45b43f00d`; парные HD-кадры и ночная проверка Lancet записаны в галерее.
| Issue | Реализовано | Что остаётся для полной приёмки |
|---|---|---|
| #72 | Upstream Horizon 0.2.97 объединён с форком; сохранена история; локальные тесты и Metal-полигон | Windows/Linux, native HDR, сравнительная производительность |
| #87 | Каноническое SDK-free ядро `airdef-core`, используется модом и сценариями | Дальнейшее отделение текстового/визуального вывода домена от адаптера |
| #88 | Типизированный журнал измеренных переходов; read-only Snapshot для Smoke/Shown; записанные пожары, позы, пуски и зажигание | Перевести оставшиеся model/audio adapters и режиссёра на общий снимок; замер полной 10-минутной записи |
| #89 | Session владеет Live/Replay/Export; явные часы/поколения; единый cleanup; задержанный звук следует часам показа | Полный игровой цикл MP4 с отменой/ошибкой энкодера и проверкой хвоста очереди |
| #91 | Общий каталог доступности и потребители меню/инвентаря; явный RM48U-профиль; корректные подписи очередей | Единый источник всех чисел, звуков и Python-регистраций; проверка вариантов комплексов |
| #89 | Session владеет Live/Replay/Export; явные часы/поколения; единый cleanup; задержанный звук следует часам показа; выход в заголовок завершает показ одним cleanup (хук `frame`, `Session::world_left`); движок освобождает temp/лог ошибки энкодера и не трогает готовый MP4 | Реальный короткий MP4 проверен 4 ноября (звук/видео, отмена, ошибка SDK и энкодера, повторный запуск, совпадение кадров и хвоста очереди, сохранность прежнего MP4). Остаётся: 10-минутный экспорт; приёмка Windows/Linux |
| #91 | Общий каталог доступности и потребители меню/инвентаря; явный RM48U-профиль; корректные подписи очередей; `catalog/specs.json` — единственный источник числовых строк, из него генерируются Rust-таблицы для мода и `airdef-core`, CI проверяет свежесть | Варианты комплексов (разные ракеты/профили по батареям) и игровая приёмка; каталог остаётся статичными данными, не динамическим ECS |
| #92 | Authored overrides, проверка ссылок/PNG/границ, manifest, безопасная транзакционная генерация; registry/texture/icon modules | Дальнейшее ручное улучшение контента относится к #115 |
| #96 | Акустические пути; измеренные синтетические occlusion/echo/reverb fixtures; лицензии и исходные notices в архивах | Прослушивание, игровой массовый звук/CPU, акустика реального MP4; точность RT60 пока по допуску 35%, не 15% |
| #102 | Pinned engine/API27, packer/build identity; smoke/acoustics/capture-owner milestones; fallback/владение; WASM26 и flat stress271 с двумя принятыми налётами и проверенными184 воздушными на тике2102; JSON provenance/failure tests; Metal/no-audio smoke; URL/Git-регрессия | Старое69-шаговое утверждение о перекрытии отозвано; статусы света/камер/sound sources, полные query/voice/peak budgets, GPU/готовый MP4 и Windows-приёмка остаются |
| #96 | Акустические пути; измеренные синтетические occlusion/echo/reverb fixtures; лицензии и исходные notices в архивах; настоящий MP4 с акустикой: пары on/off, статусы ready, окклюзия/поглощение и диффузный wet-остаток в замкнутой геометрии | Прослушивание, игровой массовый звук/CPU, чистый хвост/RT60 в MP4; точность RT60 пока по допуску 35%, не 15% |
| #102 | Pinned engine/API30, packer/build identity; smoke/acoustics/capture-owner/light/source/owner-scoped camera milestones; fallback/владение; WASM27 и flat stress271; измеренный callback fuel; JSON provenance/failure tests; Metal/no-audio smoke; URL/Git-регрессия; camera-ready по закодированному кадру с per-run/per-world сбросом; GPU-приёмка monitor/main-view на Metal/offscreen (Apple M5) | Старое69-шаговое утверждение о перекрытии отозвано; визуальная/Windows-GPU приёмка картинки камер, полные query/voice/peak budgets, GPU/готовый MP4 и Windows-приёмка остаются |
| #104 | Движок вынесен в `chexit/horizon-airdef`, ветка `airdef`; AirDef использует точный gitlink | Отдельная Windows-проверка миграции старого standalone checkout |
| #107 | ПУ оценивается по наблюдениям: обратный курс не выдаёт точную ПУ | Повторная игровая проверка сценариев с маневрирующими целями |
| #110 | Изменения чанков инвалидируют акустические снимки/кэш; включено в pin и проверено engine-тестами | Внешняя игровая приёмка на целевых машинах |
@@ -21,6 +29,8 @@
| #115 | Три пилота с кадрами до/после, спокойные материалы; authored-проход по боевым и вспомогательным машинам | Крупные планы и точность прототипов ещё промежуточные; остальные летательные аппараты/ракеты, анимации, дальние виды и FPS |
| #116 | Streaming не освобождает busy-guard работающего acoustic worker; проверено engine-тестами | Внешняя игровая приёмка на целевых машинах |
| #118 | Физический С-400/RM48U, четыре общие ячейки, конечные запасы; доставка и обратный вывоз ТЗМ, резерв/отмена, возврат снятой ПВО; обе фазы вывозного маршрута сохраняются; carrier/крышки/выброс/зажигание/разгон в записи; фантомное ПВО удалено | Визуальная приёмка пуска и маршрутов на сложном рельефе; другие носители не добавлены без подтверждённого профиля |
| #128 | Невыполнимый возврат RM48U (ПУ движется/повреждена, маршрут недоступен, заявку уже везёт другая ТЗМ, у склада нет места) больше не блокирует ТЗМ: заявка сохраняется, свободная ТЗМ исполняет независимые заявки на доставку; выполнимый возврат снова в приоритете; консервация боеприпасов и save-restore посреди маршрута покрыты регрессиями | Игровая приёмка маршрутов на сложном рельефе остаётся за #118 |
| #129 | Единые стадии пуска: выброс без мотора (`cold` 20/24 тика у С-400/С-500, 8 у IRIS-T/Тора), зажигание в текущей позиции, departure с плавным ростом тяги/темпа поворота, наведение только после `cold + boost`; рельсовые ракеты получили spool тяги без холодного выброса, P1-SUN — без струи; RM48U согласован на 20 тиков; live/replay/export читают записанное зажигание; `pk`, максимальные скорости и коллизии не менялись | Парные replay-MP4 до/после и кадры сняты на одном мире/seed/сценарии (Metal/offscreen); измеренный сдвиг первой вспышки 0,233 → 0,900 с. Остаётся человеческая визуальная оценка композиции, very-close план выброса; live-видео, Windows/Linux и живое прослушивание не проверялись |
Для #118 RM48U — явно условный Minecraft-профиль. Существование сочетания опирается на сообщение ведомства,
а игровые параметры не выдаются за реальные. `ground-stock` — команда подготовки sandbox-сценария,
@@ -38,9 +48,17 @@
| Issue | Реализовано | Границы и оставшаяся приёмка |
|---|---|---|
| #119 | Три read-only луча в известной геометрии ослабляют непрямой blast для корпуса/узлов/объектов; проёмы дают частичное воздействие; прямой контакт сохранён | Unknown/stale: прежний урон без защиты, нулевое ожидание; partial blocks считаются занятыми кубами; GUI-проверка разрушения укрытия ещё нужна |
| #120 | Конечное горение, powered/coast, сопротивление и снижение доступного манёвра, один остаточный pk по фактической скорости; swept-встреча; события burnout/energy loss; согласованное прекращение факела/дыма/звука | Игровой профиль, без аэродинамики и реальных параметров; сравнительная выборка 12 рейдов, расширенная балансировка и прослушивание остаются |
| #120 | Конечное горение, powered/coast, сопротивление и снижение доступного манёвра, один остаточный pk по фактической скорости; swept-встреча; события burnout/energy loss; согласованное прекращение факела/дыма/звука | Игровой профиль, без аэродинамики и реальных параметров; сравнительная выборка 12 рейдов и расширенная сетка 48 рейдов (6 вариантов × 8 seed, батареи/дальности/классы) записаны в measurements; без подтверждённого дефекта параметры не менялись; прослушивание остаётся |
| #121 | On/Off в команде и карте, save/replay; Off не создаёт own measurements и сохраняет сетевой приём; раскрытие работающего радара наблюдателем; SEAD использует last-known и возраст | Условный наблюдатель по расстоянию, без радиотехнической модели и ошибки пеленга; выбор на карте ещё не проверен в GUI |
| #122 | Воспроизведён tick fuel exhaustion на двух максимальных составах, HD; полный обход height-cache на каждом взрыве заменён удалением нужных ключей; тест эквивалентности и WASM421/3602 прошли, max135.3M/300M; callback diagnostics/profile | Требуется приёмка на Windows; без старого лога нельзя подтвердить ту же причину пользовательского сеанса; FPS/GPU не измерялись |
| #122 | Воспроизведены два класса: tick fuel exhaustion на двух максимальных составах, HD (полный обход height-cache на каждом взрыве заменён удалением нужных ключей; max135.3M/300M) и остановка в UI event на втором крупном приказе (переснимок known_units на каждом дроне заменён одним снимком на приказ и O(журнал+группировка); max command 32.9M/1e9, `/stats` до/после совпал); нативные тесты эквивалентности и второго приказа; WASM fixture с 4 принятыми приказами; callback diagnostics/profile | Требуется приёмка на Windows; без подтверждённого build identity нельзя утверждать ту же причину пользовательского сеанса; FPS/GPU не измерялись |
| #127 | Этапы 1–2. **Картина:** журнал раскрытий заменён картой контактов (`Intel.contacts`: последнее «пуск/излучение/глушение», место, время, метка эмиссии, наблюдённая гибель, счётчик увиденных пусков), уверенность — функция возраста (Confirmed/Probable/Doubtful, TTL 6000), угроза и цены читают только published-параметры и факты наблюдений (launcher-only без донора «слеп»), уничтожение учится только из BSA. **Structured intent:** `Intent` (Plan/Sead/React/Replace) и `Aim` (юнит, since, switches, confidence) отделены от random-выбора; throttle `SWITCH_HOLD=160`, `SWITCH_CAP=3`, `ASSIGN_PER_TICK=16`, `ASSIGN_PER_CONTACT=6`, цена смены `SWITCH_GAIN=120`; в полёте цель меняется только когда картинка её убила/забыла. **Durable queue:** автосейв пишет версионированную секцию `air 1` — дроны, очередь запуска, задания (id, дрон, цель, юнит, версия, приоритет, намерение, версия рельефа), контакты, RLE-рельеф; очередь ограничена 256, устаревшие/фантомные/дублирующие задания отменяются при загрузке (`JOB_TTL=1200`), картина задания восстанавливается на свою версию, старые saves читаются (пустое небо), сценарии воздух не несут, Live/Replay не смешиваются. **Неизвестная земля не бесплатна** (`Relief.unknown=6` у повторного плана). **Объяснимость:** `enemy_picture()` дополнен aims/pending reason/aimed_by/pending_jobs без русского текста в core. Метаморфные тесты скрытых изменений (включая нагрев/замок РЭБ), save/restore посреди незавершённой очереди, детерминизм seed, 40+ массовый ретаргет. Замеры: `docs/measurements/issue-127-intent-queue-{baseline,result}.json` | GUI поверх `enemy_picture()`, игровая приёмка сохранения налёта на Windows/Linux, оценка баланса ew-adaptive (kills 59→58/59→58/56→63, потери 3→3/3→4/4→2 — следствие throttle, параметры не менялись) |
По #127 реализованы карта контактов, структурированное намерение с throttle и durable-очередь:
autosave хранит дронов, очередь запуска, задания с картиной и рельефом своей версии, поэтому
незавершённый ретаргет продолжается после перезахода. Старые saves без секции `air` читаются как
прежде (пустое небо), сценарии воздушное состояние не несут, replay по-прежнему хранит траектории.
Ракеты-перехватчики, площадки запуска, промежуточный план, статистика волны и RNG не сохраняются —
это ограничение записано в handoff.
Точные коммиты, формат сохранения, тесты и порядок продолжения:
[CODEX-HANDOFF.md](CODEX-HANDOFF.md). Формальный open-статус не меняется после реализации.
+51 -3
View File
@@ -7,10 +7,58 @@
поэтому запись может сохраниться и без ручного копирования.
Задача: [#122](https://gitea.maoniao.team/chexit/airdef/issues/122).
**Воспроизведена и исправлена одна конкретная причина отключения при таком классе нагрузки.**
Без старого лога не утверждается, что Windows-сеанс имел именно её; GPU/FPS отдельно не измерялись.
**Воспроизведены и исправлены две конкретные причины отключения в этом классе нагрузки.**
Первая — тик и кэш высот (`1f28f83`, ниже). Вторая — событие UI и второй приказ
(`order_raid`, см. раздел «Второй налёт из UI: событие, не тик»). Без старого лога не
утверждается, что Windows-сеанс имел именно их; GPU/FPS отдельно не измерялись.
## Найденная причина и фикс
## Второй налёт из UI: событие, не тик
Точный лог Windows: `Horizon: mod airdef stopped in UI event (fuel budget 1000000000,
remaining Some(0))`; backtrace: `ew::Sim::known_units` ← `raid::Sim::order_raid` ←
`airdef::AirDef::launch_wave` ← `ui_select`. Прежний fix `1f28f83` — другой класс: тогда
мод останавливался в **тике** на 300M.
**Причина.** `order_raid` для каждого дрона заново вычислял снимок известных комплексов
`known_units()` (`choose_target`), а сам `known_units()` на каждую запись журнала разведки
пересканировал весь список комплексов и список уже принятых. Журнал держит каждый пуск,
каждое раскрытие РЭБ и каждую emitting-РЛС за последние 6000 тиков. Стоимость второго
большого приказа росла как `дроны × журнал × размер группировки` внутри одного UI-события.
**Воспроизведение** (настоящий WASM, измеренный fuel по callback, диагностический гость —
`trigger.patch` гоняет тот же обработчик `ui_select(BTN_LAUNCH)` → `launch_wave` →
`order_raid` с максимальным составом меню; метка callback — `command`, бюджет тот же 1e9):
разнесённая группировка 172 комплекса (40 кластеров × 4 тяжёлых + 12 РЭБ, игрок двигается
шагами сценария — стек в одной точке умирает от одной боеголовки и не воспроизводит),
первый налёт 111 дронов отбит, второй приказ на тике ~2600 при `revealed=13172`,
`known=144` живых. До fix: второй приказ исчерпывает ровно 1e9 и останавливает мод
(`before-trap.txt`); тот же приказ из 11 дронов в том же состоянии — 247805865
(`before-scaling.txt`). После fix тот же сценарий проходит целиком: max command fuel
32946177/1e9, max tick 236581288/300M, ошибок 0; `/stats` на тике 2602 совпал побайтово
до/после, включая счётчики мира.
**Фикс.** Один снимок `known_units` на весь приказ, передаётся в `radar_strikes` и
`choose_target`; сам `known_units` — один проход O(журнал + группировка) через множества;
`price_grid_on` переиспользует свой снимок. Семантика планирования не изменилась:
нативный тест сверяет новый снимок с прежним предикатом (дубликаты, погибшие, устаревшие,
чужие id, порядок «новые первыми»). Лимиты не менялись, HD/запись не отключались,
размер волны не ограничивался.
**Регрессии.** Нативные: эквивалентность снимка и «второй умный приказ с толстым журналом
принят и запущен». Закреплённые WASM: тяжёлый fixture расширен — два умных приказа через
функцию кнопки ПУСК (`airdef preset 1` + `airdef raid` — тот же `launch_wave`, что и у
`ui_select`) с РЭБ и боевым журналом, оба приняты (`expect.chat = []`), 4 принятых приказа
в отчёте; лёгкий контракт проверяет `preset` и отказ пустой волны. Данные и точный
сценарий: [summary.json](measurements/issue-122-ui-fuel/summary.json),
[trigger.patch](measurements/issue-122-ui-fuel/trigger.patch),
[до](measurements/issue-122-ui-fuel/scenario-before.toml),
[после](measurements/issue-122-ui-fuel/scenario-after.toml). Patch — только для
диагностического гостя, в мод не входит.
Приёмка конкретного Windows-сеанса остаётся внешней: нужны build identity и строки
`latest.log` вокруг остановки. Измерение fuel — не прирост FPS.
## Первая причина и фикс (тик, `1f28f83`)
Два максимальных состава меню (11 видов × 40, два принятых приказа), 64 ПВО, расстояние 300,
HD и grid, обслуживаемый плоский мир: tick 1835 исчерпал ровно 300M fuel и мод остановился.
+3 -1
View File
@@ -34,10 +34,12 @@
Команды:
- `python3 -m pip install -r tools/requirements.txt` — зависимости генератора (закреплён Pillow).
- `python3 tools/gen_catalog.py` — обновить Rust-константы после изменений `catalog/content.json`; `--check` проверяет актуальность.
- `python3 tools/gen_catalog.py` — обновить Rust-константы после изменений `catalog/content.json`, `catalog/specs.json` или `catalog/sounds.json`; `--check` проверяет актуальность.
- `python3 tools/gen_models.py` — перегенерировать.
- `python3 tools/gen_models.py --check` — только сравнить, выход 1 при различиях.
`catalog/specs.json` — единственный источник числовых профилей симуляции: строки `DroneSpec`, `MissileSpec`/`MissileKind` (включая RCS, seeker, звук пуска и голос мотора), `SamSpec` (оружие, части моделей, приводы, датчик), общие константы (гравитация, высота раскрытия «Орешника», логистика) и именованные наборы частей. `tools/gen_catalog.py` создаёт из него `airdef-mod/src/sim/specs_generated.rs` (включается в `mod.rs`; тот же файл компилирует `airdef-core`) и `airdef-mod/src/sim/unit_specs_generated.rs` (включается в `units.rs`). Эти два файла не редактировать вручную. `tools/airdef_assets/catalog.py::load_specs` проверяет схему, звуковые ссылки, наборы kinds против `content.json`, ссылки на именованные части и заполненность всех строк; `gen_catalog.py --check` в CI ловит расхождение. Значения — игровой масштаб, не реальные характеристики техники.
`catalog/sounds.json` хранит звуковые ID, дальности и наличие дальнего варианта; `tools/gen_catalog.py` экспортирует ID для Rust, а `tools/gen_sounds.py` создаёт `airdef-mod/assets/airdef/sounds/*.ogg` и `sounds.json`. Этот генератор не использует manifest и не входит в проверку `gen_models.py`.
## Архив: `legacy/`
+85
View File
@@ -0,0 +1,85 @@
{
"airdef": {
"diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"dirty": false,
"sha": "56339b076e3dad9c6825ddbc73fdfe6b9a2727bc"
},
"api_level": 29,
"artifact_sha256": "f3720d58e18210b2e962ae924306a18cbf12c28e033c2bf862ad6a1a0db462b6",
"build_identity": {
"checks": {
"airdef_diff_sha256": true,
"airdef_dirty": true,
"airdef_sha": true,
"artifact_sha256": true,
"engine_identity": true,
"engine_pin": true,
"wit_sha256": true
},
"matches": true,
"path": "/Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/airdef-mod/target/horizon-mod/build-identity.json"
},
"command": "test-budgets",
"engine": {
"identity": "57f8b2853c4443f7e3ff5701600cbb262b53118f",
"pin": "57f8b2853c4443f7e3ff5701600cbb262b53118f"
},
"exit_code": 0,
"measured_fuel": {
"available": true,
"callbacks": [
{
"budget": 1000000000,
"callback": "command",
"calls": 69,
"failures": 0,
"max_used": 1013387,
"mod": "airdef"
},
{
"budget": 300000000,
"callback": "tick",
"calls": 2102,
"failures": 0,
"max_used": 106132646,
"mod": "airdef"
}
],
"scope": "guest callback fuel; excludes host CPU, memory and GPU time"
},
"output": " Compiling horizon-mods v0.1.0 (/Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/horizon/crates/horizon-mods)\n Compiling cargo-horizon-mod v0.1.0 (/Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/horizon/crates/cargo-horizon-mod)\n Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.70s\n Running `/Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/horizon/target/debug/cargo-horizon-mod horizon-mod test --hmod /Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/airdef-mod/target/horizon-mod/airdef.hmod --fuel-profile budget`\nrunning 1 scripts against /Users/chexit/Documents/ChatGPT/reviewer-horizon/airdef-kimi-work/airdef-mod/target/horizon-mod/airdef.hmod\nfuel airdef command: calls=69 max=1013387 budget=1000000000 failures=0\nfuel airdef tick: calls=2102 max=106132646 budget=300000000 failures=0\ntest tests/wasm_budget.toml ... ok (271 steps)\ntest result: ok. 1 passed\n",
"runtime_limits": {
"fuel_per_call": {
"event": 1000000000,
"frame": 10000000,
"init": 2000000000,
"tick": 300000000
},
"memory_bytes": 67108864,
"metering": "source_configured",
"source": "horizon/crates/horizon-mods/src/runtime.rs",
"wasmtime_component_model": true,
"wasmtime_fuel_metering": true
},
"scenario": "tests/budgets/wasm_flat_budget.toml",
"scenario_counts": {
"accepted_raids_asserted": 2,
"air_defense_units": 64,
"frames": 2052,
"layout_unit_limit": 2000,
"peak_airborne_observed": null,
"raid_requests": 2,
"raid_units_requested": 80,
"scripts": 1,
"snapshot_airborne_asserted": 184,
"snapshot_tick": 2102,
"steps": 271,
"ticks": 2102
},
"scenario_render_world": "flat at y=64",
"scenario_sha256": "bcc0359289ab20ab3de608bcc130f72d2cf88f9f6fbc470d7b6846e9db5d11df",
"schema": 1,
"status": "passed",
"wasmtime_version": "48.0.7",
"wit_sha256": "dded023a150a5f916bc5d935b7f891806728e0118eb7107ad0551d2aad8c70a5"
}
+47 -17
View File
@@ -1,11 +1,11 @@
{
"airdef": {
"diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"dirty": false,
"sha": "293236490b567866f7468a5bee5d61b0dcf8086d"
"diff_sha256": "143fbab5f1fd60981df9ef8ef3081b08a4102507f2588c6942924a7325b5139b",
"dirty": true,
"sha": "e6a70004406b34ea17884875ce236a5fb4b849e4"
},
"api_level": 27,
"artifact_sha256": "cb52fa5fd6beb266c63f2a5f2aa50553c24bc435a212c76142cc1bd228fd0aa6",
"api_level": 29,
"artifact_sha256": "c4ef7d759524eb053ccd55f0eccdcb49c91954201eb4e0ad923ee9b2828efc4e",
"build_identity": {
"checks": {
"airdef_diff_sha256": true,
@@ -17,15 +17,45 @@
"wit_sha256": true
},
"matches": true,
"path": "airdef-mod/target/horizon-mod/build-identity.json"
"path": "/private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/build-identity.json"
},
"command": "test-budgets",
"engine": {
"identity": "ed7615d362490f57bca5ac239c64eb9360913a4b",
"pin": "ed7615d362490f57bca5ac239c64eb9360913a4b"
"identity": "73b9d307048fc44d7f21fa3c829fc5a855d144a6",
"pin": "73b9d307048fc44d7f21fa3c829fc5a855d144a6"
},
"exit_code": 0,
"output": " Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s\n Running `<checkout>/horizon/target/debug/cargo-horizon-mod horizon-mod test --hmod <checkout>/airdef-mod/target/horizon-mod/airdef.hmod budget`\nrunning 1 scripts against <checkout>/airdef-mod/target/horizon-mod/airdef.hmod\ntest tests/wasm_budget.toml ... ok (271 steps)\ntest result: ok. 1 passed\n",
"measured_fuel": {
"available": true,
"callbacks": [
{
"budget": 1000000000,
"callback": "command",
"calls": 79,
"failures": 0,
"max_used": 6939810,
"mod": "airdef"
},
{
"budget": 10000000,
"callback": "frame",
"calls": 2202,
"failures": 0,
"max_used": 77,
"mod": "airdef"
},
{
"budget": 300000000,
"callback": "tick",
"calls": 3302,
"failures": 0,
"max_used": 182413686,
"mod": "airdef"
}
],
"scope": "guest callback fuel; excludes host CPU, memory and GPU time"
},
"output": " Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s\n Running `/private/tmp/issue-122-raid/horizon/target/debug/cargo-horizon-mod horizon-mod test --hmod /private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/airdef.hmod --fuel-profile budget`\nrunning 1 scripts against /private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/airdef.hmod\nfuel airdef command: calls=79 max=6939810 budget=1000000000 failures=0\nfuel airdef frame: calls=2202 max=77 budget=10000000 failures=0\nfuel airdef tick: calls=3302 max=182413686 budget=300000000 failures=0\ntest tests/wasm_budget.toml ... ok (283 steps)\ntest result: ok. 1 passed\n",
"runtime_limits": {
"fuel_per_call": {
"event": 1000000000,
@@ -34,16 +64,16 @@
"tick": 300000000
},
"memory_bytes": 67108864,
"metering": "source_configured; measured_per_scenario: unavailable",
"metering": "source_configured",
"source": "horizon/crates/horizon-mods/src/runtime.rs",
"wasmtime_component_model": true,
"wasmtime_fuel_metering": true
},
"scenario": "tests/budgets/wasm_flat_budget.toml",
"scenario_counts": {
"accepted_raids_asserted": 2,
"air_defense_units": 64,
"frames": 2052,
"accepted_raids_asserted": 4,
"air_defense_units": 68,
"frames": 2202,
"layout_unit_limit": 2000,
"peak_airborne_observed": null,
"raid_requests": 2,
@@ -51,13 +81,13 @@
"scripts": 1,
"snapshot_airborne_asserted": 184,
"snapshot_tick": 2102,
"steps": 271,
"ticks": 2102
"steps": 283,
"ticks": 3302
},
"scenario_render_world": "flat at y=64",
"scenario_sha256": "bcc0359289ab20ab3de608bcc130f72d2cf88f9f6fbc470d7b6846e9db5d11df",
"scenario_sha256": "134cb4667691cf9faa639ed37120941d829cfc13ce45e9638582c409d9e0dd29",
"schema": 1,
"status": "passed",
"wasmtime_version": "48.0.7",
"wit_sha256": "14c57b73f144888e04e27b77a6dfa29098c6b0c27c0383bb96aedaccb4c0a1d4"
"wit_sha256": "dded023a150a5f916bc5d935b7f891806728e0118eb7107ad0551d2aad8c70a5"
}
+97
View File
@@ -0,0 +1,97 @@
variant,commit,seed,sams,dist,sent,kills,leaked,missiles,heavy,ticks,blocked,scrubbed,crashes,fuse_miss,expired,orphaned,energy_lost,leaks_by_kind
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,10,500,46,35,11,61,9,781,0,0,0,9,0,21,0,Geran3:3;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,1,10,500,46,37,9,62,9,812,0,0,0,4,1,23,0,Geran3:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,10,500,46,40,6,62,10,875,0,0,0,7,0,16,0,Shahed:1;Kh101:2;Kalibr:2;Iskander:1
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,2,10,500,46,41,5,65,11,883,0,0,0,6,0,20,0,Shahed:1;Kh101:2;Kalibr:1;Iskander:1
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,10,500,46,39,7,56,6,740,0,0,0,4,0,18,0,Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,3,10,500,46,39,7,56,6,740,0,0,0,4,0,18,0,Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,10,500,46,38,8,75,9,919,0,0,0,13,0,24,0,Geran3:1;Kh101:1;Kh22:1;Iskander:3;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,4,10,500,46,34,11,57,8,854,0,0,0,4,0,20,0,Geran3:2;Kh101:3;Kalibr:2;Kh22:1;Iskander:2;Kinzhal:1
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,10,500,46,34,11,66,8,871,0,0,0,12,0,26,0,Geran3:1;Kh101:2;Kh22:2;Zircon:1;Iskander:4;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,5,10,500,46,39,7,67,6,914,0,0,0,7,0,26,0,Kh101:2;Kh22:1;Iskander:3;Kinzhal:1
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,10,500,46,36,10,72,11,986,0,0,0,6,0,30,0,Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,6,10,500,46,36,10,73,11,977,0,0,0,7,0,30,0,Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,10,500,46,35,11,62,6,802,0,0,0,6,0,23,0,Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,7,10,500,46,35,11,63,6,802,0,0,0,7,0,23,0,Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,10,500,46,40,6,62,8,979,0,0,0,6,0,20,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
batt10,e6a70004406b34ea17884875ce236a5fb4b849e4,8,10,500,46,40,6,61,8,979,0,0,0,3,0,21,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,20,500,46,41,5,72,13,580,0,0,0,11,0,22,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,1,20,500,46,42,4,75,13,578,0,0,0,10,1,22,0,Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,20,500,46,40,6,81,14,629,0,0,0,10,0,36,0,Kh101:2;Kalibr:1;Zircon:1;Kinzhal:2
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,2,20,500,46,41,5,71,15,612,0,0,0,4,0,26,0,Kh101:2;Kalibr:1;Kinzhal:2
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,20,500,46,42,4,64,13,513,0,0,0,9,0,17,0,Zircon:1;Iskander:3
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,3,20,500,46,44,2,68,13,541,0,0,0,6,0,23,0,Zircon:1;Iskander:1
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,20,500,46,42,4,81,15,581,0,0,0,14,0,28,0,Kh22:1;Iskander:2;Kinzhal:1
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,4,20,500,46,42,4,76,15,614,0,0,0,8,0,27,0,Kh22:1;Iskander:2;Kinzhal:1
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,20,500,46,42,4,71,15,730,0,0,0,7,0,23,0,Kh101:1;Iskander:2;Kinzhal:1
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,5,20,500,46,42,4,73,15,748,0,0,0,6,0,25,0,Kh101:1;Iskander:2;Kinzhal:1
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,20,500,46,41,5,77,14,696,0,0,0,7,0,29,0,Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,6,20,500,46,41,5,80,13,681,0,0,0,5,0,34,0,Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,20,500,46,40,6,68,13,619,0,0,0,6,0,23,0,Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,7,20,500,46,40,6,68,13,619,0,0,0,6,0,23,0,Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
batt20,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,20,500,46,43,3,70,15,632,0,0,0,10,0,23,0,Zircon:1;Iskander:1;Kinzhal:1
batt20,e6a70004406b34ea17884875ce236a5fb4b849e4,8,20,500,46,42,4,67,14,669,0,0,0,8,0,23,0,Kh101:1;Iskander:2;Kinzhal:1
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,50,500,46,45,1,84,30,394,0,0,0,9,0,31,0,Kh22:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,1,50,500,46,45,1,83,28,418,0,0,0,7,0,32,0,Kh22:1
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,50,500,46,46,0,83,26,575,0,0,0,10,0,31,0,
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,2,50,500,46,46,0,82,28,514,0,0,0,6,0,35,0,
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,50,500,46,46,0,81,27,499,0,0,0,10,0,35,0,
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,3,50,500,46,46,0,77,27,523,0,0,0,3,0,35,0,
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,50,500,46,45,1,84,31,581,0,0,0,14,0,26,0,Iskander:1;Kinzhal:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,4,50,500,46,46,0,82,31,607,0,0,0,7,0,32,0,
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,50,500,46,44,2,82,32,586,0,0,0,8,0,36,0,Zircon:1;Kinzhal:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,5,50,500,46,46,0,87,29,707,0,0,0,10,0,40,0,
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,50,500,46,45,1,82,26,629,0,0,0,9,0,29,0,Kinzhal:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,6,50,500,46,46,0,94,29,584,0,0,0,11,0,39,0,
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,50,500,46,41,5,91,29,573,0,0,0,17,0,34,0,Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,7,50,500,46,42,4,82,31,523,0,0,0,4,0,37,0,Kh101:1;Kh22:1;Zircon:1;Kinzhal:1
batt50,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,50,500,46,45,1,74,26,677,0,0,0,6,0,30,0,Kinzhal:1
batt50,e6a70004406b34ea17884875ce236a5fb4b849e4,8,50,500,46,46,0,75,26,695,0,0,0,4,0,33,0,
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,20,200,46,41,5,75,16,350,0,0,0,2,0,32,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,1,20,200,46,41,5,75,16,350,0,0,0,2,0,32,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,20,200,46,40,5,69,14,383,0,0,1,5,0,25,0,Shahed:1;Kh101:2;Iskander:1;Kinzhal:2
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,2,20,200,46,40,5,71,14,401,0,0,1,4,0,29,0,Kh101:2;Iskander:2;Kinzhal:1
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,20,200,46,39,6,61,14,375,0,0,1,3,0,26,0,Shahed:1;Kh101:2;Iskander:2;Kinzhal:1
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,3,20,200,46,39,6,60,12,344,0,0,1,2,0,22,0,Shahed:1;Kh101:2;Iskander:3
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,20,200,46,40,6,83,15,459,0,0,0,15,0,30,0,Geran3:1;Kh22:2;Zircon:1;Iskander:1;Kinzhal:1
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,4,20,200,46,40,6,73,13,495,0,0,0,7,0,26,0,Geran3:1;Kh22:2;Iskander:2;Kinzhal:1
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,20,200,46,37,9,76,16,406,0,0,0,14,0,33,0,Kh101:1;Kh22:2;Zircon:1;Iskander:3;Kinzhal:2
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,5,20,200,46,41,5,71,17,455,0,0,0,2,0,34,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,20,200,46,39,7,71,13,450,0,0,0,4,0,29,0,Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,6,20,200,46,39,7,71,13,450,0,0,0,4,0,29,0,Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,20,200,46,39,7,77,14,448,0,0,0,9,0,31,0,Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,7,20,200,46,40,6,84,14,465,0,0,0,11,0,33,0,Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
near200,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,20,200,46,38,8,70,14,524,0,0,0,10,0,28,0,Kh101:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
near200,e6a70004406b34ea17884875ce236a5fb4b849e4,8,20,200,46,38,8,67,15,563,0,0,0,4,0,31,0,Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,20,1500,46,42,4,75,15,2181,0,0,0,9,0,27,0,Kh101:1;Iskander:1;Kinzhal:2
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,1,20,1500,46,44,2,68,14,2218,0,0,0,4,0,24,0,Iskander:1;Kinzhal:1
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,20,1500,46,41,5,72,17,2342,0,0,0,8,0,23,0,Kh101:1;Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,2,20,1500,46,43,3,70,20,2342,0,0,0,7,0,20,0,Kh101:1;Kalibr:1;Iskander:1
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,20,1500,46,43,3,68,19,2385,0,0,0,8,0,19,0,Iskander:2;Kinzhal:1
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,3,20,1500,46,44,2,70,20,2363,0,0,0,5,0,21,0,Iskander:2
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,20,1500,46,41,5,73,16,2388,0,0,0,14,0,22,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,4,20,1500,46,42,4,68,16,2387,0,0,0,5,0,25,0,Kh101:1;Kh22:1;Iskander:1;Kinzhal:1
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,20,1500,46,42,4,75,18,2550,0,0,0,12,0,24,0,Kh101:2;Iskander:1;Kinzhal:1
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,5,20,1500,46,42,4,69,19,2635,0,0,0,5,0,23,0,Kh101:2;Iskander:1;Kinzhal:1
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,20,1500,46,36,10,75,18,2575,0,0,0,3,0,37,0,Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,6,20,1500,46,38,8,76,18,2575,0,0,0,2,0,36,0,Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,20,1500,46,42,4,78,20,2361,0,0,0,10,0,27,0,Kh101:1;Iskander:1;Kinzhal:2
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,7,20,1500,46,43,3,73,18,2361,0,0,0,6,0,25,0,Kh101:1;Kalibr:1;Kinzhal:1
far1500,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,20,1500,46,41,5,66,19,2544,0,0,0,6,0,23,0,Kh101:1;Iskander:2;Kinzhal:2
far1500,e6a70004406b34ea17884875ce236a5fb4b849e4,8,20,1500,46,42,4,68,20,2544,0,0,0,4,0,26,0,Kh101:1;Iskander:2;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,1,20,500,46,41,5,79,14,606,0,0,0,12,0,27,0,Kalibr:1;Kh22:1;Zircon:1;Iskander:2
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,1,20,500,46,40,6,73,12,551,0,0,0,8,0,25,0,Geran3:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,2,20,500,46,38,8,77,15,651,8,0,0,2,0,30,0,Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,2,20,500,46,38,8,81,14,681,7,0,0,3,0,33,0,Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,3,20,500,46,44,1,79,12,640,0,1,1,10,0,28,0,Kh101:1;Zircon:1;Iskander:1
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,3,20,500,46,44,1,78,13,675,0,0,1,7,0,29,0,Kh101:1;Zircon:1;Iskander:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,4,20,500,46,40,6,82,15,492,3,3,0,13,0,25,0,Kh22:1;Iskander:4;Kinzhal:1
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,4,20,500,46,42,4,77,15,515,3,2,0,8,0,24,0,Kh22:1;Iskander:3
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,5,20,500,46,39,7,69,18,514,0,1,0,8,0,23,0,Kh22:1;Iskander:4;Kinzhal:2
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,5,20,500,46,42,4,65,15,469,1,0,0,4,0,22,0,Kh22:1;Iskander:2;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,6,20,500,46,43,3,68,13,612,0,0,0,3,0,22,0,Zircon:1;Iskander:1;Kinzhal:1
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,6,20,500,46,43,3,68,13,612,0,0,0,3,0,22,0,Zircon:1;Iskander:1;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,7,20,500,46,41,5,66,13,554,0,0,0,6,0,19,0,Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,7,20,500,46,43,3,64,15,546,0,0,0,5,0,16,0,Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
hills20,2689d933e790b7d751dfcf2a4c6a325e041562ce,8,20,500,46,42,4,77,14,712,3,0,0,14,0,20,0,Iskander:2;Kinzhal:2
hills20,e6a70004406b34ea17884875ce236a5fb4b849e4,8,20,500,46,42,4,77,14,712,3,0,0,13,0,20,0,Iskander:2;Kinzhal:2
1 variant commit seed sams dist sent kills leaked missiles heavy ticks blocked scrubbed crashes fuse_miss expired orphaned energy_lost leaks_by_kind
2 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 10 500 46 35 11 61 9 781 0 0 0 9 0 21 0 Geran3:3;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
3 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 1 10 500 46 37 9 62 9 812 0 0 0 4 1 23 0 Geran3:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
4 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 10 500 46 40 6 62 10 875 0 0 0 7 0 16 0 Shahed:1;Kh101:2;Kalibr:2;Iskander:1
5 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 2 10 500 46 41 5 65 11 883 0 0 0 6 0 20 0 Shahed:1;Kh101:2;Kalibr:1;Iskander:1
6 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 10 500 46 39 7 56 6 740 0 0 0 4 0 18 0 Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
7 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 3 10 500 46 39 7 56 6 740 0 0 0 4 0 18 0 Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
8 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 10 500 46 38 8 75 9 919 0 0 0 13 0 24 0 Geran3:1;Kh101:1;Kh22:1;Iskander:3;Kinzhal:2
9 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 4 10 500 46 34 11 57 8 854 0 0 0 4 0 20 0 Geran3:2;Kh101:3;Kalibr:2;Kh22:1;Iskander:2;Kinzhal:1
10 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 10 500 46 34 11 66 8 871 0 0 0 12 0 26 0 Geran3:1;Kh101:2;Kh22:2;Zircon:1;Iskander:4;Kinzhal:2
11 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 5 10 500 46 39 7 67 6 914 0 0 0 7 0 26 0 Kh101:2;Kh22:1;Iskander:3;Kinzhal:1
12 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 10 500 46 36 10 72 11 986 0 0 0 6 0 30 0 Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
13 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 6 10 500 46 36 10 73 11 977 0 0 0 7 0 30 0 Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
14 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 10 500 46 35 11 62 6 802 0 0 0 6 0 23 0 Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
15 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 7 10 500 46 35 11 63 6 802 0 0 0 7 0 23 0 Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
16 batt10 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 10 500 46 40 6 62 8 979 0 0 0 6 0 20 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
17 batt10 e6a70004406b34ea17884875ce236a5fb4b849e4 8 10 500 46 40 6 61 8 979 0 0 0 3 0 21 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
18 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 20 500 46 41 5 72 13 580 0 0 0 11 0 22 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
19 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 1 20 500 46 42 4 75 13 578 0 0 0 10 1 22 0 Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
20 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 20 500 46 40 6 81 14 629 0 0 0 10 0 36 0 Kh101:2;Kalibr:1;Zircon:1;Kinzhal:2
21 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 2 20 500 46 41 5 71 15 612 0 0 0 4 0 26 0 Kh101:2;Kalibr:1;Kinzhal:2
22 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 20 500 46 42 4 64 13 513 0 0 0 9 0 17 0 Zircon:1;Iskander:3
23 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 3 20 500 46 44 2 68 13 541 0 0 0 6 0 23 0 Zircon:1;Iskander:1
24 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 20 500 46 42 4 81 15 581 0 0 0 14 0 28 0 Kh22:1;Iskander:2;Kinzhal:1
25 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 4 20 500 46 42 4 76 15 614 0 0 0 8 0 27 0 Kh22:1;Iskander:2;Kinzhal:1
26 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 20 500 46 42 4 71 15 730 0 0 0 7 0 23 0 Kh101:1;Iskander:2;Kinzhal:1
27 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 5 20 500 46 42 4 73 15 748 0 0 0 6 0 25 0 Kh101:1;Iskander:2;Kinzhal:1
28 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 20 500 46 41 5 77 14 696 0 0 0 7 0 29 0 Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
29 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 6 20 500 46 41 5 80 13 681 0 0 0 5 0 34 0 Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
30 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 20 500 46 40 6 68 13 619 0 0 0 6 0 23 0 Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
31 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 7 20 500 46 40 6 68 13 619 0 0 0 6 0 23 0 Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
32 batt20 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 20 500 46 43 3 70 15 632 0 0 0 10 0 23 0 Zircon:1;Iskander:1;Kinzhal:1
33 batt20 e6a70004406b34ea17884875ce236a5fb4b849e4 8 20 500 46 42 4 67 14 669 0 0 0 8 0 23 0 Kh101:1;Iskander:2;Kinzhal:1
34 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 50 500 46 45 1 84 30 394 0 0 0 9 0 31 0 Kh22:1
35 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 1 50 500 46 45 1 83 28 418 0 0 0 7 0 32 0 Kh22:1
36 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 50 500 46 46 0 83 26 575 0 0 0 10 0 31 0
37 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 2 50 500 46 46 0 82 28 514 0 0 0 6 0 35 0
38 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 50 500 46 46 0 81 27 499 0 0 0 10 0 35 0
39 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 3 50 500 46 46 0 77 27 523 0 0 0 3 0 35 0
40 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 50 500 46 45 1 84 31 581 0 0 0 14 0 26 0 Iskander:1;Kinzhal:1
41 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 4 50 500 46 46 0 82 31 607 0 0 0 7 0 32 0
42 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 50 500 46 44 2 82 32 586 0 0 0 8 0 36 0 Zircon:1;Kinzhal:1
43 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 5 50 500 46 46 0 87 29 707 0 0 0 10 0 40 0
44 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 50 500 46 45 1 82 26 629 0 0 0 9 0 29 0 Kinzhal:1
45 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 6 50 500 46 46 0 94 29 584 0 0 0 11 0 39 0
46 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 50 500 46 41 5 91 29 573 0 0 0 17 0 34 0 Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
47 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 7 50 500 46 42 4 82 31 523 0 0 0 4 0 37 0 Kh101:1;Kh22:1;Zircon:1;Kinzhal:1
48 batt50 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 50 500 46 45 1 74 26 677 0 0 0 6 0 30 0 Kinzhal:1
49 batt50 e6a70004406b34ea17884875ce236a5fb4b849e4 8 50 500 46 46 0 75 26 695 0 0 0 4 0 33 0
50 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 20 200 46 41 5 75 16 350 0 0 0 2 0 32 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
51 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 1 20 200 46 41 5 75 16 350 0 0 0 2 0 32 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
52 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 20 200 46 40 5 69 14 383 0 0 1 5 0 25 0 Shahed:1;Kh101:2;Iskander:1;Kinzhal:2
53 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 2 20 200 46 40 5 71 14 401 0 0 1 4 0 29 0 Kh101:2;Iskander:2;Kinzhal:1
54 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 20 200 46 39 6 61 14 375 0 0 1 3 0 26 0 Shahed:1;Kh101:2;Iskander:2;Kinzhal:1
55 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 3 20 200 46 39 6 60 12 344 0 0 1 2 0 22 0 Shahed:1;Kh101:2;Iskander:3
56 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 20 200 46 40 6 83 15 459 0 0 0 15 0 30 0 Geran3:1;Kh22:2;Zircon:1;Iskander:1;Kinzhal:1
57 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 4 20 200 46 40 6 73 13 495 0 0 0 7 0 26 0 Geran3:1;Kh22:2;Iskander:2;Kinzhal:1
58 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 20 200 46 37 9 76 16 406 0 0 0 14 0 33 0 Kh101:1;Kh22:2;Zircon:1;Iskander:3;Kinzhal:2
59 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 5 20 200 46 41 5 71 17 455 0 0 0 2 0 34 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
60 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 20 200 46 39 7 71 13 450 0 0 0 4 0 29 0 Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
61 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 6 20 200 46 39 7 71 13 450 0 0 0 4 0 29 0 Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
62 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 20 200 46 39 7 77 14 448 0 0 0 9 0 31 0 Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
63 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 7 20 200 46 40 6 84 14 465 0 0 0 11 0 33 0 Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
64 near200 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 20 200 46 38 8 70 14 524 0 0 0 10 0 28 0 Kh101:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
65 near200 e6a70004406b34ea17884875ce236a5fb4b849e4 8 20 200 46 38 8 67 15 563 0 0 0 4 0 31 0 Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
66 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 20 1500 46 42 4 75 15 2181 0 0 0 9 0 27 0 Kh101:1;Iskander:1;Kinzhal:2
67 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 1 20 1500 46 44 2 68 14 2218 0 0 0 4 0 24 0 Iskander:1;Kinzhal:1
68 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 20 1500 46 41 5 72 17 2342 0 0 0 8 0 23 0 Kh101:1;Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
69 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 2 20 1500 46 43 3 70 20 2342 0 0 0 7 0 20 0 Kh101:1;Kalibr:1;Iskander:1
70 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 20 1500 46 43 3 68 19 2385 0 0 0 8 0 19 0 Iskander:2;Kinzhal:1
71 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 3 20 1500 46 44 2 70 20 2363 0 0 0 5 0 21 0 Iskander:2
72 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 20 1500 46 41 5 73 16 2388 0 0 0 14 0 22 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
73 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 4 20 1500 46 42 4 68 16 2387 0 0 0 5 0 25 0 Kh101:1;Kh22:1;Iskander:1;Kinzhal:1
74 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 20 1500 46 42 4 75 18 2550 0 0 0 12 0 24 0 Kh101:2;Iskander:1;Kinzhal:1
75 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 5 20 1500 46 42 4 69 19 2635 0 0 0 5 0 23 0 Kh101:2;Iskander:1;Kinzhal:1
76 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 20 1500 46 36 10 75 18 2575 0 0 0 3 0 37 0 Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
77 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 6 20 1500 46 38 8 76 18 2575 0 0 0 2 0 36 0 Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
78 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 20 1500 46 42 4 78 20 2361 0 0 0 10 0 27 0 Kh101:1;Iskander:1;Kinzhal:2
79 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 7 20 1500 46 43 3 73 18 2361 0 0 0 6 0 25 0 Kh101:1;Kalibr:1;Kinzhal:1
80 far1500 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 20 1500 46 41 5 66 19 2544 0 0 0 6 0 23 0 Kh101:1;Iskander:2;Kinzhal:2
81 far1500 e6a70004406b34ea17884875ce236a5fb4b849e4 8 20 1500 46 42 4 68 20 2544 0 0 0 4 0 26 0 Kh101:1;Iskander:2;Kinzhal:1
82 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 1 20 500 46 41 5 79 14 606 0 0 0 12 0 27 0 Kalibr:1;Kh22:1;Zircon:1;Iskander:2
83 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 1 20 500 46 40 6 73 12 551 0 0 0 8 0 25 0 Geran3:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
84 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 2 20 500 46 38 8 77 15 651 8 0 0 2 0 30 0 Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
85 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 2 20 500 46 38 8 81 14 681 7 0 0 3 0 33 0 Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
86 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 3 20 500 46 44 1 79 12 640 0 1 1 10 0 28 0 Kh101:1;Zircon:1;Iskander:1
87 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 3 20 500 46 44 1 78 13 675 0 0 1 7 0 29 0 Kh101:1;Zircon:1;Iskander:1
88 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 4 20 500 46 40 6 82 15 492 3 3 0 13 0 25 0 Kh22:1;Iskander:4;Kinzhal:1
89 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 4 20 500 46 42 4 77 15 515 3 2 0 8 0 24 0 Kh22:1;Iskander:3
90 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 5 20 500 46 39 7 69 18 514 0 1 0 8 0 23 0 Kh22:1;Iskander:4;Kinzhal:2
91 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 5 20 500 46 42 4 65 15 469 1 0 0 4 0 22 0 Kh22:1;Iskander:2;Kinzhal:1
92 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 6 20 500 46 43 3 68 13 612 0 0 0 3 0 22 0 Zircon:1;Iskander:1;Kinzhal:1
93 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 6 20 500 46 43 3 68 13 612 0 0 0 3 0 22 0 Zircon:1;Iskander:1;Kinzhal:1
94 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 7 20 500 46 41 5 66 13 554 0 0 0 6 0 19 0 Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
95 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 7 20 500 46 43 3 64 15 546 0 0 0 5 0 16 0 Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
96 hills20 2689d933e790b7d751dfcf2a4c6a325e041562ce 8 20 500 46 42 4 77 14 712 3 0 0 14 0 20 0 Iskander:2;Kinzhal:2
97 hills20 e6a70004406b34ea17884875ce236a5fb4b849e4 8 20 500 46 42 4 77 14 712 3 0 0 13 0 20 0 Iskander:2;Kinzhal:2
@@ -0,0 +1,6 @@
running 1 scripts against /tmp/issue-122-raid/airdef-mod/target/horizon-mod/airdef.hmod
fuel airdef command: calls=179 max=32946177 budget=1000000000 failures=0
fuel airdef frame: calls=377 max=77 budget=10000000 failures=0
fuel airdef tick: calls=3802 max=236581288 budget=300000000 failures=0
test tests/wasm_budget.toml ... ok (255 steps)
test result: ok. 1 passed
@@ -0,0 +1,10 @@
=== BEFORE: scaling witness — an 11-drone second order at the same state ===
running 1 scripts against /tmp/issue-122-run/airdef-diag-before.hmod
fuel airdef command: calls=177 max=247805865 budget=1000000000 failures=0
fuel airdef frame: calls=257 max=77 budget=10000000 failures=0
fuel airdef tick: calls=2602 max=241372671 budget=300000000 failures=0
test tests/wasm_budget.toml ... FAILED
step 229 (/airdef wave mix 1 300): feedback
expected: Some("PROBE")
got: Some("DIAG revealed=13172 known=144 sams=172 alive=144 planning=true queue=0")
error: 1 failed, 0 passed
@@ -0,0 +1,7 @@
=== BEFORE: second order (UI path) traps at the 1e9 event budget ===
running 1 scripts against /tmp/issue-122-run/airdef-diag-before.hmod
fuel airdef command: calls=177 max=1000000000 budget=1000000000 failures=1
fuel airdef frame: calls=257 max=77 budget=10000000 failures=0
fuel airdef tick: calls=2602 max=241372671 budget=300000000 failures=0
test tests/wasm_budget.toml ... ok (229 steps)
test result: ok. 1 passed
@@ -0,0 +1,762 @@
[[step]]
render-ground-y = 64
ticks = 2
frames = 2
expect.commands = ["airdef"]
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
command = "airdef ew on"
[[step]]
command = "airdef wave mix 10 300"
[[step]]
ticks = 100
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef ew on"
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef ew on"
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef stats"
expect.feedback = "В воздухе: 0, ракет: 0, ПВО: 172, сбито: 308, поражений: 87, разбились о препятствия: 0; удары по ПУ: пущено 0, уничтожено 0, подавлено 0, промахов 0, сбито ПВО 0; мир: 8156 секций (382 КБ), запросов 16075, неизвестно 0, лучей 87524 (ударов 1830, неизв. 1567), клеток 1318224; взрывы в блоках: 239 (подтверждено 0, без перемен 37, нет чанка 202), чужих ответов 0"
[[step]]
command = "airdef wave mix 10 300"
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef stats"
expect.feedback = "В воздухе: 0, ракет: 0, ПВО: 172, сбито: 309, поражений: 87, разбились о препятствия: 0; удары по ПУ: пущено 0, уничтожено 0, подавлено 0, промахов 0, сбито ПВО 0; мир: 8557 секций (401 КБ), запросов 16511, неизвестно 0, лучей 89230 (ударов 2855, неизв. 2039), клеток 1326528; взрывы в блоках: 239 (подтверждено 0, без перемен 37, нет чанка 202), чужих ответов 0"
@@ -0,0 +1,688 @@
[[step]]
render-ground-y = 64
ticks = 2
frames = 2
expect.commands = ["airdef"]
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 0.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 40.0 }
command = "airdef deploy ew"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 40.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 80.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 120.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 0.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 40.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 80.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 120.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 160.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 200.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 240.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy s400"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy patriot"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy nasams"
[[step]]
player = { x = 280.0, z = 160.0 }
command = "airdef deploy pantsir"
[[step]]
command = "airdef ew on"
[[step]]
command = "airdef wave mix 10 300"
[[step]]
ticks = 100
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef ew on"
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef ew on"
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
ticks = 50
frames = 5
[[step]]
command = "airdef stats"
expect.feedback = "В воздухе: 0, ракет: 0, ПВО: 172, сбито: 308, поражений: 87, разбились о препятствия: 0; удары по ПУ: пущено 0, уничтожено 0, подавлено 0, промахов 0, сбито ПВО 0; мир: 8156 секций (382 КБ), запросов 16075, неизвестно 0, лучей 87524 (ударов 1830, неизв. 1567), клеток 1318224; взрывы в блоках: 239 (подтверждено 0, без перемен 37, нет чанка 202), чужих ответов 0"
[[step]]
command = "airdef wave mix 10 300"
expect.stopped = "exceeded its execution limit"
@@ -0,0 +1,67 @@
{
"schema": 1,
"issue": 122,
"kind": "diagnostic_guest_ui_path_comparison_not_exact_user_session",
"user_report": {
"log": "Horizon: mod airdef stopped in UI event (fuel budget 1000000000, remaining Some(0))",
"backtrace": "airdef_core::sim::ew::Sim::known_units <- sim::raid::Sim::order_raid <- airdef::AirDef::launch_wave <- horizon_mod_sdk::Mod::ui_select <- ui-events select",
"windows_session_confirmed_same_cause": false
},
"root_cause": {
"what": "order_raid recomputed the planner snapshot known_units() for every drone (choose_target), and known_units() itself rescanned the whole force and the dedup list per intel entry",
"growth": "drones x intel_log x force_size per UI event; the intel log holds every launch, EW disclosure, and radar disclosure of the last 6000 ticks",
"state_at_trap": {
"revealed_entries": 13172,
"known_alive_units": 144,
"sams_total": 172
}
},
"fix": {
"description": "one known_units snapshot per order_raid passed to radar_strikes and choose_target; known_units is a single O(R+S) set pass; price_grid_on reuses its snapshot",
"semantics": "identical planner results; native equivalence test against the former predicate; WASM checkpoint /airdef stats byte-identical before/after at tick 2602",
"limits_unchanged": true,
"wave_size_unrestricted": true,
"hd_record_untouched": true
},
"setup": {
"defenses": "40 spread clusters x 4 heavy SAMs + 12 EW = 172, player moved per deploy step",
"first_raid": "airdef wave mix 10 (111 drones, Smart, AllSides) via the diagnostic UI-path trigger",
"second_raid": "same, at tick ~2600 after the first raid is fought off",
"note": "stacked single-point layouts die to one warhead (known=0, cheap order); the trap needs a surviving force, like the user's session"
},
"before": {
"source": "e6a7000 + trigger.patch (diagnostic guest only)",
"second_order_111_drones": {
"callback": "command (the diagnostic trigger invokes the exact ui_select(BTN_LAUNCH) handler; the UI event and the command share the same 1e9 event budget)",
"max_used": 1000000000,
"budget": 1000000000,
"failures": 1,
"mod_stopped": true,
"log": "before-trap.txt"
},
"scaling_witness_11_drones_same_state": {
"max_used": 247805865,
"budget": 1000000000,
"failures": 0,
"log": "before-scaling.txt"
}
},
"after": {
"same_scenario_passed": true,
"steps": 255,
"max_command_fuel": 32946177,
"max_tick_fuel": 236581288,
"failures": 0,
"checkpoint_stats_equal_before_after": true,
"log": "after.txt"
},
"artifacts": {
"trigger_patch": "trigger.patch",
"scenario_before": "scenario-before.toml",
"scenario_after": "scenario-after.toml",
"before_guest_sha256": "6d4525cd7aaa61dbf344593f9819be1b61e06654126e9e9088e57967dc657365",
"after_guest_sha256": "c4ef7d759524eb053ccd55f0eccdcb49c91954201eb4e0ad923ee9b2828efc4e",
"scenario_before_sha256": "398d099275e396deab269601e5adbcf325ab5e0ea6b540c1d03a477d6b0963d1",
"scenario_after_sha256": "3bc27338d2e6fb433f027a0cf1afc39ff9a94e1af5840454082af6d8d15aad7c"
}
}
@@ -0,0 +1,23 @@
diff --git a/airdef-mod/src/lib.rs b/airdef-mod/src/lib.rs
index dc6585eb3..73864e41e 100644
--- a/airdef-mod/src/lib.rs
+++ b/airdef-mod/src/lib.rs
@@ -2351,8 +2351,16 @@ impl Mod for AirDef {
.nearest_target(DVec3::new(p.x, p.y, p.z))
.unwrap_or(DVec3::new(p.x, p.y, p.z));
if *kind == "mix" {
- let objects = self.objects(DVec3::new(p.x, p.y, p.z));
- self.sim.order_raid(&wave::WaveConfig::mix(count, dist), &objects, &mut out);
+ // DIAGNOSTIC ONLY (issue #122): drive the exact UI launch path
+ // (Page::WaveGo, BTN_LAUNCH) with the maximum menu composition.
+ let mut wave = wave::WaveConfig::default();
+ wave.counts = [40; wave::KINDS.len()];
+ wave.dist = dist;
+ wave.approach = sim::Approach::AllSides;
+ wave.aim = sim::Aim::Smart;
+ self.wave = wave;
+ self.menu = Some(Page::WaveGo);
+ self.ui_select(BTN_LAUNCH, 0);
} else {
let kind = DroneKind::from_key(kind).ok_or(
"Тип: shahed, geran3, lancet, gerbera, kh101, kalibr, kh22, zircon, iskander, kinzhal, oreshnik или mix",
@@ -0,0 +1,155 @@
{
"schema": 1,
"world": "EnemyPicture127",
"branch": "kimi-work (baseline, before #127 stage 1)",
"code_commit": "0b645d77e",
"bench": "cargo run --release --example intel_bench (airdef-core, SDK-free)",
"scenarios": [
"big-smart",
"logistics",
"ew-adaptive"
],
"seeds": [
1,
7,
42
],
"metrics": "completion: raids_ended/raids_ordered, all_ended; losses: sams_lost; exchange: launched/kills/hits/crashes/fired; failure reasons: sim.tally text (Russian, as the tally words them)",
"runs": [
{
"scenario": "big-smart",
"seed": 1,
"ticks_run": 1642,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 50,
"failures": "5 промахов по взрывателю, 30 ракет остались без цели, 4 потерь трека"
},
{
"scenario": "big-smart",
"seed": 7,
"ticks_run": 1514,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 49,
"failures": "2 промахов по взрывателю, 22 ракет остались без цели, 6 потерь трека"
},
{
"scenario": "big-smart",
"seed": 42,
"ticks_run": 1490,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 56,
"failures": "5 промахов по взрывателю, 35 ракет остались без цели, 9 потерь трека"
},
{
"scenario": "logistics",
"seed": 1,
"ticks_run": 1009,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 11,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "1 промахов по взрывателю, 6 ракет остались без цели, 1 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 7,
"ticks_run": 970,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 7,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 2 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 42,
"ticks_run": 1003,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 3 потерь трека, 3 ожиданий БК"
},
{
"scenario": "ew-adaptive",
"seed": 1,
"ticks_run": 8661,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 62,
"hits": 3,
"crashes": 4,
"sams_lost": 1,
"fired": 82,
"failures": "8 промахов по взрывателю, 1 ракет выработали ресурс, 24 ракет остались без цели, 14 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 7,
"ticks_run": 8809,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 61,
"hits": 5,
"crashes": 3,
"sams_lost": 4,
"fired": 78,
"failures": "7 промахов по взрывателю, 20 ракет остались без цели, 10 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 42,
"ticks_run": 6976,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 61,
"hits": 7,
"crashes": 1,
"sams_lost": 4,
"fired": 75,
"failures": "8 промахов по взрывателю, 1 ракет выработали ресурс, 25 ракет остались без цели, 10 потерь трека"
}
]
}
@@ -0,0 +1,155 @@
{
"schema": 1,
"world": "EnemyPicture127",
"branch": "agent/issue-127-enemy-picture",
"code_commit": "agent/issue-127-enemy-picture (see git log for the exact SHA)",
"bench": "cargo run --release --example intel_bench (airdef-core, SDK-free)",
"scenarios": [
"big-smart",
"logistics",
"ew-adaptive"
],
"seeds": [
1,
7,
42
],
"metrics": "completion: raids_ended/raids_ordered, all_ended; losses: sams_lost; exchange: launched/kills/hits/crashes/fired; failure reasons: sim.tally text (Russian, as the tally words them)",
"runs": [
{
"scenario": "big-smart",
"seed": 1,
"ticks_run": 1716,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 49,
"failures": "3 промахов по взрывателю, 27 ракет остались без цели, 3 потерь трека"
},
{
"scenario": "big-smart",
"seed": 7,
"ticks_run": 1542,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 48,
"failures": "2 промахов по взрывателю, 22 ракет остались без цели, 5 потерь трека"
},
{
"scenario": "big-smart",
"seed": 42,
"ticks_run": 1433,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 49,
"failures": "2 промахов по взрывателю, 27 ракет остались без цели, 7 потерь трека"
},
{
"scenario": "logistics",
"seed": 1,
"ticks_run": 1009,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 11,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "1 промахов по взрывателю, 6 ракет остались без цели, 1 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 7,
"ticks_run": 970,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 7,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 2 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 42,
"ticks_run": 1003,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 3 потерь трека, 3 ожиданий БК"
},
{
"scenario": "ew-adaptive",
"seed": 1,
"ticks_run": 8084,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 59,
"hits": 7,
"crashes": 3,
"sams_lost": 3,
"fired": 69,
"failures": "7 промахов по взрывателю, 20 ракет остались без цели, 11 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 7,
"ticks_run": 8193,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 59,
"hits": 7,
"crashes": 3,
"sams_lost": 3,
"fired": 81,
"failures": "4 промахов по взрывателю, 3 ракет выработали ресурс, 26 ракет остались без цели, 8 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 42,
"ticks_run": 7916,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 56,
"hits": 8,
"crashes": 5,
"sams_lost": 4,
"fired": 69,
"failures": "7 промахов по взрывателю, 20 ракет остались без цели, 12 потерь трека"
}
]
}
@@ -0,0 +1,154 @@
{
"schema": 1,
"world": "IntentQueue127",
"branch": "8fc10c07a",
"code_commit": "8fc10c07a (base of the branch; the run was made from a clean worktree at that commit)",
"bench": "cargo run --release --example intel_bench (airdef-mod, SDK-free harness)",
"scenarios": [
"big-smart",
"ew-adaptive",
"logistics"
],
"seeds": [
1,
7,
42
],
"runs": [
{
"scenario": "big-smart",
"seed": 1,
"ticks_run": 1716,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 49,
"failures": "3 промахов по взрывателю, 27 ракет остались без цели, 3 потерь трека"
},
{
"scenario": "big-smart",
"seed": 7,
"ticks_run": 1542,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 48,
"failures": "2 промахов по взрывателю, 22 ракет остались без цели, 5 потерь трека"
},
{
"scenario": "big-smart",
"seed": 42,
"ticks_run": 1433,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 49,
"failures": "2 промахов по взрывателю, 27 ракет остались без цели, 7 потерь трека"
},
{
"scenario": "logistics",
"seed": 1,
"ticks_run": 1009,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 11,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "1 промахов по взрывателю, 6 ракет остались без цели, 1 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 7,
"ticks_run": 970,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 7,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 2 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 42,
"ticks_run": 1003,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"failures": "6 ракет остались без цели, 3 потерь трека, 3 ожиданий БК"
},
{
"scenario": "ew-adaptive",
"seed": 1,
"ticks_run": 8084,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 59,
"hits": 7,
"crashes": 3,
"sams_lost": 3,
"fired": 69,
"failures": "7 промахов по взрывателю, 20 ракет остались без цели, 11 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 7,
"ticks_run": 8193,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 59,
"hits": 7,
"crashes": 3,
"sams_lost": 3,
"fired": 81,
"failures": "4 промахов по взрывателю, 3 ракет выработали ресурс, 26 ракет остались без цели, 8 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 42,
"ticks_run": 7916,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 56,
"hits": 8,
"crashes": 5,
"sams_lost": 4,
"fired": 69,
"failures": "7 промахов по взрывателю, 20 ракет остались без цели, 12 потерь трека"
}
]
}
@@ -0,0 +1,190 @@
{
"schema": 1,
"world": "IntentQueue127",
"branch": "agent/issue-127-intent-durable",
"code_commit": "agent/issue-127-intent-durable (this branch; see git log for the exact SHA)",
"bench": "cargo run --release --example intel_bench (airdef-mod, SDK-free harness)",
"scenarios": [
"big-smart",
"ew-adaptive",
"logistics"
],
"seeds": [
1,
7,
42
],
"runs": [
{
"scenario": "big-smart",
"seed": 1,
"ticks_run": 1676,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 60,
"retargets_max": 1,
"air_bytes": 61895,
"switches_max": 1,
"intents": "plan:25,sead:0,react:13,replace:0",
"failures": "3 промахов по взрывателю, 41 ракет остались без цели, 9 потерь трека"
},
{
"scenario": "big-smart",
"seed": 7,
"ticks_run": 1542,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 68,
"retargets_max": 2,
"air_bytes": 62311,
"switches_max": 1,
"intents": "plan:24,sead:0,react:14,replace:0",
"failures": "6 промахов по взрывателю, 37 ракет остались без цели, 9 потерь трека"
},
{
"scenario": "big-smart",
"seed": 42,
"ticks_run": 1433,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 38,
"kills": 38,
"hits": 0,
"crashes": 0,
"sams_lost": 0,
"fired": 71,
"retargets_max": 2,
"air_bytes": 61205,
"switches_max": 1,
"intents": "plan:22,sead:0,react:16,replace:0",
"failures": "5 промахов по взрывателю, 49 ракет остались без цели, 21 потерь трека"
},
{
"scenario": "logistics",
"seed": 1,
"ticks_run": 1009,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 11,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"retargets_max": 0,
"air_bytes": 4041,
"switches_max": 0,
"intents": "plan:0,sead:0,react:0,replace:0",
"failures": "1 промахов по взрывателю, 6 ракет остались без цели, 1 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 7,
"ticks_run": 970,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 7,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"retargets_max": 0,
"air_bytes": 4031,
"switches_max": 0,
"intents": "plan:0,sead:0,react:0,replace:0",
"failures": "6 ракет остались без цели, 2 потерь трека, 3 ожиданий БК"
},
{
"scenario": "logistics",
"seed": 42,
"ticks_run": 1003,
"raids_ordered": 1,
"raids_ended": 1,
"all_ended": true,
"launched": 27,
"kills": 12,
"hits": 8,
"crashes": 0,
"sams_lost": 0,
"fired": 18,
"retargets_max": 0,
"air_bytes": 4018,
"switches_max": 0,
"intents": "plan:0,sead:0,react:0,replace:0",
"failures": "6 ракет остались без цели, 3 потерь трека, 3 ожиданий БК"
},
{
"scenario": "ew-adaptive",
"seed": 1,
"ticks_run": 7146,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 58,
"hits": 7,
"crashes": 4,
"sams_lost": 3,
"fired": 76,
"retargets_max": 0,
"air_bytes": 7125,
"switches_max": 1,
"intents": "plan:47,sead:8,react:14,replace:0",
"failures": "10 промахов по взрывателю, 17 ракет остались без цели, 11 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 7,
"ticks_run": 7650,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 58,
"hits": 9,
"crashes": 2,
"sams_lost": 4,
"fired": 98,
"retargets_max": 0,
"air_bytes": 8808,
"switches_max": 1,
"intents": "plan:19,sead:2,react:13,replace:35",
"failures": "9 промахов по взрывателю, 45 ракет остались без цели, 13 потерь трека"
},
{
"scenario": "ew-adaptive",
"seed": 42,
"ticks_run": 7243,
"raids_ordered": 3,
"raids_ended": 3,
"all_ended": true,
"launched": 69,
"kills": 63,
"hits": 3,
"crashes": 3,
"sams_lost": 2,
"fired": 82,
"retargets_max": 0,
"air_bytes": 7997,
"switches_max": 1,
"intents": "plan:49,sead:8,react:12,replace:0",
"failures": "12 промахов по взрывателю, 21 ракет остались без цели, 18 потерь трека"
}
]
}
+25
View File
@@ -0,0 +1,25 @@
variant,commit,seed,sent,kills,leaked,missiles,ticks
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,17,17,0,27,434
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,17,16,1,28,462
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,17,17,0,30,384
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,17,17,0,31,551
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,17,17,0,29,700
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,17,17,0,33,443
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,17,17,0,33,463
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,17,17,0,25,548
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,9,17,17,0,30,728
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,10,17,17,0,26,875
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,11,17,17,0,30,640
baseline,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,12,17,17,0,33,546
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,17,17,0,28,301
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,17,16,1,30,544
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,17,16,1,30,384
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,17,17,0,30,465
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,17,17,0,30,731
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,17,17,0,32,521
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,17,17,0,35,592
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,17,17,0,26,626
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,9,17,17,0,30,729
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,10,17,16,1,26,765
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,11,17,17,0,30,632
cold-launch,4b013fb7f30dbaa87a266b27a31911937fc523b4,12,17,17,0,33,546
1 variant commit seed sent kills leaked missiles ticks
2 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 17 17 0 27 434
3 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 17 16 1 28 462
4 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 17 17 0 30 384
5 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 17 17 0 31 551
6 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 17 17 0 29 700
7 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 17 17 0 33 443
8 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 17 17 0 33 463
9 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 17 17 0 25 548
10 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 9 17 17 0 30 728
11 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 10 17 17 0 26 875
12 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 11 17 17 0 30 640
13 baseline dc36d67eb740e6a9fb56224b32b007e3bf2512b9 12 17 17 0 33 546
14 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 17 17 0 28 301
15 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 17 16 1 30 544
16 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 17 16 1 30 384
17 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 17 17 0 30 465
18 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 17 17 0 30 731
19 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 17 17 0 32 521
20 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 17 17 0 35 592
21 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 17 17 0 26 626
22 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 9 17 17 0 30 729
23 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 10 17 16 1 26 765
24 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 11 17 17 0 30 632
25 cold-launch 4b013fb7f30dbaa87a266b27a31911937fc523b4 12 17 17 0 33 546
+97
View File
@@ -0,0 +1,97 @@
variant,commit,seed,sams,dist,sent,kills,leaked,missiles,heavy,ticks,blocked,scrubbed,crashes,fuse_miss,expired,orphaned,energy_lost,leaks_by_kind
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,10,500,46,37,9,62,9,812,0,0,0,4,1,23,0,Geran3:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,10,500,46,41,5,65,11,883,0,0,0,6,0,20,0,Shahed:1;Kh101:2;Kalibr:1;Iskander:1
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,10,500,46,39,7,56,6,740,0,0,0,4,0,18,0,Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,10,500,46,34,11,57,8,854,0,0,0,4,0,20,0,Geran3:2;Kh101:3;Kalibr:2;Kh22:1;Iskander:2;Kinzhal:1
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,10,500,46,39,7,67,6,914,0,0,0,7,0,26,0,Kh101:2;Kh22:1;Iskander:3;Kinzhal:1
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,10,500,46,36,10,73,11,977,0,0,0,7,0,30,0,Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,10,500,46,35,11,63,6,802,0,0,0,7,0,23,0,Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,10,500,46,40,6,61,8,979,0,0,0,3,0,21,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,10,500,46,36,10,58,9,825,0,0,0,4,0,20,0,Geran3:3;Kh101:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,10,500,46,38,8,64,10,892,0,0,0,4,0,23,0,Shahed:1;Kh101:2;Kalibr:2;Zircon:1;Iskander:2
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,10,500,46,38,8,62,8,714,0,0,0,7,0,23,0,Kalibr:2;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,10,500,46,35,10,61,8,902,0,0,0,4,0,24,0,Geran3:1;Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:2
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,10,500,46,36,9,62,6,896,0,0,0,6,0,27,0,Geran3:1;Kh101:2;Kh22:1;Iskander:4;Kinzhal:1
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,10,500,46,31,13,64,8,988,0,0,0,4,0,29,0,Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:3;Kinzhal:2
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,10,500,46,36,9,60,9,921,0,0,0,5,0,20,0,Geran3:1;Kh101:3;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
batt10,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,10,500,46,40,6,63,7,979,0,0,0,5,0,22,0,Kh101:1;Zircon:1;Iskander:2;Kinzhal:2
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,20,500,46,42,4,75,13,578,0,0,0,10,1,22,0,Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,20,500,46,41,5,71,15,612,0,0,0,4,0,26,0,Kh101:2;Kalibr:1;Kinzhal:2
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,20,500,46,44,2,68,13,541,0,0,0,6,0,23,0,Zircon:1;Iskander:1
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,20,500,46,42,4,76,15,614,0,0,0,8,0,27,0,Kh22:1;Iskander:2;Kinzhal:1
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,20,500,46,42,4,73,15,748,0,0,0,6,0,25,0,Kh101:1;Iskander:2;Kinzhal:1
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,20,500,46,41,5,80,13,681,0,0,0,5,0,34,0,Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,20,500,46,40,6,68,13,619,0,0,0,6,0,23,0,Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
batt20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,20,500,46,42,4,67,14,669,0,0,0,8,0,23,0,Kh101:1;Iskander:2;Kinzhal:1
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,20,500,46,40,6,79,12,555,0,0,0,10,0,31,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,20,500,46,40,6,71,14,626,0,0,0,4,0,29,0,Kh101:2;Kalibr:1;Zircon:1;Iskander:1;Kinzhal:1
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,20,500,46,42,4,65,14,528,0,0,0,5,0,22,0,Zircon:1;Iskander:1;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,20,500,46,42,4,79,15,632,0,0,0,10,0,30,0,Kh22:1;Iskander:1;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,20,500,46,41,5,74,14,687,0,0,0,6,0,27,0,Kh101:1;Iskander:2;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,20,500,46,39,7,83,15,689,0,0,0,9,0,34,0,Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,20,500,46,40,6,70,12,606,0,0,0,6,0,26,0,Kh101:2;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
batt20,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,20,500,46,43,3,72,16,636,0,0,0,5,0,28,0,Iskander:2;Kinzhal:1
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,50,500,46,45,1,83,28,418,0,0,0,7,0,32,0,Kh22:1
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,50,500,46,46,0,82,28,514,0,0,0,6,0,35,0,
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,50,500,46,46,0,77,27,523,0,0,0,3,0,35,0,
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,50,500,46,46,0,82,31,607,0,0,0,7,0,32,0,
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,50,500,46,46,0,87,29,707,0,0,0,10,0,40,0,
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,50,500,46,46,0,94,29,584,0,0,0,11,0,39,0,
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,50,500,46,42,4,82,31,523,0,0,0,4,0,37,0,Kh101:1;Kh22:1;Zircon:1;Kinzhal:1
batt50,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,50,500,46,46,0,75,26,695,0,0,0,4,0,33,0,
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,50,500,46,45,1,81,29,481,0,0,0,3,0,32,0,Zircon:1
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,50,500,46,45,1,85,29,501,0,0,0,2,0,42,0,Kinzhal:1
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,50,500,46,45,1,76,26,474,0,0,0,6,0,35,0,Kinzhal:1
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,50,500,46,46,0,77,29,617,0,0,0,4,0,32,0,
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,50,500,46,46,0,86,31,597,0,0,0,7,0,40,0,
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,50,500,46,44,2,91,31,821,0,0,0,10,0,42,0,Kh22:1;Kinzhal:1
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,50,500,46,43,3,79,28,523,0,0,0,4,0,34,0,Kh101:1;Zircon:1;Kinzhal:1
batt50,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,50,500,46,44,2,77,27,678,0,0,0,6,0,35,0,Zircon:1;Kinzhal:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,20,1500,46,44,2,68,14,2218,0,0,0,4,0,24,0,Iskander:1;Kinzhal:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,20,1500,46,43,3,70,20,2342,0,0,0,7,0,20,0,Kh101:1;Kalibr:1;Iskander:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,20,1500,46,44,2,70,20,2363,0,0,0,5,0,21,0,Iskander:2
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,20,1500,46,42,4,68,16,2387,0,0,0,5,0,25,0,Kh101:1;Kh22:1;Iskander:1;Kinzhal:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,20,1500,46,42,4,69,19,2635,0,0,0,5,0,23,0,Kh101:2;Iskander:1;Kinzhal:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,20,1500,46,38,8,76,18,2575,0,0,0,2,0,36,0,Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,20,1500,46,43,3,73,18,2361,0,0,0,6,0,25,0,Kh101:1;Kalibr:1;Kinzhal:1
far1500,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,20,1500,46,42,4,68,20,2544,0,0,0,4,0,26,0,Kh101:1;Iskander:2;Kinzhal:1
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,20,1500,46,44,2,67,16,2145,0,0,0,4,0,26,0,Iskander:1;Kinzhal:1
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,20,1500,46,42,4,65,17,2346,0,0,0,6,0,18,0,Kh101:1;Kalibr:1;Iskander:1;Kinzhal:1
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,20,1500,46,43,3,68,18,2358,0,0,0,5,0,21,0,Iskander:3
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,20,1500,46,41,5,70,16,2386,0,0,0,5,0,28,0,Kh101:1;Kh22:1;Iskander:1;Kinzhal:2
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,20,1500,46,42,4,71,19,2551,0,0,0,5,0,24,0,Kh101:2;Iskander:1;Kinzhal:1
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,20,1500,46,37,9,78,19,2579,0,0,0,3,0,38,0,Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,20,1500,46,43,3,75,20,2365,0,0,0,7,0,26,0,Kh101:1;Kinzhal:2
far1500,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,20,1500,46,42,4,67,18,2548,0,0,0,4,0,25,0,Kh101:1;Iskander:2;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,20,500,46,40,6,73,12,551,0,0,0,8,0,25,0,Geran3:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,20,500,46,38,8,81,14,681,7,0,0,3,0,33,0,Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,20,500,46,44,1,78,13,675,0,0,1,7,0,29,0,Kh101:1;Zircon:1;Iskander:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,20,500,46,42,4,77,15,515,3,2,0,8,0,24,0,Kh22:1;Iskander:3
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,20,500,46,42,4,65,15,469,1,0,0,4,0,22,0,Kh22:1;Iskander:2;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,20,500,46,43,3,68,13,612,0,0,0,3,0,22,0,Zircon:1;Iskander:1;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,20,500,46,43,3,64,15,546,0,0,0,5,0,16,0,Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
hills20,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,20,500,46,42,4,77,14,712,3,0,0,13,0,20,0,Iskander:2;Kinzhal:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,20,500,46,38,8,75,14,541,0,0,0,6,0,31,0,Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,20,500,46,39,6,77,14,633,5,0,1,3,0,31,0,Kh101:2;Iskander:3;Kinzhal:1
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,20,500,46,41,3,71,12,643,0,1,2,1,0,27,0,Kh101:1;Zircon:1;Iskander:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,20,500,46,39,7,75,16,520,3,2,0,3,0,28,0,Kh22:1;Iskander:4;Kinzhal:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,20,500,46,39,7,70,18,512,0,1,0,3,0,28,0,Kh101:1;Kh22:1;Iskander:3;Kinzhal:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,20,500,46,41,5,66,14,615,1,0,0,4,0,20,0,Kh101:1;Iskander:2;Kinzhal:2
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,20,500,46,41,5,76,14,579,0,0,0,8,0,28,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
hills20,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,20,500,46,41,5,70,14,653,0,0,0,6,0,26,0,Kh101:1;Zircon:1;Iskander:2;Kinzhal:2
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,1,20,200,46,41,5,75,16,350,0,0,0,2,0,32,0,Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,2,20,200,46,40,5,71,14,401,0,0,1,4,0,29,0,Kh101:2;Iskander:2;Kinzhal:1
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,3,20,200,46,39,6,60,12,344,0,0,1,2,0,22,0,Shahed:1;Kh101:2;Iskander:3
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,4,20,200,46,40,6,73,13,495,0,0,0,7,0,26,0,Geran3:1;Kh22:2;Iskander:2;Kinzhal:1
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,5,20,200,46,41,5,71,17,455,0,0,0,2,0,34,0,Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,6,20,200,46,39,7,71,13,450,0,0,0,4,0,29,0,Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,7,20,200,46,40,6,84,14,465,0,0,0,11,0,33,0,Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
near200,dc36d67eb740e6a9fb56224b32b007e3bf2512b9,8,20,200,46,38,8,67,15,563,0,0,0,4,0,31,0,Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,1,20,200,46,41,5,84,16,404,0,0,0,8,0,35,0,Geran3:1;Kh22:1;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,2,20,200,46,38,7,70,15,393,0,0,1,4,0,30,0,Shahed:1;Kh101:2;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,3,20,200,46,39,6,61,13,338,0,0,1,4,0,27,0,Shahed:1;Kh101:2;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,4,20,200,46,38,7,74,14,467,0,0,0,3,0,36,0,Geran3:1;Kh22:2;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,5,20,200,46,40,6,73,13,481,0,0,0,8,0,32,0,Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,6,20,200,46,38,8,66,14,540,0,0,0,2,0,27,0,Kh101:3;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,7,20,200,46,39,7,86,16,496,0,0,0,9,0,39,0,Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
near200,4b013fb7f30dbaa87a266b27a31911937fc523b4,8,20,200,46,38,8,73,15,585,0,0,0,4,0,34,0,Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
1 variant commit seed sams dist sent kills leaked missiles heavy ticks blocked scrubbed crashes fuse_miss expired orphaned energy_lost leaks_by_kind
2 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 10 500 46 37 9 62 9 812 0 0 0 4 1 23 0 Geran3:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
3 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 10 500 46 41 5 65 11 883 0 0 0 6 0 20 0 Shahed:1;Kh101:2;Kalibr:1;Iskander:1
4 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 10 500 46 39 7 56 6 740 0 0 0 4 0 18 0 Kalibr:2;Zircon:1;Iskander:3;Kinzhal:1
5 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 10 500 46 34 11 57 8 854 0 0 0 4 0 20 0 Geran3:2;Kh101:3;Kalibr:2;Kh22:1;Iskander:2;Kinzhal:1
6 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 10 500 46 39 7 67 6 914 0 0 0 7 0 26 0 Kh101:2;Kh22:1;Iskander:3;Kinzhal:1
7 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 10 500 46 36 10 73 11 977 0 0 0 7 0 30 0 Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:2;Kinzhal:2
8 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 10 500 46 35 11 63 6 802 0 0 0 7 0 23 0 Geran3:1;Kh101:2;Kalibr:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
9 batt10 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 10 500 46 40 6 61 8 979 0 0 0 3 0 21 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:2
10 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 10 500 46 36 10 58 9 825 0 0 0 4 0 20 0 Geran3:3;Kh101:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
11 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 10 500 46 38 8 64 10 892 0 0 0 4 0 23 0 Shahed:1;Kh101:2;Kalibr:2;Zircon:1;Iskander:2
12 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 10 500 46 38 8 62 8 714 0 0 0 7 0 23 0 Kalibr:2;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
13 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 10 500 46 35 10 61 8 902 0 0 0 4 0 24 0 Geran3:1;Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:2
14 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 10 500 46 36 9 62 6 896 0 0 0 6 0 27 0 Geran3:1;Kh101:2;Kh22:1;Iskander:4;Kinzhal:1
15 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 10 500 46 31 13 64 8 988 0 0 0 4 0 29 0 Geran3:1;Kh101:3;Kalibr:3;Zircon:1;Iskander:3;Kinzhal:2
16 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 10 500 46 36 9 60 9 921 0 0 0 5 0 20 0 Geran3:1;Kh101:3;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
17 batt10 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 10 500 46 40 6 63 7 979 0 0 0 5 0 22 0 Kh101:1;Zircon:1;Iskander:2;Kinzhal:2
18 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 20 500 46 42 4 75 13 578 0 0 0 10 1 22 0 Kalibr:1;Kh22:1;Iskander:1;Kinzhal:1
19 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 20 500 46 41 5 71 15 612 0 0 0 4 0 26 0 Kh101:2;Kalibr:1;Kinzhal:2
20 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 20 500 46 44 2 68 13 541 0 0 0 6 0 23 0 Zircon:1;Iskander:1
21 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 20 500 46 42 4 76 15 614 0 0 0 8 0 27 0 Kh22:1;Iskander:2;Kinzhal:1
22 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 20 500 46 42 4 73 15 748 0 0 0 6 0 25 0 Kh101:1;Iskander:2;Kinzhal:1
23 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 20 500 46 41 5 80 13 681 0 0 0 5 0 34 0 Kalibr:1;Zircon:1;Iskander:1;Kinzhal:2
24 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 20 500 46 40 6 68 13 619 0 0 0 6 0 23 0 Kh101:2;Kh22:1;Zircon:1;Kinzhal:2
25 batt20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 20 500 46 42 4 67 14 669 0 0 0 8 0 23 0 Kh101:1;Iskander:2;Kinzhal:1
26 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 20 500 46 40 6 79 12 555 0 0 0 10 0 31 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
27 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 20 500 46 40 6 71 14 626 0 0 0 4 0 29 0 Kh101:2;Kalibr:1;Zircon:1;Iskander:1;Kinzhal:1
28 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 20 500 46 42 4 65 14 528 0 0 0 5 0 22 0 Zircon:1;Iskander:1;Kinzhal:2
29 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 20 500 46 42 4 79 15 632 0 0 0 10 0 30 0 Kh22:1;Iskander:1;Kinzhal:2
30 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 20 500 46 41 5 74 14 687 0 0 0 6 0 27 0 Kh101:1;Iskander:2;Kinzhal:2
31 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 20 500 46 39 7 83 15 689 0 0 0 9 0 34 0 Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
32 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 20 500 46 40 6 70 12 606 0 0 0 6 0 26 0 Kh101:2;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
33 batt20 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 20 500 46 43 3 72 16 636 0 0 0 5 0 28 0 Iskander:2;Kinzhal:1
34 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 50 500 46 45 1 83 28 418 0 0 0 7 0 32 0 Kh22:1
35 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 50 500 46 46 0 82 28 514 0 0 0 6 0 35 0
36 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 50 500 46 46 0 77 27 523 0 0 0 3 0 35 0
37 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 50 500 46 46 0 82 31 607 0 0 0 7 0 32 0
38 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 50 500 46 46 0 87 29 707 0 0 0 10 0 40 0
39 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 50 500 46 46 0 94 29 584 0 0 0 11 0 39 0
40 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 50 500 46 42 4 82 31 523 0 0 0 4 0 37 0 Kh101:1;Kh22:1;Zircon:1;Kinzhal:1
41 batt50 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 50 500 46 46 0 75 26 695 0 0 0 4 0 33 0
42 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 50 500 46 45 1 81 29 481 0 0 0 3 0 32 0 Zircon:1
43 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 50 500 46 45 1 85 29 501 0 0 0 2 0 42 0 Kinzhal:1
44 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 50 500 46 45 1 76 26 474 0 0 0 6 0 35 0 Kinzhal:1
45 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 50 500 46 46 0 77 29 617 0 0 0 4 0 32 0
46 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 50 500 46 46 0 86 31 597 0 0 0 7 0 40 0
47 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 50 500 46 44 2 91 31 821 0 0 0 10 0 42 0 Kh22:1;Kinzhal:1
48 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 50 500 46 43 3 79 28 523 0 0 0 4 0 34 0 Kh101:1;Zircon:1;Kinzhal:1
49 batt50 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 50 500 46 44 2 77 27 678 0 0 0 6 0 35 0 Zircon:1;Kinzhal:1
50 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 20 1500 46 44 2 68 14 2218 0 0 0 4 0 24 0 Iskander:1;Kinzhal:1
51 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 20 1500 46 43 3 70 20 2342 0 0 0 7 0 20 0 Kh101:1;Kalibr:1;Iskander:1
52 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 20 1500 46 44 2 70 20 2363 0 0 0 5 0 21 0 Iskander:2
53 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 20 1500 46 42 4 68 16 2387 0 0 0 5 0 25 0 Kh101:1;Kh22:1;Iskander:1;Kinzhal:1
54 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 20 1500 46 42 4 69 19 2635 0 0 0 5 0 23 0 Kh101:2;Iskander:1;Kinzhal:1
55 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 20 1500 46 38 8 76 18 2575 0 0 0 2 0 36 0 Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
56 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 20 1500 46 43 3 73 18 2361 0 0 0 6 0 25 0 Kh101:1;Kalibr:1;Kinzhal:1
57 far1500 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 20 1500 46 42 4 68 20 2544 0 0 0 4 0 26 0 Kh101:1;Iskander:2;Kinzhal:1
58 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 20 1500 46 44 2 67 16 2145 0 0 0 4 0 26 0 Iskander:1;Kinzhal:1
59 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 20 1500 46 42 4 65 17 2346 0 0 0 6 0 18 0 Kh101:1;Kalibr:1;Iskander:1;Kinzhal:1
60 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 20 1500 46 43 3 68 18 2358 0 0 0 5 0 21 0 Iskander:3
61 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 20 1500 46 41 5 70 16 2386 0 0 0 5 0 28 0 Kh101:1;Kh22:1;Iskander:1;Kinzhal:2
62 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 20 1500 46 42 4 71 19 2551 0 0 0 5 0 24 0 Kh101:2;Iskander:1;Kinzhal:1
63 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 20 1500 46 37 9 78 19 2579 0 0 0 3 0 38 0 Kh101:2;Kalibr:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
64 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 20 1500 46 43 3 75 20 2365 0 0 0 7 0 26 0 Kh101:1;Kinzhal:2
65 far1500 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 20 1500 46 42 4 67 18 2548 0 0 0 4 0 25 0 Kh101:1;Iskander:2;Kinzhal:1
66 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 20 500 46 40 6 73 12 551 0 0 0 8 0 25 0 Geran3:1;Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:1
67 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 20 500 46 38 8 81 14 681 7 0 0 3 0 33 0 Kh101:2;Kalibr:1;Kh22:1;Iskander:3;Kinzhal:1
68 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 20 500 46 44 1 78 13 675 0 0 1 7 0 29 0 Kh101:1;Zircon:1;Iskander:1
69 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 20 500 46 42 4 77 15 515 3 2 0 8 0 24 0 Kh22:1;Iskander:3
70 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 20 500 46 42 4 65 15 469 1 0 0 4 0 22 0 Kh22:1;Iskander:2;Kinzhal:1
71 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 20 500 46 43 3 68 13 612 0 0 0 3 0 22 0 Zircon:1;Iskander:1;Kinzhal:1
72 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 20 500 46 43 3 64 15 546 0 0 0 5 0 16 0 Kh22:1;Zircon:1;Iskander:1;Kinzhal:1
73 hills20 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 20 500 46 42 4 77 14 712 3 0 0 13 0 20 0 Iskander:2;Kinzhal:2
74 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 20 500 46 38 8 75 14 541 0 0 0 6 0 31 0 Kalibr:1;Kh22:1;Zircon:1;Iskander:3;Kinzhal:2
75 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 20 500 46 39 6 77 14 633 5 0 1 3 0 31 0 Kh101:2;Iskander:3;Kinzhal:1
76 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 20 500 46 41 3 71 12 643 0 1 2 1 0 27 0 Kh101:1;Zircon:1;Iskander:2
77 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 20 500 46 39 7 75 16 520 3 2 0 3 0 28 0 Kh22:1;Iskander:4;Kinzhal:2
78 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 20 500 46 39 7 70 18 512 0 1 0 3 0 28 0 Kh101:1;Kh22:1;Iskander:3;Kinzhal:2
79 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 20 500 46 41 5 66 14 615 1 0 0 4 0 20 0 Kh101:1;Iskander:2;Kinzhal:2
80 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 20 500 46 41 5 76 14 579 0 0 0 8 0 28 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
81 hills20 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 20 500 46 41 5 70 14 653 0 0 0 6 0 26 0 Kh101:1;Zircon:1;Iskander:2;Kinzhal:2
82 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 1 20 200 46 41 5 75 16 350 0 0 0 2 0 32 0 Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
83 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 2 20 200 46 40 5 71 14 401 0 0 1 4 0 29 0 Kh101:2;Iskander:2;Kinzhal:1
84 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 3 20 200 46 39 6 60 12 344 0 0 1 2 0 22 0 Shahed:1;Kh101:2;Iskander:3
85 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 4 20 200 46 40 6 73 13 495 0 0 0 7 0 26 0 Geran3:1;Kh22:2;Iskander:2;Kinzhal:1
86 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 5 20 200 46 41 5 71 17 455 0 0 0 2 0 34 0 Kh101:1;Kh22:1;Iskander:2;Kinzhal:1
87 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 6 20 200 46 39 7 71 13 450 0 0 0 4 0 29 0 Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
88 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 7 20 200 46 40 6 84 14 465 0 0 0 11 0 33 0 Kh101:1;Kh22:1;Zircon:1;Iskander:1;Kinzhal:2
89 near200 dc36d67eb740e6a9fb56224b32b007e3bf2512b9 8 20 200 46 38 8 67 15 563 0 0 0 4 0 31 0 Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
90 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 1 20 200 46 41 5 84 16 404 0 0 0 8 0 35 0 Geran3:1;Kh22:1;Iskander:2;Kinzhal:2
91 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 2 20 200 46 38 7 70 15 393 0 0 1 4 0 30 0 Shahed:1;Kh101:2;Iskander:2;Kinzhal:2
92 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 3 20 200 46 39 6 61 13 338 0 0 1 4 0 27 0 Shahed:1;Kh101:2;Iskander:2;Kinzhal:2
93 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 4 20 200 46 38 7 74 14 467 0 0 0 3 0 36 0 Geran3:1;Kh22:2;Iskander:2;Kinzhal:2
94 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 5 20 200 46 40 6 73 13 481 0 0 0 8 0 32 0 Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:1
95 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 6 20 200 46 38 8 66 14 540 0 0 0 2 0 27 0 Kh101:3;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
96 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 7 20 200 46 39 7 86 16 496 0 0 0 9 0 39 0 Kh101:1;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
97 near200 4b013fb7f30dbaa87a266b27a31911937fc523b4 8 20 200 46 38 8 73 15 585 0 0 0 4 0 34 0 Kh101:2;Kh22:1;Zircon:1;Iskander:2;Kinzhal:2
+150
View File
@@ -0,0 +1,150 @@
{
"schema": 1,
"world": "ColdLaunch129",
"scenario": "pair129",
"scenario_seed": 965460218386186365,
"scenario_file": "scenario 1 / sam s400 1.5 72 8.5 / roles s400 31 / wave 0,0,0,0,0,0,1,0,0,0,0 0 900 0 1",
"director": "/airdef replay export <name> best fps=30 size=1280x720 crf=16 sec=24",
"launch_shot_start_frame": 94,
"launch_shot_start_seconds": 3.1,
"center_region": "x 590..689, y 300..419 in 1280x720",
"center_threshold": 100.0,
"before": {
"code_commit": "dc36d67eb740e6a9fb56224b32b007e3bf2512b9",
"artifact_sha256": "2d828aa8b865c8d5e6ba52be91c4d6b380811151fb85335cac80f3cbffbd9175",
"source_mp4": "/private/tmp/issue-129-pair-base/airdef-films/pair129-before.mp4",
"source_sha256": "fdc828199666fa986effd4feafb8e90b9d2646f64f7f4d4ac1afd90de5002301",
"source_size": 17268968,
"probe": {
"programs": [],
"stream_groups": [],
"streams": [
{
"codec_name": "h264",
"width": 1280,
"height": 720,
"r_frame_rate": "30/1",
"nb_frames": "403"
},
{
"codec_name": "aac",
"sample_rate": "48000",
"r_frame_rate": "0/0",
"nb_frames": "631"
}
],
"format": {
"duration": "13.433333",
"size": "17268968"
}
},
"center_illumination_frame": 101,
"center_illumination_seconds_after_launch": 0.23333333333333334,
"launch_shot_end_frame": 151,
"cold_ticks": 5,
"cold_spec_seconds": 0.25,
"audio_rms_window_s": 0.05,
"audio_onset_threshold_rms": 0.03,
"audio_onset_s": 3.45,
"audio_onset_after_launch_s": 0.35
},
"after": {
"code_commit": "00f0209942868a10624117abb799b56407e96d5f",
"artifact_sha256": "ca3bdd305f0149f627a8d733c148525421c987c5486fc246664ad6c980c1f680",
"source_mp4": "/private/tmp/issue-129-pair-after/airdef-films/pair129-after.mp4",
"source_sha256": "fb381cce5d83cb98eb43ba35d8434bc2f3e514970cf418fd301366a14f8c80ca",
"source_size": 17832718,
"probe": {
"programs": [],
"stream_groups": [],
"streams": [
{
"codec_name": "h264",
"width": 1280,
"height": 720,
"r_frame_rate": "30/1",
"nb_frames": "412"
},
{
"codec_name": "aac",
"sample_rate": "48000",
"r_frame_rate": "0/0",
"nb_frames": "645"
}
],
"format": {
"duration": "13.733333",
"size": "17832718"
}
},
"center_illumination_frame": 121,
"center_illumination_seconds_after_launch": 0.9,
"launch_shot_end_frame": 160,
"cold_ticks": 20,
"cold_spec_seconds": 1.0,
"audio_rms_window_s": 0.05,
"audio_onset_threshold_rms": 0.03,
"audio_onset_s": 4.15,
"audio_onset_after_launch_s": 1.05,
"code_commit_note": "hmod identity 00f020994; the code is the same as 4b013fb7 (only docs changed after it)"
},
"docs_copies": {
"before_mp4": {
"path": "docs/media/cold-launch/cold-launch-129-before.mp4",
"size": 5831407,
"sha256": "ef5fb96738d5092f0282ac1c5d0ab241eb2ba8dc2114a8f466b1151b2a9c639e",
"probe": {
"programs": [],
"stream_groups": [],
"streams": [
{
"codec_name": "h264",
"width": 1280,
"height": 720,
"r_frame_rate": "30/1",
"nb_frames": "403"
},
{
"codec_name": "aac",
"sample_rate": "48000",
"r_frame_rate": "0/0",
"nb_frames": "631"
}
],
"format": {
"duration": "13.433333",
"size": "5831407"
}
}
},
"after_mp4": {
"path": "docs/media/cold-launch/cold-launch-129-after.mp4",
"size": 6137154,
"sha256": "d165b2d2ac3c79dd8c57fb1cc477e1ae5ec43ab92b8bab6e9a6a5ffe3d315d98",
"probe": {
"programs": [],
"stream_groups": [],
"streams": [
{
"codec_name": "h264",
"width": 1280,
"height": 720,
"r_frame_rate": "30/1",
"nb_frames": "412"
},
{
"codec_name": "aac",
"sample_rate": "48000",
"r_frame_rate": "0/0",
"nb_frames": "645"
}
],
"format": {
"duration": "13.733333",
"size": "6137154"
}
}
},
"note": "re-encoded h264 crf 26 for storage; frame count, frame rate, duration and AAC track preserved"
}
}
@@ -0,0 +1,27 @@
{
"audio_ms_per_tick": 50,
"audio_sha256": "8b5eeabb2585e2d8b2524a9fe992b028b2eba8c413f5c822d2a68ef352689b25",
"capture_reset": "next capture produced exact zero samples",
"channels": 2,
"command": "HORIZON_ACOUSTICS_OUT=/scratch cargo test --release --manifest-path horizon/Cargo.toml -p horizon-client --no-default-features --lib -j 2 audio::tests::export_moving_mass_raid -- --ignored --nocapture",
"fixture_commit": "e44ad82a9",
"gpu_or_windows_fps_measured": false,
"machine": "Apple M5 / macOS arm64",
"max_direct_cells_per_tick": 4056,
"max_echo_cells_per_tick": 36835,
"max_sources": 116,
"output_device": false,
"profile": "release",
"rate": 48000,
"real_mp4_checked": false,
"rust": "1.99.1",
"sample_determinism": "two full runs compared sample-for-sample in the test",
"schema": 1,
"scope": "synthetic geometry and samples through production Audio::tick_acoustics and film_mix, excludes game snapshot construction and GPU/encoder",
"seconds": 6,
"step_plus_mix_ms_max": 5.573375,
"step_plus_mix_ms_p50": 3.551625,
"step_plus_mix_ms_p95": 4.297167,
"synthetic": true,
"ticks": 120
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 948 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

+1 -1
Submodule horizon updated: f95f03c08e...278f356aa6
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""Export authored aircraft silhouettes; run gen_models.py after editing."""
import math
import gen_models as g
from pilot_models import export
def lancet():
# Keep the former fuselage length, two X-wing stations and propeller origin.
p = g.ogive(-16, -10, 2.0, "lancet", 4) + g.oct_z(-10, 20, 2.0, "lancet")
p += [g.B(-1.2, 5.2, -14, 1.2, 6.4, -9, "bare_lamp"),
g.B(-0.8, 5.05, -13.4, 0.8, 5.2, -10, "dark_metal"),
g.B(-0.8, 9.9, -6, 0.8, 10.1, 5, "dark_metal")]
# Individual short diagonal panels approximate swept wings while keeping the
# former maximum span. Each piece rotates around its own centre.
for z0, z1, span in [(-5, 1, 13), (12, 18, 11)]:
for sign_x in (-1, 1):
for sign_y in (-1, 1):
angle = 45 * sign_x * sign_y
for i in range(4):
lo, hi = span * i / 4, span * (i + 1) / 4
mid = (lo + hi) / (2 * math.sqrt(2))
half = (hi - lo) / 2 + .08
sweep = (i / 4) * 2.0
p.append(g.B(sign_x * mid - half, 8 + sign_y * mid - .22, z0 + sweep,
sign_x * mid + half, 8 + sign_y * mid + .22, z1 - .5 * sweep,
"lancet", rot=("z", angle)))
p += g.oct_z(20, 24, 1.5, "dark_metal")
p += [g.B(-5, 7.85, 24, 5, 8.15, 24.5, "prop"),
g.B(-.15, 3, 24, .15, 13, 24.5, "prop")]
return p
def kh101():
# Retain the existing low body, underbody pod and tail locations. Sweep the
# deployed wings in short panels and add restrained seams to the housing.
p = g.ogive(-16, -8, 2.9, "kh101", 4) + g.oct_z(-8, 27, 2.9, "kh101")
p = [dict(e, **{"from": [e["from"][0], e["from"][1] - .5, e["from"][2]],
"to": [e["to"][0], e["to"][1] - .5, e["to"][2]]}) for e in p]
for i in range(6):
x0 = 2.5 + i * 3
x1 = min(20.5, x0 + 3.05)
p += g.both(g.B(x0, 6.9, 2 + i * .65, x1, 7.5, 11 - i * .12,
"kh101", {"down": "kh101_belly"}))
p += [g.B(-.4, 10, 20, .4, 16, 28, "kh101")] + g.both(g.B(1.5, 6.9, 22, 8, 7.4, 28, "kh101"))
p += [g.B(-1.9, 3.2, 12, 1.9, 5.4, 26, "dark_metal"),
g.B(-1.6, 3.5, 11.4, 1.6, 5.1, 12, "bare_nozzle"),
g.B(-1.5, 3.6, 26, 1.5, 5, 28, "bare_nozzle"),
g.B(-1.1, 3.9, 28, 1.1, 4.7, 28.4, "glow_ember"),
g.B(-1, 10, -2, 1, 10.6, 10, "dark_metal")]
return p
if __name__ == "__main__":
for name, make in [("lancet", lancet), ("kh101", kh101)]:
parts = make()
export(name, parts)
print(name, len(parts), "elements")
+4 -2
View File
@@ -158,7 +158,7 @@ def test_wasm():
BUDGET_SCENARIO = "tests/budgets/wasm_flat_budget.toml"
BUDGET_ASSERTED_SHA256 = "bcc0359289ab20ab3de608bcc130f72d2cf88f9f6fbc470d7b6846e9db5d11df"
BUDGET_ASSERTED_SHA256 = "134cb4667691cf9faa639ed37120941d829cfc13ce45e9638582c409d9e0dd29"
def fuel_measurements(output):
@@ -280,8 +280,10 @@ def test_budgets():
report["status"] = "failed"
raise RuntimeError("pinned runtime did not return requested callback fuel counters")
# These assertions belong to this exact fixture, not to arbitrary edited scripts.
# Two `airdef wave oreshnik` orders plus two Smart orders through the UI launch
# path (`airdef preset` + `airdef raid`, the wave screen's ПУСК handler, #122).
if result.returncode == 0 and report["scenario_sha256"] == BUDGET_ASSERTED_SHA256:
counts["accepted_raids_asserted"] = 2
counts["accepted_raids_asserted"] = 4
counts["snapshot_airborne_asserted"] = 184
counts["snapshot_tick"] = 2102
except Exception as exc:
+324 -2
View File
@@ -1,8 +1,18 @@
"""Shared content identities and item presentation used by runtime and assets."""
import json
import math
import re
from pathlib import Path
PATH = Path(__file__).resolve().parents[2] / "catalog" / "content.json"
SPECS = PATH.parent / "specs.json"
FAMILIES = {"trainable", "gun", "turret", "vertical", "static", "truck", "light"}
CLASSES = {"drone", "jet", "cruise", "supersonic", "ballistic"}
MUZZLES = {"none", "patriot", "pantsir", "grid", "rails", "cells"}
ENGINES = {"prop": {"type", "back", "size"}, "jet": {"type", "up", "back", "size"},
"rocket": {"type", "back", "size"}}
MODEL = r"airdef:[a-z0-9_]+"
def load():
@@ -27,8 +37,6 @@ def load():
def load_sounds():
"""Load stable event IDs and engine attenuation metadata."""
import re
entries = json.loads((PATH.parent / "sounds.json").read_text(encoding="utf-8"))
seen = set()
for entry in entries:
@@ -47,6 +55,320 @@ def load_sounds():
return entries
def _exact(entry, keys, where):
if not isinstance(entry, dict) or set(entry) != set(keys):
got = sorted(entry) if isinstance(entry, dict) else type(entry).__name__
raise ValueError(f"{where}: expected keys {sorted(keys)}, got {got}")
def _number(value, where, minimum=None):
if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value):
raise ValueError(f"{where}: expected a finite number, got {value!r}")
if minimum is not None and value < minimum:
raise ValueError(f"{where}: {value!r} is below {minimum}")
return value
def _integer(value, where, minimum=0):
if isinstance(value, bool) or not isinstance(value, int) or value < minimum:
raise ValueError(f"{where}: expected an integer >= {minimum}, got {value!r}")
return value
def _text(value, where, pattern=None):
if not isinstance(value, str) or not value:
raise ValueError(f"{where}: expected a non-empty string")
if pattern and not re.fullmatch(pattern, value):
raise ValueError(f"{where}: {value!r} does not match {pattern}")
return value
def _sound(value, where, events):
_text(value, where, r"[a-z0-9_]+\.[a-z0-9_]+")
if value not in events:
raise ValueError(f"{where}: sound event {value!r} is not registered in sounds.json")
def _named_ref(value, where, named, kind):
_exact(value, {"ref"}, where)
name = value["ref"]
if name not in named or named[name]["kind"] != kind:
raise ValueError(f"{where}: unknown {kind} reference {name!r}")
return name
def _model_ref(value, where, named, kind):
return f"NAMED_{_named_ref(value, where, named, kind).upper()}"
def _parts(entry, where, named):
_exact(entry, {"body", "launcher", "pack", "dish", "fixed", "spinner"}, where)
_text(entry["body"], f"{where}.body", MODEL)
for slot in ("launcher", "pack"):
if entry[slot] is not None:
_text(entry[slot], f"{where}.{slot}", MODEL)
dish = entry["dish"]
if dish is not None:
if not isinstance(dish, list) or len(dish) != 4:
raise ValueError(f"{where}.dish: expected [model, height, forward, tilt]")
_text(dish[0], f"{where}.dish.model", MODEL)
for i, v in enumerate(dish[1:], 1):
_number(v, f"{where}.dish[{i}]")
fixed = entry["fixed"]
if isinstance(fixed, dict):
_named_ref(fixed, f"{where}.fixed", named, "fixed")
elif not isinstance(fixed, list):
raise ValueError(f"{where}.fixed: expected a list or a named reference")
else:
for i, piece in enumerate(fixed):
if not isinstance(piece, list) or len(piece) != 3:
raise ValueError(f"{where}.fixed[{i}]: expected [model, height, back]")
_text(piece[0], f"{where}.fixed[{i}].model", MODEL)
_number(piece[1], f"{where}.fixed[{i}].height")
_number(piece[2], f"{where}.fixed[{i}].back")
spinner = entry["spinner"]
if isinstance(spinner, dict):
_named_ref(spinner, f"{where}.spinner", named, "spinner")
elif spinner is not None:
if not isinstance(spinner, list) or len(spinner) != 5:
raise ValueError(f"{where}.spinner: expected [model, height, back, size, tilt]")
_text(spinner[0], f"{where}.spinner.model", MODEL)
for i, v in enumerate(spinner[1:], 1):
_number(v, f"{where}.spinner[{i}]")
def _muzzle(entry, where):
if not isinstance(entry, dict) or entry.get("type") not in MUZZLES:
raise ValueError(f"{where}: expected one of {sorted(MUZZLES)}")
kind = entry["type"]
keys = {"grid": {"type", "cols", "rows", "size"}, "rails": {"type", "xs"}}.get(kind, {"type"})
_exact(entry, keys, where)
if kind == "grid":
_integer(entry["cols"], f"{where}.cols", 1)
_integer(entry["rows"], f"{where}.rows", 1)
_number(entry["size"], f"{where}.size", 0)
elif kind == "rails":
xs = entry["xs"]
if not isinstance(xs, list) or not xs:
raise ValueError(f"{where}.xs: expected a non-empty list")
for i, v in enumerate(xs):
_number(v, f"{where}.xs[{i}]")
def _rest_pitch(entry, where):
if isinstance(entry, dict):
_exact(entry, {"half_pi"}, where)
_number(entry["half_pi"], f"{where}.half_pi")
else:
_number(entry, where)
def load_specs():
"""Load the numeric profiles shared by Rust and Python, validating every reference."""
return validate_specs(json.loads(SPECS.read_text(encoding="utf-8")), load(),
{entry["event"] for entry in load_sounds()})
def validate_specs(data, content, events):
"""Check a specs document against the content identities and registered sound events.
Nothing here names a unit or aircraft kind: a new type only needs its catalog entry.
"""
_exact(data, {"shared", "drones", "units", "missiles", "named"}, "specs.json")
shared = data["shared"]
_exact(shared, {"mobility", "flight", "logistics"}, "shared")
_exact(shared["mobility"], {"drive_scale", "drive_ramp", "trainable", "vertical", "other"}, "shared.mobility")
_number(shared["mobility"]["drive_scale"], "shared.mobility.drive_scale", 0)
_number(shared["mobility"]["drive_ramp"], "shared.mobility.drive_ramp", 0)
for family in ("trainable", "vertical", "other"):
axes = shared["mobility"][family]
if not isinstance(axes, list) or len(axes) != 2:
raise ValueError(f"shared.mobility.{family}: expected [yaw, pitch]")
for i, v in enumerate(axes):
_number(v, f"shared.mobility.{family}[{i}]")
_exact(shared["flight"], {"gravity", "block_split"}, "shared.flight")
_number(shared["flight"]["gravity"], "shared.flight.gravity", 0)
_number(shared["flight"]["block_split"], "shared.flight.block_split", 0)
_exact(shared["logistics"], {"depot_reach", "handover", "truck_load", "stock_limit"}, "shared.logistics")
_number(shared["logistics"]["depot_reach"], "shared.logistics.depot_reach", 0)
_number(shared["logistics"]["handover"], "shared.logistics.handover", 0)
_integer(shared["logistics"]["truck_load"], "shared.logistics.truck_load", 1)
_integer(shared["logistics"]["stock_limit"], "shared.logistics.stock_limit", 1)
named = data["named"]
if not isinstance(named, dict):
raise ValueError("named: expected an object")
referenced = set()
for name, entry in named.items():
where = f"named.{name}"
_exact(entry, {"kind", "value"}, where)
value = entry["value"]
if not isinstance(value, list):
raise ValueError(f"{where}.value: expected a list")
if entry["kind"] == "fixed":
for i, piece in enumerate(value):
if not isinstance(piece, list) or len(piece) != 3:
raise ValueError(f"{where}.value[{i}]: expected [model, height, back]")
_text(piece[0], f"{where}.value[{i}].model", MODEL)
_number(piece[1], f"{where}.value[{i}].height")
_number(piece[2], f"{where}.value[{i}].back")
elif entry["kind"] == "spinner":
if len(value) != 5:
raise ValueError(f"{where}: expected [model, height, back, size, tilt]")
_text(value[0], f"{where}.model", MODEL)
for i, v in enumerate(value[1:], 1):
_number(v, f"{where}[{i}]")
elif entry["kind"] == "pivot":
if len(value) != 3:
raise ValueError(f"{where}: expected [x, y, z]")
for i, v in enumerate(value):
_number(v, f"{where}[{i}]")
else:
raise ValueError(f"{where}.kind: expected fixed, spinner or pivot")
missile_kinds = set()
for i, entry in enumerate(data["missiles"]):
where = f"missiles[{i}]"
_exact(entry, {"kind", "model", "speed", "accel", "turn", "boost", "cold", "eject", "eject_drag",
"pk", "fuse", "life", "scale", "flame", "rear", "seeker", "launch_sound", "voice"}, where)
kind = _text(entry["kind"], f"{where}.kind", r"[A-Z][A-Za-z0-9]*")
if kind in missile_kinds:
raise ValueError(f"{where}: duplicate missile kind {kind}")
missile_kinds.add(kind)
_text(entry["model"], f"{where}.model", MODEL)
for field in ("speed", "accel", "turn", "pk", "fuse", "scale", "flame", "rear", "seeker"):
_number(entry[field], f"{where}.{field}", 0)
_integer(entry["boost"], f"{where}.boost")
_integer(entry["cold"], f"{where}.cold")
_number(entry["eject"], f"{where}.eject", 0)
_number(entry["eject_drag"], f"{where}.eject_drag", 0)
_integer(entry["life"], f"{where}.life", 1)
_sound(entry["launch_sound"], f"{where}.launch_sound", events)
_exact(entry["voice"], {"event", "gain", "pitch"}, f"{where}.voice")
_sound(entry["voice"]["event"], f"{where}.voice.event", events)
_number(entry["voice"]["gain"], f"{where}.voice.gain", 0)
_number(entry["voice"]["pitch"], f"{where}.voice.pitch", 0)
drone_kinds = []
keys = set()
for i, entry in enumerate(data["drones"]):
where = f"drones[{i}]"
_exact(entry, {"kind", "key", "name", "model", "speed", "turn", "cruise", "clearance", "dive",
"warhead", "scale", "engine", "decoy", "stealth", "sound", "class", "ballistic",
"rcs", "launch_sound"}, where)
kind = _text(entry["kind"], f"{where}.kind", r"[A-Z][A-Za-z0-9]*")
drone_kinds.append(kind)
key = _text(entry["key"], f"{where}.key", r"[a-z0-9_]+")
if key in keys:
raise ValueError(f"{where}: duplicate key {key}")
keys.add(key)
_text(entry["name"], f"{where}.name")
_text(entry["model"], f"{where}.model", MODEL)
for field in ("speed", "turn", "cruise", "clearance", "dive", "scale", "stealth", "rcs"):
_number(entry[field], f"{where}.{field}", 0)
_integer(entry["warhead"], f"{where}.warhead")
if not isinstance(entry["decoy"], bool):
raise ValueError(f"{where}.decoy: expected a boolean")
engine = entry["engine"]
if not isinstance(engine, dict) or engine.get("type") not in ENGINES:
raise ValueError(f"{where}.engine: expected one of {sorted(ENGINES)}")
_exact(engine, ENGINES[engine["type"]], f"{where}.engine")
for field in ENGINES[engine["type"]] - {"type"}:
_number(engine[field], f"{where}.engine.{field}")
_exact(entry["sound"], {"event", "pitch", "interval"}, f"{where}.sound")
_sound(entry["sound"]["event"], f"{where}.sound.event", events)
_number(entry["sound"]["pitch"], f"{where}.sound.pitch", 0)
_integer(entry["sound"]["interval"], f"{where}.sound.interval", 1)
if entry["class"] not in CLASSES:
raise ValueError(f"{where}.class: expected one of {sorted(CLASSES)}")
if entry["ballistic"] is not None:
_number(entry["ballistic"], f"{where}.ballistic", 0)
_sound(entry["launch_sound"], f"{where}.launch_sound", events)
unit_kinds = []
used_missiles = set()
for i, entry in enumerate(data["units"]):
where = f"units[{i}]"
_exact(entry, {"kind", "key", "name", "missile", "gun", "reload", "scale", "rest_pitch",
"roles", "family", "parts", "mount", "pivot", "muzzle", "sensor", "mast"}, where)
kind = _text(entry["kind"], f"{where}.kind", r"[A-Z][A-Za-z0-9]*")
unit_kinds.append(kind)
key = _text(entry["key"], f"{where}.key", r"[a-z0-9_]+")
if key in keys:
raise ValueError(f"{where}: duplicate key {key}")
keys.add(key)
_text(entry["name"], f"{where}.name")
_integer(entry["reload"], f"{where}.reload")
_number(entry["scale"], f"{where}.scale", 0)
_rest_pitch(entry["rest_pitch"], f"{where}.rest_pitch")
_integer(entry["roles"], f"{where}.roles")
if entry["roles"] > 0x1F:
raise ValueError(f"{where}.roles: mask out of range")
if entry["family"] not in FAMILIES:
raise ValueError(f"{where}.family: expected one of {sorted(FAMILIES)}")
_parts(entry["parts"], f"{where}.parts", named)
if not isinstance(entry["mount"], list) or len(entry["mount"]) != 2:
raise ValueError(f"{where}.mount: expected [up, forward]")
for j, v in enumerate(entry["mount"]):
_number(v, f"{where}.mount[{j}]")
pivot = entry["pivot"]
if isinstance(pivot, dict):
_model_ref(pivot, f"{where}.pivot", named, "pivot")
elif not isinstance(pivot, list) or len(pivot) != 3:
raise ValueError(f"{where}.pivot: expected [x, y, z] or a named reference")
else:
for j, v in enumerate(pivot):
_number(v, f"{where}.pivot[{j}]")
_muzzle(entry["muzzle"], f"{where}.muzzle")
_number(entry["sensor"], f"{where}.sensor", 0)
_number(entry["mast"], f"{where}.mast", 0)
missile = entry["missile"]
if missile is not None:
_exact(missile, {"kind", "magazine", "min", "max", "interval"}, f"{where}.missile")
used_missiles.add(_text(missile["kind"], f"{where}.missile.kind", r"[A-Z][A-Za-z0-9]*"))
_integer(missile["magazine"], f"{where}.missile.magazine", 1)
_number(missile["min"], f"{where}.missile.min", 0)
_number(missile["max"], f"{where}.missile.max", 0)
_integer(missile["interval"], f"{where}.missile.interval", 1)
gun = entry["gun"]
if gun is not None:
_exact(gun, {"range", "track", "p", "bursts", "shell", "slew"}, f"{where}.gun")
for field in ("range", "track", "p", "shell"):
_number(gun[field], f"{where}.gun.{field}", 0)
_integer(gun["bursts"], f"{where}.gun.bursts", 1)
if not isinstance(gun["slew"], list) or len(gun["slew"]) != 2:
raise ValueError(f"{where}.gun.slew: expected [yaw, pitch]")
for j, v in enumerate(gun["slew"]):
_number(v, f"{where}.gun.slew[{j}]", 0)
if set(drone_kinds) != {entry["kind"] for entry in content["aircraft"]}:
raise ValueError("specs.json drones and content.json aircraft disagree")
if len(drone_kinds) != len(content["aircraft"]):
raise ValueError("specs.json drones and content.json aircraft differ in count")
if set(unit_kinds) != {entry["kind"] for entry in content["units"]}:
raise ValueError("specs.json units and content.json units disagree")
if len(unit_kinds) != len(content["units"]):
raise ValueError("specs.json units and content.json units differ in count")
missing = used_missiles - missile_kinds
if missing:
raise ValueError(f"units reference missiles without a profile: {sorted(missing)}")
unused = missile_kinds - used_missiles
if unused:
raise ValueError(f"missile profiles are not carried by any unit: {sorted(unused)}")
for entry in data["units"]:
parts = entry["parts"]
for slot in ("fixed", "spinner"):
if isinstance(parts[slot], dict):
referenced.add(parts[slot]["ref"])
if isinstance(entry["pivot"], dict):
referenced.add(entry["pivot"]["ref"])
idle = set(named) - referenced
if idle:
raise ValueError(f"named part profiles are not referenced: {sorted(idle)}")
return data
def sound_events(entries):
"""Build the Minecraft sound event registry without generating audio."""
events = {}
+270 -2
View File
@@ -4,9 +4,17 @@ import argparse
from pathlib import Path
import re
from airdef_assets.catalog import load, load_sounds
from airdef_assets.catalog import load, load_specs, load_sounds
OUTPUT = Path(__file__).resolve().parents[1] / "airdef-mod/src/sim/catalog_entries.rs"
SPEC_OUTPUT = OUTPUT.with_name("specs_generated.rs")
UNIT_SPEC_OUTPUT = OUTPUT.with_name("unit_specs_generated.rs")
CLASSES = {"drone": "Drone", "jet": "Jet", "cruise": "Cruise", "supersonic": "Supersonic",
"ballistic": "Ballistic"}
FAMILIES = {"trainable": "Trainable", "gun": "Gun", "turret": "Turret", "vertical": "Vertical",
"static": "Static", "truck": "Truck", "light": "Light"}
SOUND_PREFIX = "sound::"
def generate(data):
@@ -40,12 +48,272 @@ def generate_sound_ids(entries):
return "\n".join(lines + [""])
def num(value):
"""A Rust float literal that round-trips the catalog value exactly."""
value = float(value)
text = repr(value)
return text.replace("e+", "e")
def integer(value):
return str(int(value))
def text(value):
return '"' + value.replace("\\", "\\\\").replace('"', '\\"') + '"'
def sound_ref(event):
return SOUND_PREFIX + event.replace(".", "_").upper()
def parts_value(parts, indent):
pad = " " * indent
lines = [pad + "parts: Parts {"]
inner = " " * (indent + 4)
lines.append(f"{inner}body: {text(parts['body'])},")
for slot in ("launcher", "pack"):
value = parts[slot]
lines.append(f"{inner}{slot}: " + (f"Some({text(value)})" if value is not None else "None") + ",")
dish = parts["dish"]
if dish is None:
lines.append(f"{inner}dish: None,")
else:
lines.append(f"{inner}dish: Some(({text(dish[0])}, {', '.join(num(v) for v in dish[1:])})),")
fixed = parts["fixed"]
if isinstance(fixed, dict):
lines.append(f"{inner}fixed: NAMED_{fixed['ref'].upper()},")
else:
pieces = ", ".join(f"({text(piece[0])}, {num(piece[1])}, {num(piece[2])})" for piece in fixed)
lines.append(f"{inner}fixed: &[{pieces}],")
spinner = parts["spinner"]
if isinstance(spinner, dict):
lines.append(f"{inner}spinner: NAMED_{spinner['ref'].upper()},")
elif spinner is None:
lines.append(f"{inner}spinner: None,")
else:
lines.append(f"{inner}spinner: Some(({text(spinner[0])}, {', '.join(num(v) for v in spinner[1:])})),")
lines.append(pad + "},")
return lines
def pivot_value(pivot):
if isinstance(pivot, dict):
return f"NAMED_{pivot['ref'].upper()}"
if all(float(v) == 0.0 for v in pivot):
return "DVec3::ZERO"
return f"DVec3::new({', '.join(num(v) for v in pivot)})"
def muzzle_value(muzzle):
kind = muzzle["type"]
if kind == "grid":
return f"Muzzle::Grid({muzzle['cols']}, {muzzle['rows']}, {num(muzzle['size'])})"
if kind == "rails":
return f"Muzzle::Rails(&[{', '.join(num(v) for v in muzzle['xs'])}])"
return "Muzzle::" + {"none": "None", "patriot": "Patriot", "pantsir": "Pantsir", "cells": "Cells"}[kind]
def rest_pitch_value(pitch):
if isinstance(pitch, dict):
offset = float(pitch["half_pi"])
if offset == 0.0:
return "HALF_PI"
if offset < 0.0:
return f"HALF_PI - {num(-offset)}"
return f"HALF_PI + {num(offset)}"
return num(pitch)
def drone_profile(entry):
engine = entry["engine"]
if engine["type"] == "prop":
motor = f"Engine::Prop({num(engine['back'])}, {num(engine['size'])})"
elif engine["type"] == "jet":
motor = f"Engine::Jet({num(engine['up'])}, {num(engine['back'])}, {num(engine['size'])})"
else:
motor = f"Engine::Rocket({num(engine['back'])}, {num(engine['size'])})"
sound = entry["sound"]
ballistic = "None" if entry["ballistic"] is None else f"Some({num(entry['ballistic'])})"
lines = [f"const DRONE_SPEC_{entry['kind'].upper()}: DroneSpec = DroneSpec {{",
f" name: {text(entry['name'])},",
f" key: {text(entry['key'])},",
f" model: {text(entry['model'])},",
f" speed: {num(entry['speed'])},",
f" turn: {num(entry['turn'])},",
f" cruise: {num(entry['cruise'])},",
f" clearance: {num(entry['clearance'])},",
f" dive: {num(entry['dive'])},",
f" warhead: {integer(entry['warhead'])},",
f" scale: {num(entry['scale'])},",
f" engine: {motor},",
f" decoy: {str(entry['decoy']).lower()},",
f" stealth: {num(entry['stealth'])},",
f" rcs: {num(entry['rcs'])},",
f" sound: ({sound_ref(sound['event'])}, {num(sound['pitch'])}, {integer(sound['interval'])}),",
f" class: Class::{CLASSES[entry['class']]},",
f" ballistic: {ballistic},",
f" launch_sound: {sound_ref(entry['launch_sound'])},",
"};"]
return "\n".join(lines)
def missile_profile(entry):
voice = entry["voice"]
lines = [f"const MISSILE_SPEC_{entry['kind'].upper()}: MissileSpec = MissileSpec {{",
f" model: {text(entry['model'])},",
f" speed: {num(entry['speed'])},",
f" accel: {num(entry['accel'])},",
f" turn: {num(entry['turn'])},",
f" boost: {integer(entry['boost'])},",
f" cold: {integer(entry['cold'])},",
f" eject: {num(entry['eject'])},",
f" eject_drag: {num(entry['eject_drag'])},",
f" pk: {num(entry['pk'])},",
f" fuse: {num(entry['fuse'])},",
f" life: {integer(entry['life'])},",
f" scale: {num(entry['scale'])},",
f" flame: {num(entry['flame'])},",
f" rear: {num(entry['rear'])},",
f" seeker: {num(entry['seeker'])},",
f" launch_sound: {sound_ref(entry['launch_sound'])},",
f" voice: ({sound_ref(voice['event'])}, {num(voice['gain'])}, {num(voice['pitch'])}),",
"};"]
return "\n".join(lines)
def unit_profile(entry):
missile = entry["missile"]
gun = entry["gun"]
if missile is None:
missile_expr = "None"
else:
missile_expr = (f"Some(MissileLoad {{ kind: MissileKind::{missile['kind']}, magazine: {integer(missile['magazine'])}, "
f"min: {num(missile['min'])}, max: {num(missile['max'])}, interval: {integer(missile['interval'])} }})")
if gun is None:
gun_expr = "None"
else:
gun_expr = (f"Some(GunSpec {{ range: {num(gun['range'])}, track: {num(gun['track'])}, p: {num(gun['p'])}, "
f"bursts: {integer(gun['bursts'])}, shell: {num(gun['shell'])}, "
f"slew: ({num(gun['slew'][0])}, {num(gun['slew'][1])}) }})")
lines = [f"const UNIT_SPEC_{entry['kind'].upper()}: SamSpec = SamSpec {{",
f" name: {text(entry['name'])},",
f" key: {text(entry['key'])},",
f" missile: {missile_expr},",
f" gun: {gun_expr},",
f" reload: {integer(entry['reload'])},",
f" scale: {num(entry['scale'])},",
f" rest_pitch: {rest_pitch_value(entry['rest_pitch'])},",
f" roles: {integer(entry['roles'])},",
f" family: Family::{FAMILIES[entry['family']]},"]
lines += parts_value(entry["parts"], 4)
lines += [f" mount: ({num(entry['mount'][0])}, {num(entry['mount'][1])}),",
f" pivot: {pivot_value(entry['pivot'])},",
f" muzzle: {muzzle_value(entry['muzzle'])},",
f" sensor: {num(entry['sensor'])},",
f" mast: {num(entry['mast'])},",
"};"]
return "\n".join(lines)
def generate_specs(data):
"""The simulation's numeric rows, generated for both the mod and airdef-core."""
shared = data["shared"]
lines = ["// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.",
"// Game-scale values, not real weapon data; the catalog is the only copy.",
"",
"/// Share of the old slew speed a launcher keeps when it has no rate of its own.",
f"const DRIVE_SCALE: f64 = {num(shared['mobility']['drive_scale'])};",
"/// Ticks a drive takes to reach its top speed (and to stop from it).",
f"const DRIVE_RAMP: f64 = {num(shared['mobility']['drive_ramp'])};"]
for family in ("trainable", "vertical", "other"):
axes = shared["mobility"][family]
lines.append(f"const DRIVE_{family.upper()}: (f64, f64) = ({num(axes[0])}, {num(axes[1])});")
lines += ["/// Ballistic flight's gravity, blocks a tick².",
f"const GRAVITY: f64 = {num(shared['flight']['gravity'])};",
"/// Height over the target where the Oreshnik's blocks release their submunitions.",
f"const BLOCK_SPLIT: f64 = {num(shared['flight']['block_split'])};",
"/// How near a depot a system reloads straight from it.",
f"const DEPOT_REACH: f64 = {num(shared['logistics']['depot_reach'])};",
"/// How near a truck must come to hand a reload over, or to load up at a depot.",
f"const HANDOVER: f64 = {num(shared['logistics']['handover'])};",
"/// What a truck carries.",
f"const TRUCK_LOAD: u32 = {integer(shared['logistics']['truck_load'])};",
f"const STOCK_LIMIT: u32 = {integer(shared['logistics']['stock_limit'])};",
""]
for entry in data["drones"]:
lines += [drone_profile(entry), ""]
for entry in data["missiles"]:
lines += [missile_profile(entry), ""]
lines += ["impl DroneKind {",
" /// Its row of numbers from `catalog/specs.json`.",
" pub fn spec(self) -> &'static DroneSpec {",
" match self {"]
for entry in data["drones"]:
lines.append(f" DroneKind::{entry['kind']} => &DRONE_SPEC_{entry['kind'].upper()},")
lines += [" }", " }", "}", "",
"impl MissileKind {",
" fn spec(self) -> &'static MissileSpec {",
" match self {"]
for entry in data["missiles"]:
lines.append(f" MissileKind::{entry['kind']} => &MISSILE_SPEC_{entry['kind'].upper()},")
lines += [" }", " }", "}", "",
"/// Save keys by kind; a rename needs an explicit migration.",
"#[cfg(test)]",
f"pub(super) const DRONE_SPEC_KEYS: [(DroneKind, &str); {len(data['drones'])}] = ["]
for entry in data["drones"]:
lines.append(f" (DroneKind::{entry['kind']}, {text(entry['key'])}),")
lines += ["];", "",
"#[cfg(test)]",
f"pub(super) const MISSILE_SPEC_MODELS: [(MissileKind, &str); {len(data['missiles'])}] = ["]
for entry in data["missiles"]:
lines.append(f" (MissileKind::{entry['kind']}, {text(entry['model'])}),")
return "\n".join(lines + ["];", ""])
def generate_unit_specs(data):
"""The deployed units' rows, generated where the unit types live."""
lines = ["// Generated by tools/gen_catalog.py from catalog/specs.json. Do not edit.",
"// Game-scale values, not real weapon data; the catalog is the only copy.",
""]
for name, entry in data["named"].items():
value = entry["value"]
if entry["kind"] == "fixed":
pieces = ", ".join(f"({text(piece[0])}, {num(piece[1])}, {num(piece[2])})" for piece in value)
lines.append(f"const NAMED_{name.upper()}: &[(&str, f64, f64)] = &[{pieces}];")
elif entry["kind"] == "spinner":
lines.append(f"const NAMED_{name.upper()}: Option<(&str, f64, f64, f64, f64)> = "
f"Some(({text(value[0])}, {', '.join(num(v) for v in value[1:])}));")
else:
lines.append(f"const NAMED_{name.upper()}: DVec3 = DVec3::new({', '.join(num(v) for v in value)});")
lines.append("")
for entry in data["units"]:
lines += [unit_profile(entry), ""]
lines += ["impl SamKind {",
" /// Its row of numbers from `catalog/specs.json`.",
" pub fn spec(self) -> &'static SamSpec {",
" match self {"]
for entry in data["units"]:
lines.append(f" SamKind::{entry['kind']} => &UNIT_SPEC_{entry['kind'].upper()},")
lines += [" }", " }", "}", "",
"/// Save keys by kind; a rename needs an explicit migration.",
"#[cfg(test)]",
f"pub(super) const UNIT_SPEC_KEYS: [(SamKind, &str); {len(data['units'])}] = ["]
for entry in data["units"]:
lines.append(f" (SamKind::{entry['kind']}, {text(entry['key'])}),")
return "\n".join(lines + ["];", ""])
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--check", action="store_true")
args = parser.parse_args()
sound_output = OUTPUT.with_name("catalog_sound_ids.rs")
outputs = ((OUTPUT, generate(load())), (sound_output, generate_sound_ids(load_sounds())))
specs = load_specs()
outputs = ((OUTPUT, generate(load())),
(sound_output, generate_sound_ids(load_sounds())),
(SPEC_OUTPUT, generate_specs(specs)),
(UNIT_SPEC_OUTPUT, generate_unit_specs(specs)))
for path, generated in outputs:
if args.check:
if not path.exists() or path.read_text(encoding="utf-8") != generated:
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "model-preview"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["cdylib"]
[dependencies]
horizon-mod-sdk = { path = "../../horizon/crates/horizon-mod-sdk" }
[workspace]
+7
View File
@@ -0,0 +1,7 @@
id = "model_preview"
name = "Model Preview"
version = "0.1.0"
api = "0.1"
side = "client"
capabilities = ["render"]
experimental = ["render"]
+10
View File
@@ -0,0 +1,10 @@
use horizon_mod_sdk::{Mod, Registration, render};
struct Preview;
impl Mod for Preview {
fn init() -> Result<(Self, Registration), String> { Ok((Self, Registration::new().on_tick())) }
fn tick(&mut self, _: u64) {
render::set_lighting(render::Lighting { hd: true, exposure: 1., bloom: 0.55 });
render::set_models(&[render::ModelInstance { id: 1, model: "airdef:lancet".into(), x: 0.5, y: 110.5, z: 0.5, rotation: (0.,0.,0.,1.), scale: 1., glow: false }]);
}
}
horizon_mod_sdk::export_mod!(Preview);
+1 -1
View File
@@ -123,7 +123,7 @@ class BudgetReportFailureTests(unittest.TestCase):
self.assertEqual(report["scenario"], airdef.BUDGET_SCENARIO)
self.assertEqual(report["scenario_render_world"], "flat at y=64")
counts = report["scenario_counts"]
self.assertEqual((counts["accepted_raids_asserted"], counts["snapshot_airborne_asserted"], counts["snapshot_tick"]), (2, 184, 2102))
self.assertEqual((counts["accepted_raids_asserted"], counts["snapshot_airborne_asserted"], counts["snapshot_tick"]), (4, 184, 2102))
self.assertIsNone(counts["peak_airborne_observed"])
self.assertEqual(report["measured_fuel"]["callbacks"], [{
"mod": "airdef", "callback": "tick", "calls": 2102,
+13
View File
@@ -15,6 +15,7 @@ from PIL import Image
TOOLS = Path(__file__).resolve().parent
sys.path.insert(0, str(TOOLS))
from airdef_assets import catalog
from airdef_assets import pipeline
from airdef_assets import icons
import gen_tex
@@ -33,6 +34,18 @@ class ContentCatalogTests(unittest.TestCase):
self.assertEqual(language[f"item.airdef.{name}"], title)
self.assertTrue((root / "airdef-mod/data/airdef/horizon/item" / (name + ".json")).is_file())
def test_a_new_unit_kind_needs_only_catalog_entries(self):
# The validator must not carry its own list of kind names: a hypothetical unit is
# accepted from a specs row plus its content entry, with no code change.
data = json.loads(json.dumps(catalog.load_specs()))
content = json.loads(json.dumps(catalog.load()))
template = next(entry for entry in data["units"] if entry["gun"] is not None)
added = dict(template, kind="TestGun", key="testgun", name="Test gun")
data["units"].append(added)
content["units"].append({"kind": "TestGun", "item": None})
events = {entry["event"] for entry in catalog.load_sounds()}
catalog.validate_specs(data, content, events)
class ManifestTests(unittest.TestCase):
def test_manifest_rejects_traversal_and_duplicate_paths(self):