docs.unity3d.com
    Show / Hide Table of Contents

    Struct SimulatorUtility.Parameters

    Configuration parameters for the simulator pipeline stage.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Networking.Transport.Utilities
    Syntax
    public struct 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
    Int32

    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
    Int32

    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
    Int32

    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
    Int32

    Packet size in bytes.

    Mode

    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
    Int32

    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
    Int32

    Interval in number of packets.

    PacketDropPercentage

    Percentage of packets that will be dropped.

    Declaration
    public int PacketDropPercentage
    Field Value
    Type Description
    Int32

    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
    Int32

    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
    Int32

    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
    UInt32

    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
    Boolean

    True if the parameter is valid, false otherwise.

    Implements
    INetworkParameter.Validate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023