In my game each player can spawn projectiles. These projectiles get spawned on the server, they move on the server and handle collision on the server. For synchronizing the position and rotation, I use the Network Transform script with a Network Send Rate of 29 and the mode: Sync Rigidbody 3D.
The problem however is, even if a client has around 20 ping in milliseconds, the movement already gets a bit jittery. I tried writing my own script to lerp the movement, but resulted in the same thing.
What would be the best way to keep the movement smooth even if the client has a little bit of latency? In big games like League of Legends is the movement being mocked of projectiles? But how is the collision being handled? Thanks for reading!
May be wrong, but I’d think your projectiles are jittery because they’re not updating at the same frequency the game is since you’re only sending the positions 29 times a second.
Not sure how doable it would be (and how well it would work with higher amounts of lag), but if you could send the start position of each projectile, its trajectory, and its speed you could get away with not having to send the positions over the network (although without more work this’ll only work with projectiles that go in a straight line) by having the clients update the movement of the projectiles themselves.
You would then need to send a timestamp of when the shot was fired, so that when the clients receive that data they know how far ahead to put that projectile to account for ping. Depending on someone’s lag, this will make the projectile appear farther away from where it should spawn the more lag someone has, but it’ll at least let everyone see the projectile in the same place.
You’ll still run all of the collision and everything on the server, and you could also do some collision on the client to tell when the projectile hit something so it doesn’t go through it because of the delay between the server and client. But that’s just if you want to hide some lag.
I haven’t tried any of this, but it seems to me like it might work. If it does, it’ll reduce quite a bit of network data too since you would normally be sending the transform of every projectile.