Search Unity

Max Delay setting on Network Manager working as intended?

Discussion in 'Multiplayer' started by trudeaudm, Jun 9, 2017.

  1. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    https://docs.unity3d.com/ScriptReference/Networking.NetworkManager-maxDelay.html

    According to the docs this setting does the following:
    NetworkManager.maxDelay

    "The maximum delay before sending packets on connections.

    In seconds. The default of 0.01 seconds means packets will be delayed at most by 10 milliseconds. Setting this to zero will disable HLAPI connection buffering."

    However when I change this setting it actually seems to be more of a minimum delay, for instance if I set this to 0.5 updates are ONLY sent every 0.5 seconds. This was very frustrating before I realized this was what was causing the lag on my game.

    Also as far as I can tell having this at a small value IE 0.01 or near zero causes random disconnects for clients. Setting it higher closer to 0.2 or 0.5 makes the connections for client more stable. This is really problematic because I either have an unstable game or a laggy game.
     
    wlwl2 likes this.
  2. MohammadAlizadeh

    MohammadAlizadeh

    Joined:
    Apr 16, 2015
    Posts:
    26
    Same problem!!
    I think there's something like bandwidth limiter but i'm noob at networking i cant find it
    Unity 5.4.0p2
     
  3. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    If you set it to something low. You are prolly DCing cause you are sending way too much packets. Each message will be a packet if set to 0.
    If you have it set to 0.5. It's sending every 0.5s. If you send a message half way between last and next send. It will only take 0.25seconds to next send. That's why it's the MAX. 0.1 means you send packets 10 times a second. 0.05 means 20 times a second etc.

    Also, a packet != a message. Basically, every (maxDelay) seconds. It bundles all messages into a packet and sends it off.

    The disconnects are probably due to the fact that you are hitting the Relay with too much info. A packet has headers etc making it innefficent to send a packet per message. So you use more bandwith with a low maxDelay.
     
    Deleted User likes this.