Skip to content

Commit a47d4d4

Browse files
Update value for maximum delayed packets
1 parent 0ae5257 commit a47d4d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,12 @@ public NetworkSettings GetDefaultNetworkSettings()
517517
// package. We just need to initialize the settings since otherwise these features will
518518
// not be enabled at all in the driver.
519519
settings.WithSimulatorStageParameters(
520-
maxPacketCount: 300, // TODO Is there any way to compute a better value?
520+
// Assuming a maximum average latency of 50 ms, and that we're somehow able to flush
521+
// an entire reliable window every tick, then at 60 ticks per second we need to be
522+
// able to store 60 * 0.05 * 64 = 192 packets per connection in the simulator
523+
// pipeline stage. Double that since we handle both directions and round it up, and
524+
// that's how we get 400 here.
525+
maxPacketCount: 400,
521526
randomSeed: DebugSimulatorRandomSeed ?? (uint)System.Diagnostics.Stopwatch.GetTimestamp());
522527
settings.WithNetworkSimulatorParameters();
523528
#endif

0 commit comments

Comments
 (0)