Stuttering movement with Photon Transform View Classic

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.

Stuttering movement with Photon Transform View Classic

Jalzu
2022-05-03 13:28:32

Hi!

I recently started making a pong in multiplayer using photon pun. I am stuck right now,

because on non-masterclient the ball's movement is very stuttering and the ball sometimes goes trough the player. In my Ball game object I have Photon View, Photon Rigidbody 2D view (with Synchronize Velocity checked) and Photon Transform View Classic (Enable teleport for great distances uncheked, Interpolate option is: Estimated speed and Extrapolate option is disabled).

https://streamable.com/v7hwpo -This is video from the game so you can maybe understand the problem better.

I'd appreciate any help! Thanks! :)

Comments

Tobias
2022-05-03 14:25:24

This simple issue is hard to fix and a good showcase of what lag and variance means for a networked game.

One player is in control of the ball. This player moves the ball but does not know the other's input for the paddle. So .. sometimes the ball misses the paddle and vice versa.

A simple approach would be to hand over control on each paddle hit.

To calculate the ball's path, you don't need a Rigidbody2dView at all. Just send where the ball was hit and the direction it took and when. Next: The hit itself could be used as signal to pass control (if you are happy to move away from PUN's built in APIs).

Last but not least: Quantum would only sync everyone's input to move the paddles. It may use the last received input to predict a few frames of input (should input arrive late) but in the end, both players will receive the input for each tick and finally be able to show the correct results.

In any of those approaches, there is a small chance that the views of the players don't align and one assume the ball is not hit while the other did.

Back to top