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! Your search result can be found below. Plus, we offer support via 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.

RigidBody networked player is jittering using PUN

CurryKitten
2020-04-30 15:04:40

Hello there,

Very new to Pun, but I spend Wednesday working on getting a networked version of my game running and although I finally got something running, the results I'm getting aren't quite there.

The problem I've got is that remote players look like they are jittering around... from their point of view they are flying smoothly and I look like I'm jittering.

My game is an FPV quad sim, usually, the quad would fly very smoothly. I attempted to capture a video of this and my best attempt was here https://youtu.be/v3G36RE0mcA If you look when we cross above the building there's a lot of jitter happening.

I feel like I must be missing something, but I'm not sure what, I worked through the tutorial code and then cracked on with mine - there were quite a few changes to make (and still some to do) but I believe I have the important aspect done - like the fact that each quad is now a prefab and so can be instantiated over the network. Each quad also has a rigidbody component which is not kinematic and does use gravity. Also in the prefab is a Photon View, Photon Transform View (sync is on for Position and rotation) and Photon Rigidbody view with sync on for velocity and angular velocity. The observed components in the Photo View are set to the PhotonRigidBodyView and PhotonTransformView.

Within the controller script - essentially which processes the input from the player and turns it into direction and velocity I have enclosed the vast majority of the code inside if (photonView.IsMine) {} ... although it was fun finding out why, and what happens when you don't turn the cameras off on the quads that aren't yours :smile:

If kind of feels like the position is having a fight between the local script and syncing with the client, but with the client the only one giving input, the only thing that the local version of the quad is doing is really adding gravity and drag to an object... which should be the same on both ends.

Is my approach here correct? I noted there was also PhotonTransformViewClassic available as an alternative, although classic sounded like an older version. What should I be using to have these rigidbody player models sync'd smoothly together ?

Comments

Amucity
2021-03-19 00:20:20

Curry,

Have you ever figure out what was causing this issue, I am having the same problem, my networked players are bouncing around the room and I can't for the life of me figure out why. I'm having difficulty locating any other forum posts regarding this issue, so any help you could provide would be much appreciated.

jc_kolbapps
2021-03-29 19:29:45

Hi. I'm starting now with PUN2. In my first attempt, my remote players were like that too. I started by synchronizing the transformation of my players with the classic PhotonTransformView. I even got a little bit of improvement by setting the component values, but nothing really cool. So, I replaced it with the normal TransFormView. It is able to function smoothly and has a good level of delay compensation, but, unlike the tremors, I found it too smooth. The Synchrony in that is strange, my players when they JUMP, land very smoothly and the animations are fully synchronized out of the transformation.

Finally, I implemented my own lag compensation, using the photon document. https://doc.photonengine.com/en-us/pun/current/gameplay/lagcompensation

What I was able to do was slightly balance the tremors and the excessive straightening. But it is still not something I can do for commercial production. I'm still looking for official information, but I don't think we'll find anything other than what already exists here.

My Prototype can be played here:
https://simmer.io/@jcpereira/megaman-prototype

Enter 2 players to test. It’s a little frustrating, but I think that’s all we have ready. Everything else and on us!

Tobias
2021-04-01 10:21:15

For long times, we assumed that each game would need it's own, fitting solution, so we did not dive deeper into perfecting synchronization. The PhotonTransformView scripts are a relatively simple approach to synchronization and lag compensation. As PUN does not touch the simulation you could not expect "perfect" results (without some work).

There are two addons, which cover synchronization quite well, as far as I know:

The asset Smooth Sync seems to achieve good results with PUN 2. I did not try it first hand but our customer's feedback was good.

Our own, free addon "Simple" turns the synchronization tick-based and achieves quite nice results with better compression than standard PUN 2.
Compared to PhotonTransformView, the components from Simple are a game changer.

Simple is in working condition but there are no major updates planned.
It got superseded by the development of Fusion, our upcoming networking package which focuses on the simulation and synchronization.

Back to top