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

Ordering between channels in UNet and MakeChannelsSharedOrder

Discussion in 'UNet' started by lama89625, Feb 14, 2019.

  1. lama89625

    lama89625

    Joined:
    Feb 14, 2019
    Posts:
    14
    Hi,

    Has anyone had experience with ConnectionConfig.MakeChannelsSharedOrder?

    I need a transport that I could send both reliable and unreliable messages through and they would all arrive in the order sent (or dropped in case of unreliable messages) without any order changes,
    so I was making my own solution on top of UNet and came across this function, which seems like exactly what I need.

    The problem is this - "Only Reliable and Unreliable QoS are allowed for shared order channel". So only Reliable and Unreliable types of channels are allowed both of which aren't even ordered within themselves. So I'm trying to understand how this shared order is supposed to work. Has anyone done this?
     
  2. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    for reliable channels all messages will be in order so if you seen m1 to ch1 then m2 to ch2 you will receive m1 first m2 second
    for unreliable channel message will be delivered in order or message will be drop
    imagine you have 3 channels 1 - reliable, 2 unreliable, 3 reliable and you send (first index channel, second index message number): m11, m12, m23, m24, m25, m16, m37, m38
    you can receive:
    m11, m12, m23, m24, m25, m16, m37, m38
    or
    m11, m12, m23, m25, m16, m37, m38
    or
    m11, m12, m24, m25, m16, m37, m38
    so order is guaranteed while delivery guaranteed only for reliable channels
     
    lama89625 likes this.
  3. lama89625

    lama89625

    Joined:
    Feb 14, 2019
    Posts:
    14
    Thanks for the explanation! Well, that seems like what I need.
    Just to make sure - if I don't make a shared order group, messages in the Reliable channel won't be ordered (just like it says here https://docs.unity3d.com/ScriptReference/Networking.QosType.Reliable.html), whereas if this channel is part of a group all messages keep their order?
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    as far as i remember - yes, reliable channel won't make that guarantee, sharing channels is construction on top of channels and this construction keep ordering by using buffer belonging to itself not to individual channel. Moreover (do not remember without code), you cannot add any ordered channel to shared group.
     
    lukanin likes this.
  5. lukanin

    lukanin

    Joined:
    Aug 17, 2018
    Posts:
    3
    I see. Thanks!
     
  6. lukanin

    lukanin

    Joined:
    Aug 17, 2018
    Posts:
    3
    But let's say if I used HLAPI with its NetworkServer and NetworkClient classes and their messages, they wouldn't keep order between channels anyway right?
    Because from what I've seen in the code these messages are buffered in separate packets one packet per channel and then passed down NetworkTransport, without keeping track of which order the individual messages were put in.
     
  7. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Yes and no, if you will do anything by default you re right. If you will create custom config and ask llapi to keep shared channels it will work behind the hlapi, becoise llapi will do this work silently
     
  8. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    Hence im not 100 % sure, probably hlapi will buffer something in c# level :(