Fix Cut 5c Soul findings: PVS wire isolation, walker clock/swap/spectator sync, Release Box3D build graph, Packet 2 overflow & bounds checks, L1 timeout/reconnect
This commit is contained in:
parent
8ab62655d5
commit
39ad46cd14
15 changed files with 1231 additions and 177 deletions
|
|
@ -291,11 +291,7 @@ public partial class Main : Node3D
|
|||
|
||||
private void StartListenHostSession(string hostArg, string callsign)
|
||||
{
|
||||
_callsign = string.IsNullOrWhiteSpace(callsign) ? "Host" : callsign.Trim();
|
||||
_session?.Dispose();
|
||||
_session = null;
|
||||
_boundViewState = null;
|
||||
_wasNetConnected = false;
|
||||
string nextCallsign = string.IsNullOrWhiteSpace(callsign) ? "Host" : callsign.Trim();
|
||||
Failure = null;
|
||||
_hud.SetNetworkError(null);
|
||||
|
||||
|
|
@ -303,15 +299,26 @@ public partial class Main : Node3D
|
|||
{
|
||||
ParseBindAndPort(hostArg, IPAddress.Loopback, DefaultNetPort, out IPAddress bindIp, out int port);
|
||||
var hostSession = new ListenHostArenaSession(bindIp, port, _seed, _mapKind);
|
||||
hostSession.Host.Session.SetHumanSlot(0, true, _callsign);
|
||||
hostSession.Host.Session.SetHumanSlot(0, true, nextCallsign);
|
||||
|
||||
var oldSession = _session;
|
||||
_session = hostSession;
|
||||
_callsign = nextCallsign;
|
||||
_boundViewState = null;
|
||||
_wasNetConnected = false;
|
||||
_lastEndpoint = $"{bindIp}:{hostSession.Host.BoundPort}";
|
||||
_hud.SetNetworkDefaults(_lastEndpoint, _callsign);
|
||||
BindSessionPresentation(resetCamera: true);
|
||||
oldSession?.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Failure = ex.Message;
|
||||
if (_session is null)
|
||||
{
|
||||
_session = new LocalArenaSession(_seed, _mapKind, _callsign);
|
||||
BindSessionPresentation(resetCamera: false);
|
||||
}
|
||||
_hud.SetNetworkError(ex.Message);
|
||||
GD.PushError("ListenHostArenaSession startup failed: " + ex);
|
||||
}
|
||||
|
|
@ -319,27 +326,34 @@ public partial class Main : Node3D
|
|||
|
||||
private void StartRemoteSession(string endpointText, string callsign)
|
||||
{
|
||||
_callsign = string.IsNullOrWhiteSpace(callsign) ? "Pilot" : callsign.Trim();
|
||||
_session?.Dispose();
|
||||
_session = null;
|
||||
_boundViewState = null;
|
||||
_wasNetConnected = false;
|
||||
string nextCallsign = string.IsNullOrWhiteSpace(callsign) ? "Pilot" : callsign.Trim();
|
||||
Failure = null;
|
||||
_hud.SetNetworkError(null);
|
||||
|
||||
try
|
||||
{
|
||||
IPEndPoint ep = ResolveEndPoint(endpointText, DefaultNetPort);
|
||||
var remote = new RemoteArenaSession(ep, _callsign);
|
||||
var remote = new RemoteArenaSession(ep, nextCallsign);
|
||||
remote.PumpNetwork();
|
||||
|
||||
var oldSession = _session;
|
||||
_session = remote;
|
||||
_callsign = nextCallsign;
|
||||
_boundViewState = null;
|
||||
_wasNetConnected = false;
|
||||
_lastEndpoint = endpointText.Trim();
|
||||
_hud.SetNetworkDefaults(_lastEndpoint, _callsign);
|
||||
BindSessionPresentation(resetCamera: true);
|
||||
oldSession?.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Failure = ex.Message;
|
||||
if (_session is null)
|
||||
{
|
||||
_session = new LocalArenaSession(_seed, _mapKind, _callsign);
|
||||
BindSessionPresentation(resetCamera: false);
|
||||
}
|
||||
_hud.SetNetworkError(ex.Message);
|
||||
GD.PushError("RemoteArenaSession startup failed: " + ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>RustToDust.Client</AssemblyName>
|
||||
<RootNamespace>RustToDust.Client</RootNamespace>
|
||||
<YmirNativeConfiguration Condition="'$(YmirNativeConfiguration)' == ''">Release</YmirNativeConfiguration>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\RustToDust.Ymir\RustToDust.Ymir.csproj" />
|
||||
|
|
|
|||
|
|
@ -62,6 +62,21 @@ namespace RustToDust.Core
|
|||
public static VehiclePackage? TryGetPackage(string id) =>
|
||||
_packagesById.TryGetValue(id, out var pkg) ? pkg : null;
|
||||
|
||||
public static bool TryGetChassisSpecOrExemplar(string id, out ChassisSpec spec)
|
||||
{
|
||||
if (_chassisById.TryGetValue(id, out spec!))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (string.Equals(id, "exemplar_frame", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
spec = SpectatorRing.ExemplarSpec;
|
||||
return true;
|
||||
}
|
||||
spec = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------- HUMAN SALVAGE MODULES (9) ----------------
|
||||
|
||||
public static readonly ModuleSpec Mg762 = new(
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ namespace RustToDust.Core
|
|||
[Key(8)] public List<SpectatorInitialDto> Spectators { get; set; } = new();
|
||||
[Key(9)] public List<GroundDropDto> GroundDrops { get; set; } = new();
|
||||
[Key(10)] public List<TerrainStampEvent> TerrainStamps { get; set; } = new();
|
||||
[Key(11)] public int ConnectedHumans { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -254,6 +255,7 @@ namespace RustToDust.Core
|
|||
[Union(5, typeof(NewMatchCmdMsg))]
|
||||
[Union(6, typeof(SimEventBatchMsg))]
|
||||
[Union(7, typeof(EntitySyncSnapshotMsg))]
|
||||
[Union(8, typeof(InteractCmdMsg))]
|
||||
public interface ISchemaWireMessage
|
||||
{
|
||||
}
|
||||
|
|
@ -304,6 +306,12 @@ namespace RustToDust.Core
|
|||
[Key(2)] public byte MapKind { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class InteractCmdMsg : ISchemaWireMessage
|
||||
{
|
||||
[Key(0)] public ushort ReqSeq { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class SimEventBatchMsg : ISchemaWireMessage
|
||||
{
|
||||
|
|
|
|||
|
|
@ -902,20 +902,7 @@ namespace RustToDust.Core
|
|||
}
|
||||
default: // Exemplar
|
||||
{
|
||||
var exemplarSpec = Catalog.Raptor with
|
||||
{
|
||||
Id = "exemplar_frame",
|
||||
Name = "Exemplar Frame",
|
||||
BaseCellArmor = 22f,
|
||||
MassKg = 1150f,
|
||||
BaseThrust = 26000f,
|
||||
BaseTurnRate = 6.2f,
|
||||
MaxSpeed = 40f,
|
||||
HalfWidth = 0.8f,
|
||||
HalfHeight = 1.55f,
|
||||
HalfLength = 0.8f
|
||||
};
|
||||
var grid = new ChassisGrid(exemplarSpec);
|
||||
var grid = new ChassisGrid(ExemplarSpec);
|
||||
MountRequired(grid, Catalog.GildedLance, "hp.weapon.arm_r");
|
||||
MountRequired(grid, Catalog.TouringPlasma, "hp.weapon.arm_l");
|
||||
MountRequired(grid, Catalog.NobleCore, "hp.engine.chest");
|
||||
|
|
@ -930,5 +917,19 @@ namespace RustToDust.Core
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly ChassisSpec ExemplarSpec = Catalog.Raptor with
|
||||
{
|
||||
Id = "exemplar_frame",
|
||||
Name = "Exemplar Frame",
|
||||
BaseCellArmor = 22f,
|
||||
MassKg = 1150f,
|
||||
BaseThrust = 26000f,
|
||||
BaseTurnRate = 6.2f,
|
||||
MaxSpeed = 40f,
|
||||
HalfWidth = 0.8f,
|
||||
HalfHeight = 1.55f,
|
||||
HalfLength = 0.8f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ namespace RustToDust.Net
|
|||
private const float InterpDelaySec = 0.050f;
|
||||
private const float HardSnapThresholdM = 4.0f;
|
||||
private const float ErrorDecayTauSec = 0.10f;
|
||||
private const long ClientDisconnectTimeoutMs = 6000;
|
||||
|
||||
private readonly record struct BufferedInput(uint Seq, PlayerInput Input);
|
||||
private readonly record struct BufferedInput(uint Seq, PlayerInput Input, WalkerCheckpoint? PreWalker);
|
||||
|
||||
private struct PoseSample
|
||||
{
|
||||
|
|
@ -41,6 +42,7 @@ namespace RustToDust.Net
|
|||
private readonly List<BufferedInput> _unackedInputs = new(MaxUnackedInputs);
|
||||
private readonly bool[] _contenderVisible = new bool[MatchState.ContenderCount];
|
||||
private readonly bool[] _spectatorVisible = new bool[SpectatorRing.DefaultSpectatorCount];
|
||||
private readonly uint[] _lastCombatSpecSeenSeq = new uint[SpectatorRing.DefaultSpectatorCount];
|
||||
private readonly List<PoseSample>[] _contenderTimeline = new List<PoseSample>[MatchState.ContenderCount];
|
||||
private readonly List<PoseSample>[] _spectatorTimeline = new List<PoseSample>[SpectatorRing.DefaultSpectatorCount];
|
||||
private readonly Dictionary<int, List<WalkerSample>> _contenderWalkerTimelines = new();
|
||||
|
|
@ -55,11 +57,14 @@ namespace RustToDust.Net
|
|||
|
||||
private Vector3 _predErrorPos;
|
||||
private Quaternion _predErrorRot = Quaternion.Identity;
|
||||
private bool _pendingChassisSwapSnap;
|
||||
|
||||
private Guid _reconnectToken;
|
||||
private uint _matchGeneration;
|
||||
private uint _nextInputSeq = 1;
|
||||
private uint _nextCmdSeq = 1;
|
||||
private ushort _interactSeq;
|
||||
private bool _prevInteractPressed;
|
||||
private long _outLatestSeq = 1;
|
||||
private long _outSchemaSeq = 1;
|
||||
private uint _lastSnapshotSeq;
|
||||
|
|
@ -71,8 +76,10 @@ namespace RustToDust.Net
|
|||
private float _renderTime;
|
||||
private int _pingMs;
|
||||
private int _connectedHumans = 1;
|
||||
private long _lastServerPacketUtcMs;
|
||||
private bool _joinSent;
|
||||
private bool _joined;
|
||||
private bool _everJoined;
|
||||
private string? _lastError;
|
||||
private bool _disposed;
|
||||
|
||||
|
|
@ -111,6 +118,7 @@ namespace RustToDust.Net
|
|||
MaxPendingReliablePackets = 2048
|
||||
});
|
||||
_conn.Connect();
|
||||
_lastServerPacketUtcMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
}
|
||||
|
||||
public Func<byte[], bool>? DebugInboundLatestDropFilter { get; set; }
|
||||
|
|
@ -119,6 +127,7 @@ namespace RustToDust.Net
|
|||
public uint LastSnapshotSeq => _lastSnapshotSeq;
|
||||
public int UnackedInputCount => _unackedInputs.Count;
|
||||
public Vector3 CurrentPredictionError => _predErrorPos;
|
||||
public float? PredictedWalkerSimTime => _predWalker is { Initialized: true } ? _predWalker.SimTime : null;
|
||||
|
||||
public MatchState ViewState => _viewState;
|
||||
public int LocalContenderId => _localContenderId;
|
||||
|
|
@ -144,7 +153,9 @@ namespace RustToDust.Net
|
|||
PingMs: _pingMs,
|
||||
ConnectedHumans: _connectedHumans,
|
||||
MaxHumans: MatchState.ContenderCount,
|
||||
StateLabel: _joined ? $"ONLINE ({_pingMs} ms)" : (_lastError ?? "CONNECTING"),
|
||||
StateLabel: (_joined && _conn.Connected)
|
||||
? $"ONLINE ({_pingMs} ms)"
|
||||
: (_lastError is not null ? $"DISCONNECTED ({_lastError})" : (_everJoined ? "DISCONNECTED" : "CONNECTING")),
|
||||
LastError: _lastError);
|
||||
|
||||
public bool IsContenderVisible(int contenderId) =>
|
||||
|
|
@ -235,18 +246,35 @@ namespace RustToDust.Net
|
|||
return;
|
||||
}
|
||||
|
||||
if (input.InteractPickup && !_prevInteractPressed)
|
||||
{
|
||||
_interactSeq = _interactSeq == ushort.MaxValue ? (ushort)1 : (ushort)(_interactSeq + 1);
|
||||
SendSchemaMessage(new InteractCmdMsg { ReqSeq = _interactSeq });
|
||||
}
|
||||
_prevInteractPressed = input.InteractPickup;
|
||||
|
||||
uint seq = _nextInputSeq++;
|
||||
uint nowMs = unchecked((uint)Environment.TickCount64);
|
||||
var pkt = new ClientInputPacket(_matchGeneration, seq, nowMs, input);
|
||||
var pkt = new ClientInputPacket(_matchGeneration, seq, nowMs, input, _interactSeq);
|
||||
byte[] payload = SnapshotCodec.EncodeClientInput(pkt);
|
||||
byte[] wire = SnapshotCodec.WrapLatest(payload, _matchGeneration, _outLatestSeq++, SnapshotCodec.SchemaInputId);
|
||||
_conn.SendLatest(wire);
|
||||
try
|
||||
{
|
||||
_conn.SendLatest(wire);
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
}
|
||||
|
||||
WalkerCheckpoint? preWalker = _predWalker is { Initialized: true }
|
||||
? _predWalker.CaptureCheckpoint()
|
||||
: null;
|
||||
|
||||
if (_unackedInputs.Count >= MaxUnackedInputs)
|
||||
{
|
||||
_unackedInputs.RemoveAt(0);
|
||||
}
|
||||
_unackedInputs.Add(new BufferedInput(seq, input));
|
||||
_unackedInputs.Add(new BufferedInput(seq, input, preWalker));
|
||||
|
||||
StepLocalPredictionTick(input, updatePreviousPose: true);
|
||||
}
|
||||
|
|
@ -446,7 +474,10 @@ namespace RustToDust.Net
|
|||
return best;
|
||||
}
|
||||
|
||||
public void PumpNetwork()
|
||||
public void PumpNetwork() =>
|
||||
PumpNetwork(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds());
|
||||
|
||||
public void PumpNetwork(long nowUtcMs)
|
||||
{
|
||||
if (_disposed) return;
|
||||
|
||||
|
|
@ -461,10 +492,23 @@ namespace RustToDust.Net
|
|||
}
|
||||
|
||||
int loops = 0;
|
||||
while (loops < 256 && _conn.TryReceiveOnce(out var frame))
|
||||
while (loops < 256)
|
||||
{
|
||||
CultNetTransportFrame? frame;
|
||||
try
|
||||
{
|
||||
if (!_conn.TryReceiveOnce(out frame))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
break;
|
||||
}
|
||||
loops++;
|
||||
if (frame is null) continue;
|
||||
_lastServerPacketUtcMs = nowUtcMs;
|
||||
|
||||
CultMeshRealtimeFrame rt;
|
||||
try
|
||||
|
|
@ -490,7 +534,38 @@ namespace RustToDust.Net
|
|||
}
|
||||
}
|
||||
|
||||
_conn.PollResends();
|
||||
try
|
||||
{
|
||||
_conn.PollResends();
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
}
|
||||
|
||||
bool transportTimedOut = false;
|
||||
try
|
||||
{
|
||||
transportTimedOut = _conn.CheckTimeout(ClientDisconnectTimeoutMs);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (_joined && (!_conn.Connected || transportTimedOut || (nowUtcMs - _lastServerPacketUtcMs) > ClientDisconnectTimeoutMs))
|
||||
{
|
||||
_joined = false;
|
||||
_lastError ??= "Connection timed out";
|
||||
try
|
||||
{
|
||||
if (_conn.Connected)
|
||||
{
|
||||
_conn.Disconnect();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSchemaFrame(ReadOnlyMemory<byte> payload)
|
||||
|
|
@ -512,11 +587,29 @@ namespace RustToDust.Net
|
|||
_localContenderId = accepted.AssignedContenderId;
|
||||
_matchGeneration = accepted.MatchGeneration;
|
||||
ApplyInitialMatchState(accepted.InitialState, accepted.AssignedContenderId);
|
||||
_lastServerPacketUtcMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
_lastError = null;
|
||||
_joined = true;
|
||||
_everJoined = true;
|
||||
break;
|
||||
case JoinRejectedMsg rejected:
|
||||
_joined = false;
|
||||
_lastError = rejected.Reason;
|
||||
break;
|
||||
case LeaveMsg leave:
|
||||
_joined = false;
|
||||
_lastError = string.IsNullOrWhiteSpace(leave.Reason) ? "Disconnected by server" : leave.Reason;
|
||||
try
|
||||
{
|
||||
if (_conn.Connected)
|
||||
{
|
||||
_conn.Disconnect();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
break;
|
||||
case SimEventBatchMsg batch:
|
||||
if (batch.MatchGeneration == _matchGeneration || ContainsMatchReset(batch.Events))
|
||||
{
|
||||
|
|
@ -542,27 +635,33 @@ namespace RustToDust.Net
|
|||
{
|
||||
if (!_joined || span.IsEmpty) return;
|
||||
|
||||
var kind = (LatestPacketKind)span[0];
|
||||
switch (kind)
|
||||
try
|
||||
{
|
||||
var kind = (LatestPacketKind)span[0];
|
||||
switch (kind)
|
||||
{
|
||||
case LatestPacketKind.CorePvs:
|
||||
if (!SnapshotCodec.TryDecodeCorePvs(span, out var core)) return;
|
||||
if (core.MatchGeneration != _matchGeneration || core.SnapshotSeq <= _lastSnapshotSeq) return;
|
||||
_lastSnapshotSeq = core.SnapshotSeq;
|
||||
ApplyCorePvsSnapshot(core);
|
||||
break;
|
||||
case LatestPacketKind.SpectatorOrbitHalf:
|
||||
if (!SnapshotCodec.TryDecodeSpectatorOrbitHalf(span, out var orbit)) return;
|
||||
if (orbit.MatchGeneration != _matchGeneration || orbit.SnapshotSeq < _lastOrbitSeq) return;
|
||||
_lastOrbitSeq = orbit.SnapshotSeq;
|
||||
ApplySpectatorOrbit(orbit);
|
||||
break;
|
||||
case LatestPacketKind.RadarContacts:
|
||||
if (!SnapshotCodec.TryDecodeRadarContacts(span, out var radar)) return;
|
||||
if (radar.MatchGeneration != _matchGeneration || radar.SnapshotSeq < _lastRadarSeq) return;
|
||||
_lastRadarSeq = radar.SnapshotSeq;
|
||||
ApplyRadarContacts(radar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
case LatestPacketKind.CorePvs:
|
||||
var core = SnapshotCodec.DecodeCorePvs(span);
|
||||
if (core.MatchGeneration != _matchGeneration || core.SnapshotSeq <= _lastSnapshotSeq) return;
|
||||
_lastSnapshotSeq = core.SnapshotSeq;
|
||||
ApplyCorePvsSnapshot(core);
|
||||
break;
|
||||
case LatestPacketKind.SpectatorOrbitHalf:
|
||||
var orbit = SnapshotCodec.DecodeSpectatorOrbitHalf(span);
|
||||
if (orbit.MatchGeneration != _matchGeneration || orbit.SnapshotSeq < _lastOrbitSeq) return;
|
||||
_lastOrbitSeq = orbit.SnapshotSeq;
|
||||
ApplySpectatorOrbit(orbit);
|
||||
break;
|
||||
case LatestPacketKind.RadarContacts:
|
||||
var radar = SnapshotCodec.DecodeRadarContacts(span);
|
||||
if (radar.MatchGeneration != _matchGeneration || radar.SnapshotSeq < _lastRadarSeq) return;
|
||||
_lastRadarSeq = radar.SnapshotSeq;
|
||||
ApplyRadarContacts(radar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -573,9 +672,13 @@ namespace RustToDust.Net
|
|||
_lastSnapshotSeq = 0;
|
||||
_lastOrbitSeq = 0;
|
||||
_lastRadarSeq = 0;
|
||||
_interactSeq = 0;
|
||||
_prevInteractPressed = false;
|
||||
_pendingChassisSwapSnap = false;
|
||||
_unackedInputs.Clear();
|
||||
_predErrorPos = Vector3.Zero;
|
||||
_predErrorRot = Quaternion.Identity;
|
||||
Array.Clear(_lastCombatSpecSeenSeq);
|
||||
|
||||
_viewState = new MatchState(dto.Seed, (ArenaMapKind)dto.MapKind)
|
||||
{
|
||||
|
|
@ -605,10 +708,26 @@ namespace RustToDust.Net
|
|||
d.PickedUp = gd.PickedUp;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _viewState.Contenders.Count; i++)
|
||||
{
|
||||
_contenderTimeline[i].Clear();
|
||||
_contenderVisible[i] = i == _localContenderId;
|
||||
if (i != _localContenderId)
|
||||
{
|
||||
var hidden = _viewState.Contenders[i];
|
||||
hidden.X = 0f;
|
||||
hidden.Y = 0f;
|
||||
hidden.Z = 0f;
|
||||
hidden.Kills = 0;
|
||||
hidden.SnapPreviousPose();
|
||||
}
|
||||
}
|
||||
|
||||
int humans = 0;
|
||||
for (int i = 0; i < dto.Contenders.Count && i < _viewState.Contenders.Count; i++)
|
||||
for (int i = 0; i < dto.Contenders.Count; i++)
|
||||
{
|
||||
var cd = dto.Contenders[i];
|
||||
if (cd.Id < 0 || cd.Id >= _viewState.Contenders.Count) continue;
|
||||
var c = _viewState.Contenders[cd.Id];
|
||||
c.Name = cd.Name;
|
||||
c.IsHuman = cd.IsHuman;
|
||||
|
|
@ -620,14 +739,22 @@ namespace RustToDust.Net
|
|||
c.SnapPreviousPose();
|
||||
ApplyLoadoutToContender(c, cd.Loadout);
|
||||
_contenderTimeline[cd.Id].Clear();
|
||||
_contenderVisible[cd.Id] = cd.Id == _localContenderId;
|
||||
_contenderVisible[cd.Id] = true;
|
||||
}
|
||||
_connectedHumans = Math.Max(1, humans);
|
||||
_connectedHumans = dto.ConnectedHumans > 0 ? dto.ConnectedHumans : Math.Max(1, humans);
|
||||
|
||||
for (int i = 0; i < dto.Spectators.Count && i < _viewState.Spectators.Spectators.Count; i++)
|
||||
for (int i = 0; i < _viewState.Spectators.Spectators.Count; i++)
|
||||
{
|
||||
_spectatorTimeline[i].Clear();
|
||||
_spectatorVisible[i] = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < dto.Spectators.Count; i++)
|
||||
{
|
||||
var sd = dto.Spectators[i];
|
||||
var s = _viewState.Spectators.Spectators[i];
|
||||
int sIdx = sd.Id >= 1000 ? sd.Id - 1000 : sd.Id;
|
||||
if (sIdx < 0 || sIdx >= _viewState.Spectators.Spectators.Count) continue;
|
||||
var s = _viewState.Spectators.Spectators[sIdx];
|
||||
s.Stance = (SpectatorStance)sd.Stance;
|
||||
s.X = sd.X; s.Y = sd.Y; s.Z = sd.Z; s.Yaw = sd.Yaw;
|
||||
var q = Quaternion.CreateFromAxisAngle(Vector3.UnitY, sd.Yaw);
|
||||
|
|
@ -635,12 +762,12 @@ namespace RustToDust.Net
|
|||
s.SnapPreviousPose();
|
||||
var mounted = new List<(string, string)>(sd.Mounted.Count);
|
||||
for (int m = 0; m < sd.Mounted.Count; m++) mounted.Add((sd.Mounted[m].ModuleId, sd.Mounted[m].HardpointId));
|
||||
if (Catalog.ChassisById.TryGetValue(sd.ChassisId, out var spec))
|
||||
if (Catalog.TryGetChassisSpecOrExemplar(sd.ChassisId, out var spec))
|
||||
{
|
||||
s.Grid.ApplyReplicatedLoadout(spec, sd.CoreHp, sd.MaxCoreHp, sd.ArmorBytes, mounted, null, id => Catalog.ModulesById.TryGetValue(id, out var ms) ? ms : null);
|
||||
}
|
||||
_spectatorTimeline[i].Clear();
|
||||
_spectatorVisible[i] = false;
|
||||
_spectatorTimeline[sIdx].Clear();
|
||||
_spectatorVisible[sIdx] = true;
|
||||
}
|
||||
|
||||
_contenderWalkerTimelines.Clear();
|
||||
|
|
@ -824,6 +951,8 @@ namespace RustToDust.Net
|
|||
Quaternion prevVisRot = NormalizeQuat(_predErrorRot * currQ);
|
||||
|
||||
bool chassisChanged = !string.Equals(_predChassisId, local.Grid.Spec.Id, StringComparison.Ordinal);
|
||||
bool hadSavedPrevSnap = _predWalker is { Initialized: true };
|
||||
WalkerVisualSnapshot savedPrevSnap = hadSavedPrevSnap ? _predWalker!.PrevSnap : default;
|
||||
|
||||
// Discard acked inputs
|
||||
int removeCount = 0;
|
||||
|
|
@ -836,6 +965,10 @@ namespace RustToDust.Net
|
|||
_unackedInputs.RemoveRange(0, removeCount);
|
||||
}
|
||||
|
||||
WalkerCheckpoint? replayBaseWalker = (!chassisChanged && !_pendingChassisSwapSnap && _unackedInputs.Count > 0)
|
||||
? _unackedInputs[0].PreWalker
|
||||
: null;
|
||||
|
||||
// Snap single-body physics state to authoritative snapshot
|
||||
local.X = pkt.LocalPos.X;
|
||||
local.Y = pkt.LocalPos.Y;
|
||||
|
|
@ -847,18 +980,23 @@ namespace RustToDust.Net
|
|||
local.VelX = pkt.LocalVel.X;
|
||||
local.VelY = pkt.LocalVel.Y;
|
||||
local.VelZ = pkt.LocalVel.Z;
|
||||
local.TargetHoverAltAgl = pkt.LocalTargetHoverAltAgl;
|
||||
SpawnLocalPredictionBody(pkt.LocalPos, pkt.LocalRot, pkt.LocalVel, pkt.LocalAngVel);
|
||||
|
||||
if (replayBaseWalker is { } baseCp &&
|
||||
_predWalker is { Initialized: true } &&
|
||||
baseCp.GeomLegCount == _predWalker.Geom.LegCount &&
|
||||
MathF.Abs(baseCp.GeomScale - _predWalker.GeomScale) < 1e-4f)
|
||||
{
|
||||
_predWalker.RestoreCheckpoint(in baseCp);
|
||||
_predWalker.SyncBodyPoseOnly(pkt.LocalPos, pkt.LocalRot, local.Grid.Spec.MassKg);
|
||||
}
|
||||
|
||||
// Replay unacked inputs
|
||||
for (int i = 0; i < _unackedInputs.Count; i++)
|
||||
{
|
||||
StepLocalPredictionTick(_unackedInputs[i].Input, updatePreviousPose: false);
|
||||
}
|
||||
local.SnapPreviousPose();
|
||||
if (_predWalker is { Initialized: true })
|
||||
{
|
||||
_predWalker.SnapshotPrev();
|
||||
}
|
||||
|
||||
Vector3 newPredPos = new(local.X, local.Y, local.Z);
|
||||
Quaternion newPredRot = NormalizeQuat(new Quaternion(local.CurrRotX, local.CurrRotY, local.CurrRotZ, local.CurrRotW));
|
||||
|
|
@ -867,15 +1005,26 @@ namespace RustToDust.Net
|
|||
Quaternion deltaRot = NormalizeQuat(prevVisRot * Quaternion.Inverse(newPredRot));
|
||||
if (deltaRot.W < 0f) deltaRot = -deltaRot;
|
||||
|
||||
if (!pkt.LocalAlive || chassisChanged || deltaPos.Length() > HardSnapThresholdM)
|
||||
bool hardSnap = !pkt.LocalAlive || chassisChanged || _pendingChassisSwapSnap || deltaPos.Length() > HardSnapThresholdM;
|
||||
if (hardSnap)
|
||||
{
|
||||
_predErrorPos = Vector3.Zero;
|
||||
_predErrorRot = Quaternion.Identity;
|
||||
_pendingChassisSwapSnap = false;
|
||||
local.SnapPreviousPose();
|
||||
if (_predWalker is { Initialized: true })
|
||||
{
|
||||
_predWalker.SnapshotPrev();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_predErrorPos = deltaPos;
|
||||
_predErrorRot = deltaRot;
|
||||
if (_predWalker is { Initialized: true } && hadSavedPrevSnap)
|
||||
{
|
||||
_predWalker.PrevSnap = savedPrevSnap;
|
||||
}
|
||||
}
|
||||
|
||||
// Remote contenders in PVS
|
||||
|
|
@ -919,6 +1068,28 @@ namespace RustToDust.Net
|
|||
}
|
||||
_connectedHumans = CountHumanContenders();
|
||||
|
||||
// Combat spectators in PVS (must apply BEFORE walkers so spectator poses are current for walker ComPos/ComRot!)
|
||||
for (int i = 0; i < pkt.CombatSpectators.Count; i++)
|
||||
{
|
||||
var cs = pkt.CombatSpectators[i];
|
||||
if (cs.Id < _lastCombatSpecSeenSeq.Length)
|
||||
{
|
||||
_lastCombatSpecSeenSeq[cs.Id] = pkt.SnapshotSeq;
|
||||
}
|
||||
ApplySpectatorSnapshot(cs, pkt.SimTime);
|
||||
}
|
||||
|
||||
var allSpecs = _viewState.Spectators.Spectators;
|
||||
for (int i = 0; i < allSpecs.Count && i < _spectatorVisible.Length; i++)
|
||||
{
|
||||
if (_spectatorVisible[i] &&
|
||||
allSpecs[i].Stance != SpectatorStance.Neutral &&
|
||||
pkt.SnapshotSeq > _lastCombatSpecSeenSeq[i] + 2)
|
||||
{
|
||||
_spectatorVisible[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Walkers in PVS
|
||||
for (int i = 0; i < pkt.Walkers.Count; i++)
|
||||
{
|
||||
|
|
@ -943,21 +1114,25 @@ namespace RustToDust.Net
|
|||
snap.IsDigitigrade = g.IsDigitigrade;
|
||||
snap.IsArachnidUp = g.IsArachnidUp;
|
||||
snap.ComPos = new Vector3(c.X, c.Y, c.Z);
|
||||
snap.ComRot = new Quaternion(c.CurrRotX, c.CurrRotY, c.CurrRotZ, c.CurrRotW);
|
||||
snap.ComRot = NormalizeQuat(new Quaternion(c.CurrRotX, c.CurrRotY, c.CurrRotZ, c.CurrRotW));
|
||||
}
|
||||
else if (!nw.IsContender && nw.EntityId < allSpecs.Count)
|
||||
{
|
||||
var s = allSpecs[nw.EntityId];
|
||||
var g = WalkerGeometrySpec.GetForChassis(s.Grid.Spec.Id);
|
||||
snap.GeomScale = g.ModelHalfHeight > 1e-4f ? s.Grid.Spec.HalfHeight / g.ModelHalfHeight : 1f;
|
||||
snap.IsDigitigrade = g.IsDigitigrade;
|
||||
snap.IsArachnidUp = g.IsArachnidUp;
|
||||
snap.ComPos = new Vector3(s.X, s.Y, s.Z);
|
||||
snap.ComRot = NormalizeQuat(new Quaternion(s.CurrRotX, s.CurrRotY, s.CurrRotZ, s.CurrRotW));
|
||||
}
|
||||
list.Add(new WalkerSample { SimTime = pkt.SimTime, Snap = snap });
|
||||
}
|
||||
|
||||
// Combat spectators in PVS
|
||||
for (int i = 0; i < pkt.CombatSpectators.Count; i++)
|
||||
{
|
||||
ApplySpectatorSnapshot(pkt.CombatSpectators[i], pkt.SimTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplySpectatorOrbit(DecodedSpectatorOrbitSnapshot orbit)
|
||||
{
|
||||
// Clear visibility for spectators in this half before re-marking PVS ones
|
||||
// Clear visibility for neutral spectators in this half before re-marking PVS ones
|
||||
var specs = _viewState.Spectators.Spectators;
|
||||
for (int i = orbit.HalfIndex; i < specs.Count; i += 2)
|
||||
{
|
||||
|
|
@ -968,7 +1143,12 @@ namespace RustToDust.Net
|
|||
}
|
||||
for (int i = 0; i < orbit.Spectators.Count; i++)
|
||||
{
|
||||
ApplySpectatorSnapshot(orbit.Spectators[i], _latestServerSimTime);
|
||||
var ns = orbit.Spectators[i];
|
||||
if (ns.Stance != SpectatorStance.Neutral && ns.Id < _lastCombatSpecSeenSeq.Length)
|
||||
{
|
||||
_lastCombatSpecSeenSeq[ns.Id] = orbit.SnapshotSeq;
|
||||
}
|
||||
ApplySpectatorSnapshot(ns, _latestServerSimTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1081,10 +1261,20 @@ namespace RustToDust.Net
|
|||
case ContenderLoadoutEvent cl:
|
||||
if (cl.ContenderId >= 0 && cl.ContenderId < _viewState.Contenders.Count)
|
||||
{
|
||||
string prevChassisId = _viewState.Contenders[cl.ContenderId].Grid.Spec.Id;
|
||||
ApplyLoadoutToContender(_viewState.Contenders[cl.ContenderId], cl);
|
||||
if (cl.ContenderId == _localContenderId)
|
||||
{
|
||||
var l = LocalContender;
|
||||
if (!string.Equals(prevChassisId, cl.ChassisId, StringComparison.Ordinal))
|
||||
{
|
||||
_pendingChassisSwapSnap = true;
|
||||
_predErrorPos = Vector3.Zero;
|
||||
_predErrorRot = Quaternion.Identity;
|
||||
float groundY = _viewState.Terrain.SampleHeight(l.X, l.Z);
|
||||
l.Y = MathF.Max(l.Y, groundY + l.Grid.Spec.HalfHeight + 0.1f);
|
||||
l.SnapPreviousPose();
|
||||
}
|
||||
SpawnLocalPredictionBody(
|
||||
new Vector3(l.X, l.Y, l.Z),
|
||||
NormalizeQuat(new Quaternion(l.CurrRotX, l.CurrRotY, l.CurrRotZ, l.CurrRotW)),
|
||||
|
|
@ -1321,7 +1511,13 @@ namespace RustToDust.Net
|
|||
{
|
||||
byte[] payload = SnapshotCodec.SerializeSchemaMessage(msg);
|
||||
byte[] wire = SnapshotCodec.WrapSchema(payload, _matchGeneration, _outSchemaSeq++);
|
||||
_conn.SendSchema(wire);
|
||||
try
|
||||
{
|
||||
_conn.SendSchema(wire);
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private int CountHumanContenders()
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<YmirNativeConfiguration Condition="'$(YmirNativeConfiguration)' == ''">Release</YmirNativeConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RustToDust.Core\RustToDust.Core.csproj" />
|
||||
<ProjectReference Include="..\RustToDust.Ymir\RustToDust.Ymir.csproj" />
|
||||
<ProjectReference Include="$(YmirRoot)/src/Ymir.Box3D/Ymir.Box3D.csproj" AdditionalProperties="YmirNativeConfiguration=$(YmirNativeConfiguration)" />
|
||||
<ProjectReference Include="$(CultLibRoot)/src/GameCult.Networking/GameCult.Networking.csproj" />
|
||||
<ProjectReference Include="$(CultLibRoot)/src/GameCult.Mesh/GameCult.Mesh.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@ namespace RustToDust.Net
|
|||
public long LastHeardUtcMs;
|
||||
public uint LastAcceptedInputSeq;
|
||||
public uint LastEchoSendMs;
|
||||
public ushort LastInteractSeq;
|
||||
public bool Active = true;
|
||||
public readonly EntityPvsTracker[] ContenderTrackers = new EntityPvsTracker[MatchState.ContenderCount];
|
||||
public readonly EntityPvsTracker[] SpectatorTrackers = new EntityPvsTracker[SpectatorRing.DefaultSpectatorCount];
|
||||
public readonly HashSet<int> SentDropIds = new();
|
||||
}
|
||||
|
||||
private struct EntityPvsTracker
|
||||
|
|
@ -51,6 +53,7 @@ namespace RustToDust.Net
|
|||
private readonly int? _hostContenderId;
|
||||
|
||||
private ArenaSession _session;
|
||||
private string _hostCallsign = "Host";
|
||||
private uint _matchGeneration = 1;
|
||||
private uint _simTick;
|
||||
private uint _snapshotSeq;
|
||||
|
|
@ -119,6 +122,10 @@ namespace RustToDust.Net
|
|||
|
||||
public void ResetMatch(int seed, ArenaMapKind mapKind)
|
||||
{
|
||||
if (_hostContenderId.HasValue && _hostContenderId.Value >= 0 && _hostContenderId.Value < _session.State.Contenders.Count)
|
||||
{
|
||||
_hostCallsign = _session.State.Contenders[_hostContenderId.Value].Name;
|
||||
}
|
||||
_session.Dispose();
|
||||
_session = new ArenaSession(seed, mapKind, slot0Human: _hostContenderId == 0);
|
||||
_matchGeneration++;
|
||||
|
|
@ -130,13 +137,15 @@ namespace RustToDust.Net
|
|||
|
||||
if (_hostContenderId.HasValue)
|
||||
{
|
||||
_session.SetHumanSlot(_hostContenderId.Value, true, "Host");
|
||||
_session.SetHumanSlot(_hostContenderId.Value, true, _hostCallsign);
|
||||
}
|
||||
|
||||
foreach (var peer in _peersByEndpoint.Values)
|
||||
{
|
||||
if (!peer.Active) continue;
|
||||
int slot = peer.AssignedContenderId;
|
||||
peer.LastAcceptedInputSeq = 0;
|
||||
peer.LastInteractSeq = 0;
|
||||
_session.SetHumanSlot(slot, true, peer.Callsign);
|
||||
_reconnectTokens[peer.ReconnectToken] = (slot, peer.Callsign);
|
||||
InitPeerTrackers(peer);
|
||||
|
|
@ -181,7 +190,13 @@ namespace RustToDust.Net
|
|||
|
||||
FlushEventsAndPvsEnter();
|
||||
BroadcastSnapshots();
|
||||
_server.PollResends();
|
||||
try
|
||||
{
|
||||
_server.PollResends();
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
}
|
||||
|
||||
if (_autoRestartSec > 0 && _session.State.Phase == MatchPhase.Completed)
|
||||
{
|
||||
|
|
@ -196,8 +211,20 @@ namespace RustToDust.Net
|
|||
private void PollIncoming(long nowUtcMs)
|
||||
{
|
||||
int processed = 0;
|
||||
while (processed < 256 && _server.TryReceiveOnce(out var serverFrame))
|
||||
while (processed < 256)
|
||||
{
|
||||
CultNetRudpSocketServerFrame? serverFrame;
|
||||
try
|
||||
{
|
||||
if (!_server.TryReceiveOnce(out serverFrame))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
break;
|
||||
}
|
||||
processed++;
|
||||
if (serverFrame is null || _retiredTransportPeers.Contains(serverFrame.Peer))
|
||||
{
|
||||
|
|
@ -267,6 +294,17 @@ namespace RustToDust.Net
|
|||
}
|
||||
}
|
||||
break;
|
||||
case InteractCmdMsg interactCmd:
|
||||
if (_peersByEndpoint.TryGetValue(epKey, out var intPeer) && intPeer.Active && ReferenceEquals(intPeer.TransportPeer, transportPeer))
|
||||
{
|
||||
intPeer.LastHeardUtcMs = nowUtcMs;
|
||||
if (interactCmd.ReqSeq != 0 && interactCmd.ReqSeq != intPeer.LastInteractSeq)
|
||||
{
|
||||
intPeer.LastInteractSeq = interactCmd.ReqSeq;
|
||||
_session.TriggerHumanInteract(intPeer.AssignedContenderId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,6 +321,12 @@ namespace RustToDust.Net
|
|||
RetirePeer(existing, SlotControlReason.HandedToAi);
|
||||
}
|
||||
|
||||
if (ConnectedHumanCount >= _maxHumans)
|
||||
{
|
||||
SendSchemaRaw(transportPeer, new JoinRejectedMsg { Reason = "Server human capacity reached." });
|
||||
return;
|
||||
}
|
||||
|
||||
string callsign = string.IsNullOrWhiteSpace(join.Callsign) ? $"Pilot-{_nextPeerId}" : join.Callsign.Trim();
|
||||
if (callsign.Length > 24) callsign = callsign.Substring(0, 24);
|
||||
|
||||
|
|
@ -294,22 +338,23 @@ namespace RustToDust.Net
|
|||
if (saved.SlotId >= 0 && saved.SlotId < _session.State.Contenders.Count)
|
||||
{
|
||||
var cand = _session.State.Contenders[saved.SlotId];
|
||||
if (cand.Alive && !cand.IsHuman && saved.SlotId != _hostContenderId)
|
||||
if (!cand.Alive)
|
||||
{
|
||||
slotId = saved.SlotId;
|
||||
reason = SlotControlReason.Reclaimed;
|
||||
SendSchemaRaw(transportPeer, new JoinRejectedMsg { Reason = "Chassis destroyed." });
|
||||
return;
|
||||
}
|
||||
if (cand.IsHuman || saved.SlotId == _hostContenderId)
|
||||
{
|
||||
SendSchemaRaw(transportPeer, new JoinRejectedMsg { Reason = "Slot already occupied." });
|
||||
return;
|
||||
}
|
||||
slotId = saved.SlotId;
|
||||
reason = SlotControlReason.Reclaimed;
|
||||
}
|
||||
}
|
||||
|
||||
if (slotId < 0)
|
||||
{
|
||||
if (ConnectedHumanCount >= _maxHumans)
|
||||
{
|
||||
SendSchemaRaw(transportPeer, new JoinRejectedMsg { Reason = "Server human capacity reached." });
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _session.State.Contenders.Count; i++)
|
||||
{
|
||||
if (i == _hostContenderId) continue;
|
||||
|
|
@ -368,7 +413,10 @@ namespace RustToDust.Net
|
|||
ClientInputPacket pkt;
|
||||
try
|
||||
{
|
||||
pkt = SnapshotCodec.DecodeClientInput(rtFrame.Payload.Span);
|
||||
if (!SnapshotCodec.TryDecodeClientInput(rtFrame.Payload.Span, out pkt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -382,7 +430,20 @@ namespace RustToDust.Net
|
|||
|
||||
peer.LastAcceptedInputSeq = pkt.InputSeq;
|
||||
peer.LastEchoSendMs = pkt.ClientSendMs;
|
||||
_session.SetHumanInput(peer.AssignedContenderId, pkt.Input);
|
||||
bool triggerInteract = pkt.Input.InteractPickup;
|
||||
if (pkt.InteractSeq != 0)
|
||||
{
|
||||
if (pkt.InteractSeq != peer.LastInteractSeq)
|
||||
{
|
||||
peer.LastInteractSeq = pkt.InteractSeq;
|
||||
triggerInteract = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
triggerInteract = false;
|
||||
}
|
||||
}
|
||||
_session.SetHumanInput(peer.AssignedContenderId, pkt.Input with { InteractPickup = triggerInteract });
|
||||
}
|
||||
|
||||
private void SweepTimeouts(long nowUtcMs)
|
||||
|
|
@ -415,6 +476,13 @@ namespace RustToDust.Net
|
|||
private void RetirePeer(ConnectedPeer peer, SlotControlReason reason)
|
||||
{
|
||||
if (!peer.Active) return;
|
||||
if (!_retiredTransportPeers.Contains(peer.TransportPeer))
|
||||
{
|
||||
SendSchemaRaw(peer.TransportPeer, new LeaveMsg
|
||||
{
|
||||
Reason = reason == SlotControlReason.HandedToAi ? "Connection timed out" : "Disconnected"
|
||||
});
|
||||
}
|
||||
peer.Active = false;
|
||||
_peersByEndpoint.Remove(peer.EndpointKey);
|
||||
_retiredTransportPeers.Add(peer.TransportPeer);
|
||||
|
|
@ -440,13 +508,13 @@ namespace RustToDust.Net
|
|||
for (int i = 0; i < _session.State.Contenders.Count; i++)
|
||||
{
|
||||
var c = _session.State.Contenders[i];
|
||||
bool inPvs = _session.IsEntityInPeerPvs(peer.AssignedContenderId, true, c.Id);
|
||||
bool inPvs = c.Id == peer.AssignedContenderId || _session.IsEntityInPeerPvs(peer.AssignedContenderId, true, c.Id);
|
||||
peer.ContenderTrackers[i] = new EntityPvsTracker
|
||||
{
|
||||
InPvs = inPvs,
|
||||
SnapNext = false,
|
||||
AckedLoadoutVersion = c.LoadoutVersion,
|
||||
AckedDamageVersion = c.DamageVersion
|
||||
AckedLoadoutVersion = inPvs ? c.LoadoutVersion : -1,
|
||||
AckedDamageVersion = inPvs ? c.DamageVersion : -1
|
||||
};
|
||||
}
|
||||
for (int i = 0; i < _session.State.Spectators.Spectators.Count; i++)
|
||||
|
|
@ -457,10 +525,19 @@ namespace RustToDust.Net
|
|||
{
|
||||
InPvs = inPvs,
|
||||
SnapNext = false,
|
||||
AckedLoadoutVersion = 1,
|
||||
AckedDamageVersion = s.Grid.HitSequence
|
||||
AckedLoadoutVersion = inPvs ? 1 : -1,
|
||||
AckedDamageVersion = inPvs ? s.Grid.HitSequence : -1
|
||||
};
|
||||
}
|
||||
peer.SentDropIds.Clear();
|
||||
for (int i = 0; i < _session.State.GroundDrops.Count; i++)
|
||||
{
|
||||
var d = _session.State.GroundDrops[i];
|
||||
if (!d.PickedUp && _session.IsPointInPeerPvs(peer.AssignedContenderId, d.X, _session.State.Terrain.SampleHeight(d.X, d.Z) + 0.5f, d.Z))
|
||||
{
|
||||
peer.SentDropIds.Add(d.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlushEventsAndPvsEnter()
|
||||
|
|
@ -509,8 +586,9 @@ namespace RustToDust.Net
|
|||
if (inPvs && !tracker.InPvs)
|
||||
{
|
||||
tracker.SnapNext = true;
|
||||
if (tracker.AckedDamageVersion != s.Grid.HitSequence)
|
||||
if (tracker.AckedLoadoutVersion != 1 || tracker.AckedDamageVersion != s.Grid.HitSequence)
|
||||
{
|
||||
tracker.AckedLoadoutVersion = 1;
|
||||
tracker.AckedDamageVersion = s.Grid.HitSequence;
|
||||
SendSchemaToPeer(peer, new EntitySyncSnapshotMsg
|
||||
{
|
||||
|
|
@ -527,10 +605,25 @@ namespace RustToDust.Net
|
|||
tracker.InPvs = inPvs;
|
||||
}
|
||||
|
||||
if (_stepEvents.Count == 0) continue;
|
||||
|
||||
var obs = _session.State.Contenders[obsId];
|
||||
var filtered = new List<ISimEvent>(_stepEvents.Count);
|
||||
for (int i = 0; i < _session.State.GroundDrops.Count; i++)
|
||||
{
|
||||
var d = _session.State.GroundDrops[i];
|
||||
if (d.PickedUp || peer.SentDropIds.Contains(d.Id)) continue;
|
||||
if (_session.IsPointInPeerPvs(obsId, d.X, _session.State.Terrain.SampleHeight(d.X, d.Z) + 0.5f, d.Z))
|
||||
{
|
||||
peer.SentDropIds.Add(d.Id);
|
||||
filtered.Add(new DropSpawnedEvent
|
||||
{
|
||||
DropId = d.Id,
|
||||
X = d.X,
|
||||
Z = d.Z,
|
||||
ChassisId = d.Chassis?.Id,
|
||||
ModuleId = d.Module?.Id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (int e = 0; e < _stepEvents.Count; e++)
|
||||
{
|
||||
var ev = _stepEvents[e];
|
||||
|
|
@ -547,36 +640,88 @@ namespace RustToDust.Net
|
|||
}
|
||||
break;
|
||||
case ShotFiredEvent shot:
|
||||
bool shooterVisible = _session.IsEntityInPeerPvs(obsId, !shot.IsSpectatorShooter, shot.ShooterId);
|
||||
float dxEnd = shot.EndX - obs.X;
|
||||
float dzEnd = shot.EndZ - obs.Z;
|
||||
if (shooterVisible || (dxEnd * dxEnd + dzEnd * dzEnd) <= 85f * 85f)
|
||||
{
|
||||
bool shooterVisible = shot.IsSpectatorShooter
|
||||
? _session.IsEntityInPeerPvs(obsId, false, shot.ShooterId)
|
||||
: (shot.ShooterId == obsId || _session.IsEntityInPeerPvs(obsId, true, shot.ShooterId));
|
||||
if (shooterVisible)
|
||||
{
|
||||
filtered.Add(shot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HitImpactEvent hit:
|
||||
{
|
||||
bool shooterInPvs = (hit.IsContenderShooter && hit.ShooterId == obsId) ||
|
||||
(hit.ShooterId >= 0 && _session.IsEntityInPeerPvs(obsId, hit.IsContenderShooter, hit.ShooterId));
|
||||
bool deliver = false;
|
||||
if (hit.TargetKind == (byte)HitTargetKind.Contender && hit.TargetId >= 0 && hit.TargetId < peer.ContenderTrackers.Length)
|
||||
{
|
||||
if (hit.TargetId == obsId || _session.IsEntityInPeerPvs(obsId, true, hit.TargetId))
|
||||
bool targetInPvs = hit.TargetId == obsId || _session.IsEntityInPeerPvs(obsId, true, hit.TargetId);
|
||||
if (targetInPvs)
|
||||
{
|
||||
peer.ContenderTrackers[hit.TargetId].AckedDamageVersion = _session.State.Contenders[hit.TargetId].DamageVersion;
|
||||
filtered.Add(hit);
|
||||
deliver = true;
|
||||
}
|
||||
else if (shooterInPvs && _session.IsPointInPeerPvs(obsId, hit.HitX, hit.HitY + 0.35f, hit.HitZ))
|
||||
{
|
||||
deliver = true;
|
||||
}
|
||||
}
|
||||
else if (hit.TargetKind == (byte)HitTargetKind.Spectator)
|
||||
{
|
||||
int specIdx = hit.TargetId >= 1000 ? hit.TargetId - 1000 : hit.TargetId;
|
||||
if (specIdx >= 0 && specIdx < peer.SpectatorTrackers.Length &&
|
||||
_session.IsEntityInPeerPvs(obsId, false, specIdx))
|
||||
bool targetInPvs = specIdx >= 0 && specIdx < peer.SpectatorTrackers.Length &&
|
||||
_session.IsEntityInPeerPvs(obsId, false, specIdx);
|
||||
if (targetInPvs)
|
||||
{
|
||||
peer.SpectatorTrackers[specIdx].AckedDamageVersion = _session.State.Spectators.Spectators[specIdx].Grid.HitSequence;
|
||||
filtered.Add(hit);
|
||||
deliver = true;
|
||||
}
|
||||
else if (shooterInPvs && _session.IsPointInPeerPvs(obsId, hit.HitX, hit.HitY + 0.35f, hit.HitZ))
|
||||
{
|
||||
deliver = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filtered.Add(hit);
|
||||
deliver = shooterInPvs || _session.IsPointInPeerPvs(obsId, hit.HitX, hit.HitY + 0.35f, hit.HitZ);
|
||||
}
|
||||
|
||||
if (deliver)
|
||||
{
|
||||
filtered.Add(shooterInPvs ? hit : ScrubHitShooter(hit));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DropSpawnedEvent ds:
|
||||
if (_session.IsPointInPeerPvs(obsId, ds.X, _session.State.Terrain.SampleHeight(ds.X, ds.Z) + 0.5f, ds.Z))
|
||||
{
|
||||
if (peer.SentDropIds.Add(ds.DropId))
|
||||
{
|
||||
filtered.Add(ds);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DropPickedUpEvent dp:
|
||||
if (dp.ContenderId == obsId ||
|
||||
_session.IsEntityInPeerPvs(obsId, true, dp.ContenderId) ||
|
||||
peer.SentDropIds.Contains(dp.DropId))
|
||||
{
|
||||
peer.SentDropIds.Remove(dp.DropId);
|
||||
filtered.Add(dp);
|
||||
}
|
||||
break;
|
||||
case TerrainStampEvent stamp:
|
||||
if (_session.IsPointInPeerPvs(obsId, stamp.X, _session.State.Terrain.SampleHeight(stamp.X, stamp.Z) + 0.5f, stamp.Z))
|
||||
{
|
||||
filtered.Add(stamp);
|
||||
}
|
||||
break;
|
||||
case OverheatAlertEvent oh:
|
||||
if (oh.ContenderId == obsId)
|
||||
{
|
||||
filtered.Add(oh);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -599,6 +744,37 @@ namespace RustToDust.Net
|
|||
}
|
||||
}
|
||||
|
||||
private static HitImpactEvent ScrubHitShooter(HitImpactEvent hit) => new()
|
||||
{
|
||||
EventId = hit.EventId,
|
||||
HitX = hit.HitX,
|
||||
HitY = hit.HitY,
|
||||
HitZ = hit.HitZ,
|
||||
NormalX = hit.NormalX,
|
||||
NormalY = hit.NormalY,
|
||||
NormalZ = hit.NormalZ,
|
||||
SourceX = hit.HitX,
|
||||
SourceY = hit.HitY,
|
||||
SourceZ = hit.HitZ,
|
||||
TargetKind = hit.TargetKind,
|
||||
TargetId = hit.TargetId,
|
||||
CellX = hit.CellX,
|
||||
CellY = hit.CellY,
|
||||
WeaponClass = hit.WeaponClass,
|
||||
WeaponId = hit.WeaponId,
|
||||
IsAirburst = hit.IsAirburst,
|
||||
Ttl = hit.Ttl,
|
||||
NewCellArmor = hit.NewCellArmor,
|
||||
NewCellTemp = hit.NewCellTemp,
|
||||
NewCoreHp = hit.NewCoreHp,
|
||||
HitSequence = hit.HitSequence,
|
||||
ShooterId = -1,
|
||||
IsContenderShooter = false,
|
||||
ArmorDamage = hit.ArmorDamage,
|
||||
CoreDamage = hit.CoreDamage,
|
||||
Killed = hit.Killed
|
||||
};
|
||||
|
||||
private void BroadcastSnapshots()
|
||||
{
|
||||
if (_peersByEndpoint.Count == 0) return;
|
||||
|
|
@ -765,17 +941,24 @@ namespace RustToDust.Net
|
|||
localAngVel,
|
||||
pvsContenders,
|
||||
walkers,
|
||||
combatSpecs);
|
||||
combatSpecs,
|
||||
out int combatSpecsWritten);
|
||||
|
||||
SendLatestToPeer(peer, corePayload);
|
||||
|
||||
if (neutralSpecsHalf.Count > 0)
|
||||
if (combatSpecsWritten < combatSpecs.Count || neutralSpecsHalf.Count > 0)
|
||||
{
|
||||
var packet2Specs = new List<NetSpectatorState>((combatSpecs.Count - combatSpecsWritten) + neutralSpecsHalf.Count);
|
||||
for (int i = combatSpecsWritten; i < combatSpecs.Count; i++)
|
||||
{
|
||||
packet2Specs.Add(combatSpecs[i]);
|
||||
}
|
||||
packet2Specs.AddRange(neutralSpecsHalf);
|
||||
byte[] orbitPayload = SnapshotCodec.EncodeSpectatorOrbitHalf(
|
||||
_matchGeneration,
|
||||
_snapshotSeq,
|
||||
halfIndex,
|
||||
neutralSpecsHalf);
|
||||
packet2Specs);
|
||||
SendLatestToPeer(peer, orbitPayload);
|
||||
}
|
||||
}
|
||||
|
|
@ -849,12 +1032,25 @@ namespace RustToDust.Net
|
|||
SafeRadius = _session.State.Spectators.SafeRadius,
|
||||
Phase = (byte)(_session.State.Phase == MatchPhase.Completed ? 1 : 0),
|
||||
WinnerContenderId = _session.State.WinnerContenderId,
|
||||
TerrainStamps = new List<TerrainStampEvent>(_terrainStampHistory)
|
||||
ConnectedHumans = ConnectedHumanCount
|
||||
};
|
||||
|
||||
for (int i = 0; i < _terrainStampHistory.Count; i++)
|
||||
{
|
||||
var ts = _terrainStampHistory[i];
|
||||
if (_session.IsPointInPeerPvs(forContenderId, ts.X, _session.State.Terrain.SampleHeight(ts.X, ts.Z) + 0.5f, ts.Z))
|
||||
{
|
||||
dto.TerrainStamps.Add(ts);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _session.State.Contenders.Count; i++)
|
||||
{
|
||||
var c = _session.State.Contenders[i];
|
||||
if (c.Id != forContenderId && !_session.IsEntityInPeerPvs(forContenderId, true, c.Id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dto.Contenders.Add(new ContenderInitialDto
|
||||
{
|
||||
Id = c.Id,
|
||||
|
|
@ -869,6 +1065,10 @@ namespace RustToDust.Net
|
|||
for (int i = 0; i < _session.State.Spectators.Spectators.Count; i++)
|
||||
{
|
||||
var s = _session.State.Spectators.Spectators[i];
|
||||
if (!_session.IsEntityInPeerPvs(forContenderId, false, s.Id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var mounted = new List<MountedSlotDto>(s.Grid.Mounted.Count);
|
||||
for (int m = 0; m < s.Grid.Mounted.Count; m++)
|
||||
{
|
||||
|
|
@ -891,6 +1091,10 @@ namespace RustToDust.Net
|
|||
for (int i = 0; i < _session.State.GroundDrops.Count; i++)
|
||||
{
|
||||
var d = _session.State.GroundDrops[i];
|
||||
if (d.PickedUp || !_session.IsPointInPeerPvs(forContenderId, d.X, _session.State.Terrain.SampleHeight(d.X, d.Z) + 0.5f, d.Z))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
dto.GroundDrops.Add(new GroundDropDto
|
||||
{
|
||||
Id = d.Id,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ namespace RustToDust.Net
|
|||
uint MatchGeneration,
|
||||
uint InputSeq,
|
||||
uint ClientSendMs,
|
||||
PlayerInput Input);
|
||||
PlayerInput Input,
|
||||
ushort InteractSeq = 0);
|
||||
|
||||
public struct NetContenderState
|
||||
{
|
||||
|
|
@ -96,6 +97,7 @@ namespace RustToDust.Net
|
|||
public Vector3 LocalAngVel;
|
||||
public float LocalCoreHp;
|
||||
public float LocalMaxThermalRatio;
|
||||
public float LocalTargetHoverAltAgl;
|
||||
public byte[] LocalCellTempsQuantized = Array.Empty<byte>();
|
||||
public float[] LocalMountedTemps = Array.Empty<float>();
|
||||
public float[] LocalMountedCooldowns = Array.Empty<float>();
|
||||
|
|
@ -199,14 +201,16 @@ namespace RustToDust.Net
|
|||
if (pkt.Input.Brake) flags |= 2;
|
||||
if (pkt.Input.InteractPickup) flags |= 4;
|
||||
span[31] = flags;
|
||||
return buf; // 32-36 B
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(span.Slice(32), pkt.InteractSeq);
|
||||
return buf; // 36 B
|
||||
}
|
||||
|
||||
public static ClientInputPacket DecodeClientInput(ReadOnlySpan<byte> span)
|
||||
public static bool TryDecodeClientInput(ReadOnlySpan<byte> span, out ClientInputPacket pkt)
|
||||
{
|
||||
if (span.Length < 32 || span[0] != (byte)LatestPacketKind.ClientInput)
|
||||
{
|
||||
throw new InvalidOperationException("Invalid ClientInput packet.");
|
||||
pkt = default;
|
||||
return false;
|
||||
}
|
||||
uint gen = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(1));
|
||||
uint seq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(5));
|
||||
|
|
@ -218,7 +222,10 @@ namespace RustToDust.Net
|
|||
float steer = DecodeSnorm16(BinaryPrimitives.ReadInt16LittleEndian(span.Slice(27)));
|
||||
float vert = DecodeSnorm16(BinaryPrimitives.ReadInt16LittleEndian(span.Slice(29)));
|
||||
byte flags = span[31];
|
||||
return new ClientInputPacket(
|
||||
ushort interactSeq = span.Length >= 34
|
||||
? BinaryPrimitives.ReadUInt16LittleEndian(span.Slice(32))
|
||||
: (ushort)0;
|
||||
pkt = new ClientInputPacket(
|
||||
gen,
|
||||
seq,
|
||||
sendMs,
|
||||
|
|
@ -231,7 +238,18 @@ namespace RustToDust.Net
|
|||
(flags & 4) != 0,
|
||||
(flags & 2) != 0,
|
||||
ay,
|
||||
vert));
|
||||
vert),
|
||||
interactSeq);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ClientInputPacket DecodeClientInput(ReadOnlySpan<byte> span)
|
||||
{
|
||||
if (!TryDecodeClientInput(span, out var pkt))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid ClientInput packet.");
|
||||
}
|
||||
return pkt;
|
||||
}
|
||||
|
||||
public static byte[] EncodeCorePvs(
|
||||
|
|
@ -250,7 +268,44 @@ namespace RustToDust.Net
|
|||
Vector3 localAngVel,
|
||||
IReadOnlyList<NetContenderState> pvsContenders,
|
||||
IReadOnlyList<NetWalkerEntry> pvsWalkers,
|
||||
IReadOnlyList<NetSpectatorState> combatSpectators)
|
||||
IReadOnlyList<NetSpectatorState> combatSpectators) =>
|
||||
EncodeCorePvs(
|
||||
matchGeneration,
|
||||
snapshotSeq,
|
||||
simTick,
|
||||
simTime,
|
||||
ackedInputSeq,
|
||||
echoSendMs,
|
||||
safeRadius,
|
||||
phase,
|
||||
winnerContenderId,
|
||||
detectedByCount,
|
||||
contenderPvsMask,
|
||||
localContender,
|
||||
localAngVel,
|
||||
pvsContenders,
|
||||
pvsWalkers,
|
||||
combatSpectators,
|
||||
out _);
|
||||
|
||||
public static byte[] EncodeCorePvs(
|
||||
uint matchGeneration,
|
||||
uint snapshotSeq,
|
||||
uint simTick,
|
||||
float simTime,
|
||||
uint ackedInputSeq,
|
||||
uint echoSendMs,
|
||||
float safeRadius,
|
||||
MatchPhase phase,
|
||||
int? winnerContenderId,
|
||||
byte detectedByCount,
|
||||
ushort contenderPvsMask,
|
||||
ContenderState localContender,
|
||||
Vector3 localAngVel,
|
||||
IReadOnlyList<NetContenderState> pvsContenders,
|
||||
IReadOnlyList<NetWalkerEntry> pvsWalkers,
|
||||
IReadOnlyList<NetSpectatorState> combatSpectators,
|
||||
out int combatSpecsWritten)
|
||||
{
|
||||
Span<byte> buf = stackalloc byte[MaxLatestPayloadBytes];
|
||||
int offset = 0;
|
||||
|
|
@ -293,6 +348,8 @@ namespace RustToDust.Net
|
|||
BinaryPrimitives.WriteSingleLittleEndian(buf.Slice(offset), localAngVel.Z); offset += 4;
|
||||
BinaryPrimitives.WriteSingleLittleEndian(buf.Slice(offset), localContender.Grid.CoreHp); offset += 4;
|
||||
buf[offset++] = EncodeRatioByte(localContender.MaxThermalRatio, maxVal: 1.5f);
|
||||
ushort qHoverAlt = (ushort)Math.Clamp((int)MathF.Round(MathF.Max(0f, localContender.TargetHoverAltAgl) * 100f), 0, ushort.MaxValue);
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(buf.Slice(offset), qHoverAlt); offset += 2;
|
||||
|
||||
int cellCountPos = offset++;
|
||||
int cellCount = 0;
|
||||
|
|
@ -396,76 +453,83 @@ namespace RustToDust.Net
|
|||
specsWritten++;
|
||||
}
|
||||
buf[combatSpecCountPos] = (byte)specsWritten;
|
||||
combatSpecsWritten = specsWritten;
|
||||
|
||||
return buf.Slice(0, offset).ToArray();
|
||||
}
|
||||
|
||||
public static DecodedCorePvsSnapshot DecodeCorePvs(ReadOnlySpan<byte> span)
|
||||
public static bool TryDecodeCorePvs(ReadOnlySpan<byte> span, out DecodedCorePvsSnapshot res)
|
||||
{
|
||||
if (span.Length < 40 || span[0] != (byte)LatestPacketKind.CorePvs)
|
||||
res = null!;
|
||||
if (span.Length < 89 || span[0] != (byte)LatestPacketKind.CorePvs)
|
||||
{
|
||||
throw new InvalidOperationException("Invalid CorePvs snapshot packet.");
|
||||
return false;
|
||||
}
|
||||
int offset = 1;
|
||||
var res = new DecodedCorePvsSnapshot
|
||||
var decoded = new DecodedCorePvsSnapshot
|
||||
{
|
||||
MatchGeneration = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)),
|
||||
};
|
||||
offset += 4;
|
||||
res.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.SimTick = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.SimTime = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.AckedInputSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.EchoSendMs = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.SafeRadius = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.SimTick = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.SimTime = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.AckedInputSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.EchoSendMs = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.SafeRadius = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
|
||||
byte phaseByte = span[offset++];
|
||||
res.Phase = (phaseByte & 1) != 0 ? MatchPhase.Completed : MatchPhase.Active;
|
||||
decoded.Phase = (phaseByte & 1) != 0 ? MatchPhase.Completed : MatchPhase.Active;
|
||||
sbyte winnerRaw = (sbyte)span[offset++];
|
||||
res.WinnerContenderId = (phaseByte & 2) != 0 ? winnerRaw : null;
|
||||
res.DetectedByCount = span[offset++];
|
||||
decoded.WinnerContenderId = (phaseByte & 2) != 0 ? winnerRaw : null;
|
||||
decoded.DetectedByCount = span[offset++];
|
||||
|
||||
ushort arc = BinaryPrimitives.ReadUInt16LittleEndian(span.Slice(offset)); offset += 2;
|
||||
res.InArcWeapons = arc & 0xF;
|
||||
res.OutOfArcWeapons = (arc >> 4) & 0xF;
|
||||
res.DisabledWeapons = (arc >> 8) & 0xF;
|
||||
res.AllWeaponsOutOfArc = (arc & (1 << 12)) != 0;
|
||||
res.ContenderPvsMask = BinaryPrimitives.ReadUInt16LittleEndian(span.Slice(offset)); offset += 2;
|
||||
decoded.InArcWeapons = arc & 0xF;
|
||||
decoded.OutOfArcWeapons = (arc >> 4) & 0xF;
|
||||
decoded.DisabledWeapons = (arc >> 8) & 0xF;
|
||||
decoded.AllWeaponsOutOfArc = (arc & (1 << 12)) != 0;
|
||||
decoded.ContenderPvsMask = BinaryPrimitives.ReadUInt16LittleEndian(span.Slice(offset)); offset += 2;
|
||||
|
||||
res.LocalAlive = (span[offset++] & 1) != 0;
|
||||
res.LocalPos = new Vector3(
|
||||
decoded.LocalAlive = (span[offset++] & 1) != 0;
|
||||
decoded.LocalPos = new Vector3(
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 4)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 8)));
|
||||
offset += 12;
|
||||
res.LocalRot = ReadQuatSnorm16(span.Slice(offset)); offset += 8;
|
||||
res.LocalVel = new Vector3(
|
||||
decoded.LocalRot = ReadQuatSnorm16(span.Slice(offset)); offset += 8;
|
||||
decoded.LocalVel = new Vector3(
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 4)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 8)));
|
||||
offset += 12;
|
||||
res.LocalAngVel = new Vector3(
|
||||
decoded.LocalAngVel = new Vector3(
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 4)),
|
||||
BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset + 8)));
|
||||
offset += 12;
|
||||
res.LocalCoreHp = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.LocalMaxThermalRatio = span[offset++] / 255f * 1.5f;
|
||||
decoded.LocalCoreHp = BinaryPrimitives.ReadSingleLittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.LocalMaxThermalRatio = span[offset++] / 255f * 1.5f;
|
||||
decoded.LocalTargetHoverAltAgl = BinaryPrimitives.ReadUInt16LittleEndian(span.Slice(offset)) / 100f; offset += 2;
|
||||
|
||||
if (offset >= span.Length) return false;
|
||||
int cellCount = span[offset++];
|
||||
res.LocalCellTempsQuantized = span.Slice(offset, cellCount).ToArray();
|
||||
if (cellCount > 64 || offset + cellCount >= span.Length) return false;
|
||||
decoded.LocalCellTempsQuantized = span.Slice(offset, cellCount).ToArray();
|
||||
offset += cellCount;
|
||||
|
||||
int mountedCount = span[offset++];
|
||||
res.LocalMountedTemps = new float[mountedCount];
|
||||
res.LocalMountedCooldowns = new float[mountedCount];
|
||||
if (mountedCount > 16 || offset + mountedCount * 2 >= span.Length) return false;
|
||||
decoded.LocalMountedTemps = new float[mountedCount];
|
||||
decoded.LocalMountedCooldowns = new float[mountedCount];
|
||||
for (int i = 0; i < mountedCount; i++)
|
||||
{
|
||||
res.LocalMountedTemps[i] = ChassisGrid.AmbientTemp + span[offset++] * 2.0f;
|
||||
res.LocalMountedCooldowns[i] = span[offset++] / 25f;
|
||||
decoded.LocalMountedTemps[i] = ChassisGrid.AmbientTemp + span[offset++] * 2.0f;
|
||||
decoded.LocalMountedCooldowns[i] = span[offset++] / 25f;
|
||||
}
|
||||
|
||||
int contenderCount = span[offset++];
|
||||
if (contenderCount > MatchState.ContenderCount || offset + contenderCount * 35 >= span.Length) return false;
|
||||
for (int i = 0; i < contenderCount; i++)
|
||||
{
|
||||
byte slotId = span[offset++];
|
||||
|
|
@ -484,7 +548,7 @@ namespace RustToDust.Net
|
|||
float coreRatio = span[offset++] / 255f;
|
||||
float thermalRatio = span[offset++] / 255f * 1.5f;
|
||||
|
||||
res.Contenders.Add(new NetContenderState
|
||||
decoded.Contenders.Add(new NetContenderState
|
||||
{
|
||||
SlotId = slotId,
|
||||
Alive = (flags & 1) != 0,
|
||||
|
|
@ -507,10 +571,12 @@ namespace RustToDust.Net
|
|||
int walkerCount = span[offset++];
|
||||
for (int i = 0; i < walkerCount; i++)
|
||||
{
|
||||
if (offset + 2 > span.Length) return false;
|
||||
byte tag = span[offset++];
|
||||
bool isContender = (tag & 0x80) != 0;
|
||||
byte entityId = (byte)(tag & 0x7F);
|
||||
int legCount = span[offset++];
|
||||
if (legCount > 4 || offset + legCount * 13 > span.Length) return false;
|
||||
var snap = new WalkerVisualSnapshot { LegCount = legCount };
|
||||
for (int l = 0; l < legCount; l++)
|
||||
{
|
||||
|
|
@ -526,7 +592,7 @@ namespace RustToDust.Net
|
|||
snap.FootNormal[l] = ReadOctNormal(span.Slice(offset)); offset += 2;
|
||||
snap.LoadG[l] = span[offset++] / 50f;
|
||||
}
|
||||
res.Walkers.Add(new NetWalkerEntry
|
||||
decoded.Walkers.Add(new NetWalkerEntry
|
||||
{
|
||||
IsContender = isContender,
|
||||
EntityId = entityId,
|
||||
|
|
@ -534,13 +600,25 @@ namespace RustToDust.Net
|
|||
});
|
||||
}
|
||||
|
||||
if (offset >= span.Length) return false;
|
||||
int specCount = span[offset++];
|
||||
if (offset + specCount * 26 > span.Length) return false;
|
||||
for (int i = 0; i < specCount; i++)
|
||||
{
|
||||
res.CombatSpectators.Add(ReadCompactSpectator(span.Slice(offset)));
|
||||
decoded.CombatSpectators.Add(ReadCompactSpectator(span.Slice(offset)));
|
||||
offset += 26;
|
||||
}
|
||||
|
||||
res = decoded;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static DecodedCorePvsSnapshot DecodeCorePvs(ReadOnlySpan<byte> span)
|
||||
{
|
||||
if (!TryDecodeCorePvs(span, out var res))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid CorePvs snapshot packet.");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -572,26 +650,41 @@ namespace RustToDust.Net
|
|||
return buf.Slice(0, offset).ToArray();
|
||||
}
|
||||
|
||||
public static DecodedSpectatorOrbitSnapshot DecodeSpectatorOrbitHalf(ReadOnlySpan<byte> span)
|
||||
public static bool TryDecodeSpectatorOrbitHalf(ReadOnlySpan<byte> span, out DecodedSpectatorOrbitSnapshot res)
|
||||
{
|
||||
res = null!;
|
||||
if (span.Length < 11 || span[0] != (byte)LatestPacketKind.SpectatorOrbitHalf)
|
||||
{
|
||||
throw new InvalidOperationException("Invalid SpectatorOrbitHalf packet.");
|
||||
return false;
|
||||
}
|
||||
int offset = 1;
|
||||
var res = new DecodedSpectatorOrbitSnapshot
|
||||
var decoded = new DecodedSpectatorOrbitSnapshot
|
||||
{
|
||||
MatchGeneration = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)),
|
||||
};
|
||||
offset += 4;
|
||||
res.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
res.HalfIndex = span[offset++];
|
||||
decoded.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.HalfIndex = span[offset++];
|
||||
int count = span[offset++];
|
||||
if (offset + count * 26 > span.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
res.Spectators.Add(ReadCompactSpectator(span.Slice(offset)));
|
||||
decoded.Spectators.Add(ReadCompactSpectator(span.Slice(offset)));
|
||||
offset += 26;
|
||||
}
|
||||
res = decoded;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static DecodedSpectatorOrbitSnapshot DecodeSpectatorOrbitHalf(ReadOnlySpan<byte> span)
|
||||
{
|
||||
if (!TryDecodeSpectatorOrbitHalf(span, out var res))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid SpectatorOrbitHalf packet.");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -631,31 +724,50 @@ namespace RustToDust.Net
|
|||
return buf.Slice(0, offset).ToArray();
|
||||
}
|
||||
|
||||
public static DecodedRadarContactsSnapshot DecodeRadarContacts(ReadOnlySpan<byte> span)
|
||||
public static bool TryDecodeRadarContacts(ReadOnlySpan<byte> span, out DecodedRadarContactsSnapshot res)
|
||||
{
|
||||
res = null!;
|
||||
if (span.Length < 11 || span[0] != (byte)LatestPacketKind.RadarContacts)
|
||||
{
|
||||
throw new InvalidOperationException("Invalid RadarContacts packet.");
|
||||
return false;
|
||||
}
|
||||
int offset = 1;
|
||||
var res = new DecodedRadarContactsSnapshot
|
||||
var decoded = new DecodedRadarContactsSnapshot
|
||||
{
|
||||
MatchGeneration = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)),
|
||||
};
|
||||
offset += 4;
|
||||
res.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
decoded.SnapshotSeq = BinaryPrimitives.ReadUInt32LittleEndian(span.Slice(offset)); offset += 4;
|
||||
int cCount = span[offset++];
|
||||
if (offset + cCount * 11 >= span.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < cCount; i++)
|
||||
{
|
||||
res.Contenders.Add(ReadRadarContact(span.Slice(offset)));
|
||||
decoded.Contenders.Add(ReadRadarContact(span.Slice(offset)));
|
||||
offset += 11;
|
||||
}
|
||||
int sCount = span[offset++];
|
||||
if (offset + sCount * 11 > span.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < sCount; i++)
|
||||
{
|
||||
res.Spectators.Add(ReadRadarContact(span.Slice(offset)));
|
||||
decoded.Spectators.Add(ReadRadarContact(span.Slice(offset)));
|
||||
offset += 11;
|
||||
}
|
||||
res = decoded;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static DecodedRadarContactsSnapshot DecodeRadarContacts(ReadOnlySpan<byte> span)
|
||||
{
|
||||
if (!TryDecodeRadarContacts(span, out var res))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid RadarContacts packet.");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<RollForward>LatestMajor</RollForward>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<YmirNativeConfiguration Condition="'$(YmirNativeConfiguration)' == ''">Release</YmirNativeConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -125,6 +125,20 @@ namespace RustToDust.Ymir
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerHumanInteract(int contenderId)
|
||||
{
|
||||
if (contenderId >= 0 && contenderId < _pendingInteract.Length)
|
||||
{
|
||||
_pendingInteract[contenderId] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public float? GetWalkerSimTime(bool isContender, int id)
|
||||
{
|
||||
var dict = isContender ? _contenderWalkers : _spectatorWalkers;
|
||||
return dict.TryGetValue(id, out var ws) && ws.Initialized ? ws.SimTime : null;
|
||||
}
|
||||
|
||||
public void DrainStepEvents(List<ISimEvent> dest)
|
||||
{
|
||||
if (_stepEvents.Count == 0)
|
||||
|
|
@ -149,6 +163,22 @@ namespace RustToDust.Ymir
|
|||
return specIdx >= 0 && specIdx < _spectatorPvs.GetLength(1) && _spectatorPvs[observerContenderId, specIdx];
|
||||
}
|
||||
|
||||
public bool IsPointInPeerPvs(int observerContenderId, float tx, float ty, float tz)
|
||||
{
|
||||
if (observerContenderId < 0 || observerContenderId >= State.Contenders.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var obs = State.Contenders[observerContenderId];
|
||||
if (!obs.Alive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
float obsEyeY = MatchRules.GetObserverEyeY(obs.Y, obs.Grid.Spec.HalfHeight);
|
||||
return HasLineOfSight(obs.X, obsEyeY, obs.Z, tx, ty, tz) ||
|
||||
HasLineOfSight(obs.X, obsEyeY + 1.0f, obs.Z, tx, ty + 0.5f, tz);
|
||||
}
|
||||
|
||||
public bool TryEquipCargo(int contenderId, int cargoIndex, string hardpointId) =>
|
||||
State.TryEquipCargo(contenderId, cargoIndex, hardpointId);
|
||||
|
||||
|
|
@ -1714,7 +1744,7 @@ namespace RustToDust.Ymir
|
|||
}
|
||||
}
|
||||
|
||||
_contenderPvs[obs.Id, i] = obsSees || ComputeConservativePvs(obs, pEyeY, c.X, c.Y, c.Z, c.Grid.Spec, distSqC);
|
||||
_contenderPvs[obs.Id, i] = 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))
|
||||
|
|
@ -1771,7 +1801,7 @@ namespace RustToDust.Ymir
|
|||
mem.FaintHorizonPing = horizonPing;
|
||||
}
|
||||
|
||||
_spectatorPvs[obs.Id, i] = obsSees || ComputeConservativePvs(obs, pEyeY, s.X, s.Y, s.Z, s.Grid.Spec, sDistSq);
|
||||
_spectatorPvs[obs.Id, i] = obsSees || ComputeConservativePvs(obs, pEyeY, s.X, s.Y, s.Z, s.Grid.Spec);
|
||||
|
||||
if (s.Stance != SpectatorStance.Neutral &&
|
||||
s.TargetContenderId == obs.Id &&
|
||||
|
|
@ -1791,14 +1821,8 @@ namespace RustToDust.Ymir
|
|||
float tx,
|
||||
float ty,
|
||||
float tz,
|
||||
ChassisSpec targetSpec,
|
||||
float distSq)
|
||||
ChassisSpec targetSpec)
|
||||
{
|
||||
if (distSq <= 65f * 65f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
float aimY = MatchRules.GetTargetAimY(ty, targetSpec.HalfHeight);
|
||||
if (HasLineOfSight(obs.X, obsEyeY + 1.0f, obs.Z, tx, aimY, tz))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<YmirNativeConfiguration Condition="'$(YmirNativeConfiguration)' == ''">Release</YmirNativeConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -195,6 +195,33 @@ namespace RustToDust.Ymir
|
|||
public float RecoilKneeImpulse;
|
||||
}
|
||||
|
||||
public struct WalkerCheckpoint
|
||||
{
|
||||
public int GeomLegCount;
|
||||
public float GeomScale;
|
||||
public bool Initialized;
|
||||
public int StanceGroup;
|
||||
public float SwingTime;
|
||||
public float SwingPhase;
|
||||
public float SimTime;
|
||||
public bool IsAirborne;
|
||||
public bool WasAirborne;
|
||||
public float MaxFootSlipM;
|
||||
public Vector3 LastTotalForce;
|
||||
public Vector3 LastTotalTorque;
|
||||
public LegArray4<bool> Planted;
|
||||
public LegArray4<Vector3> FootSole;
|
||||
public LegArray4<Vector3> SwingStartSole;
|
||||
public LegArray4<Vector3> SwingTargetSole;
|
||||
public LegArray4<Vector3> FootNormal;
|
||||
public LegArray4<Vector3> SwingStartNormal;
|
||||
public LegArray4<Vector3> SwingTargetNormal;
|
||||
public LegArray4<float> LastGrfY;
|
||||
public LegArray4<WalkerJointActuator> Actuators;
|
||||
public WalkerVisualSnapshot PrevSnap;
|
||||
public WalkerVisualSnapshot CurrSnap;
|
||||
}
|
||||
|
||||
public sealed class WalkerState
|
||||
{
|
||||
public const float ArenaGravity = 20f;
|
||||
|
|
@ -305,6 +332,58 @@ namespace RustToDust.Ymir
|
|||
PrevSnap = CurrSnap;
|
||||
}
|
||||
|
||||
public WalkerCheckpoint CaptureCheckpoint() => new()
|
||||
{
|
||||
GeomLegCount = Geom.LegCount,
|
||||
GeomScale = GeomScale,
|
||||
Initialized = Initialized,
|
||||
StanceGroup = StanceGroup,
|
||||
SwingTime = SwingTime,
|
||||
SwingPhase = SwingPhase,
|
||||
SimTime = SimTime,
|
||||
IsAirborne = IsAirborne,
|
||||
WasAirborne = WasAirborne,
|
||||
MaxFootSlipM = MaxFootSlipM,
|
||||
LastTotalForce = LastTotalForce,
|
||||
LastTotalTorque = LastTotalTorque,
|
||||
Planted = Planted,
|
||||
FootSole = FootSole,
|
||||
SwingStartSole = SwingStartSole,
|
||||
SwingTargetSole = SwingTargetSole,
|
||||
FootNormal = FootNormal,
|
||||
SwingStartNormal = SwingStartNormal,
|
||||
SwingTargetNormal = SwingTargetNormal,
|
||||
LastGrfY = LastGrfY,
|
||||
Actuators = Actuators,
|
||||
PrevSnap = PrevSnap,
|
||||
CurrSnap = CurrSnap
|
||||
};
|
||||
|
||||
public void RestoreCheckpoint(in WalkerCheckpoint cp)
|
||||
{
|
||||
Initialized = cp.Initialized;
|
||||
StanceGroup = cp.StanceGroup;
|
||||
SwingTime = cp.SwingTime;
|
||||
SwingPhase = cp.SwingPhase;
|
||||
SimTime = cp.SimTime;
|
||||
IsAirborne = cp.IsAirborne;
|
||||
WasAirborne = cp.WasAirborne;
|
||||
MaxFootSlipM = cp.MaxFootSlipM;
|
||||
LastTotalForce = cp.LastTotalForce;
|
||||
LastTotalTorque = cp.LastTotalTorque;
|
||||
Planted = cp.Planted;
|
||||
FootSole = cp.FootSole;
|
||||
SwingStartSole = cp.SwingStartSole;
|
||||
SwingTargetSole = cp.SwingTargetSole;
|
||||
FootNormal = cp.FootNormal;
|
||||
SwingStartNormal = cp.SwingStartNormal;
|
||||
SwingTargetNormal = cp.SwingTargetNormal;
|
||||
LastGrfY = cp.LastGrfY;
|
||||
Actuators = cp.Actuators;
|
||||
PrevSnap = cp.PrevSnap;
|
||||
CurrSnap = cp.CurrSnap;
|
||||
}
|
||||
|
||||
public void SyncBodyPoseOnly(Vector3 comPos, Quaternion qBody, float mass)
|
||||
{
|
||||
CurrSnap.ComPos = comPos;
|
||||
|
|
|
|||
|
|
@ -332,6 +332,401 @@ namespace RustToDust.Tests
|
|||
Assert.Equal(0, host.ConnectedHumanCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cut5cFix1_Sion30mAcrossBuilding_OmitsOccludedRivalFromInitialStateCorePvsAndEvents()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, 0, seed: 42, ArenaMapKind.Sion, maxHumans: 12, autoRestartSec: 0);
|
||||
var ep = new IPEndPoint(IPAddress.Loopback, host.BoundPort);
|
||||
|
||||
// Pick a solid Sion Old Town building ~30m wide and place contender 0 & 1 on opposite sides BEFORE client B joins!
|
||||
var sion = host.Session.State.SionMap!;
|
||||
var terrain = host.Session.State.Terrain;
|
||||
float halfH = Catalog.Jackal.HalfHeight;
|
||||
SionBuildingAabb? chosen = null;
|
||||
float z1 = 0f, z2 = 0f;
|
||||
for (int i = 0; i < sion.Buildings.Count; i++)
|
||||
{
|
||||
var b = sion.Buildings[i];
|
||||
if (b.Class != "Gebaeude Einzelhaus" || b.HalfX < 6f || b.HalfZ < 6f || (b.RoofY - b.GroundY) < 9f ||
|
||||
MathF.Abs(b.CenterX) > 600f || MathF.Abs(b.CenterZ) > 600f)
|
||||
continue;
|
||||
float candZ1 = b.CenterZ - b.HalfZ - 5f;
|
||||
float candZ2 = b.CenterZ + b.HalfZ + 5f;
|
||||
if (MathF.Abs(candZ2 - candZ1) > 48f) continue;
|
||||
if (sion.IsInsideAnyBuildingXz(b.CenterX, candZ1, 3.5f) || sion.IsInsideAnyBuildingXz(b.CenterX, candZ2, 3.5f))
|
||||
continue;
|
||||
float y1 = terrain.SampleHeight(b.CenterX, candZ1) + halfH + 0.15f;
|
||||
float y2 = terrain.SampleHeight(b.CenterX, candZ2) + halfH + 0.15f;
|
||||
if (!host.Session.HasLineOfSight(b.CenterX, MatchRules.GetObserverEyeY(y1, halfH), candZ1,
|
||||
b.CenterX, MatchRules.GetTargetAimY(y2, halfH), candZ2))
|
||||
{
|
||||
chosen = b;
|
||||
z1 = candZ1;
|
||||
z2 = candZ2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assert.NotNull(chosen);
|
||||
var building = chosen!.Value;
|
||||
|
||||
using var clientA = new RemoteArenaSession(ep, "Alpha");
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
Assert.True(PumpUntil(host, new[] { clientA }, () => clientA.IsJoined, ref nowMs, 3000));
|
||||
int slotA = clientA.LocalContenderId;
|
||||
|
||||
// Place A on side 1, and pick an AI/B slot on side 2 (~30m away across the building) BEFORE clientB joins
|
||||
int slotB = (slotA + 1) % MatchState.ContenderCount;
|
||||
host.Session.SetContenderPose(slotA, building.CenterX, z1, 0f);
|
||||
host.Session.SetContenderPose(slotB, building.CenterX, z2, MathF.PI);
|
||||
host.Session.State.SpawnChassisDrop(building.CenterX, z2 + 2f, Catalog.Anvil);
|
||||
host.StepOnce(nowMs += 16);
|
||||
|
||||
// Re-place B after step and join B while A & B are ~30m apart across the building
|
||||
host.Session.SetContenderPose(slotA, building.CenterX, z1, 0f);
|
||||
host.Session.SetContenderPose(slotB, building.CenterX, z2, MathF.PI);
|
||||
host.StepOnce(nowMs += 16);
|
||||
|
||||
Assert.False(host.Session.IsEntityInPeerPvs(slotA, true, slotB),
|
||||
"Occluded rival 30m across Sion building must NOT be in Peer A PVS (no 65m blind bypass)");
|
||||
|
||||
using var clientB = new RemoteArenaSession(ep, "Bravo");
|
||||
Assert.True(PumpUntil(host, new[] { clientA, clientB }, () => clientB.IsJoined, ref nowMs, 3000));
|
||||
int realSlotB = clientB.LocalContenderId;
|
||||
|
||||
// Verify InitialMatchStateDto omits occluded rival at ~30m across Sion building:
|
||||
// Retire clientA, pin slotA at z1 and slotB at z2, then reconnect clientA with its token!
|
||||
Guid tokenA = clientA.ReconnectToken;
|
||||
clientA.DisconnectGracefully("RejoinTest");
|
||||
clientA.Dispose();
|
||||
for (int t = 0; t < 35; t++)
|
||||
{
|
||||
host.Session.SetContenderPose(slotA, building.CenterX, z1, 0f);
|
||||
host.Session.SetContenderPose(realSlotB, building.CenterX, z2, MathF.PI);
|
||||
nowMs += 16;
|
||||
host.StepOnce(nowMs);
|
||||
clientB.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
using var clientARejoin = new RemoteArenaSession(ep, "Alpha", tokenA);
|
||||
Assert.True(PumpUntil(host, new[] { clientARejoin, clientB }, () => clientARejoin.IsJoined, ref nowMs, 3000));
|
||||
Assert.Equal(slotA, clientARejoin.LocalContenderId);
|
||||
Assert.False(clientARejoin.IsContenderVisible(realSlotB), "Occluded rival 30m across building must not be visible in InitialMatchStateDto");
|
||||
Assert.Equal(0f, clientARejoin.ViewState.Contenders[realSlotB].X);
|
||||
Assert.Equal(0f, clientARejoin.ViewState.Contenders[realSlotB].Z);
|
||||
|
||||
// Re-pin & test live events while occluded behind building
|
||||
host.Session.SetContenderPose(slotA, building.CenterX, z1, 0f);
|
||||
host.Session.SetContenderPose(realSlotB, building.CenterX, z2, MathF.PI);
|
||||
if (host.Session.State.ObserverStates.TryGetValue(slotA, out var obsA)) obsA.ContenderContacts.Remove(realSlotB);
|
||||
|
||||
int dropsBefore = clientARejoin.ViewState.GroundDrops.Count(d => !d.PickedUp && Vector2.Distance(new Vector2(d.X, d.Z), new Vector2(building.CenterX, z2)) < 12f);
|
||||
host.Session.State.SpawnChassisDrop(building.CenterX, z2 + 3f, Catalog.Paladin);
|
||||
int hitsBefore = clientARejoin.ViewState.HitEvents.Count;
|
||||
int tracersBefore = clientARejoin.ViewState.Tracers.Count;
|
||||
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
clientARejoin.SubmitLocalInput(new PlayerInput(0f, 0f, building.CenterX, z1 - 10f, false, false, false), true);
|
||||
clientB.SubmitLocalInput(new PlayerInput(0f, 0f, building.CenterX + 3f, z2 + 6f, Fire: true, false, false, AimWorldY: terrain.SampleHeight(building.CenterX + 3f, z2 + 6f)), true);
|
||||
nowMs += 16;
|
||||
host.StepOnce(nowMs);
|
||||
clientARejoin.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
clientB.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
Assert.False(host.Session.IsEntityInPeerPvs(slotA, true, realSlotB));
|
||||
Assert.False(clientARejoin.IsContenderVisible(realSlotB));
|
||||
int dropsAfter = clientARejoin.ViewState.GroundDrops.Count(d => !d.PickedUp && Vector2.Distance(new Vector2(d.X, d.Z), new Vector2(building.CenterX, z2)) < 12f);
|
||||
Assert.Equal(dropsBefore, dropsAfter);
|
||||
// Any HitImpactEvent or ShotFiredEvent from occluded B behind the building must NOT leak B's coordinates to A!
|
||||
for (int i = tracersBefore; i < clientARejoin.ViewState.Tracers.Count; i++)
|
||||
{
|
||||
var tr = clientARejoin.ViewState.Tracers[i];
|
||||
Assert.True(Vector2.Distance(new Vector2(tr.StartX, tr.StartZ), new Vector2(building.CenterX, z2)) > 5f,
|
||||
"Occluded ShotFiredEvent must not leak rival shooter coords");
|
||||
}
|
||||
for (int i = hitsBefore; i < clientARejoin.ViewState.HitEvents.Count; i++)
|
||||
{
|
||||
var he = clientARejoin.ViewState.HitEvents[i];
|
||||
Assert.True(Vector2.Distance(new Vector2(he.SourceX, he.SourceZ), new Vector2(building.CenterX, z2)) > 5f,
|
||||
"Occluded HitImpactEvent must scrub SourceX/Y/Z if shooter not in PVS");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cut5cFix2_WalkerGaitClock_ChassisSwapSink_AndSpectatorWalkerSync()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, 0, seed: 42, ArenaMapKind.Desert, maxHumans: 12, autoRestartSec: 0);
|
||||
var serverEp = new IPEndPoint(IPAddress.Loopback, host.BoundPort);
|
||||
|
||||
// Real 120ms RTT UDP delay proxy (60ms uplink + 60ms downlink)
|
||||
using var proxyToClient = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp) { Blocking = false };
|
||||
using var proxyToServer = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp) { Blocking = false };
|
||||
proxyToClient.Bind(new IPEndPoint(IPAddress.Loopback, 0));
|
||||
proxyToServer.Bind(new IPEndPoint(IPAddress.Loopback, 0));
|
||||
var proxyEp = new IPEndPoint(IPAddress.Loopback, ((IPEndPoint)proxyToClient.LocalEndPoint!).Port);
|
||||
|
||||
var uplink = new Queue<(long DeliverMs, byte[] Data)>();
|
||||
var downlink = new Queue<(long DeliverMs, byte[] Data)>();
|
||||
EndPoint? clientRemoteEp = null;
|
||||
void PumpProxy(long tMs, int oneWayMs)
|
||||
{
|
||||
var buf = new byte[4096];
|
||||
while (proxyToClient.Available > 0)
|
||||
{
|
||||
EndPoint from = new IPEndPoint(IPAddress.Any, 0);
|
||||
int n = proxyToClient.ReceiveFrom(buf, ref from);
|
||||
clientRemoteEp = from;
|
||||
uplink.Enqueue((tMs + oneWayMs, buf.AsSpan(0, n).ToArray()));
|
||||
}
|
||||
while (proxyToServer.Available > 0)
|
||||
{
|
||||
EndPoint from = new IPEndPoint(IPAddress.Any, 0);
|
||||
int n = proxyToServer.ReceiveFrom(buf, ref from);
|
||||
downlink.Enqueue((tMs + oneWayMs, buf.AsSpan(0, n).ToArray()));
|
||||
}
|
||||
while (uplink.Count > 0 && uplink.Peek().DeliverMs <= tMs)
|
||||
{
|
||||
proxyToServer.SendTo(uplink.Dequeue().Data, serverEp);
|
||||
}
|
||||
while (downlink.Count > 0 && downlink.Peek().DeliverMs <= tMs && clientRemoteEp is not null)
|
||||
{
|
||||
proxyToClient.SendTo(downlink.Dequeue().Data, clientRemoteEp);
|
||||
}
|
||||
}
|
||||
|
||||
using var client = new RemoteArenaSession(proxyEp, "Walker");
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
var deadline = DateTimeOffset.UtcNow.AddMilliseconds(4000);
|
||||
while (DateTimeOffset.UtcNow < deadline && !client.IsJoined)
|
||||
{
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.PumpNetwork(nowMs);
|
||||
Thread.Sleep(2);
|
||||
}
|
||||
Assert.True(client.IsJoined);
|
||||
int slot = client.LocalContenderId;
|
||||
|
||||
// a) Swap local contender to Paladin (biped walker), walk 2.0s @ 120ms simulated RTT
|
||||
host.Session.SetContenderPose(slot, 0f, 0f, 0f);
|
||||
host.Session.State.SpawnChassisDrop(0f, 0f, Catalog.Paladin);
|
||||
Assert.True(host.Session.TrySwapNearbyChassis(slot));
|
||||
for (int t = 0; t < 16; t++)
|
||||
{
|
||||
client.SubmitLocalInput(new PlayerInput(0f, 0f, 0f, 120f, false, false, false), true);
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
float clientStartTime = client.PredictedWalkerSimTime ?? 0f;
|
||||
float serverStartTime = host.Session.GetWalkerSimTime(true, slot) ?? 0f;
|
||||
int maxUnackedObserved = 0;
|
||||
for (int t = 0; t < 120; t++)
|
||||
{
|
||||
client.SubmitLocalInput(new PlayerInput(0.8f, 0f, 0f, 120f, false, false, false), true);
|
||||
maxUnackedObserved = Math.Max(maxUnackedObserved, client.UnackedInputCount);
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
Assert.True(maxUnackedObserved >= 5, $"Expected >=5 unacked inputs under 120ms RTT, saw {maxUnackedObserved}");
|
||||
|
||||
float? serverWalkerTime = host.Session.GetWalkerSimTime(true, slot);
|
||||
float? clientWalkerTime = client.PredictedWalkerSimTime;
|
||||
Assert.NotNull(serverWalkerTime);
|
||||
Assert.NotNull(clientWalkerTime);
|
||||
float clientDelta = clientWalkerTime!.Value - clientStartTime;
|
||||
float serverDelta = serverWalkerTime!.Value - serverStartTime;
|
||||
Assert.True(MathF.Abs(clientDelta - serverDelta) <= 0.20f,
|
||||
$"Walker SimTime must track 1x within +-0.20s (no 4.83x overdrive): client={clientDelta:F3}s server={serverDelta:F3}s");
|
||||
|
||||
// b) Mid-match Jackal -> Breaker chassis swap must produce 0.0m vertical underground _predErrorPos
|
||||
host.Session.State.SpawnChassisDrop(host.Session.State.Contenders[slot].X, host.Session.State.Contenders[slot].Z, Catalog.Jackal);
|
||||
Assert.True(host.Session.TrySwapNearbyChassis(slot));
|
||||
for (int t = 0; t < 16; t++)
|
||||
{
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
var cServer = host.Session.State.Contenders[slot];
|
||||
host.Session.State.SpawnChassisDrop(cServer.X, cServer.Z, Catalog.Breaker);
|
||||
Assert.True(host.Session.TrySwapNearbyChassis(slot));
|
||||
for (int t = 0; t < 16; t++)
|
||||
{
|
||||
client.SubmitLocalInput(new PlayerInput(0f, 0f, cServer.X, cServer.Z + 120f, false, false, false), true);
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
var visPos = client.GetInterpolatedContenderPose(slot, 1f).Pos;
|
||||
float gh = host.Session.State.Terrain.SampleHeight(visPos.X, visPos.Z);
|
||||
Assert.True(visPos.Y >= gh + Catalog.Jackal.HalfHeight * 0.5f,
|
||||
$"Jackal->Breaker swap must not sink underground: visY={visPos.Y:F3}m gh={gh:F3}m");
|
||||
Assert.True(MathF.Abs(client.CurrentPredictionError.Y) < 0.15f,
|
||||
$"Jackal->Breaker swap must not accumulate vertical sink error: predErrorY={client.CurrentPredictionError.Y:F3}m");
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
|
||||
// c) Combat spectator walker (Exemplar) has valid GeomScale > 0, IsDigitigrade, non-zero ComRot, and synced Exemplar HP/armor
|
||||
var exemplar = host.Session.State.Spectators.Spectators.First(s => s.Tier == SpectatorTier.Exemplar && s.Alive);
|
||||
exemplar.Stance = SpectatorStance.Provoked;
|
||||
exemplar.TargetContenderId = slot;
|
||||
host.Session.SetContenderPose(slot, exemplar.X, exemplar.Z - 24f, 0f);
|
||||
for (int t = 0; t < 20; t++)
|
||||
{
|
||||
nowMs += 16;
|
||||
PumpProxy(nowMs, 60);
|
||||
host.StepOnce(nowMs);
|
||||
PumpProxy(nowMs, 60);
|
||||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
Assert.True(client.TrySampleInterpolatedWalkerPose(false, exemplar.Id, 1f, out var exSnap),
|
||||
"Combat Exemplar walker snapshot should be available");
|
||||
Assert.True(exSnap.GeomScale > 0.1f, $"Exemplar GeomScale must be > 0, got {exSnap.GeomScale}");
|
||||
Assert.True(exSnap.IsDigitigrade, "Exemplar walker must have IsDigitigrade=true");
|
||||
Assert.True(exSnap.ComRot.LengthSquared() > 0.5f, "Exemplar walker ComRot must be valid normalized quaternion");
|
||||
var clientExemplar = client.ViewState.Spectators.Spectators.First(s => s.Id == exemplar.Id);
|
||||
Assert.Equal(SpectatorRing.ExemplarSpec.Id, clientExemplar.Grid.Spec.Id);
|
||||
Assert.InRange(clientExemplar.Grid.CoreHp, exemplar.Grid.CoreHp - 1f, exemplar.Grid.CoreHp + 1f);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cut5cFix4_Packet2OverflowDeliversAll10CombatSpectators_AndMalformedPacketDoesNotThrow()
|
||||
{
|
||||
var state = new MatchState(seed: 42, ArenaMapKind.Desert);
|
||||
var local = state.Contenders[0];
|
||||
local.Grid.SwapChassis(Catalog.Bastion); // large 8x8 local grid
|
||||
|
||||
var contenders = new List<NetContenderState>(12);
|
||||
var walkers = new List<NetWalkerEntry>(12);
|
||||
var combatSpecs = new List<NetSpectatorState>(10);
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
contenders.Add(new NetContenderState
|
||||
{
|
||||
SlotId = (byte)i,
|
||||
Alive = true,
|
||||
IsHuman = true,
|
||||
Pos = new Vector3(i * 8f, 3f, 0f),
|
||||
Rot = Quaternion.Identity,
|
||||
CoreHpRatio = 1f
|
||||
});
|
||||
var ws = new WalkerVisualSnapshot { LegCount = 4 };
|
||||
for (int l = 0; l < 4; l++) ws.FootNormal[l] = Vector3.UnitY;
|
||||
walkers.Add(new NetWalkerEntry { IsContender = true, EntityId = (byte)i, Snapshot = ws });
|
||||
}
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
combatSpecs.Add(new NetSpectatorState
|
||||
{
|
||||
Id = (byte)i,
|
||||
Alive = true,
|
||||
Stance = SpectatorStance.Provoked,
|
||||
TargetContenderId = 0,
|
||||
Pos = new Vector3(40f + i * 4f, 3f, -20f),
|
||||
Rot = Quaternion.Identity
|
||||
});
|
||||
}
|
||||
|
||||
byte[] p1 = SnapshotCodec.EncodeCorePvs(
|
||||
1, 7, 14, 0.25f, 5, 100, 450f, MatchPhase.Active, null, 1, 0xFFF,
|
||||
local, Vector3.Zero, contenders, walkers, combatSpecs, out int writtenInP1);
|
||||
byte[] w1 = SnapshotCodec.WrapLatest(p1, 1, 1);
|
||||
|
||||
var packet2List = new List<NetSpectatorState>();
|
||||
for (int i = writtenInP1; i < combatSpecs.Count; i++) packet2List.Add(combatSpecs[i]);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
packet2List.Add(new NetSpectatorState
|
||||
{
|
||||
Id = (byte)(20 + i),
|
||||
Alive = true,
|
||||
Stance = SpectatorStance.Neutral,
|
||||
TargetContenderId = -1,
|
||||
Pos = new Vector3(200f, 3f, 200f),
|
||||
Rot = Quaternion.Identity
|
||||
});
|
||||
}
|
||||
byte[] p2 = SnapshotCodec.EncodeSpectatorOrbitHalf(1, 7, 0, packet2List);
|
||||
byte[] w2 = SnapshotCodec.WrapLatest(p2, 1, 2);
|
||||
|
||||
Assert.True(w1.Length <= SnapshotCodec.MaxLatestDatagramBytes);
|
||||
Assert.True(w2.Length <= SnapshotCodec.MaxLatestDatagramBytes);
|
||||
|
||||
var dec1 = SnapshotCodec.DecodeCorePvs(SnapshotCodec.Unwrap(w1).Payload.Span);
|
||||
var dec2 = SnapshotCodec.DecodeSpectatorOrbitHalf(SnapshotCodec.Unwrap(w2).Payload.Span);
|
||||
var deliveredCombatIds = dec1.CombatSpectators.Select(s => s.Id)
|
||||
.Concat(dec2.Spectators.Where(s => s.Stance != SpectatorStance.Neutral).Select(s => s.Id))
|
||||
.OrderBy(id => id)
|
||||
.ToList();
|
||||
Assert.Equal(Enumerable.Range(0, 10).Select(i => (byte)i).ToList(), deliveredCombatIds);
|
||||
|
||||
// b) Malformed 120B packet with cellCount=200 must return false cleanly without throwing!
|
||||
byte[] bad = new byte[120];
|
||||
bad[0] = (byte)LatestPacketKind.CorePvs;
|
||||
bad[88] = 200; // cellCount = 200 > 64 and > remaining bytes
|
||||
Assert.False(SnapshotCodec.TryDecodeCorePvs(bad, out _));
|
||||
bad[0] = (byte)LatestPacketKind.SpectatorOrbitHalf;
|
||||
bad[10] = 250;
|
||||
Assert.False(SnapshotCodec.TryDecodeSpectatorOrbitHalf(bad, out _));
|
||||
bad[0] = (byte)LatestPacketKind.RadarContacts;
|
||||
bad[9] = 250;
|
||||
Assert.False(SnapshotCodec.TryDecodeRadarContacts(bad, out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cut5cFix5_TimedOutClientDisconnectsCleanly_AndDeadSlotReconnectIsRejected()
|
||||
{
|
||||
using var host = new ServerMatchHost(IPAddress.Loopback, 0, seed: 42, ArenaMapKind.Desert, maxHumans: 12, autoRestartSec: 0);
|
||||
var ep = new IPEndPoint(IPAddress.Loopback, host.BoundPort);
|
||||
|
||||
using var client = new RemoteArenaSession(ep, "Ghost");
|
||||
long nowMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
Assert.True(PumpUntil(host, new[] { client }, () => client.IsJoined, ref nowMs, 3000));
|
||||
int slot = client.LocalContenderId;
|
||||
Guid token = client.ReconnectToken;
|
||||
Assert.True(client.ConnectionStatus.Connected);
|
||||
|
||||
// a) Simulate > 6000ms server silence -> client MUST transition to Disconnected (not stuck Connected)!
|
||||
client.PumpNetwork(nowMs + 7000);
|
||||
Assert.False(client.ConnectionStatus.Connected);
|
||||
Assert.False(client.IsJoined);
|
||||
Assert.Contains("DISCONNECTED", client.ConnectionStatus.StateLabel, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// Server also times out client & destroys that slot's chassis
|
||||
nowMs += ServerMatchHost.IdleTimeoutMs + 500;
|
||||
host.StepOnce(nowMs);
|
||||
var deadContender = host.Session.State.Contenders[slot];
|
||||
deadContender.Grid.ApplyReplicatedDamage(0, 0, 0f, 20f, 0f, deadContender.Grid.HitSequence + 1);
|
||||
Assert.False(deadContender.Alive);
|
||||
|
||||
// b) Reconnecting with dead-slot ReconnectToken MUST be rejected cleanly instead of hijacking another AI slot!
|
||||
using var deadReconnect = new RemoteArenaSession(ep, "Ghost", token);
|
||||
Assert.False(PumpUntil(host, new[] { deadReconnect }, () => deadReconnect.IsJoined, ref nowMs, 800));
|
||||
Assert.NotNull(deadReconnect.ConnectionStatus.LastError);
|
||||
Assert.Contains("destroyed", deadReconnect.ConnectionStatus.LastError!, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Equal(0, host.ConnectedHumanCount);
|
||||
}
|
||||
|
||||
private static bool PumpUntil(
|
||||
ServerMatchHost host,
|
||||
RemoteArenaSession[] clients,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
<YmirNativeConfiguration Condition="'$(YmirNativeConfiguration)' == ''">Release</YmirNativeConfiguration>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue