How to Reduce Client-Client Lag in Unity with PUN?

My Unity project (a little 3rd-person tag-like game) seems to have a lot of lag from client-to-client. Each client's ping is ~24ms, but the transformation update is very delayed (probably 700-900ms, but noticeable). I have looked at all of the demo projects that are downloaded with PUN and have not been able to determine what is causing my lag. Each client has 4 Photon Views, yet I still see lag with 2 players - 8 Photon Views shouldn't be too much, right?

I am lerping the transforms and rotations, with Time.deltaTime * 8, but even increasing to 20 doesn't seem to help with the lag. The sendRates are all default, though when I increased them to 50 for the player networks (and decreased them to 3 for the game logic networks) it still did not help.

I am all out of ideas! Any suggestions?

EDIT: I have looked at lots of threads about these issues, and none of those suggestions have worked.


  • Tobias
    A ping of 24ms is pretty good. It should be possible to avoid most of the client side lag, too.
    For testing you should apply updates immediately (no lerping). Maybe something is wrong with that.
    Check what / how much / how often you are sending. The default send rate creates updates every 100ms only using the current pos or whatever you put in via OnPhotonSerializeView. It should dispatch the info asap after receiving it.
    Can you profile your game code (Unity Pro only)? Or at least make sure the framerate is consistent.

    With a framerate of 60fps, you need to lerp to a new position within just 6 frames.
  • Even without lerping, there was some noticeable lag. This becomes a problem when I want to do collision detection between two players, and make sure that it looks the same for both players. So, to work-around it, when one player thinks he is within a certain distance of another player, he sends his distance over RPC to that player, who, then makes sure that he agrees before confirming a collision.
  • Tobias wrote:
    For testing you should apply updates immediately (no lerping). Maybe something is wrong with that..

    Just to double check, if it's sending updates every 100ms, then no lerping at all should update a player's position every 100ms, correct? Because when I removed lerping the updated motion was very jittery
  • Tobias
    Maybe your ping is low but changing a lot? Not sure.
    How do you measure the jitter without lerping? How much do you think it is?
  • I can just see that the photon characters from the other clients are moving from position-to-position. Maybe every 300-400ms? I'm just guessing, but it's very noticeable, and the characters move large enough distances
  • dreamora
    are you using your own server or the cloud?
    If the cloud, where are you located and what cloud server are you connecting to?