Physics based movement in multiplayer, sync issues

This has been driving me mad, I can’t get an accurate way to do this working. I had a very smooth and nice network script working, but I found that it quickly became out of sync between the various clients.

My goal:

  • Client-side physics based movement (because my controls need to be very responsive, can’t wait for server to say “Yes that’s ok”)
  • Replication of this movement to other clients via the server (Doesn’t need to be physics based but does need to be smooth)

What I tried originally:

  • Method: Replication of setting physics values on the characters.
  • Result: Very smooth movement on all clients, responsive, but quickly became out of sync
  • Conclusion: Not a huge surprise, latency would mean the application of the physics values would be timed differently

What I tried to fix this with:

  • Method:
  • – Local physics based movement.
  • – Kinematic replication of character rotation and position on the server, replicated other clients.
  • Result: Actors with “Simulate Physics” can’t have kinematic based property applied to them, so it didn’t work at all.

I then tried using an Authority switch to turn off Simulate Physics on the server side, but this didn’t help as I assume the remote clients still had it enabled so ignored the replicated movement they were asked to do.

I am thus at a loss. How on earth can I do this? I’m sure its possible, I’m just not seeing how!

This concerns me as well. Why aren’t there any answer on that point on any other topics?

Hello, let me join you in your problem. My physics game also gets out of sync, despite being an example ‘blueprint rolling’ project.

What I did find out is that you either (a) Have to create a very complicated system of applying physics locally to re-sync all network entities using physics (there is a forum post about it somewhere, though the guy doesn’t share his work) or (b) you run all the physics simulation server side only. The downside to this is that if you have any network latency what so ever, controls are going to feel horrible and slow.

Seems that desyncing is not my only problem, server and clients are flickering between client/server view even on some projects that work flawlessly for other people, I have no idea what’s wrong with my UE :confused:

Well that is disappointing. Thank you for your answer

It does make sense though. Consider how physics work and that any latency what-so-ever from client to client means the physics are applied slightly later remotely as they were locally. That means everything in the game will interact with that entity slightly differently, which is a snowballing effect.

I was mainly hoping that UE4 would have some sort of auto-syncing/auto-correcting network physics that can run locally, but it seems not. Even if it did, I suspect overall it would be very network heavy. I’ve reverted to using standard input control, which is still vaguely physics based, you just can’t apply physical forces the same way.

I find it surprising that making a simple multiplayer racing game could be that complicated.

You’re going to have to copy the bone and other transformations to server and then to clients every few frames. No other way around it.

How do we do that? Do we have to create an array to store every transformation every frame and then send that array through a client-to-server RPC and have it send that array to all the clients?