Search Unity

Feature Request Unreliable Not Sequenced

Discussion in 'Unity Transport' started by MariuszKowalczyk, Mar 18, 2023.

  1. MariuszKowalczyk

    MariuszKowalczyk

    Joined:
    Nov 29, 2011
    Posts:
    301
    If I have not missed anything we now only have UnreliableSequenced pipeline. Is there any way to achieve Unreliable without sequenced? I assume that out of order packets are dropped in the sequenced pipeline.

    It may look like such a not sequenced pipeline has no use in practice, but it is not true.

    For example in my game Ball 3D (available on Steam) I use very old Unity Networking (the first one, I started working on the game in 2012). I implemented a client side prediction and to make sure that the server will execute the inputs the way client predicts them, the server gets not the last input but an input from 2 packets earlier. I do it because almost all the time there are fluctuations in the delivery and if I would get the last input, I would many times have no input for the simulation (as the last input would not be delivered yet, so I would have to just predict the input using the last one). It works pretty great in practice and with 2 frames of margin the client predicts the local player movements pretty much perfectly at if there is any fluctuation it has 2 additional frames that can be consumed while waiting for the new input frames.

    What I described will still work with UnreliableSequenced, but if some packet will get out of order, I will not be able to put it in my array (as I assume it will be dropped). And in this case it may result in a wrong prediction. I am not sure how often packets arrive out of order these days, it is probably a rare case and not worth implementing the additional pipeline. If that's the case please let me know. But in some networks it may be frequent enough to justify such pipeline. Or maybe there could be some method implemented that would allow to access the out of order dropped packets.

    In short: I would like to receive every packet (even those out of order) and put them in order myself in a an array in case I will need the previous packets too.
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Unreliable and unsequenced is the default behavior you get if you don't specify a pipeline (or create a pipeline with neither
    UnreliableSequenced
    or
    ReliableSequenced
    stages). Basically without pipelines, you have the same guarantees as a basic UDP socket (e.g. packets may be delivered out of order, and they may not be delivered at all). I'll edit the pipeline documentation to clarify this.
     
  3. MariuszKowalczyk

    MariuszKowalczyk

    Joined:
    Nov 29, 2011
    Posts:
    301
    Great to know this, thank you.