Gameplay fixes and art from the owner's balance review of 2026-12-05.
- The P1-SUN never launched (0 launches in 12 seeds of a 196-target raid): it
has no radar of its own and only a separate launcher could fire on another
station's plot. A unit without its own radar now fires like one
(`why::on_network`), on the fresh own fire plot of an engagement or
multifunction radar within link reach. Seven P1-SUN then launch 26-42 and
kill 13-24 per raid; the leak count does not change.
- The С-400 and С-500 exist only as separate launchers (`mode: "launcher"` in
the catalog). The `s400_launcher`/`s500_launcher` variants and their remotes
are gone: `deploy s400`/`s500` and their remotes place a launcher. A system
saved with its own radar loads as a launcher; `battery <n> integrated` is
refused for these kinds.
- Every radar role has its own model: a wide curved array (search), a
parabolic dish (engagement), a small head on mast sections (height); the
multifunction radar keeps its panel, the optical post gets its own post and
a turning head with a lens. A variant may carry its own `parts` in
`catalog/content.json`; `Sam::parts()` resolves them.
- The enemy remembers the sides each approach raided from: a raid ordered the
same way and within 200 blocks of the same distance comes from the same
sides, so its sites stand where the last ones did. A launch area the radars
fixed is remembered (up to 32): a site placed there again is known before
its first launch and can be struck at once. Neither is saved yet.
- `sim/balance.rs` flies several raids over one cluster with stocked depots
(`supply_raids`). With the 16-block depot reach, depots 30 blocks from the
batteries leave 10 / 36 / 80 leaks over three raids against 6 / 10 / 17 for
depots within reach; the reach itself is unchanged by decision of the owner.
The saturation checkpoint is re-recorded (123 kills / 323 launches instead of
129 / 344): that loadout has no fire radar, so its С-400/С-500 fire less as
launchers.
Verified: airdef-core release 363 passed and 8 scenarios; airdef-mod 135 passed,
1 boundary, 2 saturation, 5 scenarios; gen_catalog/gen_models/gen_sounds --check;
test_gen_assets, test_model_bounds, test_web_panel; git diff --check. Not run:
the actual WASM contract, the models in game, CI.
Co-Authored-By: ZCode <zcode@localhost>
Check launch terrain, reserve ballistic targets for marked objectives, tune in-game reach and fallback fire, and support bounded terrain work on supply routes.
Co-Authored-By: Codex <noreply@openai.com>
Measure matching DLSS and native TAAU modes on Windows before and after the renderer changes. On the 480-light graphics fixture, the masks improve 37.0 to 41.6 FPS with DLSS. The same candidate reaches about 58 FPS with TAAU in fullscreen.
Verified the GPU output on the RTX 3060 with a static capture, 36 HD tests including shader translation, and the separate Metal TAAU test.
Resolve benchmark input paths before switching to the disposable game home and report startup failures without a missing screenshot traceback. Capture the executable hash and keep report environment metadata limited to benchmark settings.
Record the earlier light and smoke measurements and the repeated idle A/B runs. Verified with 18 Python benchmark tests, 36 Horizon HD tests, the Metal TAAU smoke test, and the real idle launch and error paths.
The engine's kimi-work-124 moves b4c68a78b..4215e8999:
- The light tiles keep the whole screen's lights in one global list instead
of a copy per tile, and the tile lists no longer overflow into "every
light on every pixel". In a raid the render phase of the window thread was
27-83 ms of CPU a frame on an M5 at 1440p (tile_lists 21-25% of the thread
in a sample); it is 5-13 ms now.
- The fog's march skips the steps that stay inside an empty brick of the
smoke grid: about -11% of the GPU time where a raid's replay still has
smoke, nothing where it has none.
Neither changes the picture: on one paused frame of a recorded raid, with
and without each (the smoke-skip and light-tiles diagnostics), the pixels
that do not depend on the wall clock are the same to the frame-to-frame
flicker of one level. The water is not compared: it moves with the clock.
Not explained: in the early windows of a replay some frames take 100-230 ms
with 45-55 ms of GPU and 20-30 ms of CPU. The engine before the fixes shows
it too.
Run 140, the first green build since 2 November, knocked Gitea's database
over: from 19:42:52 UTC, right after the mod test binaries were written,
the API answered 500 and 401 and ssh said 'the database system is in
recovery mode' until 19:53:28, eighteen seconds after the job had ended and
its workspace was gone. The tests themselves are innocent (ground_oom peaks
at 113 MiB RSS); what the job leaves behind is not. rustup installed stable
and then the pinned 1.99.1 on top of it (about 1.1 GB), and the debug test
targets of the core and of the mod (669 MB for the mod alone) stayed on
disk through the release build. The runner shares that disk with Gitea and
its database; on 6 November release.yml found 1 GB free there.
The job now installs only the channel pinned in rust-toolchain.toml, deletes
each test target directory once its step is done, and refuses to start with
less than 4 GB free, with the same ::error:: wording as release.yml, after
printing df and free into the log. Both test suites stay complete.
Not verified on the server (no access there). The log now shows the free
space at the start, so the next run confirms or corrects the diagnosis.
With Pillow installable again, build.yml failed one step later: on the Linux
runner 171 generated PNGs (every item icon) differed from the committed
files. Their pixels are identical (sha256 of the decoded rasters matches
the macOS ones byte for byte); only the deflate stream differs, because the
zlib inside the Pillow wheel is built per platform and Python version. The
manifest's byte hashes are not portable, so the check could only pass where
the assets had been generated.
--check now treats a PNG whose bytes differ as unchanged when it decodes to
the same mode, size and pixels, and only while the file still matches its
manifest row: a hand-edited file stays a conflict. Writing (a run without
--check) and the manifest stay byte-exact.
Verified: a copy of airdef-mod with all 175 manifest PNGs re-encoded
(stored blocks) and the manifest rows updated passes --check; the real tree
still reports no differences; tools/test_gen_assets.py OK (13 tests, two
new: a re-encoded icon is accepted and then rewritten by a real run, another
picture and a hand-edited icon are still reported).
Since 2 November build.yml has failed before its first test: gen_models.py
--check needs Pillow, and python3 -m pip install --user refuses the system
Python of the catthehacker/ubuntu:act-latest image (PEP 668,
externally-managed-environment). The job container is disposable, so
--break-system-packages with --user is safe here.
No step order or limit changes; the checkout, fork and Rust steps already
passed and are untouched.
Point horizon at b4c68a78b (the slider is monotonic: 100% renders 1:1 DLAA,
80% no longer renders larger than 100%). Update the scale docs and pin
test-dlss.bat to HORIZON_HD_SCALE=0.67 for the upscaling A/B (empty would now
be DLAA at the slider's 100%).
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Pin horizon to 4e441de6a (agent/resolution-scale): hd::scale_override used
to pin the HD world at 2/3 whenever DLSS was enabled and its SDK open, so
the Resolution Scale slider (50-200%) was ignored — pixel-identical image
and unchanged FPS at every step. Now the slider drives the world target and
the DLSS render size live, no restart: film quality, then HORIZON_HD_SCALE,
then the slider; with DLSS the render scale caps at the output (100% keeps
the 2/3 auto ratio, above 100% renders at the output — supersampling is
native TAAU's with DLSS off), without DLSS the slider applies as-is
including above 1. The jitter and motion globals match the new size on the
very frame it changes; the NGX context is kept while the render size fits
its dynamic-resolution range, and the histories reset on every scale
change. The #143 motion/jitter contract (MVJittered, render-pixel jitter,
MV scale [1,1]) is intact.
Verified on Mac (M5/Metal, no DLSS device): lib suite 1243 passed, new GPU
test the_world_target_follows_the_resolution_slider (50/100/200% target
sizes + live resize + hd_scale precedence), taau_gpu_smoke_still_surface_ab,
non-dlss build, and a Windows-gnu cross-check of the dlss-gated code against
the NGX v310.9.1 headers. DLSS evaluation awaits RTX.
Docs: DLSS-TESTING.md documents the scale semantic, the live-update
mechanism and the RTX verification checklist (slider changes the DLSS
render size + FPS, no shaking regression, context reuse, fallback logs);
HD-RENDERER.md's scale references follow the slider.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Sim::air_text built the save text with `head += &format!(...)` per contact
and `line += &format!(...)` per relief run, and Drone::air_line did the same
for a route point. Each of those allocated a temporary String and re-copied
the whole growing buffer, so the cost was quadratic in the section's size.
The head is not covered by the fits check (only the drone/queue body is): up
to 8 relief grids of 40k run-length tokens each plus 4096 contact lines. On a
heavy raid the autosave's tick therefore exhausted its 300M fuel while
formatting — the crash was in Sim::air_text.
Format directly into the buffer now (std::fmt::Write, push_str, push), which
grows it amortized with no per-token temporary. Nothing else changes: the
format, every MAX_* bound and the byte-budget logic are untouched.
The output is byte-identical: the same air_text over a relief-heavy raid
state and over the 600-drone byte-bound state hashes and measures the same
before and after (64a1787d37047447, 894 and 747942 bytes).
The points budget first gated on (recording tick - first) % step, but a strike
carrier's samples fall on its flight-age grid, offset from the recording's
ticks — the gate skipped them (physical_strike_track_keeps_muzzle... failed).
Count the sampling calls per track instead (Track::due): at STEP it pushes
every call exactly as before, and the thinning doubles the interval without
touching the track's phase. Track::points_len exposes the count for diagnostics.
tests/ground_oom.rs gains the continuous extreme load (eight overlapping
40-Oreshnik waves, 1118 objects airborne at once — well past the crash's >200):
peak 26.3 MiB steady + 5.5 MiB rehash transient, the flight tracks thin to
step 16 (91k points, 2.3 MiB) under their 2 MiB budget, the journal and poses
stay within theirs, and the fight still resolves (157 intercepts). The radar
picture itself (11.5 MiB at 1118 airborne) scales with the sky — it is the
simulation's state, not a cache, and is ~3 MiB at the crash's >200 load.
The WASM budget fixture's final /airdef stats pin was stale at the base commit
already: it was measured on engine 8e711f969, and the base pins acfb379aa,
whose host answers shift the two late Smart raids (417/2463, 7 in the air).
Verified identical on the pristine base and on this branch — the memory bounds
do not move that fight; the tick-2102 checkpoint (184/325/2011) is unchanged.
Re-pinned to the measured string and updated BUDGET_ASSERTED_SHA256 so the
raid/snapshot assertions stay active. test-budgets: 283 steps ok, tick fuel
max 184.7M/300M, 0 failures.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The fullscreen-map OOM (rust_oom in hashbrown reserve_rehash under
Ground::answer during a large raid): the mod's whole state shares one
64 MiB linear memory, and three consumers grew without an effective bound.
Measured on a native replica of the crash load (tests/ground_oom.rs: 64
complexes, six all-sides Oreshnik raids plus a smart raid over 10000 ticks,
304 objects airborne at once, a wide map query walk; render answers exactly
as the WASM host gives them): peak 45.5 MiB steady + 21.9 MiB rehash
transient = 67 MiB, over the cap. The bulk: kept replays 23.2 MiB (the scene
journal 4.6 MiB each, filled with per-radar track transitions), Ground.known
10.9 MiB (277k columns; the old sweep only ran above 300k and kept everything
younger than 2000 ticks, so a wide query pattern grew it without bound and
the next rehash doubled the table), the live recording 7.5 MiB, radar tracks
3.2 MiB.
Bounds, derived from the 64 MiB budget (Sim::memory reports each consumer):
- Ground.known: KNOWN_MAX 100_000 columns (~2.7 MiB steady, ~8.2 MiB through
a rehash at 24 B + control byte per entry, 7/8 load). Over the cap the
oldest answers go down to three quarters (a sweep is not every tick),
ordered by (age, column) so the sweep is deterministic; heights past
SWEEP_AGE go with them. Evicted columns are asked again when next needed —
the cache is reconstructible, no target, frequency or precision is cut.
- Scene journal: MAX_SCENE_EVENTS 65_536 -> 24_576 (~1.7 MiB), and the track
transitions (acquire/handoff/lock/lost — they grow with systems x contacts,
the journal's bulk under a large raid) get their own 8_192 budget; beyond
it the later ones are not recorded. Launches, fires and outcomes keep the
rest of the journal; chains() already tolerates missing steps.
- Flight track points: MAX_TRACK_POINTS 2 MiB per recording; over it every
other point is kept and the ticks between points double (Track::step, the
#142 decimation pattern for the systems' poses). Replay readers use the
track's own step.
Replica peak after: 24.5 MiB steady + 5.5 MiB transient = 30 MiB, under the
48 MiB headroom target; the fight resolves (376 intercepts, sky clears) and
the same seed replays the same ordered trace. The saturation checkpoint is
untouched (314 / 2022 / 184): its cache stays under the cap.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The fullscreen-map OOM (Ground::answer rehash under a large raid) needs a
measured breakdown, not a guess: Sim::memory estimates each consumer's
allocated capacity (hashbrown tables with their control bytes, vec capacities,
BTreeMap nodes) — Ground.known, WorldCache.secs and rays, the sim vectors and
radar tracks, the recording and kept replays, Intel/recon, routes, sites,
strikes, the raid plan. MemoryReport::rehash_headroom names the transient a
rehash adds (old + new table of the biggest map). Ground::known_len exposes the
column count the budget tests guard.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The larger memory cap shifts the heavy scenario's final stats slightly
(417/2463, fewer pending sections); deterministic across runs, fuel
failures still 0. The tick-2102 checkpoint is unchanged.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Engine agent/dlss-temporal-stability (a791e8439 -> acfb379aa):
- f536fa958 DLSS: declare the jittered motion vectors (MVJittered). The create flags left
MVJittered unset, so NGX applied the jitter offset on top of the already-jittered motion
buffer — the camera jitter counted twice, the severe shaking. Contract verified against the
DLSS Programming Guide (31 March 2026) §3.6.1-3.6.3/§3.7.3/§3.8.1, nvsdk_ngx_defs.h and
Streamline's dlssEntry.cpp (pixel-space vectors take MV.Scale 1.0; the {1/w,1/h} advice is
Streamline's own constant, scaled back by its plugin).
- 26ee82398 Native TAA: a reactive mask for water (its own depth, binding 7; less history where
the waves/glint animate fastest, faded to 96 blocks) + the wind-motion contract test.
- acfb379aa Wind-blown leaves and plants carry their own motion vectors (previous frame's wind
time/strength in Globals.hd_motion.zw, terrain.wgsl wind_offset_at).
Verified on Mac (no RTX): horizon-client --lib 1242 passed / 0 failed; taau_gpu_smoke on Metal
(fixed decode at the spatial filter's error floor, phase spread 0.0029 vs legacy 0.0156); naga
validation + HLSL translation of every HD shader and terrain/entity; frame/global layouts;
deterministic jitter/reprojection fixtures; non-dlss binary build; clippy clean on the touched
files. NGX evaluation itself awaits RTX — docs/DLSS-TESTING.md has the verification steps and
three fallback variants (jitter sign/axes, Streamline-style scale, non-jittered conversion pass).
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Every catalog variant now has a `airdef:deploy_<id>` remote in `give` and
in the hotbar: deploy_radar_search, deploy_radar_track, deploy_radar_height,
deploy_s400_launcher and deploy_s500_launcher. The variant rows carry their
remote item in the generated catalog, and the inventory appends them after
the existing remotes so no ordinary remote changes slot.
Placing a remote now resolves the item back to its (kind, mode, role)
configuration and settles the system, the same path `/airdef deploy <key>`
already used. The base remotes keep deploying the ordinary integrated,
multifunction system; the radar remotes place Search/Engagement/Height
profiles, so radar_track gets fire authority and the others do not.
The N menu's battery-deploy page is removed entirely (button, page and its
handlers); variants remain available through `/airdef deploy` and now the
remotes. Items, icons (aliased to the unit silhouettes), lang entries and
generated assets are regenerated from the content catalog.
Checks: gen_catalog.py --check, gen_models.py --check, test_gen_assets (11),
airdef-mod lib 115 + integration suites, airdef-core 327, cargo build.
The zero-step Windows+RTX toolchain now also covers libclang: LLVM is no
longer a build prerequisite, the detected or downloaded directory is
passed as LIBCLANG_PATH, and the cache layout gains
.horizon-cache/libclang/<version>/. Manual override (winget install
LLVM.LLVM + LIBCLANG_PATH) and the Unable to find libclang troubleshooting
note remain.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The DLSS build failed on Windows at dlss_wgpu's bindgen step: libclang.dll
is neither in the DLSS SDK nor in the Vulkan headers. It is now part of the
same zero-manual toolchain.
Detection first, download last: an explicit LIBCLANG_PATH (directory with
libclang.dll or clang.dll) wins and disables auto-install; otherwise PATH,
Program Files\LLVM\bin (both Program Files roots) and LLVM shipped with
Visual Studio (vswhere -find VC\Tools\Llvm\x64\bin\libclang.dll) are
checked, then the cache.
When nothing is found, the NuGet package libclang.runtime.win-x64 is
downloaded (~34 MB, version from the flat-container index with pinned
23.1.5 fallback) and only runtimes/win-x64/native/libclang.dll (~89 MB) is
extracted to .horizon-cache/libclang/<version>/ behind the existing
staging + airdef-install.json marker pattern. The resolved directory is
passed to cargo as LIBCLANG_PATH.
libclang is resolved only when the DLSS SDK and Vulkan headers are already
available, so a missing SDK never triggers a useless download. Any
detection/download/extract failure warns and degrades to mods/TAAU, and
non-Windows/non-RTX still returns before any network access.
Tests cover PATH/Program Files/vswhere detection, explicit precedence,
numeric NuGet version choice and fallback, selective extraction and marker,
cache hit, damaged cache reinstall, package without the DLL, plan env
wiring and failure to mods-only.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
A valid DLSS_SDK must not block the Vulkan header auto-download, and vice
versa; assert that only the missing component is fetched.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Scanning .horizon-cache/dlss-sdk is best-effort: a permissions error or a
missing directory now means "nothing cached" and the normal install path
runs, instead of an exception escaping before the mods fallback.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The quick-start build section no longer asks for an NVIDIA DLSS SDK or a
LunarG Vulkan SDK: `airdef.py all` downloads only the headers, static libs
and nvngx_dlss.dll it needs, caches them under .horizon-cache with a
version marker, and copies the fresh DLL beside horizon-client.exe. Keeps
the explicit DLSS_SDK/VULKAN_SDK override, the offline/failure fallback to
mods with native TAAU, and the remaining LLVM/clang build prerequisite.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
`airdef.py game` no longer needs manual SDK setup. On Windows with an RTX
adapter, when neither DLSS_SDK nor VULKAN_SDK is set, it downloads only the
files dlss_wgpu reads:
- NVIDIA/DLSS at the newest stable v310.9.x tag (GitHub API; pinned v310.9.1
when the API fails): include/*.h, both x64 static libs and the runtime
rel/nvngx_dlss.dll (~67 MB once), laid out under
.horizon-cache/dlss-sdk/<tag>/ exactly as valid_dlss_sdk expects.
- KhronosGroup/Vulkan-Headers include/ under
.horizon-cache/vulkan-headers/<tag>/Include/, since build.rs uses headers
only and links no Vulkan library.
The resolved roots are passed to cargo as DLSS_SDK/VULKAN_SDK, and after a
successful dlss build the fresh nvngx_dlss.dll is copied beside the built
horizon-client.exe. Explicit DLSS_SDK/VULKAN_SDK (and the sdk argument)
keep priority and disable auto-download for that component. Any network or
layout failure warns and falls back to --features mods/native TAAU instead
of failing the build; non-Windows and non-RTX take the old mods path with
no network access.
valid_dlss_sdk now looks for the real nvsdk_ngx*.h names instead of the
nonexistent nvngx*.h glob, so a genuine SDK (and the downloaded cache) is
recognised at all.
Tests cover tag selection and fallback, selective layout + marker cache
hit, damaged/partial caches, streamed download and truncation, Vulkan
Include layout, plan env wiring, explicit-env precedence, failure to mods,
and DLL placement beside the client.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The build auto-detect hint still said HORIZON_DLSS=1 enables the backend;
the player-facing control is now the mod settings toggle (default on),
with HORIZON_DLSS=1|0 as an override.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The More page (N → Огонь, ремонт, эффекты…) gains a DLSS row next to
Акустика. Default on: a world without a saved choice leaves the engine's
own default (on where supported). The row reads render.dlss-status (API
level 33): with a DLSS device it toggles live; without one it says
«недоступен», and an on-request is kept and applied at the next launch —
a graceful no-op, never an error. The request is saved in the world's
layout (`dlss true|false`, older saves load unchanged) and re-applied on
world load; the engine persists it in horizon-graphics.txt for the next
start's device opening. /airdef capabilities reports the DLSS state too.
Graphics-only: no resolution control (the player's own Horizon settings
stay in charge) and no sim changes. Engine gitlink → b2cc11c45
(agent/dlss-toggle): the dlss graphics setting, the live evaluation gate,
the dlss control command and the level-33 SDK imports.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
tools/airdef.py game always built with --features mods, so an RTX user had
to run the manual cargo line from docs/DLSS-TESTING.md. The feature string
now comes from dlss_build_features(): dlss is added only when the OS is
Windows, a Win32_VideoController name has both NVIDIA and RTX, the DLSS SDK
has include/nvngx*.h and lib/Windows_x86_64/x64 (DLSS_SDK, a repo DLSS/ dir
or %ProgramFiles%\NVIDIA\DLSS), and VULKAN_SDK has Include/vulkan/vulkan.h
(dlss_wgpu's build script needs both SDKs). Otherwise the build stays
mods-only; on Windows + RTX without the SDK it prints how to get v310.9.1
instead of failing. GPU/SDK probe errors mean "no DLSS" and never abort the
build; the HORIZON_DLSS runtime switch is untouched.
Tests: tools/test_airdef_build.py covers non-Windows, no RTX, missing DLSS
SDK, missing Vulkan SDK, the full toolchain, a failed GPU probe, the SDK
layout check and the feature string reaching cargo. python3 tools/airdef.py
game still builds mods-only on macOS (fresh target dir: 3m11s, exit 0).
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The temporary in-session shader switch (harness build, reverted) renders the
same frozen tick with both effects.wgsl versions: old-vs-new differs by at
most 1-2/255, no pixel over 5/255, and no more than two frames of the same
shader differ. Frame time is below the in-game noise floor on M5 (32
screen-filling late-life fireballs: +0.37 ms median, sigma 3.6). Includes
the hd_bench polygon_noon run and test counts.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
In the HD smoke path fade = 1 - smoothstep(0.08, 0.28, k) is exactly 0
from k = 0.28: every step's density is zero, absorb is 0, so the march
adds no light and leaves transmittance alone while still sampling fbm
and shading the volume. Wrap the loop in an `if fade > 0.0` guard; the
glow after it is untouched (heat is still live there) and is itself
skipped once its heat is spent. Density, steps, sampling and lighting
are unchanged.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Measure-first profile naming the culprit with data; no worker implemented
(step 3.2 is out of scope). docs/measurements/issue-147-cpu-profile/: README +
report-server.json (default server-thread path) + report-inframe.json
(--in-frame control), M5/Metal 2560x1440 HD, same-recording battle with
overlapping raids + explosions + dense smoke, each run serialized under the
shared flock /tmp/airdef-bench.lock (earlier concurrent runs discarded).
Instrumentation: host per-tick tick_mods spans (ground/world/snapshot/wasm/
models/output/total, HORIZON_MOD_CPU_PROFILE=1, attributed by tick+frame),
mod Sim::step phase timing via an adapter-injected monotonic clock
(game.monotonic-nanos, API level 32; airdef-core stays SDK-free), raid_bench
--scheduler + per-frame span/frame correlation + mod phase delta.
Findings: on the default path the battle frame is GPU-bound (GPU avg 73.7ms ~
frame p95 88ms; 127/128 frames >33ms); the mod path is ~2.5ms/tick, per-frame
p99 7.7ms, 0 frames >25ms, host world answers <0.1ms, model prep ~0.05ms; the
872ms CPU spike is a render/GPU hitch (mod 2.15ms). In-frame is CPU-bound
(CPU p99 175ms); the mod path reaches >25ms in 27 frames, and step_drones
dominates Sim::step (52%, max 47ms/tick), A* only 15%. The schedulers' mod
peaks do not coincide; only the render-dominated catch-up spike is common.
Recommendation: a pure A* route worker and a world-snapshot worker are NOT
justified (A* leads only the tiny default-path mod; world answers never lead).
Default-path peaks are GPU -> steps 1-2 (GPU/geometry) apply, a CPU worker
would not help. If targeting in-frame CPU, the unit is the whole Sim::step
(Wasmtime on its own thread), not a route worker — still not implemented.
Harness fix (engine gitlink 48eff0fcb): control-socket chat/chat-log now reach
the client mod on the server-thread path (chat-box parity), enabling the
required default-path battle measurement; sim rules untouched.
Tests: airdef-core 326 passed/0 failed/8 ignored; airdef-mod 113+1+2+5 passed
incl. same_seed_same_result and combat_trace_is_deterministic;
tools/test_raid_bench.py 11 passed; horizon-mods suite + wasm ABI test ok.
Engine: d073783f5 (spans + clock) + 48eff0fcb (chat harness) on
agent/126-cpu-profile. Parent: 92c058f60 (profiler + driver) + this commit.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Mod side: Sim::step times plan_step, adapt, step_drones, step_moves,
update_sight, step_sams and record, plus the whole step and its untimed
remainder, through sim::profile. The simulation stays SDK-independent (also
built as airdef-core): the adapter installs the host monotonic clock
(game.monotonic-nanos) in init, native tests use std::time::Instant. The
counters are fixed-size, per-thread, read no randomness and change no
decision; /airdef stats reports them as PROFILE chat lines, reset per world.
Driver: raid_bench gains --scheduler in-frame|server-thread (the two
single-player paths, measured separately), HORIZON_MOD_CPU_PROFILE=1, the
per-tick mod-path spans joined to the frame trace (per-frame totals, >25/33 ms
counts, what the worst CPU frames carry), and the mod phase profile read at
idle and battle end with the battle delta. report.json carries mod_cpu,
mod_cpu_ticks, mod_phases_* and the derived correlation. Tests for the new
helpers.
Engine gitlink: mod-path CPU spans + game.monotonic-nanos (API level 32).
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
tools/raid_bench.py (+ tests): the #147 step-0 driver replaces the #126
scratch script. One battle at fixed ticks (waves inside resident terrain —
far waves stall at the unknown-chunk edge and no fight happens), fingerprint
chat lines at control ticks, then the raid's own recording replayed. Both
render paths are benched on the SAME recording in ONE process via the
engine's diagnostic `model-instancing off|on` toggle (cross-process battles
diverge in event timing: 16 vs 32 kills at one control tick), pairs in
alternating order; idle cold/warm, mid-battle window, reload (F3+T), replay
seek, away-camera checks, and static off/on stills for pixel parity
(hd_bench motion-mask methodology). report.json carries gitlinks, device,
mod_models counters, CPU/GPU p50/p95/p99/max, raw frame times, >25/33 ms
frame counts, guest fuel and streaming queues.
Engine gitlink: one mass mod-model group GPU-instanced (retained mesh per
pack generation, current/previous pose/id/light instance stream shared by
main, motion and shadow passes, per-vertex fallback to parity, runtime
diagnostic toggle, stats raw + guest fuel reporting).
Measurements: docs/measurements/issue-147-instancing/ (M5/Metal, 2560x1440;
RTX 3060 pending). docs/REPO-MAP.md and docs/ENGINE.md pin updated.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
Re-applied the genuinely new #149 features onto kimi-work, REUSING the already-integrated
#146 infrastructure (KnowledgeSnapshot { tick, contacts, marks }, knowledge_now(),
Plan.knowledge, RouteJob.known, versioned price_grid_known and restore). No #146 scaffolding
is duplicated: one snapshot per order, prices over known.tick, versioned restore are kept
exactly as they were. The only additive change to KnowledgeSnapshot is observations().
New #149 layer:
- observe::Observation + observe::merge: Contact and Mark become one public hint, matched by
public features only (area overlap + exact category); coarse Unknown/contradicting marks stay
separate, the contact's kind/fix are never rewritten, recon.truth and real ids are not used.
One Observation::rank scale replaces the two ranks in radar_strikes, choose_target and the
adaptive picks (kimi-work's slice signatures kept).
- price_grid_known prices marks: a trusted launcher/gun/jammer mark prices its published
category envelope weighted by confidence (Confirmed x1, Probable x0.5); a radar mark feeds
the network belief; a mark matched to a contact is priced once through the contact; a
doubtful mark prices nothing.
- Bounded refresh of the unreleased portion: ew::Refresh with absolute deadline
REFRESH_WINDOW=600; step_refresh re-aims queued Plan/Sead drones once on a report (typed
Intent::Refresh, SEAD priority) within SWITCH_CAP and assignment budgets; no report never
delays a launch.
- Bearing window: Intel.outcomes bounded VecDeque (48 entries, 12000-tick window); best_bearing
adapts exploration share by typed BearingReason (few/stale/conditions-changed/exploiting);
conditions are a fingerprint of the public picture, never hidden state. bearing_report() and
bearing/refresh_*/observations fields in EnemyPictureReport. Legacy fixed share kept.
- examples/smart_bench runner (simple/current/candidate, seeds 1/7/42, open/hills/config-change/
recon-lost, JSON+lines); Sim::smart_legacy reproduces current Smart; harness::run_with_hook.
Light modes and bounded jobs unchanged; policy reads no health/charges/hidden switches/positions.
Tests: smart_tests + observe::tests (metamorphic hidden-layout, public dedup, marks in prices,
one version per order in both modes, bounded refresh fires-once/never-pauses, bearing window and
reasons, durable window + Intent::Refresh). The relief-version regression fixture's wall is
widened in z so it crosses any east-west route after the candidate's assignment-order change.
cargo test passes: airdef-core 326 lib + 8 scenarios; airdef-mod 113 lib + core_boundary + 5 scenarios.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>