mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 21:04:18 +01:00
Charted wrecks: chart symbols, seabed obstacle, submarine hiding
- Wrecks and underwater rocks are drawn on every chart (native map view, OPZ basemap, web role map) as chart symbols with the depth of their top when zoomed in and a chart tooltip; they are published as public chart geography to Remote Crew. - Wrecks now raise the seabed within half their length, like rocks, so they are obstacles for grounding, submarines and weapons. - An evading submarine near the frigate may creep to a charted wreck within 8 NM and lie still on the bottom beside it (new WRACK state, silent, no current drift, derived from saved fields so save v12 is unchanged). A zero-Doppler echo in the same range cell and beam merges with the wreck echo: hidden from CW (750 m cell), separable with LFM (about 8 m). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a3b72e9475
commit
e5b075dcb3
21 files changed
+525
-39
No files matched your search
+26
-1
@@ -1707,6 +1707,28 @@
|
||||
if (x >= 0 && x <= plot.width && y >= 0 && y <= plot.height) plot.context.fillText(label.name, x + 5, y - 5);
|
||||
}
|
||||
for (const base of geo?.airbases || []) { const [x, y] = point(base.x, base.y); plot.context.strokeRect(x - 3, y - 3, 6, 6); }
|
||||
// Charted wrecks (hull line with masts) and underwater rocks (asterisk);
|
||||
// depth labels once zoomed in.
|
||||
const pxPerNm = Math.abs(point(1, 0)[0] - point(0, 0)[0]);
|
||||
for (const hazard of geo?.hazards || []) {
|
||||
const [x, y] = point(hazard.x, hazard.y);
|
||||
if (x < -8 || x > plot.width + 8 || y < -8 || y > plot.height + 8) continue;
|
||||
const context = plot.context;
|
||||
context.strokeStyle = hazard.kind === "wreck" ? "#96b4c8" : "#dcbe78";
|
||||
context.beginPath();
|
||||
if (hazard.kind === "wreck") {
|
||||
context.moveTo(x - 8, y); context.lineTo(x + 8, y);
|
||||
for (const dx of [-4, 0, 4]) { context.moveTo(x + dx, y - 5); context.lineTo(x + dx, y + 5); }
|
||||
} else {
|
||||
context.moveTo(x - 4, y); context.lineTo(x + 4, y); context.moveTo(x, y - 4); context.lineTo(x, y + 4);
|
||||
context.moveTo(x - 3, y - 3); context.lineTo(x + 3, y + 3); context.moveTo(x - 3, y + 3); context.lineTo(x + 3, y - 3);
|
||||
}
|
||||
context.stroke();
|
||||
if (pxPerNm >= 12) {
|
||||
context.fillStyle = context.strokeStyle;
|
||||
context.fillText(t("chart_hazard_depth", {depth: number(hazard.top_depth_m, 0)}), x + 12, y + 4);
|
||||
}
|
||||
}
|
||||
const [ox, oy] = hasPosition(data.own) ? point(data.own.x, data.own.y) : [plot.width / 2, plot.height / 2];
|
||||
if (hasPosition(data.own)) {
|
||||
addRoleMapHit(null, ox, oy);
|
||||
@@ -3152,7 +3174,10 @@
|
||||
land.points.some((point) => !Array.isArray(point) || point.length !== 2 || !point.every(finite)))) throw new Error("chart");
|
||||
if (data.geography !== undefined) {
|
||||
const geo = data.geography;
|
||||
if (!exactKeys(geo, ["labels", "airbases", "depths"]) ||
|
||||
if (!exactKeys(geo, ["labels", "airbases", "depths", "hazards"]) ||
|
||||
!Array.isArray(geo.hazards) || geo.hazards.length > 64 || geo.hazards.some((row) =>
|
||||
!exactKeys(row, ["kind", "x", "y", "top_depth_m", "length_m"]) || !["wreck", "rock"].includes(row.kind) ||
|
||||
![row.x, row.y, row.top_depth_m, row.length_m].every(finite)) ||
|
||||
![geo.labels, geo.airbases].every((rows) => Array.isArray(rows) && rows.length <= 128 && rows.every((row) =>
|
||||
exactKeys(row, ["name", "x", "y"]) && typeof row.name === "string" && row.name.length <= 96 && finite(row.x) && finite(row.y))) ||
|
||||
!Array.isArray(geo.depths) || geo.depths.length > 64 || geo.depths.some((row) =>
|
||||
|
||||
+8
-1
@@ -3396,5 +3396,12 @@
|
||||
"commander.web.weather_dip_above": "Tauchsonar über der Schicht: unter die Schicht fieren, um die Schattenzone abzudecken.",
|
||||
"commander.web.weather_shadow_hint": "Rot: Schattenzone unter der Schicht - dort kann sich ein U-Boot vor dem Bugsonar verstecken.",
|
||||
"commander.web.weather_layer_label": "SCHICHT {depth} m",
|
||||
"commander.web.weather_sofar_label": "SOFAR {depth} m"
|
||||
"commander.web.weather_sofar_label": "SOFAR {depth} m",
|
||||
"chart.hazard_depth": "{depth} m",
|
||||
"chart.wreck_title": "Wrack (kartiert)",
|
||||
"chart.wreck_detail": "Oberkante {depth} m unter der Oberfläche · Länge {length} m",
|
||||
"chart.rock_title": "Unterwasserfels (kartiert)",
|
||||
"chart.rock_detail": "Oberkante {depth} m unter der Oberfläche",
|
||||
"chart.hazard_note": "Hindernis für Schiff, U-Boote und Waffen; Wracks liefern Aktivsonar-Echos",
|
||||
"commander.web.chart_hazard_depth": "{depth} m"
|
||||
}
|
||||
+8
-1
@@ -3396,5 +3396,12 @@
|
||||
"commander.web.weather_dip_above": "Dipping sonar above the layer: lower it below to cover the shadow zone.",
|
||||
"commander.web.weather_shadow_hint": "Red: shadow zone below the layer - a submarine can hide there from the hull sonar.",
|
||||
"commander.web.weather_layer_label": "LAYER {depth} m",
|
||||
"commander.web.weather_sofar_label": "SOFAR {depth} m"
|
||||
"commander.web.weather_sofar_label": "SOFAR {depth} m",
|
||||
"chart.hazard_depth": "{depth} m",
|
||||
"chart.wreck_title": "Wreck (charted)",
|
||||
"chart.wreck_detail": "Top {depth} m below the surface · length {length} m",
|
||||
"chart.rock_title": "Underwater rock (charted)",
|
||||
"chart.rock_detail": "Top {depth} m below the surface",
|
||||
"chart.hazard_note": "Obstacle for ship, submarines and weapons; wrecks return active sonar echoes",
|
||||
"commander.web.chart_hazard_depth": "{depth} m"
|
||||
}
|
||||
@@ -113,6 +113,7 @@ Gefechtslage:
|
||||
- Weichen TAS und HMS um 9 Grad oder mehr ab, den Kontakt als möglichen Geist behandeln (die Anzeige markiert ihn) und durch eine Wende klären.
|
||||
- Die Schleppantenne ist eine Linie: sie kann eine Peilung nicht von ihrem Spiegelbild zum Kabel unterscheiden. Ein nur auf der TAS gehörter Kontakt wird als "TAS links/rechts mehrdeutig" mit Spiegelpeilung markiert und speist keine TMA; die angezeigte Seite stimmt nur in der Hälfte der Fälle. 20 Grad drehen (oder den Kontakt auf die HMS bekommen), dann fällt die falsche Seite weg. Peilungen zu den Kabelenden (Endfire) sind zudem ungenauer als querab.
|
||||
- Ein Kontakt geht 120 s nach der letzten Ortung verloren. Schwache Kontakte weiter verfolgen oder per Ping wieder erfassen.
|
||||
- Wracks liefern echte Echos ohne Doppler. Ein U-Boot, das still neben einem kartierten Wrack auf Grund liegt, versteckt sich vor einem CW-Ping in dessen Echo (750 m Entfernungszelle); ein LFM-Ping löst etwa 8 m auf und kann Boot und Wrack trennen. Jedes Wrack, das der Gegner erreichen konnte, ist verdächtig.
|
||||
- Der Bathythermograph (`E`) misst bis zum Grund, höchstens 1500 m. Erst nach einer Messung zeigt die Wetter- & Sonar-Analyse (`0`) die Schicht, die Schattenzone darunter und einen SOFAR-Kanal.
|
||||
|
||||
## Nicht modelliert {#sonar-limits}
|
||||
|
||||
@@ -112,6 +112,7 @@ Combat situation:
|
||||
- If the TAS and HMS disagree by 9 degrees or more, treat the contact as a possible ghost (the display flags it) and turn to resolve it.
|
||||
- The towed array is a line: it cannot tell a bearing from its mirror about the cable. A contact heard only on the TAS is marked "TAS left/right ambiguous" with its mirror bearing and does not feed TMA; the shown side is right only half the time. Turn 20 degrees (or get the contact on the HMS) and the wrong side drops out. Bearings toward the cable ends (endfire) are also less accurate than broadside.
|
||||
- A contact is lost 120 s after its last detection. Keep tracking weak contacts, or reacquire with a ping.
|
||||
- Wrecks return real echoes without Doppler. A submarine lying still beside a charted wreck hides in that echo from a CW ping (750 m range cell); an LFM ping resolves about 8 m and can separate the boat from the wreck. Suspect every wreck the enemy could have reached.
|
||||
- The bathythermograph (`E`) measures to the seabed, at most 1500 m. Only after a measurement does the weather & sonar analysis (`0`) show the layer, the shadow zone below it and a SOFAR channel.
|
||||
|
||||
## Not modelled {#sonar-limits}
|
||||
|
||||
@@ -61,7 +61,7 @@ Alle Werte sind die Standardwerte der aktuellen Spielversion. Eigene Schwierigke
|
||||
| Schallgeschwindigkeit | Mackenzie-Gleichung aus dem Temperaturprofil (Oberfläche 8-18 Grad C je nach Jahreszeit) |
|
||||
| Strömung | festes Feld bis 1 kn plus 3 % des Windes, 20 Grad rechts der Windrichtung |
|
||||
| Meeresboden | Fels, Kies, Sand, Schluff oder Schlick; beeinflusst die Bodenreflexion |
|
||||
| Hindernisse | bis zu 64 kartierte Wracks und Unterwasserfelsen (Spitzen mindestens 15 m tief) |
|
||||
| Hindernisse | bis zu 64 kartierte Wracks und Unterwasserfelsen (Spitzen mindestens 15 m tief), auf jeder Karte eingetragen (Wrack: Rumpfstrich mit Masten, Fels: Sternchen; Tiefe der Oberkante beim Heranzoomen, Details im Tooltip); beide heben in ihrer Grundfläche den Meeresboden an und sind Hindernisse für Schiff, U-Boote und Waffen |
|
||||
| Atmosphäre | Barometer 975-1025 hPa, das vor steigendem Seegang fällt; Lufttemperatur aus Wasser, Jahreszeit, Tageszeit und kaltem Nordwind (in Winterstürmen unter 0 Grad C: Schnee, Vereisung); Böen; Wolkenuntergrenze; Sonnenstand mit bürgerlicher/nautischer Dämmerung; Mondphase |
|
||||
| Regenlinse | Regen süßt die obersten Meter aus (bis -1 PSU, vom Wind eingemischt) und senkt die Schallgeschwindigkeit an der Oberfläche |
|
||||
| SOFAR-Kanal | ein inneres Schallgeschwindigkeitsminimum (etwa 400-500 m unter der Deckschicht) gibt es nur in ausreichend tiefem Wasser |
|
||||
@@ -83,7 +83,7 @@ Taste `0` öffnet über jeder Station ein Analysepanel über den ganzen Bildschi
|
||||
| AIP (modern) | 0,85 | 250 m | 5 |
|
||||
| Nuklear-Jagd-U-Boot | 0,92 | 400 m | 8 |
|
||||
|
||||
U-Boote weichen nach einem gehörten Ping oder Torpedo 240 s aus, können einen Täuschkörper ausstoßen, lauern, schnorcheln (durch HFDF und ESM erfassbar) und pingen gelegentlich aus 15 sm oder weniger.
|
||||
U-Boote weichen nach einem gehörten Ping oder Torpedo 240 s aus, können einen Täuschkörper ausstoßen, lauern, schnorcheln (durch HFDF und ESM erfassbar) und pingen gelegentlich aus 15 sm oder weniger. In der Nähe der Fregatte kann ein Boot stattdessen zu einem kartierten Wrack innerhalb von 8 sm schleichen und sich 15-30 Minuten still daneben auf Grund legen.
|
||||
|
||||
U-Boot-Physik: der Rumpf beschleunigt auf die befohlene Fahrt (kein Sofortsprint); Tiefenruder brauchen Fahrt (unter etwa 4 kn ändert sich die Tiefe nur langsam); das abgestrahlte Geräusch steigt je Verdopplung der Fahrt um etwa 12 dB und springt, wenn die Schraube kavitiert, wobei die Kavitationsfahrt mit der Tiefe steigt; ein Torpedoausstoß erzeugt 8 s lang ein Transientengeräusch; ein stark geflutetes Boot bläst einmal an und steigt schnell und laut auf; unter der Testtiefe ermüdet der Druckkörper, bei 1,5-facher Testtiefe wird er zerdrückt; ein lauerndes Boot hält seine Position gegen die Strömung. U-Boote orten wie Sie: passive Peilungen aus dem eigenen Sonar, eine Entfernung erst nach eigenen TMA-Schlägen (einige Minuten), ESM nur mit ausgefahrenem Mast, den Datalink nur auf Masttiefe oder beim Schnorcheln, und ein Torpedoalarm braucht einige Sekunden Reaktionszeit der Besatzung (2-15 s), bevor das Boot ausweicht. Überwasserschiffe verlieren bei schwerer See Höchstfahrt (kleine Schiffe mehr).
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ All values are the defaults of the current game version. Custom difficulty and m
|
||||
| Sound speed | Mackenzie equation from the temperature profile (sea surface 8-18 deg C by season) |
|
||||
| Current | steady field up to 1 kn plus 3 % of the wind, 20 deg right of downwind |
|
||||
| Seabed | rock, gravel, sand, silt or mud; affects bottom reflection |
|
||||
| Hazards | up to 64 charted wrecks and submerged rocks (tops at least 15 m deep) |
|
||||
| Hazards | up to 64 charted wrecks and submerged rocks (tops at least 15 m deep), shown on every chart (wreck: hull line with masts, rock: asterisk; depth of the top when zoomed in, details in the tooltip); both raise the seabed within their footprint and are obstacles for the ship, submarines and weapons |
|
||||
| Atmosphere | barometer 975-1025 hPa that falls ahead of rising seas; air temperature from the sea, season, day and cold northerly winds (below 0 deg C in winter storms: snow, icing); gusts; cloud ceiling; sun elevation with civil/nautical twilight; moon phase |
|
||||
| Rain lens | rain freshens the top few metres (up to -1 PSU, mixed away by wind) and lowers the surface sound speed |
|
||||
| SOFAR channel | an interior sound-speed minimum (about 400-500 m below the surface layer) exists only in deep enough water |
|
||||
@@ -83,7 +83,7 @@ Key `0` opens a full-screen analysis panel over any station (`0` or `Esc` closes
|
||||
| AIP (modern) | 0.85 | 250 m | 5 |
|
||||
| Nuclear attack | 0.92 | 400 m | 8 |
|
||||
|
||||
Submarines evade for 240 s after hearing a ping or a torpedo, may launch a decoy, lie in wait, snorkel (detectable by HFDF and ESM) and sometimes ping from 15 NM or less.
|
||||
Submarines evade for 240 s after hearing a ping or a torpedo, may launch a decoy, lie in wait, snorkel (detectable by HFDF and ESM) and sometimes ping from 15 NM or less. Near the frigate a boat may instead creep to a charted wreck within 8 NM and lie still on the bottom beside it for 15-30 minutes.
|
||||
|
||||
Submarine physics: the hull accelerates toward an ordered speed (no instant sprints); hydroplanes need speed (below about 4 kn depth changes are slow); radiated noise rises about 12 dB per doubling of speed and jumps when the screw cavitates, and the cavitation speed rises with depth; a torpedo launch makes an 8 s transient; a badly flooded boat blows ballast once and rises fast and loud; operating below test depth fatigues the hull, and 1.5 x test depth crushes it; a lurking boat holds its position against the current. Submarines sense like you do: passive bearings from their own sonar, a range only after their own TMA legs (a few minutes), ESM only with the mast up, the datalink only at mast depth or snorkelling, and a torpedo alarm takes the crew a few seconds (2-15 s) before the boat evades. Surface ships lose top speed in heavy seas (small ships more).
|
||||
|
||||
|
||||
@@ -345,6 +345,7 @@ Gefechtslage:
|
||||
- Weichen TAS und HMS um 9 Grad oder mehr ab, den Kontakt als möglichen Geist behandeln (die Anzeige markiert ihn) und durch eine Wende klären.
|
||||
- Die Schleppantenne ist eine Linie: sie kann eine Peilung nicht von ihrem Spiegelbild zum Kabel unterscheiden. Ein nur auf der TAS gehörter Kontakt wird als "TAS links/rechts mehrdeutig" mit Spiegelpeilung markiert und speist keine TMA; die angezeigte Seite stimmt nur in der Hälfte der Fälle. 20 Grad drehen (oder den Kontakt auf die HMS bekommen), dann fällt die falsche Seite weg. Peilungen zu den Kabelenden (Endfire) sind zudem ungenauer als querab.
|
||||
- Ein Kontakt geht 120 s nach der letzten Ortung verloren. Schwache Kontakte weiter verfolgen oder per Ping wieder erfassen.
|
||||
- Wracks liefern echte Echos ohne Doppler. Ein U-Boot, das still neben einem kartierten Wrack auf Grund liegt, versteckt sich vor einem CW-Ping in dessen Echo (750 m Entfernungszelle); ein LFM-Ping löst etwa 8 m auf und kann Boot und Wrack trennen. Jedes Wrack, das der Gegner erreichen konnte, ist verdächtig.
|
||||
- Der Bathythermograph (`E`) misst bis zum Grund, höchstens 1500 m. Erst nach einer Messung zeigt die Wetter- & Sonar-Analyse (`0`) die Schicht, die Schattenzone darunter und einen SOFAR-Kanal.
|
||||
|
||||
### Nicht modelliert
|
||||
@@ -940,7 +941,7 @@ Alle Werte sind die Standardwerte der aktuellen Spielversion. Eigene Schwierigke
|
||||
| Schallgeschwindigkeit | Mackenzie-Gleichung aus dem Temperaturprofil (Oberfläche 8-18 Grad C je nach Jahreszeit) |
|
||||
| Strömung | festes Feld bis 1 kn plus 3 % des Windes, 20 Grad rechts der Windrichtung |
|
||||
| Meeresboden | Fels, Kies, Sand, Schluff oder Schlick; beeinflusst die Bodenreflexion |
|
||||
| Hindernisse | bis zu 64 kartierte Wracks und Unterwasserfelsen (Spitzen mindestens 15 m tief) |
|
||||
| Hindernisse | bis zu 64 kartierte Wracks und Unterwasserfelsen (Spitzen mindestens 15 m tief), auf jeder Karte eingetragen (Wrack: Rumpfstrich mit Masten, Fels: Sternchen; Tiefe der Oberkante beim Heranzoomen, Details im Tooltip); beide heben in ihrer Grundfläche den Meeresboden an und sind Hindernisse für Schiff, U-Boote und Waffen |
|
||||
| Atmosphäre | Barometer 975-1025 hPa, das vor steigendem Seegang fällt; Lufttemperatur aus Wasser, Jahreszeit, Tageszeit und kaltem Nordwind (in Winterstürmen unter 0 Grad C: Schnee, Vereisung); Böen; Wolkenuntergrenze; Sonnenstand mit bürgerlicher/nautischer Dämmerung; Mondphase |
|
||||
| Regenlinse | Regen süßt die obersten Meter aus (bis -1 PSU, vom Wind eingemischt) und senkt die Schallgeschwindigkeit an der Oberfläche |
|
||||
| SOFAR-Kanal | ein inneres Schallgeschwindigkeitsminimum (etwa 400-500 m unter der Deckschicht) gibt es nur in ausreichend tiefem Wasser |
|
||||
@@ -962,7 +963,7 @@ Taste `0` öffnet über jeder Station ein Analysepanel über den ganzen Bildschi
|
||||
| AIP (modern) | 0,85 | 250 m | 5 |
|
||||
| Nuklear-Jagd-U-Boot | 0,92 | 400 m | 8 |
|
||||
|
||||
U-Boote weichen nach einem gehörten Ping oder Torpedo 240 s aus, können einen Täuschkörper ausstoßen, lauern, schnorcheln (durch HFDF und ESM erfassbar) und pingen gelegentlich aus 15 sm oder weniger.
|
||||
U-Boote weichen nach einem gehörten Ping oder Torpedo 240 s aus, können einen Täuschkörper ausstoßen, lauern, schnorcheln (durch HFDF und ESM erfassbar) und pingen gelegentlich aus 15 sm oder weniger. In der Nähe der Fregatte kann ein Boot stattdessen zu einem kartierten Wrack innerhalb von 8 sm schleichen und sich 15-30 Minuten still daneben auf Grund legen.
|
||||
|
||||
U-Boot-Physik: der Rumpf beschleunigt auf die befohlene Fahrt (kein Sofortsprint); Tiefenruder brauchen Fahrt (unter etwa 4 kn ändert sich die Tiefe nur langsam); das abgestrahlte Geräusch steigt je Verdopplung der Fahrt um etwa 12 dB und springt, wenn die Schraube kavitiert, wobei die Kavitationsfahrt mit der Tiefe steigt; ein Torpedoausstoß erzeugt 8 s lang ein Transientengeräusch; ein stark geflutetes Boot bläst einmal an und steigt schnell und laut auf; unter der Testtiefe ermüdet der Druckkörper, bei 1,5-facher Testtiefe wird er zerdrückt; ein lauerndes Boot hält seine Position gegen die Strömung. U-Boote orten wie Sie: passive Peilungen aus dem eigenen Sonar, eine Entfernung erst nach eigenen TMA-Schlägen (einige Minuten), ESM nur mit ausgefahrenem Mast, den Datalink nur auf Masttiefe oder beim Schnorcheln, und ein Torpedoalarm braucht einige Sekunden Reaktionszeit der Besatzung (2-15 s), bevor das Boot ausweicht. Überwasserschiffe verlieren bei schwerer See Höchstfahrt (kleine Schiffe mehr).
|
||||
|
||||
|
||||
@@ -344,6 +344,7 @@ Combat situation:
|
||||
- If the TAS and HMS disagree by 9 degrees or more, treat the contact as a possible ghost (the display flags it) and turn to resolve it.
|
||||
- The towed array is a line: it cannot tell a bearing from its mirror about the cable. A contact heard only on the TAS is marked "TAS left/right ambiguous" with its mirror bearing and does not feed TMA; the shown side is right only half the time. Turn 20 degrees (or get the contact on the HMS) and the wrong side drops out. Bearings toward the cable ends (endfire) are also less accurate than broadside.
|
||||
- A contact is lost 120 s after its last detection. Keep tracking weak contacts, or reacquire with a ping.
|
||||
- Wrecks return real echoes without Doppler. A submarine lying still beside a charted wreck hides in that echo from a CW ping (750 m range cell); an LFM ping resolves about 8 m and can separate the boat from the wreck. Suspect every wreck the enemy could have reached.
|
||||
- The bathythermograph (`E`) measures to the seabed, at most 1500 m. Only after a measurement does the weather & sonar analysis (`0`) show the layer, the shadow zone below it and a SOFAR channel.
|
||||
|
||||
### Not modelled
|
||||
@@ -939,7 +940,7 @@ All values are the defaults of the current game version. Custom difficulty and m
|
||||
| Sound speed | Mackenzie equation from the temperature profile (sea surface 8-18 deg C by season) |
|
||||
| Current | steady field up to 1 kn plus 3 % of the wind, 20 deg right of downwind |
|
||||
| Seabed | rock, gravel, sand, silt or mud; affects bottom reflection |
|
||||
| Hazards | up to 64 charted wrecks and submerged rocks (tops at least 15 m deep) |
|
||||
| Hazards | up to 64 charted wrecks and submerged rocks (tops at least 15 m deep), shown on every chart (wreck: hull line with masts, rock: asterisk; depth of the top when zoomed in, details in the tooltip); both raise the seabed within their footprint and are obstacles for the ship, submarines and weapons |
|
||||
| Atmosphere | barometer 975-1025 hPa that falls ahead of rising seas; air temperature from the sea, season, day and cold northerly winds (below 0 deg C in winter storms: snow, icing); gusts; cloud ceiling; sun elevation with civil/nautical twilight; moon phase |
|
||||
| Rain lens | rain freshens the top few metres (up to -1 PSU, mixed away by wind) and lowers the surface sound speed |
|
||||
| SOFAR channel | an interior sound-speed minimum (about 400-500 m below the surface layer) exists only in deep enough water |
|
||||
@@ -961,7 +962,7 @@ Key `0` opens a full-screen analysis panel over any station (`0` or `Esc` closes
|
||||
| AIP (modern) | 0.85 | 250 m | 5 |
|
||||
| Nuclear attack | 0.92 | 400 m | 8 |
|
||||
|
||||
Submarines evade for 240 s after hearing a ping or a torpedo, may launch a decoy, lie in wait, snorkel (detectable by HFDF and ESM) and sometimes ping from 15 NM or less.
|
||||
Submarines evade for 240 s after hearing a ping or a torpedo, may launch a decoy, lie in wait, snorkel (detectable by HFDF and ESM) and sometimes ping from 15 NM or less. Near the frigate a boat may instead creep to a charted wreck within 8 NM and lie still on the bottom beside it for 15-30 minutes.
|
||||
|
||||
Submarine physics: the hull accelerates toward an ordered speed (no instant sprints); hydroplanes need speed (below about 4 kn depth changes are slow); radiated noise rises about 12 dB per doubling of speed and jumps when the screw cavitates, and the cavitation speed rises with depth; a torpedo launch makes an 8 s transient; a badly flooded boat blows ballast once and rises fast and loud; operating below test depth fatigues the hull, and 1.5 x test depth crushes it; a lurking boat holds its position against the current. Submarines sense like you do: passive bearings from their own sonar, a range only after their own TMA legs (a few minutes), ESM only with the mast up, the datalink only at mast depth or snorkelling, and a torpedo alarm takes the crew a few seconds (2-15 s) before the boat evades. Surface ships lose top speed in heavy seas (small ships more).
|
||||
|
||||
|
||||
@@ -190,6 +190,12 @@ listed with their reason at the end.
|
||||
| Constant salinity | Rain-fed fresh surface lens mixed away by wind in the Mackenzie sound speed. | weather station |
|
||||
| No deep sound channel | Temperature profile continues to the seabed in the ray profiles and the bathythermograph (to 1500 m); a SOFAR axis appears where an interior sound-speed minimum exists. | weather station |
|
||||
|
||||
## Charted hazards
|
||||
|
||||
| Gap | Model now | Closed in |
|
||||
|---|---|---|
|
||||
| Wrecks only as sonar clutter | Wrecks and rocks are drawn on every chart (native and web) with depth and tooltip; wrecks raise the seabed within half their length (obstacle for grounding, submarines, weapons); evading submarines near the frigate may lie on the bottom beside a charted wreck, where a zero-Doppler echo inside the same range cell and beam merges with the wreck echo (CW 750 m cell, LFM about 8 m). | charted hazards |
|
||||
|
||||
## Out of scope (with reason)
|
||||
|
||||
| Item | Reason |
|
||||
|
||||
@@ -974,7 +974,14 @@ class CommanderBridge:
|
||||
disclaimer="commander.chart.omitted" if omitted
|
||||
else "commander.chart.disclaimer")
|
||||
self._chart_world = id(game.world)
|
||||
self._chart_geography = dict(labels=[], airbases=[], depths=[])
|
||||
self._chart_geography = dict(labels=[], airbases=[], depths=[], hazards=[])
|
||||
# Charted wrecks and underwater rocks are public chart content.
|
||||
charted = getattr(game.world, "charted_hazards", None)
|
||||
for hazard in islice(charted() if charted is not None else (), 64):
|
||||
self._chart_geography["hazards"].append(dict(
|
||||
kind=hazard.kind, x=_number(hazard.x_nm), y=_number(hazard.y_nm),
|
||||
top_depth_m=_number(hazard.top_depth_m),
|
||||
length_m=_number(hazard.length_m)))
|
||||
for land in islice(game.world.coast.landmasses, 128):
|
||||
if getattr(land, "name", None) and hasattr(land, "centroid"):
|
||||
x, y = land.centroid
|
||||
|
||||
+91
-8
@@ -35,6 +35,18 @@ if DECOY_PROFILE is None:
|
||||
SUB_REACTION_MEDIAN_S = 5.0
|
||||
SUB_TMA_RESOLVE_S = 30.0
|
||||
SUB_TMA_LEG_TURN_DEG = 35.0
|
||||
# Hiding beside a charted wreck: the boat lies still on the bottom next to
|
||||
# the wreck, so an active echo without Doppler merges with the wreck echo.
|
||||
SUB_WRECK_HIDE_RANGE_NM = 8.0
|
||||
SUB_WRECK_HIDE_S = (900.0, 1800.0)
|
||||
SUB_WRECK_STANDOFF_NM = 0.02 # beyond the wreck's footprint
|
||||
SUB_WRECK_ARRIVED_NM = 0.015
|
||||
SUB_WRECK_MIN_BOTTOM_M = 40.0
|
||||
SUB_BOTTOM_CLEARANCE_M = 3.0
|
||||
SUB_WRECK_TRANSIT_KN = 4.0
|
||||
SUB_WRECK_MAX_DEPTH_FRACTION = 0.85
|
||||
# States in which the boat runs silent (lurking, or lying by a wreck).
|
||||
QUIET_STATES = ("LAUER", "WRACK")
|
||||
|
||||
|
||||
class SubType:
|
||||
@@ -632,8 +644,13 @@ class Sub:
|
||||
if (tactical_observation is not None
|
||||
and tactical_observation.range_nm is not None
|
||||
and tactical_observation.range_nm < config.SUB_LUER_DIST_NM):
|
||||
self.state = "LAUER"
|
||||
self.evac_left = self.rng.uniform(*config.SUB_LUER_DURATION_S)
|
||||
# A charted wreck within reach is the better hiding place:
|
||||
# lie on the bottom beside it instead of hovering.
|
||||
hide = self.wreck_hiding_spot(world)
|
||||
self.state = "LAUER" if hide is None else "WRACK"
|
||||
self.evac_left = self.rng.uniform(
|
||||
*(config.SUB_LUER_DURATION_S if hide is None
|
||||
else SUB_WRECK_HIDE_S))
|
||||
self.heard_ping = False
|
||||
self.speed = 0.5
|
||||
else:
|
||||
@@ -660,6 +677,8 @@ class Sub:
|
||||
self.motion.turn_rate_deg_s * 2.5 * dt)) % 360.0
|
||||
self.speed = max(self.speed, min(self.speed_for_state(),
|
||||
max(10.0, self.stype.speed_kn * .9)))
|
||||
elif self.state == "WRACK":
|
||||
self._hide_by_wreck(dt, world, safe_depth)
|
||||
elif self.state == "LAUER":
|
||||
# W2: Stillhalten unter der Thermokline (sehr leise, lauschen)
|
||||
self.evac_left -= dt
|
||||
@@ -736,7 +755,7 @@ class Sub:
|
||||
ny = self.y - v * math.cos(math.radians(self.course))
|
||||
# W2: Meeresstroemung - reiner Driftzusatz, kein Antrieb/keine Steuerung.
|
||||
current = getattr(world, "current_vec", None)
|
||||
if current is not None:
|
||||
if current is not None and not self.bottomed:
|
||||
cu, cv = current(self.x, self.y)
|
||||
nx += config.kn_to_nm_per_s(cu) * motion_dt
|
||||
ny -= config.kn_to_nm_per_s(cv) * motion_dt
|
||||
@@ -813,7 +832,7 @@ class Sub:
|
||||
if self.state == "EVADE":
|
||||
self.speed = min(self.speed_for_state(),
|
||||
max(10.0, self.stype.speed_kn * .9))
|
||||
elif self.state == "LAUER":
|
||||
elif self.state in QUIET_STATES:
|
||||
self.speed = 1.0
|
||||
else:
|
||||
self.speed = min(6.0, self.speed_for_state())
|
||||
@@ -826,7 +845,7 @@ class Sub:
|
||||
q = self.stype.quiet * self.quiet_mult - 0.30 * (self.damage / 100.0)
|
||||
if self.state == "EVADE":
|
||||
q -= 0.30
|
||||
if self.state == "LAUER":
|
||||
if self.state in QUIET_STATES:
|
||||
q = max(0.97, q + 0.08)
|
||||
if self.transmitting:
|
||||
q += config.SNOCKEL_TRANSMIT_NOISE # M13: Senden macht lauter
|
||||
@@ -865,6 +884,70 @@ class Sub:
|
||||
f"{self.stype.acoustic.tonal_band_hz[1]:.0f} Hz")
|
||||
return f"mechanisch · {base} · {freq}{detail}"
|
||||
|
||||
@property
|
||||
def bottomed(self) -> bool:
|
||||
"""Lying still on the seabed (wreck hide): no way ordered, no drift.
|
||||
Derived from saved state, so it survives save/load."""
|
||||
return self.state == "WRACK" and self.speed_order <= 0.0
|
||||
|
||||
def wreck_hiding_spot(self, world):
|
||||
"""Nearest charted wreck within reach whose bottom this boat can lie
|
||||
on, and the berth beside it (charts are public to every navy)."""
|
||||
hazards = getattr(world, "charted_hazards", None)
|
||||
depth_at = getattr(world, "depth_m", None)
|
||||
if hazards is None or depth_at is None:
|
||||
return None
|
||||
best = None
|
||||
for index, hazard in enumerate(hazards()):
|
||||
if hazard.kind != "wreck":
|
||||
continue
|
||||
distance = math.hypot(hazard.x_nm - self.x, hazard.y_nm - self.y)
|
||||
if distance > SUB_WRECK_HIDE_RANGE_NM:
|
||||
continue
|
||||
side = detrand.phase(self.sensor_seed, "wreck-berth", index)
|
||||
offset = hazard.radius_nm + SUB_WRECK_STANDOFF_NM
|
||||
bx = hazard.x_nm + offset * math.sin(side)
|
||||
by = hazard.y_nm - offset * math.cos(side)
|
||||
bottom = depth_at(bx, by)
|
||||
# Lie well above test depth so the hull does not fatigue.
|
||||
if not (SUB_WRECK_MIN_BOTTOM_M <= bottom - SUB_BOTTOM_CLEARANCE_M
|
||||
<= SUB_WRECK_MAX_DEPTH_FRACTION * self.stype.max_depth_m):
|
||||
continue
|
||||
if best is None or (distance, index) < best[0]:
|
||||
best = ((distance, index), hazard, bx, by, bottom)
|
||||
return None if best is None else best[1:]
|
||||
|
||||
def _hide_by_wreck(self, dt: float, world, safe_depth: float) -> None:
|
||||
"""Transit quietly to the berth beside the wreck, then settle on the
|
||||
bottom and lie still until the hide time is up."""
|
||||
self.evac_left -= dt
|
||||
spot = self.wreck_hiding_spot(world)
|
||||
if spot is None or self.evac_left <= 0.0:
|
||||
self.state = "PATROLLE"
|
||||
self.speed = min(6.0, self.speed_for_state())
|
||||
self.turn_left = self.rng.uniform(300.0, 900.0)
|
||||
self.turn_delta = 0.0
|
||||
return
|
||||
_hazard, bx, by, bottom = spot
|
||||
distance = math.hypot(bx - self.x, by - self.y)
|
||||
if distance > SUB_WRECK_ARRIVED_NM and not self.bottomed:
|
||||
self.target_course = math.degrees(math.atan2(
|
||||
bx - self.x, -(by - self.y))) % 360.0
|
||||
diff = config.angle_diff_deg(self.target_course, self.course)
|
||||
self.course = (self.course + config.clamp(
|
||||
diff, -self.motion.turn_rate_deg_s * dt,
|
||||
self.motion.turn_rate_deg_s * dt)) % 360.0
|
||||
# Slow down on the final approach so the boat stops on its berth.
|
||||
self.speed = min(SUB_WRECK_TRANSIT_KN, self.speed_for_state(),
|
||||
max(0.5, distance * 3600.0 / 60.0))
|
||||
# Transit with the usual bottom clearance over the berth, too,
|
||||
# so the approach is not blocked by the rising seabed.
|
||||
self.target_depth = max(0.0, min(safe_depth, bottom - 30.0))
|
||||
else:
|
||||
self.speed = 0.0
|
||||
self.target_depth = max(0.0, bottom - SUB_BOTTOM_CLEARANCE_M)
|
||||
self._advance_depth(self.target_depth, self.motion.depth_rate_m_s, dt)
|
||||
|
||||
def speed_for_state(self) -> float:
|
||||
"""Fahrt bei Schaden: langsamer je nach Schadensgrad."""
|
||||
return self.motion.maximum_speed_kn * (1.0 - 0.25 * self.damage / 100.0)
|
||||
@@ -919,7 +1002,7 @@ class Sub:
|
||||
if self.state == "EVADE":
|
||||
f *= 1.2
|
||||
amp = min(1.0, amp + 0.30)
|
||||
if self.state == "LAUER":
|
||||
if self.state in QUIET_STATES:
|
||||
amp *= 0.5
|
||||
lines.append((f, amp, 1.5))
|
||||
if v > 4.0:
|
||||
@@ -946,7 +1029,7 @@ class Sub:
|
||||
level = broadband[0]
|
||||
if self.state == "EVADE":
|
||||
level *= 1.6
|
||||
if self.state == "LAUER":
|
||||
if self.state in QUIET_STATES:
|
||||
level *= 0.5
|
||||
return {"level": min(1.0, level + 0.10 * self.damage / 100.0),
|
||||
"low_hz": broadband[1], "high_hz": broadband[2]}
|
||||
@@ -957,7 +1040,7 @@ class Sub:
|
||||
level = self.fingerprint.bb_level * (0.15 + 0.85 * min(1.0, v / vmax))
|
||||
if self.state == "EVADE":
|
||||
level *= 1.6
|
||||
if self.state == "LAUER":
|
||||
if self.state in QUIET_STATES:
|
||||
level *= 0.5
|
||||
level = min(1.0, level + 0.10 * (self.damage / 100.0))
|
||||
return {"level": min(1.0, level),
|
||||
|
||||
@@ -284,6 +284,30 @@ class ActiveTerms:
|
||||
ACTIVE_FREQUENCY_HZ = 3500.0 # medium-frequency hull sonar
|
||||
ACTIVE_BEAMWIDTH_DEG = 12.0
|
||||
|
||||
SOUND_SPEED_M_S = 1500.0
|
||||
DOPPLER_FREE_KN = 0.5
|
||||
|
||||
|
||||
def range_resolution_m(pulse: str) -> float:
|
||||
"""Range resolution of a pulse: c T / 2 for CW, c / 2B for LFM."""
|
||||
duration, bandwidth = PULSES[pulse]
|
||||
if pulse == "CW":
|
||||
return SOUND_SPEED_M_S * duration / 2.0
|
||||
return SOUND_SPEED_M_S / (2.0 * bandwidth)
|
||||
|
||||
|
||||
def echo_merges_with_clutter(target_range_m: float, target_bearing_deg: float,
|
||||
target_radial_kn: float, clutter_range_m: float,
|
||||
clutter_bearing_deg: float, pulse: str,
|
||||
beamwidth_deg: float = ACTIVE_BEAMWIDTH_DEG) -> bool:
|
||||
"""True when a target echo cannot be separated from a clutter echo: no
|
||||
Doppler to tell it apart, inside the same range cell and the same beam."""
|
||||
if abs(target_radial_kn) >= DOPPLER_FREE_KN:
|
||||
return False
|
||||
bearing_gap = abs((target_bearing_deg - clutter_bearing_deg + 180.0) % 360.0 - 180.0)
|
||||
return (abs(target_range_m - clutter_range_m) < range_resolution_m(pulse)
|
||||
and bearing_gap < beamwidth_deg / 2.0)
|
||||
|
||||
|
||||
def active_noise_db(sea_state: float, rain: float = 0.0) -> float:
|
||||
return _db_sum(ambient_noise_db(ACTIVE_FREQUENCY_HZ, sea_state, rain),
|
||||
|
||||
+29
-2
@@ -1556,6 +1556,31 @@ class SonarSystem:
|
||||
self.ping_pulse = order[(order.index(self.ping_pulse) + 1) % len(order)]
|
||||
return self.ping_pulse
|
||||
|
||||
def _masked_by_wreck(self, tgt, frigate, world, mode: str) -> bool:
|
||||
"""Target echo hidden in a wreck echo (same range cell and beam, no
|
||||
Doppler). The finer LFM range resolution can separate them."""
|
||||
ocean = getattr(world, "ocean", None)
|
||||
if ocean is None or not hasattr(tgt, "stype"):
|
||||
return False
|
||||
bearing = math.degrees(math.atan2(tgt.x - frigate.x, -(tgt.y - frigate.y))) % 360.0
|
||||
radial = getattr(tgt, "speed", 0.0) * math.cos(math.radians(
|
||||
config.angle_diff_deg((bearing + 180.0) % 360.0, getattr(tgt, "course", 0.0))))
|
||||
target_range = math.hypot(tgt.x - frigate.x, tgt.y - frigate.y) * 1852.0
|
||||
beam = 6.0 if mode == "TOWED" else equation.ACTIVE_BEAMWIDTH_DEG
|
||||
for hazard in ocean.hazards:
|
||||
if hazard.kind != "wreck":
|
||||
continue
|
||||
if math.hypot(hazard.x_nm - tgt.x, hazard.y_nm - tgt.y) > 0.5:
|
||||
continue
|
||||
if equation.echo_merges_with_clutter(
|
||||
target_range, bearing, radial,
|
||||
math.hypot(hazard.x_nm - frigate.x, hazard.y_nm - frigate.y) * 1852.0,
|
||||
math.degrees(math.atan2(hazard.x_nm - frigate.x,
|
||||
-(hazard.y_nm - frigate.y))) % 360.0,
|
||||
self.ping_pulse, beam):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _queue_clutter(self, frigate, world, t_real: float,
|
||||
range_factor: float, mode: str) -> None:
|
||||
"""Wrecks on the seabed return real echoes that no contact owns."""
|
||||
@@ -1828,8 +1853,10 @@ class SonarSystem:
|
||||
if can_hear:
|
||||
tgt.hear_ping()
|
||||
|
||||
# Echo erhalten?
|
||||
if dist < active_range:
|
||||
# Echo erhalten? A stopped boat lying beside a wreck returns an
|
||||
# echo that merges with the wreck's own clutter echo.
|
||||
if dist < active_range and not self._masked_by_wreck(
|
||||
tgt, frigate, world, mode):
|
||||
snapshot = self._measure_ping(
|
||||
frigate, tgt, t_real, dist,
|
||||
self.active_terms(tgt, frigate, world, range_factor,
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
"""Nautical chart symbols for charted wrecks and underwater rocks.
|
||||
|
||||
Charted hazards are public chart information (not hidden truth), drawn in
|
||||
the style of paper charts: a wreck as a hull line with masts, an underwater
|
||||
rock as an asterisk. Depth labels appear once the chart is zoomed in.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pygame
|
||||
|
||||
from src.core.i18n import message
|
||||
from src.ui import layout
|
||||
|
||||
WRECK_COLOR = (150, 180, 200)
|
||||
ROCK_COLOR = (220, 190, 120)
|
||||
LABEL_MIN_SCALE_PX_PER_NM = 12.0
|
||||
SYMBOL_MIN_SCALE_PX_PER_NM = 0.8
|
||||
|
||||
|
||||
def draw_symbol(surface, kind: str, px: float, py: float) -> None:
|
||||
x, y = int(px), int(py)
|
||||
if kind == "wreck":
|
||||
pygame.draw.line(surface, WRECK_COLOR, (x - 8, y), (x + 8, y), 2)
|
||||
for dx in (-4, 0, 4):
|
||||
pygame.draw.line(surface, WRECK_COLOR, (x + dx, y - 5), (x + dx, y + 5), 1)
|
||||
else:
|
||||
pygame.draw.line(surface, ROCK_COLOR, (x - 5, y), (x + 5, y), 2)
|
||||
pygame.draw.line(surface, ROCK_COLOR, (x, y - 5), (x, y + 5), 2)
|
||||
pygame.draw.line(surface, ROCK_COLOR, (x - 4, y - 4), (x + 4, y + 4), 1)
|
||||
pygame.draw.line(surface, ROCK_COLOR, (x - 4, y + 4), (x + 4, y - 4), 1)
|
||||
|
||||
|
||||
def draw_hazards(surface, hazards, to_screen, rect, scale_px_per_nm: float) -> None:
|
||||
"""Draw every charted hazard inside ``rect`` (screen/layer coordinates).
|
||||
|
||||
``to_screen(x_nm, y_nm)`` maps world to the target surface; hazards are
|
||||
culled by bounds before drawing (at most 64 per world)."""
|
||||
if scale_px_per_nm < SYMBOL_MIN_SCALE_PX_PER_NM:
|
||||
return
|
||||
left, top, width, height = rect
|
||||
labels = scale_px_per_nm >= LABEL_MIN_SCALE_PX_PER_NM
|
||||
for hazard in hazards:
|
||||
px, py = to_screen(hazard.x_nm, hazard.y_nm)
|
||||
if not (left - 8 <= px <= left + width + 8 and top - 8 <= py <= top + height + 8):
|
||||
continue
|
||||
draw_symbol(surface, hazard.kind, px, py)
|
||||
if labels:
|
||||
layout.blit_line(
|
||||
surface, message("chart.hazard_depth", depth=f"{hazard.top_depth_m:.0f}"),
|
||||
(int(px) + 12, int(py) - 9, 80, 18),
|
||||
WRECK_COLOR if hazard.kind == "wreck" else ROCK_COLOR, size=14)
|
||||
|
||||
|
||||
def hazard_at(hazards, to_screen, pos, radius_px: float = 10.0):
|
||||
"""Charted hazard under the cursor, for chart tooltips."""
|
||||
best = None
|
||||
for hazard in hazards:
|
||||
px, py = to_screen(hazard.x_nm, hazard.y_nm)
|
||||
distance = ((px - pos[0]) ** 2 + (py - pos[1]) ** 2) ** 0.5
|
||||
if distance <= radius_px and (best is None or distance < best[0]):
|
||||
best = (distance, hazard)
|
||||
return None if best is None else best[1]
|
||||
|
||||
|
||||
def hazard_tooltip(hazard):
|
||||
"""Tooltip lines for a charted hazard."""
|
||||
if hazard.kind == "wreck":
|
||||
return layout.tooltip_payload(
|
||||
"chart.wreck_title",
|
||||
message("chart.wreck_detail", depth=f"{hazard.top_depth_m:.0f}",
|
||||
length=f"{hazard.length_m:.0f}"),
|
||||
"chart.hazard_note",
|
||||
target_id=f"chart:wreck:{hazard.x_nm:.3f}:{hazard.y_nm:.3f}")
|
||||
return layout.tooltip_payload(
|
||||
"chart.rock_title",
|
||||
message("chart.rock_detail", depth=f"{hazard.top_depth_m:.0f}"),
|
||||
"chart.hazard_note",
|
||||
target_id=f"chart:rock:{hazard.x_nm:.3f}:{hazard.y_nm:.3f}")
|
||||
|
||||
|
||||
__all__ = ["draw_hazards", "draw_symbol", "hazard_at", "hazard_tooltip",
|
||||
"WRECK_COLOR", "ROCK_COLOR"]
|
||||
+10
-1
@@ -11,7 +11,7 @@ import pygame
|
||||
|
||||
from src.core import config
|
||||
from src.core.i18n import display_value, localized, localize, message as structured_message
|
||||
from src.ui import layout
|
||||
from src.ui import chart_symbols, layout
|
||||
from src.ui import nato_symbols
|
||||
from src.ui import observations
|
||||
|
||||
@@ -191,6 +191,11 @@ def map_hit_target(game, pos):
|
||||
if observations.position_age(contact, game.sim_t) is not None else None,
|
||||
*chart_lines,
|
||||
target_id=f"map:sonar:{contact.id}")
|
||||
hazards = getattr(game.world, "charted_hazards", None)
|
||||
hazard = (chart_symbols.hazard_at(hazards(), view.world_to_screen, pos)
|
||||
if hazards is not None else None)
|
||||
if hazard is not None:
|
||||
return chart_symbols.hazard_tooltip(hazard)
|
||||
return layout.tooltip_payload("map.position", coordinate, terrain,
|
||||
"tooltip.chart_empty",
|
||||
target_id=f"chart:{x_nm:.1f}:{y_nm:.1f}")
|
||||
@@ -328,6 +333,10 @@ def draw_map_view(game, tr=None) -> None:
|
||||
pygame.draw.rect(s, col, (int(px) - 4, int(py) - 4, 8, 8), 2)
|
||||
s.blit(game.font.render(base["name"], True, config.COLOR_TEXT_DIM),
|
||||
(int(px) + 7, int(py) - 8))
|
||||
# Charted wrecks and underwater rocks (public chart information).
|
||||
hazards = getattr(w, "charted_hazards", None)
|
||||
if hazards is not None:
|
||||
chart_symbols.draw_hazards(s, hazards(), view.world_to_screen, r, view.scale)
|
||||
|
||||
tracks = game.radar_tracks()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ from src.ship.damage import COMPARTMENTS
|
||||
from src.ship.ship import Ship
|
||||
from src.sensors.esm import animated_signal_fingerprint, spectrum_band
|
||||
from src.ui import layout
|
||||
from src.ui import chart_symbols
|
||||
from src.ui import nato_symbols
|
||||
from src.ui import observations
|
||||
|
||||
@@ -1396,6 +1397,13 @@ def _opz_basemap_surface(game, map_rect: pygame.Rect, view) -> pygame.Surface:
|
||||
else config.COLOR_FLIGHT)
|
||||
pygame.draw.rect(layer, color, (px - 3, py - 3, 7, 7), 1)
|
||||
|
||||
hazards = getattr(world, "charted_hazards", None)
|
||||
if hazards is not None:
|
||||
chart_symbols.draw_hazards(
|
||||
layer, hazards(),
|
||||
lambda x, y: (center_x + (x - bucket_x) * scale, center_y + (y - bucket_y) * scale),
|
||||
(0, 0, map_rect.w, map_rect.h), scale)
|
||||
|
||||
world_left = int(center_x - bucket_x * scale)
|
||||
world_top = int(center_y - bucket_y * scale)
|
||||
world_size_px = int(world_size_nm * scale)
|
||||
|
||||
+23
-12
@@ -71,6 +71,7 @@ SEDIMENT_ORDER = ("rock", "gravel", "sand", "silt", "mud")
|
||||
# --- hazards -----------------------------------------------------------------
|
||||
MAX_HAZARDS = 64
|
||||
ROCK_RADIUS_NM = 0.08
|
||||
WRECK_MIN_RADIUS_NM = 0.02
|
||||
ROCK_MIN_TOP_M = 15.0
|
||||
|
||||
|
||||
@@ -82,6 +83,14 @@ class Hazard:
|
||||
top_depth_m: float # depth of the highest point below the surface
|
||||
length_m: float
|
||||
|
||||
@property
|
||||
def radius_nm(self) -> float:
|
||||
"""Footprint that raises the seabed: a rock pinnacle, or half the
|
||||
length of a wreck lying on the bottom."""
|
||||
if self.kind == "rock":
|
||||
return ROCK_RADIUS_NM
|
||||
return max(WRECK_MIN_RADIUS_NM, self.length_m / 1852.0 / 2.0)
|
||||
|
||||
|
||||
def mackenzie_sound_speed(temperature_c: float, salinity_psu: float,
|
||||
depth_m: float) -> float:
|
||||
@@ -175,15 +184,14 @@ class OceanEnvironment:
|
||||
detrand.phase(seed, "iw-phase", index)))
|
||||
self._sediment = self._build_sediment(charted_depth)
|
||||
self.hazards = self._build_hazards(charted_depth)
|
||||
# Bucket rocks by 1-NM cell so depth queries stay O(1).
|
||||
self._rock_cells: dict[tuple[int, int], list[Hazard]] = {}
|
||||
# Bucket rocks and wrecks by 1-NM cell so depth queries stay O(1).
|
||||
self._hazard_cells: dict[tuple[int, int], list[Hazard]] = {}
|
||||
for hazard in self.hazards:
|
||||
if hazard.kind == "rock":
|
||||
cell = (int(hazard.x_nm), int(hazard.y_nm))
|
||||
for dx in (-1, 0, 1):
|
||||
for dy in (-1, 0, 1):
|
||||
self._rock_cells.setdefault(
|
||||
(cell[0] + dx, cell[1] + dy), []).append(hazard)
|
||||
cell = (int(hazard.x_nm), int(hazard.y_nm))
|
||||
for dx in (-1, 0, 1):
|
||||
for dy in (-1, 0, 1):
|
||||
self._hazard_cells.setdefault(
|
||||
(cell[0] + dx, cell[1] + dy), []).append(hazard)
|
||||
|
||||
# --- construction -------------------------------------------------------
|
||||
|
||||
@@ -315,11 +323,14 @@ class OceanEnvironment:
|
||||
row = int(round(min(max(y_nm, 0.0), self.size_nm) / step))
|
||||
return self._sediment[min(n - 1, row)][min(n - 1, col)]
|
||||
|
||||
def rock_top_depth_m(self, x_nm: float, y_nm: float) -> float | None:
|
||||
"""Shallowest charted rock top covering this point, if any."""
|
||||
def hazard_top_depth_m(self, x_nm: float, y_nm: float) -> float | None:
|
||||
"""Shallowest charted rock or wreck top covering this point, if any.
|
||||
|
||||
Both are physical obstacles: they raise the seabed within their
|
||||
footprint for grounding, submarines and weapons."""
|
||||
best = None
|
||||
for hazard in self._rock_cells.get((int(x_nm), int(y_nm)), ()):
|
||||
if math.hypot(hazard.x_nm - x_nm, hazard.y_nm - y_nm) <= ROCK_RADIUS_NM:
|
||||
for hazard in self._hazard_cells.get((int(x_nm), int(y_nm)), ()):
|
||||
if math.hypot(hazard.x_nm - x_nm, hazard.y_nm - y_nm) <= hazard.radius_nm:
|
||||
if best is None or hazard.top_depth_m < best:
|
||||
best = hazard.top_depth_m
|
||||
return best
|
||||
|
||||
+7
-3
@@ -202,9 +202,9 @@ class World:
|
||||
if charted <= 0.0:
|
||||
return charted
|
||||
depth = charted + self.ocean.tide_m(x_nm, y_nm, charted)
|
||||
rock = self.ocean.rock_top_depth_m(x_nm, y_nm)
|
||||
if rock is not None:
|
||||
depth = min(depth, rock)
|
||||
hazard = self.ocean.hazard_top_depth_m(x_nm, y_nm)
|
||||
if hazard is not None:
|
||||
depth = min(depth, hazard)
|
||||
return max(0.0, depth)
|
||||
|
||||
def tide_m(self, x_nm: float, y_nm: float) -> float:
|
||||
@@ -264,6 +264,10 @@ class World:
|
||||
depth_m, self.thermocline_depth_m(x_nm, y_nm), self.hour,
|
||||
weather["rain_intensity"], weather["wind_speed_kn"])
|
||||
|
||||
def charted_hazards(self) -> tuple:
|
||||
"""Charted wrecks and rocks (public chart information)."""
|
||||
return self.ocean.hazards
|
||||
|
||||
def seabed_at(self, x_nm: float, y_nm: float) -> str:
|
||||
return self.ocean.sediment_at(x_nm, y_nm)
|
||||
|
||||
|
||||
@@ -318,9 +318,14 @@ def test_opz_track_id_change_is_shared_by_every_station_projection(published):
|
||||
def test_known_chart_geography_is_bounded_detached_and_host_authored(published):
|
||||
game, _, server = published
|
||||
geography = server.v2_charts["bridge"]["geography"]
|
||||
assert set(geography) == {"labels", "airbases", "depths"}
|
||||
assert set(geography) == {"labels", "airbases", "depths", "hazards"}
|
||||
assert len(geography["labels"]) <= 128 and len(geography["airbases"]) <= 128
|
||||
assert len(geography["depths"]) <= 64
|
||||
# Charted wrecks and rocks are published as chart content.
|
||||
assert len(geography["hazards"]) == min(64, len(game.world.charted_hazards()))
|
||||
for row, hazard in zip(geography["hazards"], game.world.charted_hazards()):
|
||||
assert row == dict(kind=hazard.kind, x=hazard.x_nm, y=hazard.y_nm,
|
||||
top_depth_m=hazard.top_depth_m, length_m=hazard.length_m)
|
||||
for row in geography["airbases"]:
|
||||
assert any((row["name"], row["x"], row["y"]) ==
|
||||
(base["name"], base["x"], base["y"])
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
"""Charted wrecks: chart symbols, seabed obstacle, submarine hiding, echo merging."""
|
||||
|
||||
import copy
|
||||
import json
|
||||
import math
|
||||
|
||||
import pygame
|
||||
import pytest
|
||||
|
||||
from src.core import config
|
||||
from src.core.game import Game
|
||||
from src.enemies import sub as sub_module
|
||||
from src.sonar import equation
|
||||
from src.ui import chart_symbols
|
||||
from src.ui.map_view import map_hit_target
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def game():
|
||||
current = Game(seed=4242, start_menu=False, audio_enabled=False, language="en")
|
||||
yield current
|
||||
current.audio.shutdown()
|
||||
|
||||
|
||||
def _wreck(game, deep=False):
|
||||
for hazard in game.world.charted_hazards():
|
||||
if hazard.kind != "wreck":
|
||||
continue
|
||||
if not deep or game.world.charted_depth_m(hazard.x_nm, hazard.y_nm) > 80.0:
|
||||
return hazard
|
||||
pytest.skip("no suitable wreck in this world")
|
||||
|
||||
|
||||
def test_wrecks_raise_the_seabed_only_within_their_footprint(game):
|
||||
wreck = _wreck(game)
|
||||
world = game.world
|
||||
on = world.depth_m(wreck.x_nm, wreck.y_nm)
|
||||
assert on <= wreck.top_depth_m + 1e-9
|
||||
# The chart datum is the plain bathymetry; the wreck is a charted symbol.
|
||||
assert world.charted_depth_m(wreck.x_nm, wreck.y_nm) > wreck.top_depth_m
|
||||
beside = world.depth_m(wreck.x_nm + wreck.radius_nm + 0.05, wreck.y_nm)
|
||||
assert beside > on
|
||||
|
||||
|
||||
def test_chart_tooltip_describes_a_charted_wreck(game):
|
||||
wreck = _wreck(game)
|
||||
game.station = config_station = game.station
|
||||
view = game.map_view
|
||||
view.cx, view.cy = wreck.x_nm, wreck.y_nm
|
||||
view.scale = 40.0
|
||||
from src.ui import layout
|
||||
layout.configure_for(game)
|
||||
shown = copy.copy(view)
|
||||
shown.set_rect(config.MAP_RECT)
|
||||
pos = shown.world_to_screen(wreck.x_nm, wreck.y_nm)
|
||||
payload = map_hit_target(game, (int(pos[0]), int(pos[1])))
|
||||
assert payload is not None
|
||||
assert "wreck" in json.dumps(payload).lower() or payload.get("target_id", "").startswith("chart:wreck")
|
||||
assert chart_symbols.hazard_at([wreck], shown.world_to_screen, pos) is wreck
|
||||
del config_station
|
||||
|
||||
|
||||
def test_hazard_symbols_are_drawn_on_the_bridge_chart(game):
|
||||
wreck = _wreck(game)
|
||||
game.map_view.cx, game.map_view.cy = wreck.x_nm, wreck.y_nm
|
||||
game.map_view.scale = 20.0
|
||||
game.draw()
|
||||
shown = copy.copy(game.map_view)
|
||||
shown.set_rect(config.MAP_RECT)
|
||||
px, py = shown.world_to_screen(wreck.x_nm, wreck.y_nm)
|
||||
colours = {tuple(game.screen.get_at((int(px) + dx, int(py)))[:3]) for dx in range(-5, 6)}
|
||||
assert chart_symbols.WRECK_COLOR in colours
|
||||
|
||||
|
||||
def _hiding_sub(game):
|
||||
"""Put the first boat 1 NM from the first wreck it can lie beside."""
|
||||
sub = game.subs[0]
|
||||
for wreck in game.world.charted_hazards():
|
||||
if wreck.kind != "wreck":
|
||||
continue
|
||||
for dx, dy in ((1.0, 0.0), (-1.0, 0.0), (0.0, 1.0), (0.0, -1.0)):
|
||||
x, y = wreck.x_nm + dx, wreck.y_nm + dy
|
||||
if game.world.depth_m(x, y) < 60.0 or game.world.on_land(x, y):
|
||||
continue
|
||||
sub.x, sub.y = x, y
|
||||
sub.depth = sub.target_depth = 30.0
|
||||
spot = sub.wreck_hiding_spot(game.world)
|
||||
if spot is not None and spot[0] is wreck:
|
||||
sub.state = "WRACK"
|
||||
sub.evac_left = 3000.0
|
||||
return sub, spot
|
||||
pytest.skip("no reachable wreck berth in this world")
|
||||
|
||||
|
||||
def test_submarine_settles_on_the_bottom_beside_a_wreck_and_stays_put(game):
|
||||
sub, (_wreck_hazard, bx, by, bottom) = _hiding_sub(game)
|
||||
for _ in range(4000):
|
||||
sub.update(1.0, None, game.world)
|
||||
if sub.bottomed and sub.depth >= bottom - sub_module.SUB_BOTTOM_CLEARANCE_M - 1.0:
|
||||
break
|
||||
assert sub.bottomed
|
||||
assert math.hypot(sub.x - bx, sub.y - by) < 0.05
|
||||
assert sub.depth == pytest.approx(bottom - sub_module.SUB_BOTTOM_CLEARANCE_M, abs=1.5)
|
||||
x, y = sub.x, sub.y
|
||||
for _ in range(120):
|
||||
sub.update(1.0, None, game.world)
|
||||
# Lying on the seabed: no way, no drift with the current.
|
||||
assert (sub.x, sub.y) == (x, y) and sub.speed == 0.0
|
||||
assert sub.quiet_factor() >= 0.97
|
||||
|
||||
|
||||
def test_hide_ends_and_the_boat_patrols_again(game):
|
||||
sub, _spot = _hiding_sub(game)
|
||||
sub.evac_left = 5.0
|
||||
for _ in range(10):
|
||||
sub.update(1.0, None, game.world)
|
||||
assert sub.state == "PATROLLE" and not sub.bottomed
|
||||
|
||||
|
||||
def test_evading_boat_near_the_frigate_prefers_a_wreck(game):
|
||||
sub, _spot = _hiding_sub(game)
|
||||
sub.state = "EVADE"
|
||||
sub.evac_left = 0.5
|
||||
sub.memory["contact"] = dict(x=sub.x + 2.0, y=sub.y, course=0.0, speed=10.0, noise=0.5)
|
||||
sub.memory["contact_bearing"] = 90.0
|
||||
sub.memory["contact_age"] = 0.0
|
||||
sub.update(1.0, None, game.world)
|
||||
assert sub.state == "WRACK"
|
||||
|
||||
|
||||
def test_bottomed_state_survives_save_and_load(game):
|
||||
sub, (_hazard, bx, by, bottom) = _hiding_sub(game)
|
||||
for _ in range(4000):
|
||||
sub.update(1.0, None, game.world)
|
||||
if sub.bottomed and sub.depth >= bottom - sub_module.SUB_BOTTOM_CLEARANCE_M - 1.0:
|
||||
break
|
||||
state = json.loads(json.dumps(game.save_state()))
|
||||
restored = Game(seed=1, start_menu=False, audio_enabled=False, language="en")
|
||||
try:
|
||||
assert restored._load_save_data(copy.deepcopy(state))
|
||||
twin = next(item for item in restored.subs if item.id == sub.id)
|
||||
assert twin.state == "WRACK" and twin.bottomed
|
||||
x, y = twin.x, twin.y
|
||||
twin.update(1.0, None, restored.world)
|
||||
assert (twin.x, twin.y) == (x, y)
|
||||
finally:
|
||||
restored.audio.shutdown()
|
||||
|
||||
|
||||
def test_resolution_decides_whether_an_echo_merges_with_a_wreck():
|
||||
assert equation.range_resolution_m("CW") == pytest.approx(750.0)
|
||||
assert equation.range_resolution_m("LFM") == pytest.approx(7.5)
|
||||
# 60 m apart in range, same beam, no Doppler: CW merges, LFM separates.
|
||||
assert equation.echo_merges_with_clutter(9260.0, 90.0, 0.0, 9200.0, 90.2, "CW")
|
||||
assert not equation.echo_merges_with_clutter(9260.0, 90.0, 0.0, 9200.0, 90.2, "LFM")
|
||||
# A moving boat has Doppler; a different beam separates too.
|
||||
assert not equation.echo_merges_with_clutter(9260.0, 90.0, 3.0, 9200.0, 90.2, "CW")
|
||||
assert not equation.echo_merges_with_clutter(9260.0, 90.0, 0.0, 9200.0, 110.0, "CW")
|
||||
|
||||
|
||||
def test_sonar_masks_a_bottomed_boat_beside_a_wreck_for_cw_only(game):
|
||||
sub, (hazard, bx, by, _bottom) = _hiding_sub(game)
|
||||
sub.x, sub.y, sub.speed, sub.speed_order = bx, by, 0.0, 0.0
|
||||
# Frigate on the line wreck -> berth, so the boat is offset in range.
|
||||
dx, dy = bx - hazard.x_nm, by - hazard.y_nm
|
||||
norm = math.hypot(dx, dy)
|
||||
game.ship.x = hazard.x_nm - dx / norm * 4.0
|
||||
game.ship.y = hazard.y_nm - dy / norm * 4.0
|
||||
sonar = game.sonar
|
||||
sonar.ping_pulse = "CW"
|
||||
assert sonar._masked_by_wreck(sub, game.ship, game.world, "BOW")
|
||||
sonar.ping_pulse = "LFM"
|
||||
assert not sonar._masked_by_wreck(sub, game.ship, game.world, "BOW")
|
||||
sonar.ping_pulse = "CW"
|
||||
sub.speed = 5.0
|
||||
assert not sonar._masked_by_wreck(sub, game.ship, game.world, "BOW")
|
||||
Reference in new issue
Block a user