Cut 13a fix: occupancy-only Sion Box3D tiles, Terrain hit classification, top-96 TerrainRenderer LRU, incremental scar repair, per-map scar ledgers, and crater coalescing parity
This commit is contained in:
parent
e86fee31da
commit
812956bd5a
13 changed files with 751 additions and 105 deletions
|
|
@ -878,6 +878,45 @@ namespace RustToDust.Tests
|
|||
$"Expected _predWorld crater impact Y ({predHit.Point.Y:F3}m) to match server ({hostHit.Point.Y:F3}m)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cut13a_OverlappingCraters_CoalesceIdenticallyAcrossLiveHostJoinerAndPostReset()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, 0, seed: 42, ArenaMapKind.Sion, maxHumans: 12, autoRestartSec: 0);
|
||||
var ep = new IPEndPoint(IPAddress.Loopback, host.BoundPort);
|
||||
|
||||
const float cx = -120f;
|
||||
const float cz = 180f;
|
||||
|
||||
// Stamp 3 overlapping craters within < 0.75m (coalesce radius)
|
||||
((IOrdnanceTargetSink)host.Session).StampTerrainImpact(cx, cz, craterRadius: 4.0f, craterDepth: 1.1f, scorchRadius: 4.5f);
|
||||
((IOrdnanceTargetSink)host.Session).StampTerrainImpact(cx + 0.30f, cz - 0.20f, craterRadius: 5.8f, craterDepth: 2.2f, scorchRadius: 6.0f);
|
||||
((IOrdnanceTargetSink)host.Session).StampTerrainImpact(cx - 0.15f, cz + 0.25f, craterRadius: 3.0f, craterDepth: 0.7f, scorchRadius: 3.5f);
|
||||
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
host.StepOnce(nowMs += 16);
|
||||
|
||||
float liveHostH = host.Session.State.Terrain.SampleHeight(cx, cz);
|
||||
float liveHostEdgeH = host.Session.State.Terrain.SampleHeight(cx + 2.5f, cz - 1.5f);
|
||||
|
||||
using var clientA = new RemoteArenaSession(ep, "Joiner");
|
||||
Assert.True(PumpUntil(host, new[] { clientA }, () => clientA.IsJoined, ref nowMs, 3000));
|
||||
|
||||
float clientJoinH = clientA.ViewState.Terrain.SampleHeight(cx, cz);
|
||||
float clientJoinEdgeH = clientA.ViewState.Terrain.SampleHeight(cx + 2.5f, cz - 1.5f);
|
||||
Assert.True(MathF.Abs(liveHostH - clientJoinH) < 0.001f,
|
||||
$"Expected liveHostH ({liveHostH:F4}) == clientJoinH ({clientJoinH:F4}) within 0.001m");
|
||||
Assert.True(MathF.Abs(liveHostEdgeH - clientJoinEdgeH) < 0.001f,
|
||||
$"Expected liveHostEdgeH ({liveHostEdgeH:F4}) == clientJoinEdgeH ({clientJoinEdgeH:F4}) within 0.001m");
|
||||
|
||||
host.ResetMatch(43, ArenaMapKind.Sion, startInLobby: false);
|
||||
float postResetHostH = host.Session.State.Terrain.SampleHeight(cx, cz);
|
||||
float postResetHostEdgeH = host.Session.State.Terrain.SampleHeight(cx + 2.5f, cz - 1.5f);
|
||||
Assert.True(MathF.Abs(liveHostH - postResetHostH) < 0.001f,
|
||||
$"Expected liveHostH ({liveHostH:F4}) == postResetHostH ({postResetHostH:F4}) within 0.001m");
|
||||
Assert.True(MathF.Abs(liveHostEdgeH - postResetHostEdgeH) < 0.001f,
|
||||
$"Expected liveHostEdgeH ({liveHostEdgeH:F4}) == postResetHostEdgeH ({postResetHostEdgeH:F4}) within 0.001m");
|
||||
}
|
||||
|
||||
private static byte[] EncodeRudpLatestDatagram(byte[] frameBytes, uint sequence) =>
|
||||
CultNetRudpPacketCodec.Encode(new CultNetRudpPacket
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue