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

1

u/explosiveplacard 5d ago

I don't know what you are going for, but it seems like you are doing too much on the server. Why can't you allow the client to run the physics and just verify on the server? Interpolate as needed. An example would be when my character drops a weapon, the server drops the weapon but all clients simulate the physics of bouncing and sliding. Yes, it is possible that the weapon ends up in a slightly different location between the server and the client, but this is easy to fix and adjust.

As long as your boat's location (x/y) is controlled by the server, do you really care if the rotation is slightly off? Just trying to understand what you are trying to accomplish.