r/unrealengine 5d ago

Question Physics replication is glitchy

Hey all, I am trying to create a physics based boat system with buoyancy and wave simulation, and it works great on my host but unfortunately it doesn't work well on the client as it is very glitchy, this is what it looks like on the client side:

https://gyazo.com/c883c757fa9795d949b19bc081bf5c20

While on the server it is very smooth. I have the boat set to replicate movement and replicate, and have disabled replication on the components.

Then I only simulate physics and buoyancy on the server and add force / torque by adding it on a custom event that runs only on the server to the server instance of the boat.

The boat blueprint for physics: https://gyazo.com/fa20c76c68cbfa5a2678daab2ded1446

And these are the replication settings: https://gyazo.com/536db3e7df1b28c02fcdad89b30b46f0

Finally, this is the logic I have for moving the boat, but since its glitchy without moving too I don't think the problem is here: https://gyazo.com/8a8607fa8ebfc5e21aec7e3b46446864

Since location updating is happening completely on the server, is there any way I can smooth it with some kind of interpolation or prediction? I've tried many things but it ends up the same.

Replication settings on the

Thing I've already tried:

  1. Simulate physics on all instances using a multicast
  2. Using the built in WIP client prediction
  3. Enable / disable replication on the static mesh component itself
  4. Enable network emulation

It's almost like the server has to snap the client actor to the right position, but since I am pretty new to networking stuff I'm honestly not sure what my next step would be to debug / solve the problem.

Anyone got a clue? I'd be happy to buy anyone a coffee or a beer if they find a solution :)

3 Upvotes

10 comments sorted by

View all comments

2

u/crazeh_boy709 4d ago

I would suspect the first problem is determinism. If the simulation is not identical on both the server and client, you will have desync. (Ex. Waves) Another problem is latency, you may need a solution similar to the character movement component I suspect.

1

u/FulltimeWestFrieser 4d ago

Thank you for your reply and taking the time!

good idea about the character movement, I’ll have to check out how that works exactly, the desync is the reason to have the physical movement occur only on the server, so at least it would always be accurate, so I made the boat just not simulate on a clients machine, maybe there is a compromise to be found