Disable network PVS corner-peek raycasts in Solo and distant neutral spectators

This commit is contained in:
Meta Vens 2026-12-05 10:59:38 +01:00
commit 8ce9bece1f
2 changed files with 14 additions and 4 deletions

View file

@ -73,6 +73,7 @@ namespace RustToDust.Ymir
public MatchState State { get; }
public Box3DSoaWorld World => _world;
public bool EnableNetworkPvs { get; set; } = true;
public void SetHumanSlot(int contenderId, bool isHuman, string? callsign = null)
{
@ -1744,7 +1745,7 @@ namespace RustToDust.Ymir
}
}
_contenderPvs[obs.Id, i] = obsSees || ComputeConservativePvs(obs, pEyeY, c.X, c.Y, c.Z, c.Grid.Spec);
_contenderPvs[obs.Id, i] = !EnableNetworkPvs || obsSees || ComputeConservativePvs(obs, pEyeY, c.X, c.Y, c.Z, c.Grid.Spec);
if (distSqC <= 240f * 240f &&
HasLineOfSight(c.X, MatchRules.GetObserverEyeY(c.Y, c.Grid.Spec.HalfHeight), c.Z, obs.X, pTargetY, obs.Z))
@ -1801,7 +1802,10 @@ namespace RustToDust.Ymir
mem.FaintHorizonPing = horizonPing;
}
_spectatorPvs[obs.Id, i] = obsSees || ComputeConservativePvs(obs, pEyeY, s.X, s.Y, s.Z, s.Grid.Spec);
_spectatorPvs[obs.Id, i] = !EnableNetworkPvs ||
obsSees ||
((s.Stance != SpectatorStance.Neutral || sDistSq <= 260f * 260f) &&
ComputeConservativePvs(obs, pEyeY, s.X, s.Y, s.Z, s.Grid.Spec));
if (s.Stance != SpectatorStance.Neutral &&
s.TargetContenderId == obs.Id &&

View file

@ -11,7 +11,10 @@ namespace RustToDust.Ymir
public LocalArenaSession(int seed = 42, ArenaMapKind mapKind = ArenaMapKind.Desert, string? callsign = null)
{
Inner = new ArenaSession(seed, mapKind, slot0Human: true);
Inner = new ArenaSession(seed, mapKind, slot0Human: true)
{
EnableNetworkPvs = false
};
if (!string.IsNullOrWhiteSpace(callsign))
{
Inner.SetHumanSlot(0, true, callsign);
@ -87,7 +90,10 @@ namespace RustToDust.Ymir
string? name = LocalContender.Name;
_pendingEvents.Clear();
Inner.Dispose();
Inner = new ArenaSession(seed, mapKind, slot0Human: true);
Inner = new ArenaSession(seed, mapKind, slot0Human: true)
{
EnableNetworkPvs = false
};
if (!string.IsNullOrWhiteSpace(name))
{
Inner.SetHumanSlot(0, true, name);