Phase 13: performance pass, closure record, release 1.1.0

Memoize the ELOKA emitter ranking per measured fingerprint (bounded, tied
to the runtime catalog): it was the largest single cost of a simulation
step. A 0.1 s substep now costs the same as in 1.0.0 on the ARM
development host (6.7 ms mean over three seeds).

docs/simulation-gaps.md becomes the closure record: every gap with the
model that closes it and the phase/commit, the calibration and anchoring
policy, and the few items kept out of scope with their reason.

Release 1.1.0: version bump, README EN/DE release notes (save v12, 1.0.0
v11 saves rejected), AGENTS.md (detrand, pure physics modules, calibrate
--check), resume notes for uConsole hardware acceptance and the merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
db9979andClaude Opus 5.5 committed 2026-09-23 23:19:18 +02:00
1 parent 97319f313e
commit 1fc5bedbd1
10 files changed
+261 -380

No files matched your search

+4 -1
View File
@@ -2,7 +2,7 @@
## Authority and scope
- This is U-Jagd 1.0.0 (`src/core/version.py`); current saves are v12-only. Treat these as compatibility contracts, not changelog entries.
- This is U-Jagd 1.1.0 (`src/core/version.py`); current saves are v12-only. Treat these as compatibility contracts, not changelog entries.
- Resolve conflicts in this order: executable code and focused tests; packaged JSON/runtime resources; `pyproject.toml` and provenance/license notices; `README.md`; design/history documents under `docs/`. A plan or old comment is not an implementation contract.
- Preserve explicit compatibility tests and user data unless a task intentionally changes the contract. Add a regression test for behavior changes.
- Older phase/milestone labels under `docs/GDD.md`, `docs/implementation-plan.md`, `docs/plan-0.1.6.md`, and `docs/plan-0.1.7.md` are historical. Current resumable work is tracked in `docs/plan-0.1.8.md` and `docs/resume.md`.
@@ -28,6 +28,8 @@
- Paused, menu, game-over, splash, editor, and administrative states must not accidentally advance simulation. Cosmetic/UI timers and audio cadence use wall time where the code says so.
- Same seed, world mode, and input/update sequence must produce the same state. Use explicit local `random.Random` streams, stable hashes, stable iteration/order, and saved RNG states. Never introduce simulation dependence on global randomness, hash randomization, rendering frequency, audio availability, or wall clock.
- Save/load must preserve deterministic continuation, entity ID progression, generated coastline/bathymetry snapshots, pending sensor/projectile state, and operator focus. When adding random draws, consider stream/order compatibility and update determinism and round-trip tests.
- New random draws should use the stateless counter-based `src/core/detrand.py` (`u01`/`normal` keyed by seed, tag, entity and tick) so they need no saved stream and never shift existing `random.Random` sequences.
- Physics lives in pure modules (`src/physics/`, `src/sonar/equation.py`/`raytrace.py`, `src/sensors/radar.py`/`visual.py`/`hfdf.py`, `src/weapons/ciws.py`) anchored so the 1.0.0 behaviour appears at its reference point. `python tools/calibrate.py --check` compares 77 gameplay metrics with `tests/calibration/golden.json` (recorded on 1.0.0); intentional deviations go in `tests/calibration/deviations.json` with a reason. Caches in these paths must be pure and bounded (results may never depend on call order).
## Input ownership and precedence
@@ -103,6 +105,7 @@ Use Python 3.11+ from the repository root:
python -m pip install -e '.[dev]'
pytest
python tools/gen_contacts.py --check
python tools/calibrate.py --check
python tools/smoke_full.py
python -m build
```
+19 -1
View File
@@ -12,7 +12,25 @@ Sie führen eine fiktive Fregatte und wechseln zwischen neun Arbeitsplätzen, um
zu navigieren, zu suchen, Kontakte zu klassifizieren, Ziele zu bekämpfen und das
Schiff einsatzfähig zu halten.
Aktuelle Version: **1.0.0**
Aktuelle Version: **1.1.0**
Version 1.1.0 ersetzt die verbliebenen kinematischen Vereinfachungen durch
physikalische Modelle und hält dabei die Spielbalance von 1.0.0 (geprüft durch
einen Kalibrierungs-Harness): kraftbasierte Schiffshydrodynamik und
Seegangsbewegungen; ein zeitlich veränderlicher Ozean mit Gezeiten,
Deckschicht, Sedimenten und Wracks; passive/aktive Sonargleichungen mit
Strahlverfolgung; Seiten-Mehrdeutigkeit der Schleppantenne, Doppler und TMA mit
Kovarianz; U-Boot- und Torpedophysik (Energie, Flossen, Draht,
Annäherungszünder); Täuschkörper-Diskriminierung; Abteilungsflutung,
Stabilität, Brand und Reparaturlogistik; die Radargleichung mit drehender
Antenne, ESM-Pegel, KW-Ausbreitung und ein Ausguck mit Mondlicht; sowie
Flugkörper-Flugphysik mit Düppelwolken, CIWS-Ballistik, Pop-up-Angriffen,
Helikopter-Schwebeflug/Decklimits und treibenden Bojen. Feindliche U-Boote
brauchen jetzt eine eigene TMA, bevor sie Ihre Entfernung kennen.
**Spielstände haben jetzt das Format v12; Spielstände von 1.0.0 (v11) werden
abgelehnt.** Das Remote-Crew-v2-Protokoll bleibt bis auf neue ELOKA-Felder
unverändert. Die vollständige Übersicht steht in
[docs/simulation-gaps.md](docs/simulation-gaps.md).
Version 1.0.0 teilt jede Arbeitsstation in zwei per Tab wählbare Unterseiten,
ergänzt manuelle Freigabeschalter für CIWS und FLAK neben den bestehenden
+16 -1
View File
@@ -10,7 +10,22 @@ around the ClockworkPi uConsole's 1280 x 720 workspace. You command a fictional
frigate and move between nine workstations to navigate, search, classify,
engage, and keep the ship operational.
Current release: **1.0.0**
Current release: **1.1.0**
Release 1.1.0 replaces the remaining kinematic shortcuts with physical models
while keeping the 1.0.0 gameplay balance (checked by a calibration harness):
force-based own-ship hydrodynamics and seakeeping; a time-varying ocean with
tides, mixed layer, sediments and wrecks; passive/active sonar equations with
ray-traced propagation; towed-array left/right ambiguity, Doppler and a
covariance TMA; submarine and torpedo physics (energy, fins, wire, proximity
fuze); decoy discrimination; compartment flooding, stability, fire and repair
logistics; the radar equation with a rotating antenna, ESM amplitude, HF
propagation and a moonlit lookout; and missile flight physics with chaff
clouds, CIWS ballistics, pop-up raiders, helicopter hover/deck limits and
drifting buoys. Hostile submarines now need their own TMA before they know
your range. **Saves are now format v12; 1.0.0 (v11) saves are rejected.** The
Remote Crew v2 protocol is unchanged apart from new ELOKA intercept fields.
See [docs/simulation-gaps.md](docs/simulation-gaps.md) for the full record.
Release 1.0.0 splits every workstation into two tabbed sub-pages, adds manual
CIWS and FLAK release authorization alongside the existing automatic gates,
+21
View File
@@ -1037,3 +1037,24 @@ angepasst werden.
Softwareverifikation: volle Suite zweimal 2933/2934 bestanden, 26 abgelöst,
0 Fehler; Katalogvalidator 111 akustische Profile; `smoke_full.py`
SMOKE-OK.
## Physik-Upgrade 1.1.0 / Save v12 (2026-09-23, Branch `sim-gaps-v12`)
Alle Luecken aus `docs/simulation-gaps.md` sind in den Phasen 0-12 geschlossen
(Abschlussprotokoll mit Commit je Zeile in `docs/simulation-gaps.md`). Save v12
ist exakt; v11-Staende von 1.0.0 werden abgelehnt. Versioniert als 1.1.0.
- Kalibrierung: `python tools/calibrate.py --check` (77 Metriken gegen den
1.0.0-Stand, Abweichungen begruendet in `tests/calibration/deviations.json`).
Der Abschnitt `air` wurde mit derselben Sonde auf dem 1.0.0-Baum gemessen.
- Performance: ein 0,1-s-Simulationsschritt kostet auf dem ARM-Entwicklungshost
im Mittel 6,7 ms (drei Seeds, wie 1.0.0). Groesster Einzelposten war die
ELOKA-Emitterbewertung; sie ist jetzt pro Fingerabdruck begrenzt gecacht.
Raytrace-Tabellen (LRU), Radar-Reichweitenbrueche und ESM-Analysen sind reine,
begrenzte Caches.
- Offen fuer die Hardwareabnahme auf der uConsole (1280x720): Bildrate bei
maximaler Zeitraffung mit Luftangriff und mehreren Torpedos, Lesbarkeit der
neuen ELOKA-Zeile (Pegel/Entfernung/Umlauf) und der HFDF-Frequenz, sowie das
Verhalten der 4-s-Radarumlaeufe auf dem OPZ-Bild.
- Merge: der Branch entstand parallel zu einer Handbuch-Session auf `main`
(AGENTS.md, README, Handbuch); beim Zusammenfuehren diese Dateien pruefen.
+167 -370
View File
@@ -1,403 +1,200 @@
# Simulation Realism Gap Analysis — U-Jagd 0.2.2
# Simulation Realism Gaps — Closure Record (U-Jagd 1.1.0, save v12)
> **Status (physics upgrade, save v12):** rows are marked *Closed (Phase N)* as the
> phased upgrade on branch `sim-gaps-v12` lands. Calibration against the 1.0.0
> behaviour is enforced by `tools/calibrate.py --check` (`tests/calibration/`).
This document began as the realism gap analysis for U-Jagd 0.2.2 (2026-07-15)
and was carried forward to 1.0.0. The 1.1.0 physics upgrade closed every gap
in phases 0-12 on branch `sim-gaps-v12` (save format v12; v11 saves are
rejected without migration). Each row below states the model that now closes
the gap, the phase and its commit. The few items that stay out of scope are
listed with their reason at the end.
Analysis date: 2026-07-15
Scope: Ship dynamics, weapons, enemy AI, air, sonar/sensors, world/environment.
## How the upgrade is held to gameplay
---
- **Calibration:** `tools/calibrate.py --check` re-measures 77 gameplay metrics
(ship speed/turn/acceleration, sonar and radar ranges, lookout, torpedo,
submarine, damage and air-defence behaviour) through the public runtime and
compares them with `tests/calibration/golden.json`, recorded on the 1.0.0
tree (3b3753c). Intentional deviations are listed with their physical reason
in `tests/calibration/deviations.json` (rpm display, turn rate at HALF,
cavitating sea state 4, ray-traced sonar ranges).
- **Anchoring:** every new physical model is anchored so that the 1.0.0
equilibrium value appears at its reference point (for example the radar's
nominal range is its Pd = 0.5 range, the sonar figure of merit puts SE = 0
at the former effective range, the CIWS lethal area reproduces the 1.0.0 leak
rate).
- **Determinism and saves:** new random draws use the stateless counter-based
`src/core/detrand.py`; every new state variable is in the exact save-v12
schema (`src/core/save_schema.py`), validated strictly and covered by
round-trip and continuation tests.
- **Observation boundary:** new measurements (sonar TMA ellipse, towed-array
ambiguity, ESM level/range estimate, HF frequency, lookout contrast) are
published as observations; nothing exposes hidden truth to stations or the
Remote Crew projection.
- **Performance:** a 0.1 s simulation substep costs the same as in 1.0.0 on the
development ARM host (6.7 ms mean over three seeds); ray-trace tables,
radar range fractions and ESM emitter rankings use bounded pure caches.
## Phases
| Phase | Scope | Commit |
|---|---|---|
| 0 | Save v12, persisted AI timers, strict damage block, simulated AIS, calibration harness | bd9260b |
| 1 | Ocean environment: tides, mixed layer, SST/Mackenzie sound speed, wind drift, sediments, wrecks/rocks | d666b1b |
| 2 | Own-ship hydrodynamics: surge, Nomoto steering, cavitation number, seakeeping, squat, mass/fuel | 236d23b |
| 3 | Passive and active sonar equations, ambient noise, reverberation, pulse types | 4cd903a |
| 4 | Ray-traced propagation with bottom/surface loss and convergence zones | 5c9199e |
| 5 | Array gain, towed-array ambiguity, Doppler, Levenberg-Marquardt TMA, multistatic buoys | 7abc45f |
| 6 | Submarine and surface-ship physics | 8f79700 |
| 7 | Hostile sensing, own TMA, crew reaction, mast-limited ESM/datalink | 8e6b1d3 |
| 8 | Torpedo energy, fins, wire, proximity fuze, wake homing, ASROC | ae3991b |
| 9 | Decoys, seeker discrimination, Nixie cable, warship decoys | f75d177 |
| 10 | Damage, stability, fire, repair logistics | 9d8e15c |
| 11 | Radar equation, antenna scan, ESM amplitude, HFDF, lookout | 2f3b0f2 |
| 12 | Missile flight physics, chaff clouds, CIWS, raiders, helicopter, buoys | 97319f3 |
| 13 | Performance pass, closure record, release 1.1.0 | this change |
## 1. Player Frigate — `src/ship/ship.py` + `src/world/grounding.py` + `src/core/config.py`
### 1.1 What is currently modeled
| Aspect | Implementation | Ref |
|--------|---------------|-----|
| Rudder dynamics | 1st-order lag on rudder angle (`SHIP_RUDDER_RATE_DEG_PER_S = 4°/s`, max ±30°) + 1st-order lag on yaw rate (`SHIP_YAW_RESPONSE_S = 10 s`) | `ship.py:126-139` |
| Speed response | Linear rate-limited approach to target speed (`SHIP_SPEED_RESP_KN_PER_S = 0.08 kn/s ≈ 2–4 min to full`) | `ship.py:141-153` |
| Telegraph orders | Discrete STOP/SLOW/HALF/FULL/FLANK (0/6/10/16/25 kn) + ASTERN (3 kn) | `config.py:194-203`, `ship.py:50-71` |
| Fuel | Hotel load 400 kg/h + cubic propulsion load up to 7 400 kg/h; 500 t capacity; astern penalty ×1.15 | `ship.py:88-112`, `config.py:205-208` |
| Cavitation | Binary flag at `CAVITATION_KN = 15`; boosts noise, degrades passive sonar by factor 0.35 | `ship.py:78-81`, `config.py:214-215` |
| Quiet mode | Speed capped to 12 kn, noise ×0.65 | `ship.py:25,142-143,210-211` |
| Roll/pitch | Sinusoidal cosmetic oscillation scaled by sea state + speed | `ship.py:195-201` |
| Grounding | Swept hull-footprint (9 points) against coastline + bathymetry; impact energy → compartment flooding | `grounding.py:343-557`, `game.py:4318-4334` |
| Hull spec | Mass 3600 t, length 118 m, beam 14 m, draft 7.5 m, keel reserve 1.5 m | `grounding.py:18-43` |
| Station damage | 9 compartments; flooding/fire state machines; 3 repair teams; speed cap on engine damage | `damage.py:33-266` |
### 1.2 Gaps and simplifications
| Gap | Current behaviour | Would need for realism |
|-----|-------------------|------------------------|
| ~~**Hydrodynamic resistance**~~ | **Closed (Phase 2).** `src/physics/ship_dynamics.py`: resistance R = k v^2 (k from installed power and propulsive efficiency) plus added resistance in waves (Hs^2 B^2/L); thrust from a linear K_T(J) propeller; exact Riccati integration so any step size gives the same speed. | — |
| ~~**Propeller/shaft physics**~~ | **Closed (Phase 2).** Shaft revolutions from the propeller (steady rpm proportional to speed), a propulsion control programme limiting load-up, reverse-pitch braking, and cavitation from the cavitation number sigma at the screw depth (calibrated to 15 kn in calm water; earlier when pitching lifts the stern). | — |
| ~~**Rudder effectiveness vs speed**~~ | **Fixed (2026-09).** `speed_factor = clamp((speed/10)^2, 0, 1.5)` — already quadratic (dynamic-pressure-like), not linear. `ship.py:139`. | — |
| ~~**Turn radius**~~ | **Closed (Phase 2).** First-order Nomoto steering r = K (V/L) delta with T proportional to L/V, calibrated to 1.2 deg/s at FULL; turning circle about 0.4 NM at all speeds. | — |
| ~~**Trim / sink at speed**~~ | **Closed (Phase 2).** Hydrostatic draft from displacement (fuel burnt, floodwater), Barrass squat in shallow water feeding swept grounding, dynamic trim by the stern ~ Fn^2. | — |
| ~~**Sea-state effect on motion**~~ | **Closed (Phase 2).** Added resistance in waves; 1-DOF roll and pitch oscillators driven by an 8-component Pierson-Moskowitz wave slope relative to the wave direction, turn heel, damage list and speed-dependent fin stabilizer damping. | — |
| ~~**Draft / under-keel clearance**~~ | **Closed (Phase 2).** Dynamic draft (displacement + squat) is passed to `swept_grounding`; the tide (Phase 1) changes the water depth. | — |
| ~~**Fuel → mass → performance**~~ | **Closed (Phase 2).** Displacement = design load - burnt fuel + floodwater drives surge inertia and draft; fuel burn follows delivered shaft power (steady values reproduce the 1.0.0 cubic law). | — |
| ~~**Damage → hydrodynamics**~~ | **Closed (Phase 2).** List yaw bias (existing), jammed rudder when the aft steering-gear compartment (flight deck) is destroyed, fin stabilizers lost with a destroyed hull compartment, floodwater mass. | — |
| ~~**Wake signature**~~ | **Closed (Phase 2 model).** Bounded, saved wake ring (48 points, one per 10 s) with sea-state-dependent bubble decay and `Ship.wake_strength_at()`; consumed by own-sonar and wake-homing weapons in later phases. | — |
### 1.3 Data structures / interfaces that would be touched
- `Ship.__init__`: add `trim_deg`, `draft_m`, `mass_t` (dynamic), `propeller_state`, `rudder_lift_coeff`
- `Ship.update()`: replace linear speed approach with thrust/drag equilibrium
- `Ship.steer_input()` / `Ship.update()`: speed-dependent rudder authority
- `config.py`: add `SHIP_DRAG_COEFF`, `SHIP_PROPELLER_KV`, `SHIP_SHARP_RATIO`, `SHIP_SQUAT_EXponent`, sea-state drag table
- `damage.py`: add list angle, asymmetric flooding, structural integrity
- `grounding.py`: `HullSpec` already has mass/length/beam/draft; extend with waterplane area, metacentric height
---
| Gap | Model now | Closed in |
|---|---|---|
| Hydrodynamic resistance | `src/physics/ship_dynamics.py`: resistance R = k v^2 (k from installed power and propulsive efficiency) plus added resistance in waves (Hs^2 B^2/L); thrust from a linear K_T(J) propeller; exact Riccati integration so any step size gives the same speed. | 2 (236d23b) |
| Propeller/shaft physics | Shaft revolutions from the propeller (steady rpm proportional to speed), a propulsion control programme limiting load-up, reverse-pitch braking, and cavitation from the cavitation number sigma at the screw depth (calibrated to 15 kn in calm water; earlier when pitching lifts the stern). | 2 (236d23b) |
| Rudder effectiveness vs speed | `speed_factor = clamp((speed/10)^2, 0, 1.5)` — already quadratic (dynamic-pressure-like), not linear. `ship.py:139`. | pre-1.1 (2026-09) |
| Turn radius | First-order Nomoto steering r = K (V/L) delta with T proportional to L/V, calibrated to 1.2 deg/s at FULL; turning circle about 0.4 NM at all speeds. | 2 (236d23b) |
| Trim / sink at speed | Hydrostatic draft from displacement (fuel burnt, floodwater), Barrass squat in shallow water feeding swept grounding, dynamic trim by the stern ~ Fn^2. | 2 (236d23b) |
| Sea-state effect on motion | Added resistance in waves; 1-DOF roll and pitch oscillators driven by an 8-component Pierson-Moskowitz wave slope relative to the wave direction, turn heel, damage list and speed-dependent fin stabilizer damping. | 2 (236d23b) |
| Draft / under-keel clearance | Dynamic draft (displacement + squat) is passed to `swept_grounding`; the tide (Phase 1) changes the water depth. | 2 (236d23b) |
| Fuel → mass → performance | Displacement = design load - burnt fuel + floodwater drives surge inertia and draft; fuel burn follows delivered shaft power (steady values reproduce the 1.0.0 cubic law). | 2 (236d23b) |
| Damage → hydrodynamics | List yaw bias (existing), jammed rudder when the aft steering-gear compartment (flight deck) is destroyed, fin stabilizers lost with a destroyed hull compartment, floodwater mass. | 2 (236d23b) |
| Wake signature | Bounded, saved wake ring (48 points, one per 10 s) with sea-state-dependent bubble decay and `Ship.wake_strength_at()`; consumed by own-sonar and wake-homing weapons in later phases. | 2 (236d23b) |
## 2. Enemy Submarines — `src/enemies/sub.py` + `src/enemies/endurance.py`
### 2.1 What is currently modeled
| Aspect | Implementation | Ref |
|--------|---------------|-----|
| State machine | PATROLLE ↔ EVADE ↔ LAUER ↔ SINKING | `sub.py:417-524` |
| Utility-based AI | Scores hide/lurk/attack/escape from distance, thermo position, frigate noise, damage | `sub.py:173-199` |
| Endurance (battery/AIP/snorkel/radio) | Full phase machine: SUBMERGED → AIP → ASCENDING → SNORKEL → RADIO → DESCENDING; battery kWh, AIP energy, generator charge | `endurance.py:26-282` |
| Speed support from power | `supported_speed()` computes max speed from available kW vs propulsion power curve `load_kw = hotel + max_kw * (v/v_max)^n` | `endurance.py:92-113` |
| Noise model | `quiet_factor()` from profile (0..1), modified by damage, EVADE, LAUER, transmitting; `noise_level() = 1 - quiet` | `sub.py:582-594` |
| LOFAR / acoustic signature | Fingerprinted tonal lines (blade rate, harmonics, secondary tonals) + broadband noise; catalog-driven | `sub.py:636-714`, `data/contacts/subs.json` machines |
| Motion limits | `motion_limits()`: turn rate, accel, depth rate from catalog (length-based if reference exists) | `platform.py:405-426` |
| Counter-attack | Interception course with lead, ±3° aim error, probability-based fire, weapon-arc check | `sub.py:215-303` |
| Decoy deployment | One-time on torpedo alert, catalog probability, cooldown | `sub.py:162-172, 348-355` |
| Torpedo alert | Triggers EVADE + decoy + faster evasive speed | `sub.py:162-171` |
| Ping reaction | `hear_ping()` → immediate EVADE | `sub.py:152-161` |
| Land avoidance | Sweep check + 90° turn on blocked path | `sub.py:501-507` |
| World-boundary reflection | Bounce off 0/size_nm edges | `sub.py:510-515` |
### 2.2 Gaps and simplifications
| Gap | Current behaviour | Would need for realism |
|-----|-------------------|------------------------|
| ~~**No depth dynamics**~~ | **Closed (Phases W2 + 6).** Inertial depth changes; hydroplane authority ~ v^2 (ballast-only rate below ~4 kn); one emergency blow from a bounded HP-air store at 4 m/s. | — |
| ~~**No cavitation model on subs**~~ | **Closed (Phase 6).** Onset speed from the catalog (or tendency) rising with depth as sqrt(1 + z/10.3); cavitation adds 8 dB source level. | — |
| ~~**No pressure / hull limits**~~ | **Closed (Phase 6).** Fatigue accumulates beyond 0.9 x test depth (saved) and converts to damage; 1.5 x test depth crushes the hull. | — |
| ~~**Speed vs noise coupling is indirect**~~ | **Closed (Phase 6).** Source level ~40 log v relative to the patrol reference (subs 6 kn, ships their cruise speed), plus cavitation and launch/blow transients, in all passive sonar paths (own, dipping, buoys, NPC). | — |
| ~~**No propeller-wake / bubble effects**~~ | **Closed (Phases 2/6/8).** Own wake ring masks the hull array astern; submarine screw transients and cavitation raise source level; torpedo bubble trails in Phase 8. | — |
| ~~**Evasive manoeuvre is kinematic**~~ | **Closed (Phase 6).** Evasion speeds are reached at the hull's acceleration limit, deep dives are limited by plane authority, and a hard sprint cavitates and becomes loud. | — |
| ~~**LAUER is a speed brake, not a tactic**~~ | **Closed (Phase 6).** The lurking boat heads into the current at bare steerage way and holds station. | — |
| ~~**No current / drift**~~ | **Fixed (2026-09).** `World.current_vec(x, y)` provides a deterministic current field, already applied to ship/sub/surface ships (`world.py:217-224`), and now also to torpedoes (both classes) and the free-drift enemy decoy. | — |
| ~~**Torpedo launch is instantaneous**~~ | **Closed (Phases W2 + 6).** Motor spool-up, launch depth, and a loud 8 s tube-discharge transient on the firing boat. | — |
| ~~**No active sonar use by subs**~~ | **Closed.** `Sub._maybe_active_ping` (aggressive boats, fresh contact, cooldown saved since Phase 0); the ping is heard by the frigate. | — |
| ~~**No ESM/ESB use by subs**~~ | **Closed (Phase 7).** All submarines use their `PlatformSensorSuite` (legacy snapshot gate removed); ESM works only with the mast up (<= 18 m); range from their own passive TMA with TMA legs (saved track). | — |
| ~~**No ASW coordination**~~ | **Closed (Phase 7).** Hostile red-group datalink shares tracks; a submerged boat only exchanges at mast depth or while snorkelling/transmitting, which makes the latency physical. | — |
| ~~**Damage model is scalar**~~ | **Closed (Phases 6/10).** Shock-factor hits, progressive flooding while holed, emergency blow, fatigue; damage throttles speed and raises noise. Subs keep a lumped damage value by design (no player-visible compartments). | — |
### 2.3 Data structures / interfaces that would be touched
- `Sub.__init__`: add `trim_deg`, `plane_angle`, `current_vec`, `pressure_depth_m`, `hull_stress`
- `Sub.update()`: replace `depth += clamp(...)` with physics-based depth dynamics
- `Sub.quiet_factor()`: derive from RPM, speed, cavitation state, hull damage
- `SubmarineEndurance`: add depth-dependent power draw, emergency blow energy
- `data/contacts/subs.json` machines: add `cavitation_onset_kn`, `pressure_hull_rating_m`
- `config.py`: add current fields, pressure constants
---
| Gap | Model now | Closed in |
|---|---|---|
| No depth dynamics | Inertial depth changes; hydroplane authority ~ v^2 (ballast-only rate below ~4 kn); one emergency blow from a bounded HP-air store at 4 m/s. | W2 (1.0.0), 6 (8f79700) |
| No cavitation model on subs | Onset speed from the catalog (or tendency) rising with depth as sqrt(1 + z/10.3); cavitation adds 8 dB source level. | 6 (8f79700) |
| No pressure / hull limits | Fatigue accumulates beyond 0.9 x test depth (saved) and converts to damage; 1.5 x test depth crushes the hull. | 6 (8f79700) |
| Speed vs noise coupling is indirect | Source level ~40 log v relative to the patrol reference (subs 6 kn, ships their cruise speed), plus cavitation and launch/blow transients, in all passive sonar paths (own, dipping, buoys, NPC). | 6 (8f79700) |
| No propeller-wake / bubble effects | Own wake ring masks the hull array astern; submarine screw transients and cavitation raise source level; torpedo bubble trails in Phase 8. | 2 (236d23b), 6 (8f79700), 8 (ae3991b) |
| Evasive manoeuvre is kinematic | Evasion speeds are reached at the hull's acceleration limit, deep dives are limited by plane authority, and a hard sprint cavitates and becomes loud. | 6 (8f79700) |
| LAUER is a speed brake, not a tactic | The lurking boat heads into the current at bare steerage way and holds station. | 6 (8f79700) |
| No current / drift | `World.current_vec(x, y)` provides a deterministic current field, already applied to ship/sub/surface ships (`world.py:217-224`), and now also to torpedoes (both classes) and the free-drift enemy decoy. | pre-1.1 (2026-09) |
| Torpedo launch is instantaneous | Motor spool-up, launch depth, and a loud 8 s tube-discharge transient on the firing boat. | W2 (1.0.0), 6 (8f79700) |
| No active sonar use by subs | `Sub._maybe_active_ping` (aggressive boats, fresh contact, cooldown saved since Phase 0); the ping is heard by the frigate. | pre-1.1 (1.0.0) |
| No ESM/ESB use by subs | All submarines use their `PlatformSensorSuite` (legacy snapshot gate removed); ESM works only with the mast up (<= 18 m); range from their own passive TMA with TMA legs (saved track). | 7 (8e6b1d3) |
| No ASW coordination | Hostile red-group datalink shares tracks; a submerged boat only exchanges at mast depth or while snorkelling/transmitting, which makes the latency physical. | 7 (8e6b1d3) |
| Damage model is scalar | Shock-factor hits, progressive flooding while holed, emergency blow, fatigue; damage throttles speed and raises noise. Subs keep a lumped damage value by design (no player-visible compartments). | 6 (8f79700), 10 (9d8e15c) |
## 3. Enemy Surface Ships — `src/enemies/surface.py`
### 3.1 What is currently modeled
| Aspect | Implementation | Ref |
|--------|---------------|-----|
| Loiter / orbit | Waypoint orbit around anchor; 4-point loiter for military; civil: A→B via optional waypoint | `surface.py:126-197` |
| ASM salvo | When frigate within `WARSHIP_ASM_RANGE_NM` (35 NM) and LOS clear; salvo size from catalog | `surface.py:275-289`, `game.py:3796-3811` |
| ASROC response | Responds to positioned sonar fixes (ACTIVE/TMA/BUOY/FUSED) | `surface.py:199-232` |
| RCS aspect | `aspect_rcs_factor()` — broadside = 1.0, end-on = 0.55 | `config.py:444-449` |
| Radar emission | `esm_prob` from catalog; `emitter` flag | `surface.py:76` |
| AIS | Civilian ships transmit AIS; military do not | `surface.py:109-110` |
| Damage | Scalar 0-100; `speed_cap_kn` reduced by 25% at full damage; `hit()` adds 34 per torpedo | `surface.py:114-120` |
| Motion | Turn rate 1°/s, accel 0.03 kn/s (catalog-driven) | `surface.py:55-59` |
### 3.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No ship hydrodynamics**~~ | **Closed (Phase 6).** Speed lag from the catalog, Nomoto-linear turning, and added resistance in waves lowering attainable speed by hull length (small hulls lose more). | — |
| ~~**No radar horizon**~~ | **Closed (Phase 12).** The ASM body has its own altitude (20 m cruise, 5 m terminal); radar detection and the HOJ bearing both require line of sight over the horizon. | — |
| ~~**No countermeasures**~~ | **Closed (Phase 9 / Phase 12).** Hostile combatants stream acoustic decoys (saved store of 2) when they hear a torpedo launch; missile defence (ship chaff/CIWS) is modelled on the own ship in Phase 12. | — |
| ~~**No damage propagation**~~ | **Closed (Phases 8/10).** Shock-factor damage (near misses no longer sink), progressive flooding above 30 %, radar lost above 60 % and missile launch above 75 % damage. | — |
| ~~**No evasive manoeuvres**~~ | **Closed.** Combatants turn away at flank speed on a heard launch (W2, state saved in Phase 0) and stream decoys (Phase 9). | — |
| ~~**No weapon systems modelling**~~ | **Closed (Phases 8/12).** Warship ASMs fly to the datum of the launcher's own (noisy) sensor contact, so fire-control error carries into the shot; 3-DOF missile with seeker FOV, lock delay and PN; torpedo and ASROC proximity fuze with shock-factor damage; salvos saturate the two ESSM fire channels and the CIWS mount. | — |
### 3.3 Data structures touched
- `SurfaceShip`: add `draft_m`, `trim_deg`, `radar_height_m`, `damage_compartments`
- `data/contacts/warships.json`: add hull dimensions, radar antenna height, countermeasure profiles
---
| Gap | Model now | Closed in |
|---|---|---|
| No ship hydrodynamics | Speed lag from the catalog, Nomoto-linear turning, and added resistance in waves lowering attainable speed by hull length (small hulls lose more). | 6 (8f79700) |
| No radar horizon | The ASM body has its own altitude (20 m cruise, 5 m terminal); radar detection and the HOJ bearing both require line of sight over the horizon. | 12 (97319f3) |
| No countermeasures | Hostile combatants stream acoustic decoys (saved store of 2) when they hear a torpedo launch; missile defence (ship chaff/CIWS) is modelled on the own ship in Phase 12. | 9 (f75d177), 12 (97319f3) |
| No damage propagation | Shock-factor damage (near misses no longer sink), progressive flooding above 30 %, radar lost above 60 % and missile launch above 75 % damage. | 8 (ae3991b), 10 (9d8e15c) |
| No evasive manoeuvres | Combatants turn away at flank speed on a heard launch (W2, state saved in Phase 0) and stream decoys (Phase 9). | pre-1.1 (1.0.0) |
| No weapon systems modelling | Warship ASMs fly to the datum of the launcher's own (noisy) sensor contact, so fire-control error carries into the shot; 3-DOF missile with seeker FOV, lock delay and PN; torpedo and ASROC proximity fuze with shock-factor damage; salvos saturate the two ESSM fire channels and the CIWS mount. | 8 (ae3991b), 12 (97319f3) |
## 4. Torpedoes — `src/weapons/torpedo.py`
### 4.1 What is currently modeled
| Aspect | Implementation | Ref |
|--------|---------------|-----|
| Speed | Fixed `speed_kn` from catalog (45/55/28 kn) | `torpedo.py:45`, JSON |
| Range | Fixed `range_nm` (12/30 NM); travel counter; SASE at range | `torpedo.py:46,251-253` |
| Wire guidance | Mid-course updates every `TORP_MIDCOURSE_UPDATE_S = 0.5 s`; stale at 3 s; broken at 12 s | `torpedo.py:51-53,115-137` |
| Serpentine search | Sine-wave offset (±15°) around mid-course heading | `torpedo.py:219-225` |
| Terminal homing | Within `TORP_HOME_RANGE_NM = 1.2` NM; seeker evaluates candidates; 15°/s turn | `torpedo.py:49,189,212-215` |
| Depth control | Proportional rate-limited: `DEPTH_RATE_M_PER_S = 10 m/s` | `torpedo.py:50,231-235` |
| Kill criteria | Swept distance ≤ `kill_dist_nm` AND depth within ±`kill_depth_m` | `torpedo.py:47-48,288-313` |
| Terrain avoidance | `underwater_path_blocked()` — 64-sample sweep against land/bathymetry | `torpedo.py:20-39` |
| Throttle on turn | Speed ×0.6 when |Δcourse| > 60°; gradual reduction 30-60° | `torpedo.py:243-248` |
| Decoy interaction | Decoys are seeker candidates; torpedo "hits" decoy → SASE | `torpedo.py:139-161` |
| Enemy torpedo | 6°/s turn, 3 NM seeker range, no wire | `torpedo.py:388-436` |
| ASROC delivery | Ballistic transit to datum, then torpedo spawns at water entry | `asw.py:521-583` |
### 4.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No launch dynamics**~~ | **Closed (Phases W2 + 6 + 8).** Spool-up, launch-depth offset and tube transient on the firing boat, speed-dependent turning and depth response right after launch. | — |
| ~~**No acceleration phase**~~ | **Closed.** Spool-up (W2) plus an energy store: power ~ v^3, range emerges from the battery and grows when running slower. | — |
| ~~**No depth inertia**~~ | **Closed (Phase 8).** Fin-limited vertical acceleration (~ dynamic pressure) with a proportional depth command (saved rate, small overshoot); hostile torpedoes now have depth control too (run depth, keel depth when homing). | — |
| ~~**No hydrodynamic turn limit**~~ | **Closed (Phase 8).** Constant turning radius: turn rate proportional to speed, for both torpedo classes. | — |
| ~~**No wire dynamics**~~ | **Closed (Phase 8).** Two finite spools (torpedo 1.25 x range, ship 5 NM of own track) and tension breaks from ship overspeed (> 20 kn) or hard turns (> 1.5 deg/s) held for 5 s; the old timers remain as datalink latency. | — |
| ~~**No propeller noise model**~~ | **Closed (Phase 8).** Speed-dependent propulsor lines (both classes) and a 60 log v source level; the target hears a running torpedo through the passive sonar equation (ray excess, ambient, own noise). | — |
| ~~**Kill is binary**~~ | **Closed (Phase 8).** Proximity fuze at closest approach; damage from the shock factor sqrt(W)/R (250 kg), so near misses damage without sinking. | — |
| ~~**No target reaction to torpedo**~~ | **Closed (Phases W2 + 7 + 8).** Launch-transient and homing alerts, crew recognition delay (per-boat lognormal 2-15 s, saved countdown), evasive dive across the layer; Phase 8 makes the running-torpedo notice a sonar-equation detection. | — |
| ~~**No self-destruction timing**~~ | **Closed (Phase 8).** Battery exhaustion stops the motor; the weapon coasts (dv/dt = -k v^2) and is lost below 30 % speed. | — |
| ~~**No wake / trail signature**~~ | **Closed (Phase 8).** Shallow hostile torpedoes leave a bubble track visible to the lookout by day up to 1.5 NM; hostile torpedoes can home on the own-ship wake. | — |
| ~~**ASROC payload depth**~~ | **Closed (Phase 8).** The payload flies a helix search at its splash point while its depth controller descends to the search depth. | — |
### 4.3 Data structures touched
- `Torpedo.__init__`: add `launch_delay_s`, `accel_time_s`, `cruise_speed_kn`, `max_turn_rate_by_speed`
- `Torpedo.update()`: replace fixed turn/depth rates with physics
- `config.py`: `TORP_HOME_RANGE_NM`, `TORP_MIDCOURSE_UPDATE_S` already exist; add `TORP_ACCEL_S`, `TORP_WIRE_MAX_NM`
- `data/contacts/torpedoes.json`: add `accel_time_s`, `wire_max_nm`, `cavitation_kn`
---
## 5. Decoys — `src/enemies/decoy.py` + `src/weapons/asw.py` (TowedAcousticDecoy)
### 5.1 What is currently modeled
| Aspect | Implementation |
|--------|---------------|
| Free-drift decoy (enemy sub) | Constant speed from catalog, random course, lifetime from catalog; LOFAR lines from profile; quiet factor 0.15 |
| Towed decoy (Nixie, own ship) | Tethered behind ship at fixed `tether_nm`; depth fixed; lifetime from loadout; `TowedAcousticDecoy.update()` just tracks position + life |
| Decoy as torpedo target | Decoys are in `seeker_candidates` list; torpedo "hits" decoy → SASE (no damage) |
### 5.2 Gaps and simplifications
All closed in Phase 9:
- ~~No self-noise model~~ — decoy emission fades with its battery (`source_level_offset_db`); the Nixie has a designed emission 12 dB above a quiet hull.
- ~~No towed-decoy cable dynamics~~ — quasi-static cable equilibrium: depth ~ design depth x (15 kn / v)^2 (bounded), layback from the cable length, tow bearing lagging the ship's course (saved), cable parts above 25 kn.
- ~~No frequency/content modulation~~ — replica tonals with a slow +/-2 % sweep and battery-dependent level.
- ~~No decoy effectiveness model~~ — seekers score candidates by received level (source level, spreading, depth mismatch) with a Doppler gate against stationary echoes; the moving towed Nixie passes the gate.
- ~~No multiple-decoy confusion logic~~ — lock hysteresis (6 dB), and a torpedo that overruns a decoy remembers it (bounded, saved) and re-attacks with its remaining energy.
---
| Gap | Model now | Closed in |
|---|---|---|
| No launch dynamics | Spool-up, launch-depth offset and tube transient on the firing boat, speed-dependent turning and depth response right after launch. | W2 (1.0.0), 6 (8f79700), 8 (ae3991b) |
| No acceleration phase | Spool-up (W2) plus an energy store: power ~ v^3, range emerges from the battery and grows when running slower. | pre-1.1 (1.0.0) |
| No depth inertia | Fin-limited vertical acceleration (~ dynamic pressure) with a proportional depth command (saved rate, small overshoot); hostile torpedoes now have depth control too (run depth, keel depth when homing). | 8 (ae3991b) |
| No hydrodynamic turn limit | Constant turning radius: turn rate proportional to speed, for both torpedo classes. | 8 (ae3991b) |
| No wire dynamics | Two finite spools (torpedo 1.25 x range, ship 5 NM of own track) and tension breaks from ship overspeed (> 20 kn) or hard turns (> 1.5 deg/s) held for 5 s; the old timers remain as datalink latency. | 8 (ae3991b) |
| No propeller noise model | Speed-dependent propulsor lines (both classes) and a 60 log v source level; the target hears a running torpedo through the passive sonar equation (ray excess, ambient, own noise). | 8 (ae3991b) |
| Kill is binary | Proximity fuze at closest approach; damage from the shock factor sqrt(W)/R (250 kg), so near misses damage without sinking. | 8 (ae3991b) |
| No target reaction to torpedo | Launch-transient and homing alerts, crew recognition delay (per-boat lognormal 2-15 s, saved countdown), evasive dive across the layer; Phase 8 makes the running-torpedo notice a sonar-equation detection. | W2 (1.0.0), 7 (8e6b1d3), 8 (ae3991b) |
| No self-destruction timing | Battery exhaustion stops the motor; the weapon coasts (dv/dt = -k v^2) and is lost below 30 % speed. | 8 (ae3991b) |
| No wake / trail signature | Shallow hostile torpedoes leave a bubble track visible to the lookout by day up to 1.5 NM; hostile torpedoes can home on the own-ship wake. | 8 (ae3991b) |
| ASROC payload depth | The payload flies a helix search at its splash point while its depth controller descends to the search depth. | 8 (ae3991b) |
## 6. Air — `src/air/`
### 6.1 What is currently modeled
| Entity | Model | Ref |
|--------|-------|-----|
| **Flight** (civil/military) | Waypoint transit or loiter; 2°/s turn; ESM sensing; AIS (civil) | `flights.py:113-172` |
| **Raider** (attack plane) | 3-phase FSM: APPROACH → ATTACK (tangential stand-off) → RETREAT; fires ASM salvo; fixed altitude; 4°/s turn | `raid.py:75-117` |
| **ASM** (missile) | Sea-skimming; homing on frigate with 12°/s turn; optional jammer (burn-through at `jam_break_nm`); chaff vulnerability; terminal-active radar seeker (silent until `seeker_active_range_nm`, then feeds ESM independently of the HOJ path) | `asm.py:75-113` |
| **ESSM** (SAM) | Homing on observed ASM track; seeker activates within `seeker_range_nm`; 12°/s turn; no boost phase | `asm.py:138-182` |
| **Helicopter** | Fixed speed 120 kn; fuel timer; dipping sonar (deploy/retrieve, depth control); sonobuoy drop; torpedo release; weather-gated launch/dip | `helicopter.py:59-272` |
| **Sonobuoy** | Static position, battery life, passive sonar sensor | `sonobuoy.py:6-19` |
### 6.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No flight dynamics**~~ | **Closed (Phase 12).** Raiders fly coordinated turns at a 56 deg bank limit (rate = g tan(bank)/v) and climb/descend at a limited vertical speed; missiles are 3-DOF point masses (boost, sustainer, altitude control, g-limited turns). Civil/military transit flights keep standard-rate turns at constant altitude (their cruise profile); engine failures are out of scope. | — |
| ~~**No radar horizon**~~ | **Fixed (2026-09) for airframes.** Raiders already used `radar_horizon_nm()`; regular civil/military `flights` now use it too (flat `FLIGHT_RADAR_ALTITUDE_M`). **Still open for the ASM body itself** (see below): its own search-radar detection in `game.py._update_air_picture` uses flat `air_eff` with no altitude/horizon term, so a sea-skimmer is currently seen by search radar at the same range as a 60 m-altitude aircraft. | — |
| ~~**No ASM boost phase**~~ | **Closed (Phase 12).** Launched rounds boost from the launcher's speed at 60 m/s^2, then the sustainer holds cruise; the saved age is bounded by the powered flight time (range at cruise plus boost). | — |
| ~~**No seeker physics**~~ | **Closed (Phase 12).** ASM: inertial mid-course to the launch datum, active seeker with a +/-30 deg field of view and 1.5 s lock, then proportional navigation (N = 4) limited to 15 g. ESSM: PN on the seeker LOS rate within its airframe turn limit. | — |
| ~~**No ESM warning for inbound ASM**~~ | **Fixed (2026-09).** ASM `seeker_active()` stays silent mid-course (INS-only) and radiates once inside `seeker_active_range_nm` (18 NM); the seeker's own fingerprint (9.0-9.5 GHz, pulse-Doppler) feeds `_update_esm_picture` as a distinct RWR track, independent of the existing HOJ/jammer path (`asm.py`, `game.py._asm_seeker_emitter`). Not yet catalogued for classification in `data/contacts/*` emitters, so `rank_emitters()` won't positively ID it as "missile" — an intentional ambiguity, but worth revisiting. | — |
| ~~**ASM body ignores radar horizon**~~ | **Closed (Phase 12).** See radar horizon above: a sea-skimmer appears at about 20 NM (15 NM in the terminal phase). | — |
| ~~**Raider has no attack-altitude profile**~~ | **Closed (Phase 12).** Each salvo needs a pop-up to 300 m and a 4 s fire-control lock; the fire-control radar is an ESM emission only during the pop-up, and the higher raider crosses the radar horizon earlier. | — |
| ~~**No CIWS physics**~~ | **Closed (Phase 12).** Mount slews at 115 deg/s and fires only on target; the fire control uses its own latest measurement; the CIWS radar holds missiles inside 3 NM; burst kill from dispersion (2 mrad) and prediction error over the rounds' time of flight; bursts that would arrive after impact cannot kill. Calibrated to the 1.0.0 leak rate. | — |
| ~~**No chaff physics**~~ | **Closed (Phase 12).** Up to 8 saved chaff clouds laid off the threat axis, blooming over 3 s, drifting with the wind and falling out after 90 s; seduction is the Swerling-1 contest between cloud and ship echo, reduced when the cloud has not bloomed by the missile's arrival; a seduced missile steers to the cloud. | — |
| ~~**No ECM on own ship**~~ | **Closed.** The ELOKA station's ECM jammer (noise, RGPO/VGPO, false targets) acts on missile seekers; GPS spoofing is out of scope for this setting. | — |
| ~~**Helicopter: no hover dynamics**~~ | **Closed (Phase 12).** Hover burns fuel 1.3x faster; wind pushes the aircraft off its (saved) hover point against the pilot's position hold; launch and recovery wait for a deck-motion window (roll 8 deg, pitch 3.5 deg). | — |
| ~~**Sonobuoy: no drift**~~ | **Closed (Phase 12).** Buoys drift with the surface current (which carries the wind drift) plus 2 % windage. | — |
| **No air-to-air threat** | **Out of scope (by design).** U-Jagd is an ASW frigate simulation without fighters or CAP; hostile aircraft are engaged only by own ship air defence. | — |
### 6.3 Data structures touched
- `ASM.__init__`: seeker activation range done (`seeker_active_range_nm`); still add `altitude_m` for its own radar-horizon detection (distinct from the seeker's ESM range), `boost_phase_s`
- `Raider.__init__`: add `climb_rate_m_s`, `min_altitude_m`, `max_altitude_m` for an attack pop-up
- `Helicopter`: add `wind_drift`, `hover_fuel_rate`, `dip_sonar_dynamics`
- `config.py`: add `ASM_BOOST_S`, `CIWS_TURN_RATE`, `RAIDER_CLIMB_RATE`
---
| Gap | Model now | Closed in |
|---|---|---|
| No flight dynamics | Raiders fly coordinated turns at a 56 deg bank limit (rate = g tan(bank)/v) and climb/descend at a limited vertical speed; missiles are 3-DOF point masses (boost, sustainer, altitude control, g-limited turns). Civil/military transit flights keep standard-rate turns at constant altitude (their cruise profile); engine failures are out of scope. | 12 (97319f3) |
| No radar horizon | Raiders already used `radar_horizon_nm()`; regular civil/military `flights` now use it too (flat `FLIGHT_RADAR_ALTITUDE_M`). **Still open for the ASM body itself** (see below): its own search-radar detection in `game.py._update_air_picture` uses flat `air_eff` with no altitude/horizon term, so a sea-skimmer is currently seen by search radar at the same range as a 60 m-altitude aircraft. | pre-1.1 (2026-09) |
| No ASM boost phase | Launched rounds boost from the launcher's speed at 60 m/s^2, then the sustainer holds cruise; the saved age is bounded by the powered flight time (range at cruise plus boost). | 12 (97319f3) |
| No seeker physics | ASM: inertial mid-course to the launch datum, active seeker with a +/-30 deg field of view and 1.5 s lock, then proportional navigation (N = 4) limited to 15 g. ESSM: PN on the seeker LOS rate within its airframe turn limit. | 12 (97319f3) |
| No ESM warning for inbound ASM | ASM `seeker_active()` stays silent mid-course (INS-only) and radiates once inside `seeker_active_range_nm` (18 NM); the seeker's own fingerprint (9.0-9.5 GHz, pulse-Doppler) feeds `_update_esm_picture` as a distinct RWR track, independent of the existing HOJ/jammer path (`asm.py`, `game.py._asm_seeker_emitter`). Not yet catalogued for classification in `data/contacts/*` emitters, so `rank_emitters()` won't positively ID it as "missile" — an intentional ambiguity, but worth revisiting. | pre-1.1 (2026-09) |
| ASM body ignores radar horizon | See radar horizon above: a sea-skimmer appears at about 20 NM (15 NM in the terminal phase). | 12 (97319f3) |
| Raider has no attack-altitude profile | Each salvo needs a pop-up to 300 m and a 4 s fire-control lock; the fire-control radar is an ESM emission only during the pop-up, and the higher raider crosses the radar horizon earlier. | 12 (97319f3) |
| No CIWS physics | Mount slews at 115 deg/s and fires only on target; the fire control uses its own latest measurement; the CIWS radar holds missiles inside 3 NM; burst kill from dispersion (2 mrad) and prediction error over the rounds' time of flight; bursts that would arrive after impact cannot kill. Calibrated to the 1.0.0 leak rate. | 12 (97319f3) |
| No chaff physics | Up to 8 saved chaff clouds laid off the threat axis, blooming over 3 s, drifting with the wind and falling out after 90 s; seduction is the Swerling-1 contest between cloud and ship echo, reduced when the cloud has not bloomed by the missile's arrival; a seduced missile steers to the cloud. | 12 (97319f3) |
| No ECM on own ship | The ELOKA station's ECM jammer (noise, RGPO/VGPO, false targets) acts on missile seekers; GPS spoofing is out of scope for this setting. | pre-1.1 (1.0.0) |
| Helicopter: no hover dynamics | Hover burns fuel 1.3x faster; wind pushes the aircraft off its (saved) hover point against the pilot's position hold; launch and recovery wait for a deck-motion window (roll 8 deg, pitch 3.5 deg). | 12 (97319f3) |
| Sonobuoy: no drift | Buoys drift with the surface current (which carries the wind drift) plus 2 % windage. | 12 (97319f3) |
## 7. Sonar & Propagation — `src/sonar/sonar.py` + `src/sonar/propagation.py` + `src/audio/receiver.py`
### 7.1 What is currently modeled
| Aspect | Implementation | Ref |
|--------|---------------|-----|
| **Passive detection** | `SNR = 20·log10(R_eff / d)`; detect if SNR ≥ 0 dB; quality = SNR / 14 dB | `sonar.py:30-33, 895-902` |
| **R_eff computation** | Base 20 NM × own-noise penalty × target-noise bonus × sea-state × array factor × towed bonus × propagation factor | `sonar.py:726-775` |
| **Own-ship noise** | `noise_level()` from speed + cavitation; isotropic + directional lobe (Gaussian, 70° FWHM) | `ship.py:205-212`, `sonar.py:748-754` |
| **Bearing error** | Base 6° (bow) / 2° (towed) × speed factor × quality factor; smooth correlated noise | `sonar.py:36-41, 1263-1270` |
| **Active ping** | Echo delay = 2d/c; range + depth with ±0.18 NM / ±12 m error; 30 s cooldown | `sonar.py:672-715, 1178-1261` |
| **TMA** | Grid search over (course: 0-360°/15°, speed: 0-18 kn/2 kn) + local refinement; IRLS 2-pass; observability gate | `tma.py:157-213` |
| **Towed array** | Deploy/retrieve cycles; speed window 3-12 kn; depth 20-260 m; heading lag; fault on overspeed | `sonar.py:450-504, 1107-1128` |
| **Bouys** | 5 buoys; 8 NM range; cross-bearing fix; battery 1 h; thermocline penalty | `sonar.py:988-1039`, `config.py:321-324` |
| **Dipping sonar** | Bearing-only from helo; 18 NM passive / 14 NM active; 30 s ping cooldown | `sonar.py:777-831`, `config.py:317-320` |
| **Propagation** | 4 paths (direct/refracted/surface/bottom); spherical spreading + absorption per band; layer-crossing penalty; CZ bonus; terrain block | `propagation.py:146-235` |
| **Sound speed profile** | Synthetic 21-point profile; `c(d) = 1504 - 0.018·min(d,thermo) + 0.012·max(0,d-thermo)` | `propagation.py:106-111` |
| **LOFAR / DEMON** | FFT-based waterfall; DEMON envelope analysis; blade-count hypotheses; signature ranking | `receiver.py:491-557`, `sonar.py:1140-1149` |
| **Array fusion** | Bow + towed: confirmed / uncertain / divergent; weighted bearing combine | `sonar.py:928-957` |
| **Contact decay** | Confidence decays at `SONAR_CONF_DECAY_PER_S = 0.003/s`; lost after 120 s + conf < 0.15 | `sonar.py:369-378` |
### 7.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No full sonar equation**~~ | **Closed (Phase 3).** `src/sonar/equation.py`: passive SE = SL - TL - NL + DI - DT per band; active SE = SL - 2TL + TS - max(NL - PG, RL - Doppler rejection). Calibrated so 1.0.0 detection ranges hold (`tools/calibrate.py`). Own sonar, dipping sonar and NPC platform sonars use it. | — |
| ~~**No source-level model**~~ | **Closed (Phase 3; speed/cavitation terms Phase 6).** Source level in dB from the catalog quietness; NPC passive sonars hear loud targets farther (up to +5 dB). | — |
| ~~**No receiver noise model**~~ | **Closed (Phase 3).** Wenz/Knudsen wind noise (flat below 500 Hz), distant shipping from nearby merchant count, heavy-rain noise, thermal floor, hull-array self-noise floor plus speed/cavitation self noise, own wake astern; NPC receiver sensitivity from the catalog. | — |
| ~~**No target strength (TS)**~~ | **Closed (Phase 3).** Aspect- and length-dependent target strength (beam highlight ~20 log(L/10)+8 dB, bow/stern 15 dB lower). | — |
| ~~**Propagation: fixed 4 paths**~~ | **Closed (Phase 4).** `src/sonar/raytrace.py`: 48-ray Snell fan through the Mackenzie profile (turning points, surface duct, shadow zone, convergence where deep enough), rough-surface and lossy Rayleigh bottom reflections, incoherent flux summation into TL(range, depth) tables per band; pure functions of a quantized environment key with a bounded LRU cache (purity keeps save/load deterministic). Own, dipping and NPC passive sonars use it via reciprocity (sensor = source). | — |
| ~~**Propagation: no frequency dependence in path loss**~~ | **Closed (Phases 3-4).** Francois-Garrison absorption per band; boundary losses (surface roughness k-dependence) per band in the ray tables. | — |
| ~~**No Doppler**~~ | **Closed (Phase 5).** Tonal lines in LOFAR/audio are Doppler shifted by the closing speed; the strongest tonal is measured per bearing point (SNR-dependent error) and saved; TMA estimates the unshifted f0 and uses Doppler for observability. | — |
| ~~**No interference / clutter**~~ | **Closed (Phase 3).** Boundary (Lambert bottom by sediment, wind-dependent surface) and volume reverberation with absorption; CW Doppler rejection grows with radial speed; charted wrecks return unassociated echoes (saved pending clutter). | — |
| ~~**Ping: no pulse parameters**~~ | **Closed (Phase 3).** Selectable CW (1 s) / LFM (1 s, 100 Hz) pulse (`W`, saved): resolution c*tau/2 or c/2B, Cramer-Rao range accuracy, LFM processing gain against noise, CW Doppler against reverberation. | — |
| ~~**TMA: fixed grid**~~ | **Closed (Phase 5).** Grid seed plus Levenberg-Marquardt refinement over position/velocity (+f0 with Doppler), accepted where observable; 1-sigma covariance ellipse published and saved; range sigma never more optimistic than the observability heuristic. | — |
| ~~**No multi-static sonar**~~ | **Closed (Phase 5).** Sonobuoy (sonar-equation) and dipping bearings enter the contact's bearing track with their own observer positions, so one estimator fuses own-ship, buoy and helicopter geometry. | — |
| ~~**No sonar array beamforming**~~ | **Closed (Phase 5).** Uniform-aperture sinc beam pattern with -13 dB side lobes in the receiver/broadband scan, towed-array endfire broadening (1/sqrt(sin)), and the towed line array's left/right ambiguity (mirror bearing, excluded from TMA until an own turn or the hull array resolves it). | — |
### 7.3 Data structures / interfaces touched
- `SonarSystem._passive_range_nm()`: replace scalar R_eff with frequency-dependent SL/TL/NL/DT
- `propagation.propagate()`: add frequency parameter (currently fixed 100 Hz for passive); add reverberation; add clutter
- `Contact`: add `ts_db` (target strength), `sl_db` (source level), `snr_db` (per frequency band)
- `config.py`: add `SOUND_SPEED_M_S` already exists; add `TL_SPHERICAL_REF`, `NL_SEA_STATE_TABLE`, `TS_DEFAULT`
- `data/contacts/acoustics.json`: extend `TargetSignature` with per-band source level, target strength
- `sensors/platform.py`: `SensorProfile.sensitivity_db` is currently unused in the passive path; wire it into the sonar equation
---
| Gap | Model now | Closed in |
|---|---|---|
| No full sonar equation | `src/sonar/equation.py`: passive SE = SL - TL - NL + DI - DT per band; active SE = SL - 2TL + TS - max(NL - PG, RL - Doppler rejection). Calibrated so 1.0.0 detection ranges hold (`tools/calibrate.py`). Own sonar, dipping sonar and NPC platform sonars use it. | 3 (4cd903a) |
| No source-level model | Source level in dB from the catalog quietness; NPC passive sonars hear loud targets farther (up to +5 dB). | 3 (4cd903a), 6 (8f79700) |
| No receiver noise model | Wenz/Knudsen wind noise (flat below 500 Hz), distant shipping from nearby merchant count, heavy-rain noise, thermal floor, hull-array self-noise floor plus speed/cavitation self noise, own wake astern; NPC receiver sensitivity from the catalog. | 3 (4cd903a) |
| No target strength (TS) | Aspect- and length-dependent target strength (beam highlight ~20 log(L/10)+8 dB, bow/stern 15 dB lower). | 3 (4cd903a) |
| Propagation: fixed 4 paths | `src/sonar/raytrace.py`: 48-ray Snell fan through the Mackenzie profile (turning points, surface duct, shadow zone, convergence where deep enough), rough-surface and lossy Rayleigh bottom reflections, incoherent flux summation into TL(range, depth) tables per band; pure functions of a quantized environment key with a bounded LRU cache (purity keeps save/load deterministic). Own, dipping and NPC passive sonars use it via reciprocity (sensor = source). | 4 (5c9199e) |
| Propagation: no frequency dependence in path loss | Francois-Garrison absorption per band; boundary losses (surface roughness k-dependence) per band in the ray tables. | 3 (4cd903a), 4 (5c9199e) |
| No Doppler | Tonal lines in LOFAR/audio are Doppler shifted by the closing speed; the strongest tonal is measured per bearing point (SNR-dependent error) and saved; TMA estimates the unshifted f0 and uses Doppler for observability. | 5 (7abc45f) |
| No interference / clutter | Boundary (Lambert bottom by sediment, wind-dependent surface) and volume reverberation with absorption; CW Doppler rejection grows with radial speed; charted wrecks return unassociated echoes (saved pending clutter). | 3 (4cd903a) |
| Ping: no pulse parameters | Selectable CW (1 s) / LFM (1 s, 100 Hz) pulse (`W`, saved): resolution c*tau/2 or c/2B, Cramer-Rao range accuracy, LFM processing gain against noise, CW Doppler against reverberation. | 3 (4cd903a) |
| TMA: fixed grid | Grid seed plus Levenberg-Marquardt refinement over position/velocity (+f0 with Doppler), accepted where observable; 1-sigma covariance ellipse published and saved; range sigma never more optimistic than the observability heuristic. | 5 (7abc45f) |
| No multi-static sonar | Sonobuoy (sonar-equation) and dipping bearings enter the contact's bearing track with their own observer positions, so one estimator fuses own-ship, buoy and helicopter geometry. | 5 (7abc45f) |
| No sonar array beamforming | Uniform-aperture sinc beam pattern with -13 dB side lobes in the receiver/broadband scan, towed-array endfire broadening (1/sqrt(sin)), and the towed line array's left/right ambiguity (mirror bearing, excluded from TMA until an own turn or the hull array resolves it). | 5 (7abc45f) |
## 8. Radar / ESM / HFDF — `src/sensors/esm.py`, `src/sensors/tracks.py`, `src/core/game.py`
### 8.1 What is currently modeled
| Sensor | Model | Ref |
|--------|-------|-----|
| **Surface radar** | Range 30 NM (nominal) × weather × rain; bearing ±0.8°; range ±1.5%; RCS aspect factor; terrain occlusion; 0.5 s epoch | `game.py:2949-2981`, `config.py:133-134,254-269` |
| **Air radar** | Range 100 NM; same model; 0.5 s epoch | `game.py:3004-3040` |
| **ESM** | Range 150 NM; bearing ±3°; frequency/PRF/modulation fingerprint; emitter ranking; 300 s operator memory with quality decay and stable association across intermittent radar duty cycles; terrain occlusion | `esm.py`, `game.py` |
| **HFDF** | Range 120 NM; bearing ±8°; cross-bearing fix with covariance; 0.5 s cadence | `game.py:3678-3794` |
| **Lookout (visual)** | Surface 12 NM, sub 5 NM (only if <2 m depth), air 20 NM; night ×0.35; sea state loss; weather visibility cap | `game.py:2888-2947`, `config.py:160-170` |
| **Track fusion (OPZ)** | Bounded picture (512 air, 64 ESM); smoothing (exponential, per-source τ); correlation gating; manual fusion; classification/affiliation | `tracks.py`, `fusion.py`, `game.py:3086-3111` |
| **Weather effects** | Sea state 0-6; wind; rain; fog; visibility; all modulate radar/lookout/range | `world.py:44-142` |
### 8.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No radar equation**~~ | **Closed (Phase 11).** `src/sensors/radar.py`: SNR ~ sigma/R^4 anchored so the nominal range is the Pd = 0.5 point for a broadside target; Swerling-1 target behind a 16-cell CA-CFAR (exact closed form, Pfa 1e-6); GIT-type sea clutter (+3 dB per sea state, CNR ~ R^-3; air search with MTI); two-way rain attenuation; aspect enters as RCS (aspect^4). Hostile platform radars use the same Pd = 0.5 range. Anchors reproduce the 1.0.0 weather/rain losses (calibration harness). | — |
| ~~**No scan rate / PPI dynamics**~~ | **Closed (Phase 11).** The antenna turns in simulation time (90 deg/s, phase and pending sweep saved); a contact gets one look only when the beam passed its bearing since the previous publication; one deterministic (`detrand`) detection draw per look; the PPI sweep line is the saved antenna phase. | — |
| ~~**No ECCM / jamming effect on radar**~~ | **Closed (Phase 11).** Self-screening noise jammer as JNR ~ R^-2 solved from the profiled burn-through range; skin detection uses SINR = S/(N + C + J), so the echo emerges inside burn-through (HOJ bearing outside). Deception jamming (RGPO/angle) is out of scope: missiles carry noise jammers only. | — |
| ~~**ESM: no signal strength**~~ | **Closed (Phase 11).** One-way level 20 log10(R_class/R); rotating search radars reach the mast with the main beam once per revolution (2-5 s by role, 0.5 s dwell), side lobes at -25 dB; peak-hold level, measured scan period (LIVE window follows it) and a range estimate from the best candidate's power class, shown at ELOKA and in Remote Crew. | — |
| ~~**HFDF: no frequency**~~ | **Closed (Phase 11).** `src/sensors/hfdf.py`: the boat picks OWF = 0.85 MUF for its shore path (foF2 day/night, F2 height 300 km); ground-wave range falls with frequency (anchored 120 NM at 15 MHz); sky wave only beyond the skip distance with doubled bearing error; frequency and mode are published on the observation. | — |
| ~~**No AIS decoding**~~ | **Closed (Phase 0).** `src/sensors/ais.py` is a simulated own-ship AIS receiver: ITU-R M.1371 class-A dynamic reports (COG/SOG every 2-10 s, 3 min at anchor) and static reports (name every 6 min), received only inside VHF line of sight and not through land. Radar observations of civilians no longer carry the true name/course (an observation-boundary leak); both come from the latest decoded report. MMSI is deliberately not shown to the player, so live and simulated traffic stay indistinguishable. Decoded reports are saved (save v12). | — |
| ~~**Lookout: no silhouette / size**~~ | **Closed (Phase 11).** `src/sensors/visual.py`: Koschmieder contrast decay with meteorological visibility, Blackwell-type threshold vs angular size (target height), optical horizon (eye 18 m), whitecap clutter for sea-level targets, night threshold interpolated by lunar illumination (seeded lunar age advancing with sim time). C0 anchored to the 1.0.0 day ranges; searchlight and smoke are out of scope. | — |
### 8.3 Data structures touched
- `config.py`: add radar power, antenna gain, pulse width, PRF; ESM sensitivity; HFDF frequency bands
- `game._update_air_picture()`: integrate radar equation, clutter, scan dynamics
- `sensors/esm.py`: add signal-level gating
- `sensors/tracks.py`: add scan-phase to track age
---
| Gap | Model now | Closed in |
|---|---|---|
| No radar equation | `src/sensors/radar.py`: SNR ~ sigma/R^4 anchored so the nominal range is the Pd = 0.5 point for a broadside target; Swerling-1 target behind a 16-cell CA-CFAR (exact closed form, Pfa 1e-6); GIT-type sea clutter (+3 dB per sea state, CNR ~ R^-3; air search with MTI); two-way rain attenuation; aspect enters as RCS (aspect^4). Hostile platform radars use the same Pd = 0.5 range. Anchors reproduce the 1.0.0 weather/rain losses (calibration harness). | 11 (2f3b0f2) |
| No scan rate / PPI dynamics | The antenna turns in simulation time (90 deg/s, phase and pending sweep saved); a contact gets one look only when the beam passed its bearing since the previous publication; one deterministic (`detrand`) detection draw per look; the PPI sweep line is the saved antenna phase. | 11 (2f3b0f2) |
| No ECCM / jamming effect on radar | Self-screening noise jammer as JNR ~ R^-2 solved from the profiled burn-through range; skin detection uses SINR = S/(N + C + J), so the echo emerges inside burn-through (HOJ bearing outside). Deception jamming (RGPO/angle) is out of scope: missiles carry noise jammers only. | 11 (2f3b0f2) |
| ESM: no signal strength | One-way level 20 log10(R_class/R); rotating search radars reach the mast with the main beam once per revolution (2-5 s by role, 0.5 s dwell), side lobes at -25 dB; peak-hold level, measured scan period (LIVE window follows it) and a range estimate from the best candidate's power class, shown at ELOKA and in Remote Crew. | 11 (2f3b0f2) |
| HFDF: no frequency | `src/sensors/hfdf.py`: the boat picks OWF = 0.85 MUF for its shore path (foF2 day/night, F2 height 300 km); ground-wave range falls with frequency (anchored 120 NM at 15 MHz); sky wave only beyond the skip distance with doubled bearing error; frequency and mode are published on the observation. | 11 (2f3b0f2) |
| No AIS decoding | `src/sensors/ais.py` is a simulated own-ship AIS receiver: ITU-R M.1371 class-A dynamic reports (COG/SOG every 2-10 s, 3 min at anchor) and static reports (name every 6 min), received only inside VHF line of sight and not through land. Radar observations of civilians no longer carry the true name/course (an observation-boundary leak); both come from the latest decoded report. MMSI is deliberately not shown to the player, so live and simulated traffic stay indistinguishable. Decoded reports are saved (save v12). | 0 (bd9260b) |
| Lookout: no silhouette / size | `src/sensors/visual.py`: Koschmieder contrast decay with meteorological visibility, Blackwell-type threshold vs angular size (target height), optical horizon (eye 18 m), whitecap clutter for sea-level targets, night threshold interpolated by lunar illumination (seeded lunar age advancing with sim time). C0 anchored to the 1.0.0 day ranges; searchlight and smoke are out of scope. | 11 (2f3b0f2) |
## 9. Damage Model — `src/ship/damage.py`
### 9.1 What is currently modeled
- 9 compartments with volume, centroid, floor height, fuel load and electrical load
- Torpedo hit: impact point → compartment, hole area from warhead stand-off; ASM hit: above-waterline fire
- Flooding: orifice law against the outside waterline; teams patch (8 kits) then pump
- Stability: displacement, free-surface GM, heel; sinking beyond reserve buoyancy, capsize at lost GM / 35° heel
- Fire: fuel × oxygen growth, smothering, heat-timer spread, electrical shorts, magazine cook-off
- Continuous station capability; teams with walking time (20 s per compartment)
- Grounding: impact energy → localized flooding (deterministic, no RNG)
### 9.2 Gaps and simplifications
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No hit-location physics**~~ | **Closed (Phase 10).** The torpedo's impact point on the hull (`_hull_impact`) selects the compartment; hole area scales with the warhead stand-off (20 m / distance, 0.5-3x); ASM hits above the waterline and mainly starts fires. | — |
| ~~**No flooding dynamics**~~ | **Closed (Phase 10).** Orifice inflow Q = Cd A sqrt(2 g h) against the outside waterline (dynamic draft + heel), so flooding slows as levels equalize and high rooms stay dry; floodwater mass, free-surface GM loss and transverse moment give draft and list; the ship sinks beyond reserve buoyancy and capsizes at lost GM or 35 deg heel. | — |
| ~~**No fire propagation physics**~~ | **Closed (Phase 10).** Growth from compartment fuel load x oxygen, smothered by flooding and cooled by water; deterministic spread after a bulkhead has stayed hot (heat timer, saved); flooded switchboards short and start electrical fires. | — |
| ~~**No systems degradation**~~ | **Closed (Phase 10).** Continuous `capability()` per compartment from flooding and fire scales sonar and radar range; destroyed rooms still disable their station. | — |
| ~~**No damage repair realism**~~ | **Closed (Phase 10).** Teams walk the compartment graph (20 s per hop, ETA saved) and act only on arrival; holes must be patched first with one of 8 patch kits, leaving a small leak. | — |
| ~~**No secondary damage**~~ | **Closed (Phase 10).** Magazine cook-off above 90 % fire destroys the weapons room and holes its neighbours; electrical short-circuit fires; capsize as structural stability failure. | — |
| ~~**Torpedo damage to subs**~~ | **Closed (Phases 6/8/10).** Shock-factor damage, one emergency blow, hull fatigue, and progressive flooding of a holed boat (30-100 % damage) that ends in sinking unless it surfaces. | — |
---
| Gap | Model now | Closed in |
|---|---|---|
| No hit-location physics | The torpedo's impact point on the hull (`_hull_impact`) selects the compartment; hole area scales with the warhead stand-off (20 m / distance, 0.5-3x); ASM hits above the waterline and mainly starts fires. | 10 (9d8e15c) |
| No flooding dynamics | Orifice inflow Q = Cd A sqrt(2 g h) against the outside waterline (dynamic draft + heel), so flooding slows as levels equalize and high rooms stay dry; floodwater mass, free-surface GM loss and transverse moment give draft and list; the ship sinks beyond reserve buoyancy and capsizes at lost GM or 35 deg heel. | 10 (9d8e15c) |
| No fire propagation physics | Growth from compartment fuel load x oxygen, smothered by flooding and cooled by water; deterministic spread after a bulkhead has stayed hot (heat timer, saved); flooded switchboards short and start electrical fires. | 10 (9d8e15c) |
| No systems degradation | Continuous `capability()` per compartment from flooding and fire scales sonar and radar range; destroyed rooms still disable their station. | 10 (9d8e15c) |
| No damage repair realism | Teams walk the compartment graph (20 s per hop, ETA saved) and act only on arrival; holes must be patched first with one of 8 patch kits, leaving a small leak. | 10 (9d8e15c) |
| No secondary damage | Magazine cook-off above 90 % fire destroys the weapons room and holes its neighbours; electrical short-circuit fires; capsize as structural stability failure. | 10 (9d8e15c) |
| Torpedo damage to subs | Shock-factor damage, one emergency blow, hull fatigue, and progressive flooding of a holed boat (30-100 % damage) that ends in sinking unless it surfaces. | 6 (8f79700), 8 (ae3991b), 10 (9d8e15c) |
## 10. World / Environment — `src/world/`
### 10.1 What is currently modeled
| Gap | Model now | Closed in |
|---|---|---|
| No ocean currents | Static seeded current field (`World.current_vec`) applied to ship, subs, surface ships, torpedoes and decoys; Phase 1 adds the wind-driven component. | pre-1.1 (1.0.0) |
| No tides | `src/world/ocean.py`: M2 + S2 constituents, seeded amplitude/phase and a spatial phase gradient, Green's-law shoaling. `World.depth_m`/`physical_depth_m` = chart datum + tide, so grounding and sub safe depth follow the tide. | 1 (d666b1b) |
| No thermocline dynamics | Mixed-layer depth = seasonal cell base + diurnal heating (-8 m at 15:00, zero 24-h mean) + wind-mixing deepening (saved first-order relaxation, fast deepening / slow restratification) + three internal-wave components. | 1 (d666b1b) |
| No wind/current interaction | 3 % of wind speed, deflected 20 deg to the right of downwind, added to `current_vec`. | 1 (d666b1b) |
| No seasonal / diurnal sound-speed variation | Seeded season, SST with seasonal and diurnal terms, exponential thermocline temperature profile and the Mackenzie (1981) equation. Used by the bathythermograph and ping echo latency; the ray tracer (Phase 4) samples the same profile. | 1 (d666b1b) |
| Seabed composition | Seeded 12x12 sediment grid (rock/gravel/sand/silt/mud) from depth and slope with Hamilton-style geoacoustic parameters and a Rayleigh fluid-fluid bottom-loss function; consumed by the sonar equation (Phase 3) and ray tracer (Phase 4). | 1 (d666b1b) |
| No underwater geography beyond depth | Up to 64 seeded wrecks and submerged rocks. Rocks shoal `depth_m` (tops at least 15 m, a hazard to submarines and weapons, never to surface keels); wrecks become active-sonar clutter in Phase 3. | 1 (d666b1b) |
| Aspect | Implementation |
|--------|---------------|
| Bathymetry | 12×12 grid (procedural) or real-sector (loaded from gz); bilinear interpolation |
| Thermocline | Per-cell depth (40-120 m procedural); affects sonar layer detection |
| Coastline | Polygon landmasses; `on_land()`, `land_blocks_line()`, `sonar_path_blocked()` (straight-ray terrain test) |
| Weather | Sea state 0-6 (±1 random walk every hour); wind (direction/speed); rain (0-1); fog; visibility; blended over 600 s transition |
| Day/night | 24-h cycle; `is_night()` at 19:30-05:30; affects lookout |
| Sound speed | Synthetic profile (1504 m/s base); echo delay = 2d/1500 |
## Out of scope (with reason)
### 10.2 Gaps and simplifications
| Item | Reason |
|---|---|
| Air-to-air combat, CAP, fighters | U-Jagd is an ASW frigate simulation; hostile aircraft are engaged only by own-ship air defence. |
| Deception jamming by missiles (RGPO/angle gates) | Hostile missiles carry self-screening noise jammers (modelled with burn-through); own-ship ECM does model RGPO/VGPO/false targets against seekers. |
| GPS spoofing | Not relevant to the modelled sensors and weapons (inertial/radar guidance). |
| Lookout searchlight and smoke | No player control for them; visibility, contrast, size, horizon and moonlight are modelled. |
| Aircraft engine failure | Aircraft are threats/traffic, not player-flown airframes. |
| Compartments inside hostile submarines | Hostile boats keep a lumped damage value with progressive flooding, emergency blow and hull fatigue; their internal layout is never observable. |
| Counter-flooding orders | Heel is corrected by repair and rudder; the stability model is complete without a manual ballast order. |
| Gap | Current behaviour | Would need |
|-----|-------------------|------------|
| ~~**No ocean currents**~~ | **Closed.** Static seeded current field (`World.current_vec`) applied to ship, subs, surface ships, torpedoes and decoys; Phase 1 adds the wind-driven component. | — |
| ~~**No tides**~~ | **Closed (Phase 1).** `src/world/ocean.py`: M2 + S2 constituents, seeded amplitude/phase and a spatial phase gradient, Green's-law shoaling. `World.depth_m`/`physical_depth_m` = chart datum + tide, so grounding and sub safe depth follow the tide. | — |
| ~~**No thermocline dynamics**~~ | **Closed (Phase 1).** Mixed-layer depth = seasonal cell base + diurnal heating (-8 m at 15:00, zero 24-h mean) + wind-mixing deepening (saved first-order relaxation, fast deepening / slow restratification) + three internal-wave components. | — |
| ~~**No wind/current interaction**~~ | **Closed (Phase 1).** 3 % of wind speed, deflected 20 deg to the right of downwind, added to `current_vec`. | — |
| ~~**No seasonal / diurnal sound-speed variation**~~ | **Closed (Phase 1).** Seeded season, SST with seasonal and diurnal terms, exponential thermocline temperature profile and the Mackenzie (1981) equation. Used by the bathythermograph and ping echo latency; the ray tracer (Phase 4) samples the same profile. | — |
| ~~**Seabed composition**~~ | **Closed (Phase 1 model).** Seeded 12x12 sediment grid (rock/gravel/sand/silt/mud) from depth and slope with Hamilton-style geoacoustic parameters and a Rayleigh fluid-fluid bottom-loss function; consumed by the sonar equation (Phase 3) and ray tracer (Phase 4). | — |
| ~~**No underwater geography beyond depth**~~ | **Closed (Phase 1 model).** Up to 64 seeded wrecks and submerged rocks. Rocks shoal `depth_m` (tops at least 15 m, a hazard to submarines and weapons, never to surface keels); wrecks become active-sonar clutter in Phase 3. | — |
---
## 11. Summary of Key Abstractions to Extend
For a "reale Simulation" upgrade, the following core interfaces would need to grow:
1. **`Ship.update()`** — from kinematic to dynamic (force-based speed/turn)
2. **`Sub.update()`** — add depth dynamics, current drift, cavitation state
3. **`Torpedo.update()`** — add launch transient, depth control loop, wire length limit, speed-dependent turn
4. **`SonarSystem._passive_range_nm()`** — replace scalar R_eff with sonar equation (SL, TL, NL, DI, DT)
5. **`propagation.propagate()`** — extend from 4 fixed paths to N-ray; add frequency dependence
6. **`HydroacousticChannel`** — already has a basic TL model (spherical spreading + absorption + 25 dB layer cross); extend with bottom-loss, grazing-angle effects
7. **`DamageModel`** — from compartment-percentage to structural/stability model
8. **`World`** — add current field, time-varying thermocline, seabed type
9. **`config.py`** — many new physical constants (drag coefficients, radar parameters, sonar equation terms, current speeds)
10. **`data/contacts/*.json`** — extend `TargetSignature` with per-band SL/TS; extend `MachineProfile` with RPM curves, cavitation thresholds; extend `EnduranceProfile` with depth-dependent power
### Determinism invariants to preserve
All changes must maintain the rules in `AGENTS.md`:
- Same seed + world + input → same state (use local `random.Random`, stable hashes)
- No global `random`, no `time.time()`, no wall-clock in sim
- Save/load round-trip: all new state fields must be serialised, validated, and restored
- Observation boundary: AI/sensors must never read hidden ground-truth except through the sensor model
- `PHYS_SUBSTEP_S = 0.05 s` sub-stepping must remain the integrator cadence; any new ODE must be stable at 0.05 s
- Bounded work: all new loops/arrays must have hard caps (the codebase is meticulous about this)
Real-world geography, seabed and weather used by the world are synthetic or
generalised (see `THIRD_PARTY_NOTICES.md` and the manual's disclaimers); the
physics models are plausible engineering approximations anchored to the
1.0.0 gameplay, not validated naval data.
+18 -2
View File
@@ -4707,10 +4707,26 @@ class Game:
return (() if track is None else
rank_emitters(track, self.runtime_catalog.emitters))
ELOKA_ANALYSIS_CACHE_MAX = 256
def eloka_analysis(self, track=None):
track = track or self.selected_eloka_track()
return (None if track is None else
analyze_signal(track, self.runtime_catalog.emitters))
if track is None:
return None
# The ranking depends only on the measured fingerprint and the
# immutable runtime catalog; memoize it (bounded, never saved).
emitters = self.runtime_catalog.emitters
if self.__dict__.get("_eloka_analysis_owner") is not emitters:
self._eloka_analysis_owner = emitters
self._eloka_analysis_cache = {}
key = (track.frequency_hz, track.prf_hz, track.modulation_code)
cache = self._eloka_analysis_cache
result = cache.get(key)
if result is None:
if len(cache) >= self.ELOKA_ANALYSIS_CACHE_MAX:
cache.clear()
result = cache[key] = analyze_signal(track, emitters)
return result
def eloka_range_estimate(self, track=None) -> float | None:
"""Range implied by the intercept's peak level, assuming the power
+1 -1
View File
@@ -4,7 +4,7 @@ This module is deliberately dependency-free because setuptools imports the
version while building the project.
"""
APP_VERSION = "1.0.0"
APP_VERSION = "1.1.0"
SAVE_VERSION = 12
SAVE_SCHEMA = "u-jagd-save-v12"
SPLASH_TEXT = (
+2 -2
View File
@@ -78,7 +78,7 @@ def test_source_and_wheel_contain_editor_templates(tmp_path):
(ROOT / "data/contact_analysis" / name).read_bytes()
assert any(name.endswith(".dist-info/licenses/THIRD_PARTY_NOTICES.md")
for name in wheel_names)
assert any(name.endswith("-1.0.0.dist-info/METADATA") for name in wheel_names)
assert any(name.endswith("-1.1.0.dist-info/METADATA") for name in wheel_names)
source = next(tmp_path.glob("u_jagd-*.tar.gz"))
with tarfile.open(source) as archive:
@@ -123,7 +123,7 @@ def test_source_and_wheel_contain_editor_templates(tmp_path):
[sys.executable, "-c",
"from importlib import resources; "
"assert resources.files('data.editor_templates').joinpath('mission.json').is_file(); "
"from src.core.version import APP_VERSION; assert APP_VERSION == '1.0.0'; "
"from src.core.version import APP_VERSION; assert APP_VERSION == '1.1.0'; "
"from src.commander.server import CommanderServer; "
"server=CommanderServer(); server.start('127.0.0.1',0); server.stop(); "
"assert resources.files('data.commander').joinpath('app.js').is_file(); "
+11
View File
@@ -222,3 +222,14 @@ def test_ciws_track_radar_holds_close_in_missiles_between_sweeps(monkeypatch):
game.radar_scan_pending_deg = 10.0
game._update_air_picture()
assert not game.asm_tracks()
def test_eloka_analysis_cache_matches_direct_ranking_and_is_bounded():
game = Game(seed=1107, start_menu=False, audio_enabled=False)
tracks = [esm.ESMTrack(f"E{index + 1:016x}", 0.0, 0.0, 90.0, 1.0,
2e9 + index * 1e6, 800.0, "pulse", .8, 0.0, 0.0)
for index in range(game.ELOKA_ANALYSIS_CACHE_MAX + 20)]
for track in tracks:
assert game.eloka_analysis(track) == esm.analyze_signal(
track, game.runtime_catalog.emitters)
assert len(game._eloka_analysis_cache) <= game.ELOKA_ANALYSIS_CACHE_MAX
+2 -2
View File
@@ -12,9 +12,9 @@ from src.world.real_coast import sector_for_seed
def test_release_version_and_exact_splash_text():
assert APP_VERSION == "1.0.0"
assert APP_VERSION == "1.1.0"
assert SPLASH_TEXT == (
"Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.0.0"
"Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.1.0"
)