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.

Other players stuttering constantly

frare
2020-06-29 19:35:48

I have been trying to sync player movement between clients but have been stuck with this issue: https://imgur.com/lZ9coeN
Players appear to have these big lag spikes pretty frequently: every 10 seconds or so. This happens even in different devices and internet connections.

Players move locally by changing their "Rigidbody.velocity" depending on joystick input. I tried using a lag compensation code that I found when looking for possible fixes, but as you can see in the gif the problem persisted:

Thanks in advance, guys.

Comments

jeffries7
2020-06-30 10:25:04

Have you tested using a CharacterController for movement instead of a rigid body?

You might be getting conflicting results by adding velocity to the player as well as setting their position. Maybe try one or the other?

Another option is not sending the players position across the network but sending their inputs. You'd then drive all non-local players as if they were local, essentially. You'd need to check to their positions to make sure they weren't out of sync or use predictions if data is lost.

frare
2020-06-30 14:46:52

Thanks a lot for the quick reply @jeffries7 ! Movement precision is not a big factor in this project, it's not a competitive game or anything like that, so I am just trying to prevent this visual stuttering and make the network experience look smoother.

I tested using Rigidbody and without adding velocity, then using Character Controller, but in both cases players still lagged behind frequently like in the gif.
When testing with 2 PC clients it doesn't look as bad but the game is meant to be played in Android and in those builds it looks terrible... players constantly stuttering and catching up.

Also tried sending the input direction and moving the respective character locally with that direction vector but couldn't make it work properly, character was overshooting a lot. Could you give me some info in how I can achieve this? I am moving characters with CharacterController.SimpleMove().

Back to top