I try to make a multiplayer game and my client is very laggy. Movement is slow and camera/rotation is stuttering. I guess the reason is that I send my input to the server and the server then applies the movement to the client? But if it’s the case, how can I fix it?
The server is smooth (left) and the client is laggy (right)
this is for example my camera movement (character rotation)
I’d probably use the player controller add input to rotate the ship. It has network prediction build in (I’m guessing the two ships are player controlled).
Didn’t know the floating pawn movement exists! Thanks for that. Movement works like a charm now.
Can you explain what you mean by “use the player controller add input to rotate the ship”?
When replicating is “Run on owning client”: The client can move, but the server won’t see.
When replicating is “Run on server”: The client can’t move at all.
When replicating is “Multicast”: The client can move, but the server won’t see.
The server can always move, and the client can see it moving.
Ok so it seems the replication works by default only if the base class is character…not ideal in the situation of using the floating movement component.
Can be slightly choppy at times due to not having any movement prediction but it works.
All replication on component is set to off
This looks way better! But the client is pretty much faster than the server and can fly through walls Guess it will take some work to fix all this little things
You need to enable simulate physics on the root and set the gravity to 0 on the pawn. Then they don’t go through walls. Speed is also the same. => game_ii.zip project.
Seems that still random physics collisions can desync the client & server so another approach is needed. Perhaps replicating elements of the physics calculations.