Ballistic flight r3: DrawAhead draws a round from the sim's facts, a hit ends at its impact cell; FireControl draws nothing
FireControl.RoundEnd and RoundAt leave FireControl (RoundEnd to DrawAhead verbatim, RoundAt as DrawAhead's private Line); DrawAhead.Round takes the published outcome, steers a hit or burst from its frozen line at the commit tick onto its end (burst point, else the impact cell on the target's drawn pose), and RoundStop is deleted. Projectile caches the last published ShotOutcome and calls DrawAhead only. BallisticFlightTests move to the new signatures; the frozen-line moving-target test is replaced by impact-cell, steer and no-drawing-function tests. Unverified: not yet built or run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d98818ea0c
commit
2dcb7b2078
5 changed files with 288 additions and 146 deletions
|
|
@ -514,26 +514,6 @@ public static class FireControl
|
|||
return shot.Target == null ? 1f : PDeviation(deviation, shot.Tracking);
|
||||
}
|
||||
|
||||
// The sim time a ballistic round's drawn flight ends, for what is known of its outcome: the one statement of a round's
|
||||
// end. A round that hit or burst (or whose outcome is not yet published) ends at its ArrivalTime. A round the sim has
|
||||
// published as a Miss flies on to the weapon's frozen range and never ends short of its own arrival (a direct round's
|
||||
// FireRange is measured to any target, in range or not). Pure: it reads the shot alone, and the simulation's own
|
||||
// arithmetic (Step, Commit, Apply) does not call it. Presenters end rounds here, through DrawAhead.
|
||||
public static float RoundEnd(in PendingShot shot, ShotResult? known) =>
|
||||
known == ShotResult.Miss
|
||||
? max(shot.ArrivalTime, shot.FireTime + (shot.Speed > .01f ? shot.MaxRange / shot.Speed : 0f))
|
||||
: shot.ArrivalTime;
|
||||
|
||||
// Where a ballistic round is at a sim time: the one statement of the round's line, from its frozen origin along its
|
||||
// frozen direction at its frozen speed, held at RoundEnd once it has flown that far. With no outcome known the round is
|
||||
// drawn no further than its arrival point and waits there for the sim to publish one. Pure, like RoundEnd.
|
||||
public static float2 RoundAt(in PendingShot shot, ShotResult? known, float time)
|
||||
{
|
||||
if (shot.Speed <= .01f) return shot.FireOrigin.xz;
|
||||
var flown = clamp(time - shot.FireTime, 0f, RoundEnd(shot, known) - shot.FireTime);
|
||||
return shot.FireOrigin.xz + shot.TravelDirection * (shot.Speed * flown);
|
||||
}
|
||||
|
||||
// How far a target can and does move off the line of fire in the solution window: the term DeviationProbability
|
||||
// and HitProbability both add. Behaviour (its observed unpredictability across the line of sight) realises the
|
||||
// evasion and capability (its envelope's reach) caps it, so a coasting ship evades nothing whatever it could do
|
||||
|
|
@ -2023,9 +2003,9 @@ public struct PendingShot
|
|||
public float3 FireTargetPosition;
|
||||
public float3 FireTargetVelocity;
|
||||
public float FireTime;
|
||||
// The weapon's Velocity at Fire: frozen with the rest, so RoundAt states the same line whatever happens to the stat later.
|
||||
// The weapon's Velocity at Fire, frozen with the rest so a presenter draws the same line whatever happens to the stat later.
|
||||
public float Speed;
|
||||
// The weapon's Range at Fire, likewise frozen: how far a round that misses flies on, read only by RoundEnd. FireRange above
|
||||
// The weapon's Range at Fire, likewise frozen: how far a presenter may draw a round that misses. FireRange above
|
||||
// is the distance to the engaged target (0 for a round with none), not how far a round that misses flies on.
|
||||
public float MaxRange;
|
||||
public float CommitTime;
|
||||
|
|
|
|||
Loading…
Reference in a new issue