Fix all 7 Cut 5d Soul findings: GL3 Sion perf >=57fps, PVS death gating, crater dedupe, hit-marker filter, loadout baseline, remote dust yaw/speed, distance-gated death trauma
This commit is contained in:
parent
323c02cf8d
commit
fcb91edb0d
16 changed files with 574 additions and 143 deletions
|
|
@ -278,6 +278,52 @@ public sealed class AudioSynthTests
|
|||
Assert.Contains(events, e => e is ShotFiredEvent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoteArenaSession_UpdatesRemoteContenderSpeedAndYawFromSnapshot()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, port: 0, seed: 42, mapKind: ArenaMapKind.Desert);
|
||||
using var remoteA = new RemoteArenaSession(new IPEndPoint(IPAddress.Loopback, host.BoundPort), "Observer");
|
||||
using var remoteB = new RemoteArenaSession(new IPEndPoint(IPAddress.Loopback, host.BoundPort), "Driver");
|
||||
IClientArenaSession ifaceA = remoteA;
|
||||
IClientArenaSession ifaceB = remoteB;
|
||||
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
for (int t = 0; t < 20 && (!remoteA.IsJoined || !remoteB.IsJoined); t++)
|
||||
{
|
||||
host.StepOnce(nowMs + t * 16);
|
||||
ifaceA.BeginRenderFrame(1.0 / 60.0, 1.0f);
|
||||
ifaceB.BeginRenderFrame(1.0 / 60.0, 1.0f);
|
||||
}
|
||||
Assert.True(remoteA.IsJoined && remoteB.IsJoined);
|
||||
|
||||
int idA = ifaceA.LocalContenderId;
|
||||
int idB = ifaceB.LocalContenderId;
|
||||
var hostA = host.Session.State.Contenders[idA];
|
||||
var hostB = host.Session.State.Contenders[idB];
|
||||
hostB.Grid.SwapChassis(Catalog.Jackal);
|
||||
host.Session.SetContenderPose(idB, hostA.X + 20f, hostA.Z + 20f, 0.75f);
|
||||
|
||||
for (int t = 0; t < 25; t++)
|
||||
{
|
||||
ifaceA.SubmitLocalInput(new PlayerInput(0f, 0f, hostA.X, hostA.Z + 20f, false, false, false), isPhysicsTick: true);
|
||||
ifaceB.SubmitLocalInput(new PlayerInput(1.0f, 0.25f, hostB.X + 30f, hostB.Z + 30f, false, false, false), isPhysicsTick: true);
|
||||
host.StepOnce(nowMs + 350 + t * 16);
|
||||
ifaceA.BeginRenderFrame(1.0 / 60.0, 1.0f);
|
||||
ifaceB.BeginRenderFrame(1.0 / 60.0, 1.0f);
|
||||
}
|
||||
|
||||
Assert.True(ifaceA.IsContenderVisible(idB));
|
||||
var rivalOnA = ifaceA.ViewState.Contenders[idB];
|
||||
float expectedSpeed = MathF.Sqrt(rivalOnA.VelX * rivalOnA.VelX + rivalOnA.VelZ * rivalOnA.VelZ);
|
||||
Assert.True(rivalOnA.Speed > 2.0f, $"Expected remote moving Jackal Speed > 2.0, got {rivalOnA.Speed}");
|
||||
Assert.InRange(MathF.Abs(rivalOnA.Speed - expectedSpeed), 0f, 0.01f);
|
||||
|
||||
var q = Quaternion.Normalize(new Quaternion(rivalOnA.CurrRotX, rivalOnA.CurrRotY, rivalOnA.CurrRotZ, rivalOnA.CurrRotW));
|
||||
var fwd = Vector3.Transform(Vector3.UnitZ, q);
|
||||
float expectedYaw = MathF.Atan2(fwd.X, fwd.Z);
|
||||
Assert.InRange(MathF.Abs(MatchRules.NormalizeAngle(rivalOnA.Yaw - expectedYaw)), 0f, 0.01f);
|
||||
}
|
||||
|
||||
private static void AssertValidPcmBounds(PcmClipData clip, string label)
|
||||
{
|
||||
Assert.True(clip.Samples.Length > 0, $"{label} empty");
|
||||
|
|
|
|||
|
|
@ -114,4 +114,32 @@ public sealed class CameraJuiceTests
|
|||
Assert.Equal(0f, juice.FootstepBumpY);
|
||||
Assert.Equal(0f, juice.FovOffsetDeg);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CameraJuiceState_DeathTrauma_RequiresVisibleAndWithin90m()
|
||||
{
|
||||
var juice = new CameraJuiceState();
|
||||
var localPos = Vector3.Zero;
|
||||
|
||||
// 1. Out-of-PVS (not visible) contender death even nearby -> 0.0f trauma
|
||||
var hiddenDeath = new ISimEvent[]
|
||||
{
|
||||
new ContenderEliminatedEvent { VictimId = 3, KillerId = 1, IsSpectatorKiller = false }
|
||||
};
|
||||
juice.ConsumeEvents(hiddenDeath, localContenderId: 0, localPos, (_, _) => (false, new Vector3(15f, 0f, 0f)));
|
||||
Assert.Equal(0.0f, juice.Trauma);
|
||||
|
||||
// 2. Visible but distant (>= 90m) contender death -> 0.0f trauma
|
||||
juice.ConsumeEvents(hiddenDeath, localContenderId: 0, localPos, (_, _) => (true, new Vector3(120f, 0f, 0f)));
|
||||
Assert.Equal(0.0f, juice.Trauma);
|
||||
|
||||
// 3. No resolver/session -> 0.0f trauma (never global)
|
||||
juice.ConsumeEvents(hiddenDeath, localContenderId: 0, localPos);
|
||||
Assert.Equal(0.0f, juice.Trauma);
|
||||
|
||||
// 4. Nearby visible death (20m) -> positive scaled trauma: 0.14 * (1 - 20 / 90)
|
||||
juice.ConsumeEvents(hiddenDeath, localContenderId: 0, localPos, (_, _) => (true, new Vector3(20f, 0f, 0f)));
|
||||
float expected = 0.14f * (1f - 20f / 90f);
|
||||
Assert.InRange(juice.Trauma, expected - 1e-4f, expected + 1e-4f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue