From 5100daa29772f9efa9d6cb01ed5c64e02ccdbb95 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 7 Oct 2026 00:48:14 +0200 Subject: [PATCH] FireControl: one PDeviation shape for the deviation price DeviationProbability's inline saturate becomes PDeviation(deviation, tolerance), defined for a zero tolerance as well. No behaviour change for a positive tolerance. Delete-first step of the evasion term: every later deviation-like price reads this one shape. Co-Authored-By: Claude Opus 5.5 --- Assets/Scripts/ServerShared/FireControl.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/ServerShared/FireControl.cs b/Assets/Scripts/ServerShared/FireControl.cs index 04e960d33..632cc9f8c 100644 --- a/Assets/Scripts/ServerShared/FireControl.cs +++ b/Assets/Scripts/ServerShared/FireControl.cs @@ -422,12 +422,17 @@ public static class FireControl return new Interval { Lo = centre - h, Hi = centre + h }; } + // The one deviation shape: the share of a shot that survives `deviation` metres of miss against a shooter that + // forgives `tolerance` metres. Every deviation-like price (flight, evasion, a missile's miss) goes through it. + public static float PDeviation(float deviation, float tolerance) => + tolerance <= 0f ? (deviation <= 0f ? 1f : 0f) : saturate(1f - deviation / tolerance); + public static float DeviationProbability(PendingShot shot, float now, out float deviation) { var elapsed = now - shot.FireTime; var predicted = shot.FireTargetPosition + shot.FireTargetVelocity * elapsed; deviation = shot.Target == null ? 0f : length((shot.Target.Position - predicted).xz); - return shot.Target == null ? 1f : saturate(1f - deviation / shot.Tracking); + return shot.Target == null ? 1f : PDeviation(deviation, shot.Tracking); } // The one decision about what a round does, made from the shooter's state and a target and nothing else: