Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question High lattency using unity Relay

Discussion in 'Multiplayer' started by VolkovVitaliy, May 14, 2024.

  1. VolkovVitaliy

    VolkovVitaliy

    Joined:
    Feb 11, 2021
    Posts:
    3
    Hello! I connect two players in multiplayer using unity relay and mirror network. I encountered the fact that even in an empty project, the lattency on the client is at least 100ms. Is this the norm or is there any way to reduce the lattency to 40-50ms? I checked the server through which the connection is made and there are no problems - this is the server closest to me. My internet speed is 80mb/s.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    How do you measure this latency?

    Are you perhaps running a web build? Those always suffer from higher than expected latency.

    Otherwise a Relay will increase latency as packets run through an additional hop. The relay latency will be different for every user depending on where they are in relation to the relay server, and how fast traffic is routed between the two. Latency may also be affected by time of day and so on - it's best to measure latency multiple times to see if and how much it fluctuates over time.
     
  3. VolkovVitaliy

    VolkovVitaliy

    Joined:
    Feb 11, 2021
    Posts:
    3
    The mirror has a standard ui to test latency. I use it. I am testing the game on Android. I do not feel a big fluctuation depending on the time of day.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    Perhaps you got to see a very low latency from your mobile when testing without relay because the traffic remained entirely within your local Wifi.

    If the mobile is connected over the air, not wifi, then 100 ms latency is actually pretty good.