extreme lag issues

Options
Hi

Im having some problems sometimes in my game players "jump" from one position to the next, this happens even when all the players have good internet connections, for example the other day I recorded a session with two of my friends and we all have 100Mbit/seg fiber optic internet yet this happened a lot. Im pretty sure I have done something wrong :oops:

Here is the video I recorded:

https://www.youtube.com/watch?v=7Ej0dQXa_Gs

On the top left you can see my ping, that day it was kind of high (100-130) but this happens regarless of the ping

I used the lerp example from the demo for the movement:

[code2=csharp]//smooth movement:
if (!photonView.isMine) {
_Controller.transform.position = Vector3.Lerp(transform.position, trueLoc, Time.deltaTime * 5);
_Controller.transform.rotation = Quaternion.Lerp(transform.rotation, trueRot, Time.deltaTime * 10);

}

....
....
....
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
if (stream.isWriting) {
if (photonView.isMine){
stream.SendNext(_Controller.transform.position);
stream.SendNext(_Controller.transform.rotation);
stream.SendNext((bool) IsFiring);

}


}
else {
if (!photonView.isMine) {//do we own this photonView?????
this.trueLoc = (Vector3)stream.ReceiveNext(); //the stream send data types of "object" we must typecast the data into a Vector3 format
this.trueRot = (Quaternion)stream.ReceiveNext();
this.IsFiring = (bool)stream.ReceiveNext();
}




}
}[/code2]

Thanks.

Comments

  • watching
  • vadim
    Options
    Hi,

    Switch to plain position sync without lerp to see if positions are updated frequently enough. You can also log updates for that.
    You may want to tune PhotonNetwork.sendRate and PhotonNetwork.sendRateOnSerialize for such dynamic game. Btw, I did not realized that something jumps at first watch. Everything is so fast that I was not sure if tank jumps or moves normally.
  • Hi thanks for the reply I changed SendRate and SendRateOnSerialize is more smooth now but this does still happens, looking at the charts on the Dashboard it says I sended more than 800Msg/sec the day I did the testing with my friends, could that be the problem? Could I be sending too many Msg/sec?
  • vadim
    Options
    I think your message rate is quite high. You need to optimize it.
    You can profile your app on per client basis with this component http://doc.exitgames.com/en/pun/current ... -stats-gui
    Compare your traffic usage to typical values for demos bundled with PUN.