Struct SimulatorUtility.Parameters
Configuration parameters for the simulator pipeline stage.
Implements
Inherited Members
Namespace: Unity.Networking.Transport.Utilities
Assembly: Unity.Networking.Transport.dll
Syntax
[Serializable]
public struct SimulatorUtility.Parameters : INetworkParameter
Fields
FuzzFactor
The fuzz factor is a percentage that represents both the proportion of packets that should be fuzzed, and the probability of any bit being flipped in the packet. For example, a value of 5 means about 5% of packets will be modified, and for each packet modified, each bit has a 5% chance of being flipped.
Declaration
public int FuzzFactor
Field Value
Type | Description |
---|---|
int | Percentage (0-100). |
Remarks
The presence of this parameter in the simulator pipeline stage should not be understood as this being a condition that should be tested against when doing network simulations. In real networks, corrupted packets basically never make it all the way to the user (they'll get dropped before that). This parameter is mostly useful to test a netcode solution against maliciously-crafted packets.
FuzzOffset
To be used along the fuzz factor. The offset is the offset inside the packet where fuzzing should start. Useful to avoid fuzzing headers for example.
Declaration
public int FuzzOffset
Field Value
Type | Description |
---|---|
int | Offset in bytes. |
MaxPacketCount
The maximum amount of packets the pipeline can keep track of. This used when a packet is delayed, the packet is stored in the pipeline processing buffer and can be later brought back.
Declaration
public int MaxPacketCount
Field Value
Type | Description |
---|---|
int | Number of packets. |
MaxPacketSize
The maximum size of a packet which the simulator stores. If a packet exceeds this size it will bypass the simulator.
Declaration
public int MaxPacketSize
Field Value
Type | Description |
---|---|
int | Packet size in bytes. |
Mode
Denotes whether or not the SimulatorPipelineStage should apply to sent or received packets (or both).
Declaration
public ApplyMode Mode
Field Value
Type | Description |
---|---|
ApplyMode |
PacketDelayMs
Fixed delay to apply to all packets which pass through.
Declaration
public int PacketDelayMs
Field Value
Type | Description |
---|---|
int | Delay in milliseconds. |
PacketDropInterval
Fixed interval to drop packets on. This is most suitable for tests where predictable behaviour is desired, as every X-th packet will be dropped. For example, if the value is 5 every fifth packet is dropped.
Declaration
public int PacketDropInterval
Field Value
Type | Description |
---|---|
int | Interval in number of packets. |
PacketDropPercentage
Percentage of packets that will be dropped.
Declaration
public int PacketDropPercentage
Field Value
Type | Description |
---|---|
int | Percentage (0-100). |
PacketDuplicationPercentage
Percentage of packets that will be duplicated. Packets are duplicated at most once and will not be duplicated if they were first deemed to be dropped.
Declaration
public int PacketDuplicationPercentage
Field Value
Type | Description |
---|---|
int | Percentage (0-100). |
PacketJitterMs
Variance of the delay that gets added to all packets that pass through. For example, setting this value to 5 will result in the delay being a random value within 5 milliseconds of the value set with PacketDelayMs.
Declaration
public int PacketJitterMs
Field Value
Type | Description |
---|---|
int | Jitter in milliseconds. |
RandomSeed
Value to use to seed the random number generator. For non-deterministic behavior, use a
dynamic value here (e.g. the result of a call to Stopwatch.GetTimestamp
).
Declaration
public uint RandomSeed
Field Value
Type | Description |
---|---|
uint | Seed for the RNG. |
Methods
Validate()
Checks if the values for all fields are valid. This method will be automatically called when adding parameters to the NetworkSettings.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
bool | True if the parameter is valid, false otherwise. |