🚢 Submarine & Crew Setup
AC-b Trident: Colonial submarine with two fixed forward Moray torpedo tubes, 80-degree firing arc (40 degrees left/right of bow). Crew of 8: driver, diving officer, 3 ballast operators, 2 torpedo gunners, secondary gunner, periscope operator, sensor operator.
Periscope depth limit: The periscope cannot detect surface ships when the submarine is below 10 meters. The sub is invisible to surface observers and map intel below 6.75 meters. Crush depth starts at 25 meters (Trident) / 20 meters (Nakki). In combat, the torpedo gunner's 150m underwater view is your primary sensor.
Best accuracy: Stop or slow to minimum before firing. Sub movement is inherited by the torpedo and changes the lead angle.
🧮 Sub Movement Math
The calculator now models your submarine's forward speed (0–4 m/s, set in Step 0). The torpedo inherits the sub's velocity at launch:
Torpedo world position at time t:
y = (subSpeed * t) + torpDistanceAt(t) * cos(lead)
x = torpDistanceAt(t) * sin(lead)
Intercept equation:
torpDistanceAt(t) = hypot(target_x, target_y - subSpeed * t)
Moving forward reduces time-of-flight against closing targets and can make stern chases catchable that would be impossible from a dead stop. Faster sub speed slightly penalizes hit probability above 2 m/s.
Submerged speeds (wiki-verified): Trident surfaced 6.28 m/s, submerged ~4 m/s (7.8 knots). Nakki submerged 4.48 m/s (8.7 knots). The Step 0 slider caps at 4 m/s reflecting realistic submerged combat speeds.
🧑✈ Crew Inputs
| Field | Who gives it | Source |
| Sub Speed | Commander | Your sub's forward speed, 0–4 m/s. Inherited by torpedo |
| Range | Torpedo gunner (or sonar relay) | 150m underwater view. Toggle Sonar Relay in Step 1 to convert sonar operator readings to gunner coordinates |
| Target Speed | Crew estimate | No direct readout. Use repeated gunner/sonar calls |
| AOB | Crew estimate | Angle on bow: 0=head-on, 90=crossing, 180=away |
| Crossing side | Gunner | Left-to-right = right lead, right-to-left = left lead |
| Depth | Torpedo gunner | Moray depth 0–50m. 0m = surface ships |
🏃 Target Speed Reference
All speeds in m/s, from Foxhole wiki Movement Speed table:
| Target type | Speed |
| Stopped / anchored | 0 m/s |
| Base Ship (Longhook) | 3.5 m/s |
| Resource Ship (Bowhead) | 4.5 m/s |
| Submerged sub (Trident ~4 / Nakki 4.5) | 4–4.5 m/s |
| Battleship (Titan 5.7 / Callahan 5.4) | 5.4–5.7 m/s |
| Barge / Mine Boat | 5.5 m/s |
| Destroyer (Conqueror 6.2) | 6.2 m/s |
| Freighter (Ironship) | 6.2 m/s |
| Landing Ship | 6.3 m/s |
| Surfaced sub (Trident / Nakki) | 6.3 m/s |
| Light Frigate (Blacksteele) | 6.4 m/s |
| Gunship (Strider) | 6.4 m/s |
| Motorboat | 8.0 m/s |
| Gunboat (Charon / Ronan) | 8.2 m/s |
| Infantry Boat (Sombre 9.1) | 7.3–9.1 m/s |
If unsure, use 5–6 m/s for most surface contacts. Submerged targets rarely exceed 4 m/s.
📐 Solution Math
1 — Torpedo Time of Flight
Moray torpedo: accelerates 4.2s over 40m, then cruises at 24 m/s.
d <= 40m: TOF = 4.2 * (d / 40)
d > 40m: TOF = 4.2 + (d - 40) / 24
Example range 90m: TOF = 4.2 + 50/24 = 6.3s
2 — Target Motion
Lateral = speed * sin(AOB) * side (side: +1 right, -1 left)
Axial = -speed * cos(AOB)
0 deg: closes toward sub 90 deg: crosses
180 deg: runs away
3 — Intercept & Sub Movement
Binary search solves where torpedo meets target, accounting for sub forward speed:
miss(t) = hypot(target_x, target_y - subSpeed*t) - torpDistanceAt(t)
Solve miss(t) = 0 with 36-iteration binary search
Lead = atan2(aimX, aimY - subSpeed * tof)
Positive = right Negative = left
If the target outruns the torpedo within the 150m max run, the binary search fails and interceptPossible = false. The hit bar shows "TARGET OUTRUNNING TORPEDO".
4 — Fuse Distance
Fuse is the torpedo's traveled distance, rounded up to the nearest 10m. The Moray accepts 30–150m in 10m steps. Detonates on contact or at set distance.
Fuse = ceil(torpDistanceAt(tof), 10m) [30–150m]
Example: run = 87m → Fuse = 90m
run = 101m → Fuse = 110m
📡 Sonar Relay Mode
The sonar operator and torpedo gunner sit at different positions on the Trident submarine. They observe different range and azimuth readings for the same target — a parallax effect caused by the offset between crew seats.
Toggle Step 1 to "Sonar Relay" mode to input the sonar operator's readings. The calculator converts them to the torpedo gunner's perspective using a coordinate transform:
Sonar reports: range Rs, azimuth θs
Offset: d = distance between sonar station and torpedo tubes
Gunner range: Rg = hypot(Rs · sin θs, Rs · cos θs − d)
Gunner azimuth: θg = atan2(Rs · sin θs, Rs · cos θs − d)
Default offset: 15 m (sonar station ahead of torpedo tubes on the Trident). This value can be calibrated by aiming at the same stationary target from both seats and comparing readings.
The converted gunner range feeds into the firing solution (TOF, fuse, lead). The converted azimuth tells the gunner where to look — the target is not always directly ahead from the gunner's perspective.
All other inputs (target speed, AOB, depth, sub speed) remain unchanged. Only the range and azimuth are corrected for the seat offset.
🧭 AOB Reference
| AOB | Meaning | Lead | Hit |
| 0 deg | Head-on, coming straight at you | Zero side lead | Good if in range |
| 45 deg | Closing & crossing | Moderate side lead | Usually strong |
| 90 deg | Pure crossing | Largest side lead | Depends on speed |
| 135 deg | Opening, crossing away | Longer run distance | OK if under 150m |
| 150+ deg | Almost stern, opening fast | Small lead, very long run | Warning + penalty (AOB > 150 deg) |
| 180 deg | Fully running away | No side lead | Only if sub catches it |
📡 Sonar / Tactical Plot
The live tactical plot is rendered on a <canvas> element at ~60 FPS via requestAnimationFrame. It visualises the firing solution in real time:
Sweep radar: A 55-degree green glow rotates continuously (0.7 deg/frame), simulating an active sonar cone.
Range rings: Concentric circles at 30, 60, 90, 120, and 150 m, scaled to the canvas. The current fuse distance ring is highlighted in orange with a dashed style. A red detonation ring is also drawn at the fuse distance.
Target ship: Positioned by converting game-world coordinates (x, y) to screen space with centre at the submarine. The ship rotates to match its heading from target velocity. A dotted track line with an arrowhead shows the target's projected course, scaled by speed and TOF.
Torpedo path: A red gradient line from the submarine to the predicted impact point, with an arrowhead. A lead angle arc is drawn from straight-ahead (north) to the lead angle, labelled with degrees, using side-appropriate rotation (right = clockwise, left = counter-clockwise).
Impact zone: An orange circle at the intercept point, sized to the Moray's 6.5 m explosion radius scaled to the canvas.
Depth side-view inset: When target depth > 0 m, a small inset box appears in the bottom-left corner showing a waterline, depth fill, and a red bar at the target depth position (0–50 m scale).
Submarine icon: Top-down view matching the Step 0 diagram — ellipse hull with green stroke, sail, curved bow tip, and two torpedo tubes in brass. Identical tubes confirm no ballistics difference.
Live stats bar: Below the canvas, a 5-column grid shows the current fuse distance, lead angle, time of flight, depth, and hit probability — colour-coded as danger (red), warn (amber), or good (green).
The canvas auto-scales to its container and adapts layout for wide (landscape) vs. narrow (portrait) viewports, positioning the submarine centre slightly lower on wider displays.
🎯 Hit Estimate
Base: 96%
Penalties: lead beyond 8 deg (1.7x), run beyond 110m (0.45x),
target speed (0.65x), sub speed above 2 m/s (2x),
AOB above 150 deg (progressive 0.8x + speed 1.2x)
Hard fails: outside 80 deg arc, beyond 150m run,
intercept impossible (target outrunning)
Range: 2% – 97%
Hit % is a geometry estimate only. Real factors like target turns, crew delay, bad speed estimates, and depth errors are not modeled. Use as a crew decision aid.
💥 Fire Simulation
Pressing FIRE takes a snapshot of the current state (range, speed, AOB, side, depth, sub speed) and runs the fire sequence:
1 — Solution Lock
The calculator computes the firing solution from the snapshot. The result is fixed — changing inputs mid-simulation does not affect the in-flight torpedo.
2 — Visual Effects
A full-screen red flash overlay and a centred "TORPEDO AWAY" text animate with a fade-out over 1.4 seconds via CSS keyframes.
3 — Torpedo Travel
The sonar canvas renders the torpedo in flight: a coloured dot (green for predicted hit, red for predicted miss) moves along the lead-angle path at world-scale speed. Three trailing dots behind it fade with distance. An expanding explosion ring appears at the impact point when the torpedo reaches ~98% of its travel.
4 — Hit / Miss Determination
The result is deterministic — no random dice roll. A shot hits if and only if the geometry is physically feasible:
willHit = canHit AND depthOk
canHit = inArc (80 deg tube arc)
AND inRange (within 150 m run)
AND fuse long enough
AND intercept possible (target not outrunning torpedo)
depthOk = |depthError| <= 3 m
The hit estimate % (from the Hit Estimate section) is displayed as a reference but does not control the outcome — it rates how difficult the geometric solution is. A 45% shot will always hit if the geometry lines up; a 97% shot will always miss if the target is out of arc.
5 — Result Display & Commander Notes
After the travel duration (min 1.8s, max 6.2s, proportional to TOF × 430ms), the sonar overlay label updates to show HIT or MISS with the detail. The label pulses three times via CSS animation.
The sonar overlay label (top-left of the tactical plot canvas) updates with the result and compact commander notes. On HIT it lists factors overcome (high speed, running away, long run, sub assist); on MISS it shows the geometric reason and corrective actions (close distance, turn sub, reposition, slow before firing). On any control adjustment the label resets to "TACTICAL PLOT / LIVE".
Adjusting any control clears the result and resets the sonar label. The notes are for the commander to review and decide the next action.
📋 Moray / Trident Stats
| Parameter | Value |
| Acceleration | 4.2s to 24 m/s over 40m |
| Cruise speed | 24 m/s |
| Max fuse range | 150m (~8.8s runtime) |
| Min fuse range | 30m |
| Fuse steps | 10m (30, 40, 50... 150) |
| Depth setting | 0–50m (gunner scroll wheel) |
| Warhead | 3,512 HE damage |
| Explosion radius | 6.5m full, fade to 7.5m |
| Detonation | On contact + at fuse distance |
| Tube arc | 80 degrees fixed forward |
| Tube reload | 13 seconds |
| Periscope depth | Surface only; blind below 10m |
| Invisibility depth | Below 6.75m (map intel + visual) |
| Crush depth | 25m (Trident) / 20m (Nakki) |