mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
LatencySimulation: syntax / readonly
This commit is contained in:
parent
c5abaef4cf
commit
5d1b041b69
@ -30,6 +30,7 @@ public class LatencySimulation : Transport
|
||||
[Tooltip("Jitter latency via perlin(Time * jitterSpeed) * jitter")]
|
||||
[FormerlySerializedAs("latencySpikeMultiplier")]
|
||||
[Range(0, 1)] public float jitter = 0.02f;
|
||||
|
||||
[Tooltip("Jitter latency via perlin(Time * jitterSpeed) * jitter")]
|
||||
[FormerlySerializedAs("latencySpikeSpeedMultiplier")]
|
||||
public float jitterSpeed = 1;
|
||||
@ -44,24 +45,26 @@ public class LatencySimulation : Transport
|
||||
[Header("Unreliable Messages")]
|
||||
[Tooltip("Packet loss in %\n2% recommended for long term play testing, upto 5% for short bursts.\nAnything higher, or for a prolonged amount of time, suggests user has a connection fault.")]
|
||||
[Range(0, 100)] public float unreliableLoss = 2;
|
||||
|
||||
[Tooltip("Unreliable latency in milliseconds (1000 = 1 second) \n100ms recommended for long term play testing, upto 500ms for short bursts.\nAnything higher, or for a prolonged amount of time, suggests user has a connection fault.")]
|
||||
[Range(0, 10000)] public float unreliableLatency = 100;
|
||||
|
||||
[Tooltip("Scramble % of unreliable messages, just like over the real network. Mirror unreliable is unordered.")]
|
||||
[Range(0, 100)] public float unreliableScramble = 2;
|
||||
|
||||
// message queues
|
||||
// list so we can insert randomly (scramble)
|
||||
List<QueuedMessage> reliableClientToServer = new List<QueuedMessage>();
|
||||
List<QueuedMessage> reliableServerToClient = new List<QueuedMessage>();
|
||||
List<QueuedMessage> unreliableClientToServer = new List<QueuedMessage>();
|
||||
List<QueuedMessage> unreliableServerToClient = new List<QueuedMessage>();
|
||||
readonly List<QueuedMessage> reliableClientToServer = new List<QueuedMessage>();
|
||||
readonly List<QueuedMessage> reliableServerToClient = new List<QueuedMessage>();
|
||||
readonly List<QueuedMessage> unreliableClientToServer = new List<QueuedMessage>();
|
||||
readonly List<QueuedMessage> unreliableServerToClient = new List<QueuedMessage>();
|
||||
|
||||
// random
|
||||
// UnityEngine.Random.value is [0, 1] with both upper and lower bounds inclusive
|
||||
// but we need the upper bound to be exclusive, so using System.Random instead.
|
||||
// => NextDouble() is NEVER < 0 so loss=0 never drops!
|
||||
// => NextDouble() is ALWAYS < 1 so loss=1 always drops!
|
||||
System.Random random = new System.Random();
|
||||
readonly System.Random random = new System.Random();
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user