Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Transport.preview 0.2.3 UnreliableSequencedPipelineStage not working as expected?

Discussion in 'Multiplayer' started by Quynhftw, Jan 16, 2020.

  1. Quynhftw

    Quynhftw

    Joined:
    Dec 25, 2018
    Posts:
    1
    Hi all,

    I am working with the transport layer by sending simple messages across the wire. I've set up my project to use pipelines (specifically UnreliableSequencedPipelineStage with the SimulatorPipelineStage):

    Code (CSharp):
    1. m_Pipeline = m_Driver.CreatePipeline(typeof(UnreliableSequencedPipelineStage), typeof(SimulatorPipelineStage));
    My configuration for the simulator stage:
    Code (CSharp):
    1. var simParams = new SimulatorUtility.Parameters {
    2.             MaxPacketSize = k_PacketSize,
    3.             PacketDelayMs = 200,
    4.             PacketDropPercentage = 50,
    5.             PacketJitterMs = 10
    6.         };
    With a 50% drop rate, I would expect the server to miss messages, and thus not be able to sync. This is not what is happening. With the 50% droprate, the server still receives every single message (and in order!). I've tested this by passing a tick number to the server, and the server logging it to console. I can see every single tick number.

    Am I doing something wrong here? Or am I dealing with "preview" issues on the transport layer?

    Been stuck on this for awhile, so if anyone could help assist. It would be very much appreciated.

    Thanks!

    Quinn Le
     
  2. MakinStuffLookGood

    MakinStuffLookGood

    Joined:
    Nov 20, 2012
    Posts:
    21
    Sorry for the necro post, but I ran into this issue and this came up in search with no answer.

    The problem Quinn seems to have had 3 years ago (and is still relevant in UTP today!), was that they did not specify the MaxPacketCount. It gets the default value from struct initialization instead, which is 0. This value is the max number of packets the stage will add simulated network conditions to at any given time, so naturally you'd want a value greater than 0, otherwise it will not affect any packets.

    This is probably why if you use the extension method WithSimulatorStageParameters, maxPacketCount and maxPacketSize are not optional parameters, they must be specified as some useful positive integer or your simulation pipeline stage will do nothing.
     
    simon-lemay-unity likes this.