Increasing send rate makes game become more laggy
The whole answer can be found below.
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).
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
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