Increasing send rate makes game become more laggy

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Increasing send rate makes game become more laggy

lennart862
2017-07-23 13:41:35

If I increase the send rate with PhotonNetwork.sendRate and PhotonNetwork.sendRateOnSerialize the game becomes even more laggy. The higher the send rate the higher the lag. Where is my mistake?

using UnityEngine;
using System.Collections;

public class NetworkCharacter : Photon.MonoBehaviour
{
private void Awake()
{
PhotonNetwork.sendRate = 30;
PhotonNetwork.sendRateOnSerialize = 30;
}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)  
{  
    if (stream.isWriting)  
    {  
        stream.SendNext(transform.position);  
        stream.SendNext(transform.rotation);  
    }  
    else  
    {  
        this.transform.position = (Vector3)stream.ReceiveNext();  
        this.transform.rotation = (Quaternion)stream.ReceiveNext();  
    }  
}  

}

Comments

dontonka
2017-07-23 16:54:19

Yes that's normal, sending too much packet per second will overload the receiver. Usually you don't want to go higher than 10-12 and this is when it is action realtime game like FPS or something similar. What you need todo is to lerp from an update to another, not too send that much packet.

Back to top