diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 3bfeaadbb9..e4ba64a1f0 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -9,6 +9,10 @@ Additional documentation and release notes are available at [Multiplayer Documen ## [Unreleased] +### Changed + +- The debug simulator in `UnityTransport` is now non-deterministic. Its random number generator used to be seeded with a constant value, leading to the same pattern of packet drops, delays, and jitter in every run. (#2196) + ### Fixed - Fixed ILPP `TypeLoadException` on WebGL on MacOS Editor and potentially other platforms. (#2199) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index d209d8b856..d5de9abfd9 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -337,7 +337,7 @@ public struct SimulatorParameters PacketDropRate = 0 }; - internal uint DebugSimulatorRandomSeed { get; set; } = 0; + internal uint? DebugSimulatorRandomSeed { get; set; } = null; private struct PacketLossCache { @@ -1325,7 +1325,7 @@ private void ConfigureSimulator() packetDelayMs: DebugSimulator.PacketDelayMS, packetJitterMs: DebugSimulator.PacketJitterMS, packetDropPercentage: DebugSimulator.PacketDropRate, - randomSeed: DebugSimulatorRandomSeed + randomSeed: DebugSimulatorRandomSeed ?? (uint)System.Diagnostics.Stopwatch.GetTimestamp() #if UTP_TRANSPORT_2_0_ABOVE , mode: ApplyMode.AllPackets #endif