Jittering/out of order movement with PhotonRigidBodyView (PUN 2.13)

Options
Hello,

I have been sent a video of our game where objects are sometimes moving in a jittery way, jumping back and forth as if they received target coordinates out of order.

I am using a PhotonView that is observing a PhotonRigidBodyView in "unreliable on change" mode.

The PhotonRigidBodyView is configured with:
- enable teleport: 12
- Synchronize velocity: yes
- Synchronize Angular Velocity: yes

The source RigidBody (where PhotonView.IsMine == true) has isKinematic == false, but on the other clients it is set to true.

Do you have an idea of what the problem may be?
Does Photon filter received position data to make sure old positions are not applied after more recent positions?

Thanks!

Comments

  • jeanfabre
    Options
    Hi,

    It could be that you have conflicting scripts trying to control the vehicle while Photon is trying to synchronize its position and rotation.

    Can you double check that indeed all your scripts that controls your vehicle are aware of the context, that is if PhotonView.isMine is true or false?

    Bye,

    Jean
  • olistan
    Options
    Thanks; I wanted to be sure that it isn't supposed to happen even when getting network packets out of order. I checked again and did find one place in our code where isKinematic was reset to false for remote vehicles... So physics was applied to PUN-controlled vehicles which causes this issue (but it's visible only when there is a huge lag).

    Sorry for the disturbance and thanks for the help :).
  • jeanfabre
    Options
    no worries :) we are here to help!
  • develax
    Options
    @olistan

    I just guess it may be caused by the slow Internet of some of the clients combined with a wrong prediction/extrapolation. It would be great to watch the video to see how it looks, it would make it easier to make objective assumptions.

    The documentation says that all messages are ordered. I deliberately implemented a check for the wrong order (by 'time') and it has never been revealed. The only thing I could notice is that PhotonNetwork.Time == 0 at the very beginning in several calls in a row, as I already wrote on this forum, and that it would be better documented since it is not obvious and can cause some minor problems when interpolating objects with custom code.

    I also have a suspicion that PhotonMessageInfo.SentServerTime can also be 0 at the very beginning wich is not documented.




  • olistan
    Options
    Thanks @develax for your suggestions. I have also added a SentServerTime check just in case but it's good to know that it doesn't happen in practice. I cannot post the video in public unfortunately.

    I don't think the Time == 0 issue is related to my problem, however I have to say I was wrong in my previous post: I am able to reproduce the issue by using the Photon Lag Simulation GUI and setting the lag to 500 on both clients for the same vehicle.

    I doesn't matter if isKinematic is set to true or false; for the problem to appear the lag just needs to be 500 ms * 2.

    The problem disappears when I use my own position synchronisation code instead of PhotonRigidBodyView.

    That said, I do not know if the source of the problem is in PUN or in my code!
  • develax
    Options
    @olistan,
    500ms is a lot, even with my slow Internet connection I never have more than 250-300ms, usually below 200. Of course, it depends on the type of game, but for fast-paced games, it's not playable, IMHO.

    They probably implemented some kind of extrapolation with a not very accurate prediction: the object is extrapolated forward and when a new data arrives with a great latency the algorithm snaps it back.