Package B of the code review: physics and weapon fixes (1.3.206)

The frigate gets under way from rest in sea state 5 and above, a reversed
depth order no longer teleports a submarine, the helicopter's MAD looks once
per simulated second whatever the frame rate, the crew assist runs from a
torpedo at 24 kn while a Nixie is out or aboard and never streams one above
its tow speed, a hostile torpedo loses a lock out of its seeker's reach,
hears the frigate louder at speed, and keeps its search pattern while the
wire holds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAa6fnf7M4fKm56aJXHvKS
This commit is contained in:
Claude committed 2026-10-05 07:20:10 +00:00
1 parent 974a055618
commit 6847c43cfc
31 files changed
+284 -69

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
## Authority and scope
- This is U-Jagd 1.3.205 (`src/core/version.py`); saves are written as v52 and older saves from v38 on are lifted to v52 on load (`src/core/save_migrate.py`). Treat these as compatibility contracts, not changelog entries.
- This is U-Jagd 1.3.206 (`src/core/version.py`); saves are written as v52 and older saves from v38 on are lifted to v52 on load (`src/core/save_migrate.py`). 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, and so is `docs/plan-1.3.md` (the plan 1.3.0 was built from). Current resumable work is tracked in `docs/resume.md`.
+15
View File
@@ -4,6 +4,21 @@
Alle Versionen von U-Jagd, die neueste zuerst. Die [README](README.de.md) zeigt nur die neueste.
## 1.3.206
Version 1.3.206 behebt Fehler in Physik und Waffen, die die Code-Prüfung
gefunden hat. Ab Seegang 5 kommt die Fregatte aus dem Stand wieder in Fahrt
(sie blieb bei 0 kn stehen). Ein U-Boot, das seinen Tiefenbefehl mitten im
Tauchen ändert, springt nicht mehr auf die neue Tiefe. Das MAD des
Hubschraubers misst einmal pro Sekunde, die Kontaktchance hängt also nicht
mehr von der Bildrate ab. Die Crew-Hilfe flieht vor einem Torpedo mit 24 kn
statt AK, solange ein Nixie ausgesetzt oder an Bord ist, weil dessen
Schleppkabel über 25 kn reißt, und setzt darüber keinen mehr aus. Ein
feindlicher Torpedo verliert seine Erfassung, wenn das Ziel außer
Reichweite seines Suchkopfs ist, hört die Fregatte lauter, je schneller sie
fährt, und behält sein Suchmuster, solange der Draht hält. Tasten bleiben
gleich. Spielstände sind v52; v38 bis v51 laden weiter.
## 1.3.205
Version 1.3.205 behebt, was eine vollständige Code-Prüfung gefunden hat,
+14
View File
@@ -4,6 +4,20 @@
Every U-Jagd release, newest first. The [README](README.md) shows only the latest one.
## 1.3.206
Release 1.3.206 fixes physics and weapon faults the code review found.
In sea state 5 and above the frigate now gets under way from a standstill
(it used to stay at 0 kn). A submarine that changes its depth order mid-dive
no longer jumps to the new depth. The helicopter's MAD looks once per
second, so its chance of a contact no longer depends on the frame rate. The
crew assist now runs from a torpedo at 24 kn instead of flank speed while a
Nixie is out or aboard, because the Nixie's tow cable parts above 25 kn,
and no longer streams one above that speed. An enemy torpedo now loses its
lock when the target is out of its seeker's reach, hears the frigate louder
the faster it runs, and keeps its search pattern while the wire is held.
Keys are unchanged. Saves are v52; v38 to v51 saves still load.
## 1.3.205
Release 1.3.205 fixes what a full code review found, without changing how
+12 -14
View File
@@ -14,21 +14,19 @@ 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.3.205**
Aktuelle Version: **1.3.206**
Version 1.3.205 behebt, was eine vollständige Code-Prüfung gefunden hat,
ohne das Spiel zu verändern. Ein beschädigter oder von Hand bearbeiteter
Spielstand wird jetzt abgewiesen, statt das Spiel zu beenden, und ein
fehlgeschlagenes Laden verändert die laufende Mission nicht mehr. Auf der
uConsole ruckelt es weniger: das Schallbild wird schneller berechnet, Regen
auf der Karte wird einmal statt in jedem Bild gezeichnet und ist im hellen
Farbschema jetzt sichtbar, Statuszeilen und Tooltips verwenden ihren
gezeichneten Text wieder, und ein Geräusch aus einer neuen Richtung wird
nicht neu erzeugt. Im Browser gehen Spielgeräusche und Durchsagen nicht mehr
verloren, wenn der Host ein Menü öffnet. Tooltip und Zeitangabe des
Sonar-Wasserfalls passen jetzt zum verkürzten Verlauf (Shift+H). Ein
abgebrochener Update-Download lässt sich erneut starten, und das
Windows-Programm schreibt sein Absturzprotokoll wieder. Tasten bleiben
Version 1.3.206 behebt Fehler in Physik und Waffen, die die Code-Prüfung
gefunden hat. Ab Seegang 5 kommt die Fregatte aus dem Stand wieder in Fahrt
(sie blieb bei 0 kn stehen). Ein U-Boot, das seinen Tiefenbefehl mitten im
Tauchen ändert, springt nicht mehr auf die neue Tiefe. Das MAD des
Hubschraubers misst einmal pro Sekunde, die Kontaktchance hängt also nicht
mehr von der Bildrate ab. Die Crew-Hilfe flieht vor einem Torpedo mit 24 kn
statt AK, solange ein Nixie ausgesetzt oder an Bord ist, weil dessen
Schleppkabel über 25 kn reißt, und setzt darüber keinen mehr aus. Ein
feindlicher Torpedo verliert seine Erfassung, wenn das Ziel außer
Reichweite seines Suchkopfs ist, hört die Fregatte lauter, je schneller sie
fährt, und behält sein Suchmuster, solange der Draht hält. Tasten bleiben
gleich. Spielstände sind v52; v38 bis v51 laden weiter.
Frühere Versionen: [CHANGELOG.de.md](CHANGELOG.de.md).
+12 -13
View File
@@ -12,20 +12,19 @@ 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.3.205**
Current release: **1.3.206**
Release 1.3.205 fixes what a full code review found, without changing how
the game plays. A damaged or hand-edited save is now refused instead of
closing the game, and a failed load no longer changes the running mission.
On the uConsole the game stutters less: the sound picture is recomputed
faster, rain on the chart is drawn once instead of every frame and is now
visible in the light scheme, status texts and tooltips reuse their rendered
text, and a sound heard from a new direction is no longer synthesized
again. In the browser, game sounds and callouts are no longer lost when the
host opens a menu. The sonar waterfall's tooltip and time label now match
the shortened history (Shift+H). A broken update download can be retried,
and the Windows program writes its crash log again. Keys are unchanged.
Saves are v52; v38 to v51 saves still load.
Release 1.3.206 fixes physics and weapon faults the code review found.
In sea state 5 and above the frigate now gets under way from a standstill
(it used to stay at 0 kn). A submarine that changes its depth order mid-dive
no longer jumps to the new depth. The helicopter's MAD looks once per
second, so its chance of a contact no longer depends on the frame rate. The
crew assist now runs from a torpedo at 24 kn instead of flank speed while a
Nixie is out or aboard, because the Nixie's tow cable parts above 25 kn,
and no longer streams one above that speed. An enemy torpedo now loses its
lock when the target is out of its seeker's reach, hears the frigate louder
the faster it runs, and keeps its search pattern while the wire is held.
Keys are unchanged. Saves are v52; v38 to v51 saves still load.
Earlier releases: [CHANGELOG.md](CHANGELOG.md).
+1 -1
View File
@@ -3982,7 +3982,7 @@
"help.sop.bridge.2": "Transit mit FULL, vor dem Suchgebiet auf SLOW oder 4-6 kn gehen.",
"help.sop.bridge.3": "Suche: ruhige Schläge von 3-5 min, dann 30-60 Grad drehen, damit TMA Entfernung gewinnt.",
"help.sop.bridge.4": "Abstand zu Küste und Flachwasser halten; Kartentiefe beachten.",
"help.sop.bridge.5": "Torpedo im Anlauf: FLANK, querab abdrehen, Nixie an der Waffenzentrale.",
"help.sop.bridge.5": "Torpedo im Anlauf: 24 kn (Nixie-Kabel reißt über 25), querab abdrehen, Nixie an der Waffenzentrale.",
"help.sop.sonar.1": "Langsam fahren (4-8 kn), HMS wählen; TAS bei 3-12 kn ausbringen (Y), VDS bei 3-15 kn unter die Sprungschicht fieren (Shift+Y).",
"help.sop.sonar.2": "BREITBAND nach Peilspuren absuchen; Töne im LOFAR bestätigen (N Notch).",
"help.sop.sonar.3": "Kontakt wählen (Auf/Ab), Fokus halten (Enter), DEMON prüfen.",
+1 -1
View File
@@ -3982,7 +3982,7 @@
"help.sop.bridge.2": "Transit at FULL, then slow to SLOW or 4-6 kn before the search area.",
"help.sop.bridge.3": "Search: steady legs of 3-5 min, then turn 30-60 degrees so TMA gains range.",
"help.sop.bridge.4": "Keep clear of the coast and shallow water; watch the chart depth.",
"help.sop.bridge.5": "Torpedo inbound: FLANK, turn away beam-on, order Nixie at Weapons.",
"help.sop.bridge.5": "Torpedo inbound: 24 kn (Nixie cable parts above 25), turn away beam-on, order Nixie at Weapons.",
"help.sop.sonar.1": "Go slow (4-8 kn) and select HMS; stream the TAS at 3-12 kn (Y) and lower the VDS below the layer at 3-15 kn (Shift+Y).",
"help.sop.sonar.2": "Search BROADBAND for bearing traces; confirm tonals on LOFAR (N notch).",
"help.sop.sonar.3": "Select the contact (Up/Down), lock focus (Enter), check DEMON.",
+1 -1
View File
@@ -58,7 +58,7 @@ Globale Tasten (alle Stationen):
5. Mit `C` klassifizieren, mit `T` TMA einschalten, dann auf der Brücke 30-60 Grad drehen und den neuen Schlag einige Minuten halten.
6. Sobald TMA oder Ping eine Entfernung liefern: Kontakt an die OPZ freigeben (`G`) und als Ziel setzen (`M`).
7. Waffen (`3`): Torpedotiefe auf die gepingte Zieltiefe stellen, mit `Strg+Enter` feuern.
8. Sonar auf anlaufende Torpedos beobachten; kommt einer, FLANK, abdrehen und Nixie ausbringen (`V` in der Waffenzentrale).
8. Sonar auf anlaufende Torpedos beobachten; kommt einer, mit 24 kn laufen (nicht FLANK: das Schleppkabel des Nixie reißt über 25 kn), abdrehen und Nixie ausbringen (`V` in der Waffenzentrale).
## Die erste Tauchfahrt (U-Boot) {#qs-first-dive}
+1 -1
View File
@@ -58,7 +58,7 @@ Global keys (all stations):
5. Classify with `C`, enable TMA with `T`, then turn the ship 30-60 degrees on the Bridge and hold the new leg for a few minutes.
6. When TMA or a ping gives range: release the contact to Operations (`G`), make it the target (`M`).
7. Weapons (`3`): set torpedo depth to the pinged target depth, fire with `Ctrl+Enter`.
8. Watch the sonar for an incoming torpedo; if one appears, go FLANK, turn away and stream the Nixie (`V` at Weapons).
8. Watch the sonar for an incoming torpedo; if one appears, run at 24 kn (not FLANK: the Nixie's tow cable parts above 25 kn), turn away and stream the Nixie (`V` at Weapons).
## Your first dive (submarine) {#qs-first-dive}
+1 -1
View File
@@ -110,7 +110,7 @@ Jede Taste in der Tastenleiste am Fuß der Station lässt sich anklicken; gedrü
Gefechtslage:
1. Torpedo gemeldet: sofort FLANK, so drehen, dass die Torpedopeilung achteraus oder querab liegt.
1. Torpedo gemeldet: sofort auf 24 kn gehen (nicht FLANK: das Schleppkabel des Nixie reißt über 25 kn), so drehen, dass die Torpedopeilung achteraus oder querab liegt.
2. Nixie in der Waffenzentrale befehlen (`V`); weiter drehen, damit der Torpedo zuerst den Täuschkörper sieht.
3. Nach der Abwehr unter 15 kn gehen, damit das Sonar wieder erfasst; mit ausgebrachtem Schleppsonar nie über 20 kn.
+1 -1
View File
@@ -110,7 +110,7 @@ Every key in the key bar at the foot of the station can be clicked; holding the
Combat situation:
1. Torpedo reported: FLANK immediately, turn to put the torpedo bearing astern or on the beam.
1. Torpedo reported: speed up to 24 kn at once (not FLANK: the Nixie's tow cable parts above 25 kn), turn to put the torpedo bearing astern or on the beam.
2. Order the Nixie at Weapons (`V`); keep turning so the torpedo sees the decoy first.
3. Once clear, reduce speed below 15 kn so sonar can reacquire; never above 20 kn with the towed array out.
+1 -1
View File
@@ -47,7 +47,7 @@ Torpedolauf von oben:
- Salve (`Y`): ein Torpedo oder zwei im Fächer von +/-8° mit eigenen, um das Schiff gedrehten Datums; ein Fächer braucht zwei geladene Rohre des gewählten Typs und zählt gegen die Doktringrenze.
- Voreingestellte Tiefe 10-300 m (Standard 60 m): `↑`/`↓` halten oder nach `T` eintippen, wie auf dem U-Boot. Falsche Tiefe bedeutet Fehlschuss: Tiefe aus dem Ping nehmen, nicht aus der TMA.
- Der Draht aktualisiert das Datum aus der beobachteten Kontaktposition. Ohne Updates wird er nach 3 s STALE und nach 12 s BROKEN; der Torpedo läuft dann zum letzten Datum weiter.
- Der Sucher steuert den nächsten Kandidaten an: das kann ein Täuschkörper, ein Wal oder ein Handelsschiff sein. Ein ziviler Treffer beendet die Mission.
- Der Sucher steuert den lautesten Kandidaten an (eine bestehende Aufschaltung bleibt, solange kein anderer 6 dB lauter ist): das kann ein Täuschkörper, ein Wal oder ein Handelsschiff sein. Ein ziviler Treffer beendet die Mission.
- Salvendoktrin SHOOT-LOOK-SHOOT: höchstens 2 eigene Torpedos gleichzeitig im Wasser.
- ASROC (`A`): 4 Schuss pro Mission. Die Rakete fliegt mit 500 kn zur beobachteten Position des Ziels (1 bis 10 sm, aktuelle Entfernung nötig) und setzt dort den Leichttorpedo des Helikopters auf der voreingestellten Tiefe ab. Es gelten dieselben Zielprüfungen wie beim Torpedo, und es zählt gegen die Doktringrenze.
- Wasserbomben (`Z`): 20 pro Mission, geworfen als Muster aus 5 (drei im Kielwasser 20, 80 und 140 m achteraus, zwei 70 m querab geworfen), danach 45 s Nachladen der Ablaufbahn. Das Schiff muss mindestens 10 kn laufen. Die Bomben sinken mit 3,5 m/s bis zur voreingestellten Tiefe (15-300 m) oder zum Grund; jede 90-kg-Ladung ist bis etwa 25 m tödlich und beschädigt noch bis etwa 100 m. U-Boote innerhalb von 5 sm hören die Detonation und weichen aus.
+1 -1
View File
@@ -47,7 +47,7 @@ Torpedo run, seen from above:
- Salvo (`Y`): one torpedo, or two in a +/-8 deg spread with their own datums turned about the ship; a spread needs two loaded tubes of the selected type and counts against the doctrine limit.
- Preset depth 10-300 m (default 60 m): hold `↑`/`↓` or type it after `T`, as on the submarine. A wrong depth is a miss: take depth from a ping, not from TMA.
- The wire updates the datum from the contact's observed position. Without updates it becomes STALE after 3 s and BROKEN after 12 s; the torpedo then continues to the last datum.
- The seeker homes on the nearest candidate: that can be a decoy, a whale or a merchant ship. A civilian hit ends the mission.
- The seeker homes on the loudest candidate (a held lock is kept unless another is 6 dB louder): that can be a decoy, a whale or a merchant ship. A civilian hit ends the mission.
- Salvo doctrine SHOOT-LOOK-SHOOT: at most 2 own torpedoes running.
- ASROC (`A`): 4 rounds per mission. The rocket flies at 500 kn to the target's observed position (1 to 10 NM, current range needed) and drops the helicopter's lightweight torpedo there, set to the preset depth. It needs the same target checks as the torpedo and counts against the doctrine limit.
- Depth charges (`Z`): 20 per mission, dropped as a pattern of 5 (three along the wake 20, 80 and 140 m astern, two thrown 70 m abeam), then 45 s to reload the rack. The ship must make at least 10 kn. The charges sink at 3.5 m/s to the preset depth (15-300 m) or the seabed; each 90 kg charge is lethal within about 25 m and still damages out to about 100 m. Submarines within 5 NM hear the detonation and evade.
Binary file not shown.
+4 -4
View File
@@ -105,7 +105,7 @@ Globale Tasten (alle Stationen):
5. Mit `C` klassifizieren, mit `T` TMA einschalten, dann auf der Brücke 30-60 Grad drehen und den neuen Schlag einige Minuten halten.
6. Sobald TMA oder Ping eine Entfernung liefern: Kontakt an die OPZ freigeben (`G`) und als Ziel setzen (`M`).
7. Waffen (`3`): Torpedotiefe auf die gepingte Zieltiefe stellen, mit `Strg+Enter` feuern.
8. Sonar auf anlaufende Torpedos beobachten; kommt einer, FLANK, abdrehen und Nixie ausbringen (`V` in der Waffenzentrale).
8. Sonar auf anlaufende Torpedos beobachten; kommt einer, mit 24 kn laufen (nicht FLANK: das Schleppkabel des Nixie reißt über 25 kn), abdrehen und Nixie ausbringen (`V` in der Waffenzentrale).
### Die erste Tauchfahrt (U-Boot)
@@ -478,11 +478,11 @@ Jede Taste in der Tastenleiste am Fuß der Station lässt sich anklicken; gedrü
2. Transit mit FULL, vor dem Suchgebiet auf SLOW oder 4-6 kn gehen.
3. Suche: ruhige Schläge von 3-5 min, dann 30-60 Grad drehen, damit TMA Entfernung gewinnt.
4. Abstand zu Küste und Flachwasser halten; Kartentiefe beachten.
5. Torpedo im Anlauf: FLANK, querab abdrehen, Nixie an der Waffenzentrale.
5. Torpedo im Anlauf: 24 kn (Nixie-Kabel reißt über 25), querab abdrehen, Nixie an der Waffenzentrale.
Gefechtslage:
1. Torpedo gemeldet: sofort FLANK, so drehen, dass die Torpedopeilung achteraus oder querab liegt.
1. Torpedo gemeldet: sofort auf 24 kn gehen (nicht FLANK: das Schleppkabel des Nixie reißt über 25 kn), so drehen, dass die Torpedopeilung achteraus oder querab liegt.
2. Nixie in der Waffenzentrale befehlen (`V`); weiter drehen, damit der Torpedo zuerst den Täuschkörper sieht.
3. Nach der Abwehr unter 15 kn gehen, damit das Sonar wieder erfasst; mit ausgebrachtem Schleppsonar nie über 20 kn.
@@ -788,7 +788,7 @@ Torpedolauf von oben:
- Salve (`Y`): ein Torpedo oder zwei im Fächer von +/-8° mit eigenen, um das Schiff gedrehten Datums; ein Fächer braucht zwei geladene Rohre des gewählten Typs und zählt gegen die Doktringrenze.
- Voreingestellte Tiefe 10-300 m (Standard 60 m): `↑`/`↓` halten oder nach `T` eintippen, wie auf dem U-Boot. Falsche Tiefe bedeutet Fehlschuss: Tiefe aus dem Ping nehmen, nicht aus der TMA.
- Der Draht aktualisiert das Datum aus der beobachteten Kontaktposition. Ohne Updates wird er nach 3 s STALE und nach 12 s BROKEN; der Torpedo läuft dann zum letzten Datum weiter.
- Der Sucher steuert den nächsten Kandidaten an: das kann ein Täuschkörper, ein Wal oder ein Handelsschiff sein. Ein ziviler Treffer beendet die Mission.
- Der Sucher steuert den lautesten Kandidaten an (eine bestehende Aufschaltung bleibt, solange kein anderer 6 dB lauter ist): das kann ein Täuschkörper, ein Wal oder ein Handelsschiff sein. Ein ziviler Treffer beendet die Mission.
- Salvendoktrin SHOOT-LOOK-SHOOT: höchstens 2 eigene Torpedos gleichzeitig im Wasser.
- ASROC (`A`): 4 Schuss pro Mission. Die Rakete fliegt mit 500 kn zur beobachteten Position des Ziels (1 bis 10 sm, aktuelle Entfernung nötig) und setzt dort den Leichttorpedo des Helikopters auf der voreingestellten Tiefe ab. Es gelten dieselben Zielprüfungen wie beim Torpedo, und es zählt gegen die Doktringrenze.
- Wasserbomben (`Z`): 20 pro Mission, geworfen als Muster aus 5 (drei im Kielwasser 20, 80 und 140 m achteraus, zwei 70 m querab geworfen), danach 45 s Nachladen der Ablaufbahn. Das Schiff muss mindestens 10 kn laufen. Die Bomben sinken mit 3,5 m/s bis zur voreingestellten Tiefe (15-300 m) oder zum Grund; jede 90-kg-Ladung ist bis etwa 25 m tödlich und beschädigt noch bis etwa 100 m. U-Boote innerhalb von 5 sm hören die Detonation und weichen aus.
+4 -4
View File
@@ -105,7 +105,7 @@ Global keys (all stations):
5. Classify with `C`, enable TMA with `T`, then turn the ship 30-60 degrees on the Bridge and hold the new leg for a few minutes.
6. When TMA or a ping gives range: release the contact to Operations (`G`), make it the target (`M`).
7. Weapons (`3`): set torpedo depth to the pinged target depth, fire with `Ctrl+Enter`.
8. Watch the sonar for an incoming torpedo; if one appears, go FLANK, turn away and stream the Nixie (`V` at Weapons).
8. Watch the sonar for an incoming torpedo; if one appears, run at 24 kn (not FLANK: the Nixie's tow cable parts above 25 kn), turn away and stream the Nixie (`V` at Weapons).
### Your first dive (submarine)
@@ -478,11 +478,11 @@ Every key in the key bar at the foot of the station can be clicked; holding the
2. Transit at FULL, then slow to SLOW or 4-6 kn before the search area.
3. Search: steady legs of 3-5 min, then turn 30-60 degrees so TMA gains range.
4. Keep clear of the coast and shallow water; watch the chart depth.
5. Torpedo inbound: FLANK, turn away beam-on, order Nixie at Weapons.
5. Torpedo inbound: 24 kn (Nixie cable parts above 25), turn away beam-on, order Nixie at Weapons.
Combat situation:
1. Torpedo reported: FLANK immediately, turn to put the torpedo bearing astern or on the beam.
1. Torpedo reported: speed up to 24 kn at once (not FLANK: the Nixie's tow cable parts above 25 kn), turn to put the torpedo bearing astern or on the beam.
2. Order the Nixie at Weapons (`V`); keep turning so the torpedo sees the decoy first.
3. Once clear, reduce speed below 15 kn so sonar can reacquire; never above 20 kn with the towed array out.
@@ -787,7 +787,7 @@ Torpedo run, seen from above:
- Salvo (`Y`): one torpedo, or two in a +/-8 deg spread with their own datums turned about the ship; a spread needs two loaded tubes of the selected type and counts against the doctrine limit.
- Preset depth 10-300 m (default 60 m): hold `↑`/`↓` or type it after `T`, as on the submarine. A wrong depth is a miss: take depth from a ping, not from TMA.
- The wire updates the datum from the contact's observed position. Without updates it becomes STALE after 3 s and BROKEN after 12 s; the torpedo then continues to the last datum.
- The seeker homes on the nearest candidate: that can be a decoy, a whale or a merchant ship. A civilian hit ends the mission.
- The seeker homes on the loudest candidate (a held lock is kept unless another is 6 dB louder): that can be a decoy, a whale or a merchant ship. A civilian hit ends the mission.
- Salvo doctrine SHOOT-LOOK-SHOOT: at most 2 own torpedoes running.
- ASROC (`A`): 4 rounds per mission. The rocket flies at 500 kn to the target's observed position (1 to 10 NM, current range needed) and drops the helicopter's lightweight torpedo there, set to the preset depth. It needs the same target checks as the torpedo and counts against the doctrine limit.
- Depth charges (`Z`): 20 per mission, dropped as a pattern of 5 (three along the wake 20, 80 and 140 m astern, two thrown 70 m abeam), then 45 s to reload the rack. The ship must make at least 10 kn. The charges sink at 3.5 m/s to the preset depth (15-300 m) or the seabed; each 90 kg charge is lethal within about 25 m and still damages out to about 100 m. Submarines within 5 NM hear the detonation and evade.
Binary file not shown.
+1 -1
View File
@@ -1,4 +1,4 @@
# U-Jagd 1.3.205 - Stations- und Tastenkürzel
# U-Jagd 1.3.206 - Stations- und Tastenkürzel
Druckfassung: [`station-shortcuts.de.pdf`](station-shortcuts.de.pdf).
Maßgeblich ist die implementierte lokale Bedienung. Stationsnummern und
Binary file not shown.
+18 -7
View File
@@ -6,6 +6,7 @@ import math
from src.core import config
from src.core.station import Station
from src.weapons.asw import NIXIE_MAX_TOW_KN
AUTOCREW_STATIONS = (
@@ -39,6 +40,14 @@ _ACTIONS = frozenset({
})
def evade_speed_kn(game, kind: str = "torpedo") -> float:
"""Speed to run from a threat: flank, but from a torpedo below the speed
at which a Nixie's tow cable parts while one is out or one is aboard."""
if kind == "torpedo" and (game.nixies or game.nixie_store.remaining_total > 0):
return min(config.SHIP_SPEED_MAX_KN, NIXIE_MAX_TOW_KN - 1.0)
return config.SHIP_SPEED_MAX_KN
def _nearest_threat(game):
"""Return the nearest inbound ASM or torpedo threat as {bearing, range_nm}.
@@ -46,11 +55,11 @@ def _nearest_threat(game):
real crew could already see, never world truth. Mirrors the range-then-id
tie-break `_opz` already uses for ASM tracks.
"""
items = [(track.range_nm, track.track_id, track.bearing)
items = [(track.range_nm, track.track_id, track.bearing, "asm")
for track in game.asm_tracks()]
# Torpedo threats are intercepts audible now or contacts the operator
# classified TORPEDO; the entity type is never consulted.
items += [(None, f"T{index:03d}", warning["bearing"])
items += [(None, f"T{index:03d}", warning["bearing"], "torpedo")
for index, warning in enumerate(game.torpedo_warnings(held=False))
if warning["age_s"] <= 2.0
and warning["source"] != "flood"]
@@ -59,9 +68,9 @@ def _nearest_threat(game):
# `_id` is a str on both branches above so the tie-break stays orderable
# even when an ASM track (str track_id) and a torpedo contact (int id)
# tie on range at the same time.
range_nm, _id, bearing = min(
range_nm, _id, bearing, kind = min(
items, key=lambda item: (float("inf") if item[0] is None else item[0], item[1]))
return {"bearing": bearing, "range_nm": range_nm}
return {"bearing": bearing, "range_nm": range_nm, "kind": kind}
def station_key(station) -> str:
@@ -222,8 +231,9 @@ class AutocrewController:
% 360.0) - 180.0)
if course_off > 5.0 and game.order_course(candidate) == "ok":
changed = True
if (game.ship.target_speed < config.SHIP_SPEED_MAX_KN - 0.5
and game.order_speed(config.SHIP_SPEED_MAX_KN) == "ok"):
evade_kn = evade_speed_kn(game, threat["kind"])
if (abs(game.ship.target_speed - evade_kn) > 0.5
and game.order_speed(evade_kn) == "ok"):
changed = True
return "evading" if changed else "monitoring"
@@ -291,7 +301,8 @@ class AutocrewController:
def _weapons(game):
observed = any(warning["age_s"] <= 2.0 and warning["source"] != "flood"
for warning in game.torpedo_warnings(held=False))
if observed and not game.nixies and game.nixie_store.ready > 0:
if (observed and not game.nixies and game.nixie_store.ready > 0
and game.ship.speed <= NIXIE_MAX_TOW_KN):
if game.deploy_nixie_result() is True:
return "countermeasure"
if game.damage.station_down("weapons"):
+7 -1
View File
@@ -679,7 +679,13 @@ class SimMixin:
helo = self.helo
if not helo.mad_mode or not helo.airborne or helo.hovering:
return
tick = int(self.sim_t / max(dt, 1e-6))
# One magnetometer look per MAD_LOOK_S of simulation time, as for the
# patrol aircraft: the chance per second must not depend on the frame
# rate (one draw per substep did, and keyed ticks by the substep).
look = mad_physics.MAD_LOOK_S
tick = math.floor((self.sim_t + 1e-9) / look)
if tick == math.floor((self.sim_t - dt + 1e-9) / look):
return
for target in targets:
if (getattr(target, "sensor_domain", None) != "subsurface"
or getattr(target, "sunk", False)):
+3 -1
View File
@@ -29,6 +29,7 @@ from functools import lru_cache
from src.core import boat_missions, commander_traits, config, detrand, opfor_plans
from src.core.autocrew import AutocrewController, _nearest_threat, station_key
from src.core.station import Station
from src.weapons.asw import NIXIE_MAX_TOW_KN
from src.llm import opponent
from src.physics.geo import bearing_deg as _bearing
@@ -717,7 +718,8 @@ def fire_range_nm(game) -> float:
def weapons(game, found) -> str:
observed = any(warning["age_s"] <= 2.0 and warning["source"] != "flood"
for warning in game.torpedo_warnings(held=False))
if observed and not game.nixies and game.nixie_store.ready > 0:
if (observed and not game.nixies and game.nixie_store.ready > 0
and game.ship.speed <= NIXIE_MAX_TOW_KN):
if game.deploy_nixie_result() is True:
return "countermeasure"
if observed and game.rbu_defence_bearing() is not None and game.fire_rbu_defence() == "ok":
+4 -1
View File
@@ -551,7 +551,10 @@ def update_wires(game, boat, dt: float) -> None:
orders.event("wire_broken")
continue
if (torpedo.seeker_acquired or torpedo.guidance_x is None
or torpedo.guidance_y is None):
or torpedo.guidance_y is None
or (torpedo.terminal_active and torpedo.pattern != "straight")):
# Seeker on with a search pattern set: the pattern steers, not
# the wire (the wire held it circling on the datum before).
continue
# The wire turns the torpedo onto its (possibly updated) datum.
desired = math.degrees(math.atan2(torpedo.guidance_x - torpedo.x,
+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.3.205"
APP_VERSION = "1.3.206"
SAVE_VERSION = 52
SAVE_SCHEMA = "u-jagd-save-v52"
SPLASH_TEXT = (
+4 -2
View File
@@ -837,8 +837,10 @@ class Sub(FrigateRelativeMixin):
new_rate = self.depth_rate_mps + config.clamp(
desired_rate - self.depth_rate_mps, -accel, accel)
step = (self.depth_rate_mps + new_rate) / 2.0 * dt
if (step >= 0.0 and self.depth + step >= target_depth) or \
(step <= 0.0 and self.depth + step <= target_depth):
gap = target_depth - self.depth
# Settle only when moving toward the order and reaching it this step:
# a reversed order first brakes the vertical motion, never teleports.
if gap == 0.0 or (step * gap > 0.0 and abs(step) >= abs(gap)):
self.depth = target_depth
self.depth_rate_mps = 0.0
else:
+13 -4
View File
@@ -183,10 +183,15 @@ def _exp_linear_step(v0: float, alpha: float, beta: float, dt: float) -> float:
def _exp_linear_time_to(v0: float, v1: float, alpha: float, beta: float) -> float:
"""Time until dv/dt = alpha + beta v reaches ``v1``; inf if it never does."""
if abs(beta) < 1e-15:
return (v1 - v0) / alpha if alpha > 0.0 else float("inf")
ratio = (v1 + alpha / beta) / (v0 + alpha / beta)
return math.log(ratio) / beta if ratio > 0.0 else float("inf")
t = (v1 - v0) / alpha if alpha != 0.0 else float("inf")
else:
ratio = (v1 + alpha / beta) / (v0 + alpha / beta)
t = math.log(ratio) / beta if ratio > 0.0 else float("inf")
# A negative time means v1 lies behind the motion (or beyond an unstable
# equilibrium): it is not reached, never jumped to.
return t if t >= 0.0 else float("inf")
def surge_step(model: HullModel, v0: float, target: float, mass_kg: float,
@@ -209,7 +214,11 @@ def surge_step(model: HullModel, v0: float, target: float, mass_kg: float,
mass_eff = model.effective_mass_kg(mass_kg)
n_target = model.steady_rps(target)
c = model.rpm_per_mps / 60.0
delta = model.load_up_rps
# The control programme's load-up margin also covers the added resistance
# in a seaway, so the calm-water acceleration margin K*delta0^2 is kept
# (without it the ship could not get under way from rest in heavy seas).
delta = math.sqrt(model.load_up_rps ** 2
+ max(0.0, extra_resistance) / model.thrust_k)
remaining = dt
v = max(0.0, v0)
governed = False
+1
View File
@@ -17,6 +17,7 @@ MAD_SURE_PROBABILITY = 0.9
MAD_FIX_UNCERTAINTY_NM = 0.3
MAD_FIX_QUALITY = 0.7
MAD_SPEED_KN = 90.0 # the run is flown slow and low
MAD_LOOK_S = 1.0 # one look per hull and second, whatever the frame rate
def slant_m(horizontal_nm: float, depth_m: float,
+18 -3
View File
@@ -61,8 +61,16 @@ def seeker_level_db(weapon, candidate) -> float:
level = getattr(candidate, "acoustic_level_db", None)
if level is None:
quiet = getattr(candidate, "quiet_factor", None)
level = (20.0 * math.log10(1.0 + 0.8 * (1.0 - quiet()))
if callable(quiet) else 0.0)
noise = getattr(candidate, "noise_level", None)
if callable(quiet):
level = 20.0 * math.log10(1.0 + 0.8 * (1.0 - quiet()))
elif callable(noise):
# A hull that publishes only its radiated noise (the frigate):
# speed, quiet running and the plant now change what it sounds
# like to a seeker (it was a constant 0 dB before).
level = 20.0 * math.log10(1.0 + 0.8 * config.clamp(noise(), 0.0, 1.0))
else:
level = 0.0
offset = getattr(candidate, "source_level_offset_db", None)
if callable(offset):
level += offset()
@@ -71,7 +79,8 @@ def seeker_level_db(weapon, candidate) -> float:
if depth is not None:
level -= abs(depth - weapon.depth) / 10.0
speed = getattr(candidate, "speed_kn", None)
if speed is None and hasattr(candidate, "stype"):
if speed is None and (hasattr(candidate, "stype")
or callable(getattr(candidate, "noise_level", None))):
speed = getattr(candidate, "speed", None)
if speed is not None and speed < SEEKER_DOPPLER_MIN_KN:
level -= SEEKER_NO_DOPPLER_DB
@@ -640,6 +649,12 @@ class EnemyTorpedo(FrigateRelativeMixin):
if candidate is not None:
self._seeker_target = candidate
self.seeker_acquired = True
elif self.seeker_acquired:
# The held target left the seeker's range or is masked: the
# lock is lost (as for own torpedoes), so a knuckle, the wake
# or the search pattern take over again.
self.seeker_acquired = False
self._seeker_target = None
target = self._seeker_target
fraction = self.speed_fraction()
desired = None
+2 -2
View File
@@ -86,7 +86,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.3.205.dist-info/METADATA") for name in wheel_names)
assert any(name.endswith("-1.3.206.dist-info/METADATA") for name in wheel_names)
source = next(tmp_path.glob("u_jagd-*.tar.gz"))
with tarfile.open(source) as archive:
@@ -139,7 +139,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.3.205'; "
"from src.core.version import APP_VERSION; assert APP_VERSION == '1.3.206'; "
"from src.commander.server import CommanderServer; "
"server=CommanderServer(); server.start('127.0.0.1',0); server.stop(); "
"from src.core import manual; page=manual.html_page('de'); assert 'station-sonar' in page; "
+140
View File
@@ -0,0 +1,140 @@
"""Physics and weapon regressions from the code review of 1.3.204 (package B)."""
import math
import random
from types import SimpleNamespace
import pytest
from src.core import autocrew, opfor
from src.core.game_sim import SimMixin
from src.enemies.sub import Sub
from src.physics import ship_dynamics as dyn
from src.sensors import mad
from src.ship.ship import Ship
from src.weapons.asw import NIXIE_MAX_TOW_KN
from src.weapons.torpedo import EnemyTorpedo, seeker_level_db
@pytest.mark.parametrize("sea", [5, 6])
def test_the_frigate_gets_under_way_from_rest_in_heavy_seas(sea):
hull = dyn.HULL
resistance = hull.added_resistance_n(sea)
v = 0.0
for _ in range(int(300 / 0.05)):
v, _, _ = dyn.surge_step(hull, v, 31 * dyn.KN, hull.mass_design_kg, 0.05,
extra_resistance=resistance)
# It used to stay at 0 kn for ever: the shaft never beat the sea.
assert v / dyn.KN > 10.0
def test_one_step_from_rest_in_heavy_seas_does_not_jump():
hull = dyn.HULL
v, _, _ = dyn.surge_step(hull, 0.0, 6 * dyn.KN, hull.mass_design_kg, 0.05,
extra_resistance=hull.added_resistance_n(6))
assert 0.0 <= v / dyn.KN < 0.5
def _sub(depth):
sub = Sub(100.0, 100.0, depth, 90.0, "aip_modern", random.Random(1))
sub.endurance = None
sub.speed = 8.0
return sub
@pytest.mark.parametrize("start,first,second", [(100.0, 200.0, 50.0), (150.0, 30.0, 300.0)])
def test_a_reversed_depth_order_does_not_teleport_the_submarine(start, first, second):
sub = _sub(start)
for _ in range(100):
sub._advance_depth(first, sub.motion.depth_rate_m_s, 0.05)
before = sub.depth
sub._advance_depth(second, sub.motion.depth_rate_m_s, 0.05)
assert abs(sub.depth - before) < 1.0
def _mad_draws(fps, seconds=20.0, monkeypatch=None):
draws = []
monkeypatch.setattr(mad, "detects", lambda seed, tid, tick, slant: draws.append(tick) or False)
fake = SimpleNamespace(
helo=SimpleNamespace(mad_mode=True, airborne=True, hovering=False, x=0.0, y=0.0),
seed=1, sim_t=0.0,
_mad_wreck_anomalies=lambda *a, **k: None)
target = SimpleNamespace(id=7, x=0.0, y=0.0, depth=50.0,
sensor_domain="subsurface", sunk=False)
dt = 1.0 / fps
for _ in range(int(round(seconds * fps))):
fake.sim_t += dt
SimMixin._update_mad(fake, [target], dt)
return draws
def test_helicopter_mad_looks_do_not_depend_on_the_frame_rate(monkeypatch):
slow = _mad_draws(30, monkeypatch=monkeypatch)
fast = _mad_draws(60, monkeypatch=monkeypatch)
assert len(slow) == len(fast) == pytest.approx(20 / mad.MAD_LOOK_S, abs=1)
assert len(set(slow)) == len(slow)
def _evade_game(nixies=(), aboard=0):
return SimpleNamespace(nixies=list(nixies),
nixie_store=SimpleNamespace(remaining_total=aboard))
def test_the_bridge_crew_runs_from_a_torpedo_below_nixie_tow_speed():
assert autocrew.evade_speed_kn(_evade_game(aboard=2)) < NIXIE_MAX_TOW_KN
assert autocrew.evade_speed_kn(_evade_game(nixies=[object()])) < NIXIE_MAX_TOW_KN
flank = autocrew.config.SHIP_SPEED_MAX_KN
assert autocrew.evade_speed_kn(_evade_game()) == flank
assert autocrew.evade_speed_kn(_evade_game(aboard=2), "asm") == flank
def test_a_hostile_torpedo_drops_a_lock_on_a_target_far_out_of_reach():
ship = SimpleNamespace(x=0.0, y=0.0, depth=5.0, wake=[], course=0.0)
torpedo = EnemyTorpedo(0.0, 2.0, 0.0, 10.0, 1, guidance_x=0.0, guidance_y=0.0)
torpedo.update(0.1, ship)
assert torpedo.seeker_acquired
ship.x = 10.0
for _ in range(50):
torpedo.update(0.1, ship)
assert not torpedo.seeker_acquired
def test_the_frigate_sounds_louder_to_a_seeker_at_speed():
ship = Ship(0.0, 0.0, 0.0)
weapon = SimpleNamespace(x=0.0, y=1.0, depth=6.0)
levels = []
for speed in (0.0, 15.0, 30.0):
ship.speed = speed
levels.append(seeker_level_db(weapon, ship))
assert levels[0] < levels[1] < levels[2]
def _pattern_run(wired, pattern):
orders = opfor.CrewOrders()
sub = SimpleNamespace(x=0.0, y=20.0, speed=3.0, course=0.0, sunk=False)
boat = SimpleNamespace(sub=sub, orders=orders, sub_id=7)
torpedo = EnemyTorpedo(0.0, 2.0, 0.0, 30.0, 1, guidance_x=0.0, guidance_y=0.0,
launch_platform_id=7, pattern=pattern, enable_nm=3.0)
game = SimpleNamespace(enemy_torpedoes=[torpedo])
ship = SimpleNamespace(x=200.0, y=200.0, depth=5.0, wake=[])
if not wired:
opfor.update_wires(game, boat, 0.25)
orders.wires[torpedo.id].state = "CUT"
acc = 0.0
farthest = 0.0
for i in range(int(300 / 0.05)):
torpedo.update(0.05, ship)
acc += 0.05
if acc >= 0.25:
opfor.update_wires(game, boat, acc)
acc = 0.0
if i * 0.05 > 120:
farthest = max(farthest, math.hypot(torpedo.x, torpedo.y))
return farthest
@pytest.mark.parametrize("pattern", ["circle", "helix"])
def test_a_held_wire_keeps_the_search_pattern(pattern):
# The wire used to steer the torpedo back to the datum, flattening its
# circle or helix into a straight run through the point.
assert _pattern_run(True, pattern) == pytest.approx(_pattern_run(False, pattern), abs=0.2)
+2 -2
View File
@@ -14,9 +14,9 @@ from src.world.real_coast import sector_for_seed
def test_release_version_and_exact_splash_text():
assert APP_VERSION == "1.3.205"
assert APP_VERSION == "1.3.206"
assert SPLASH_TEXT == (
"Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.3.205"
"Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.3.206"
)