Simulate a certain time period of physics for an actor without actually progressing time

Hello.

I’ve been writing my own physics based pawn movement for some time now. (for this reason)
It works well but for the last month or so I’ve been tossing around ideas for how to implement client prediction for this movement system.

Specifically, I need a way for the client to reconcile its position with the last agreed one received from the server whilst preserving the effects of all the inputs and movement since the client was at that last agreed position.

To do this, the client should save all the inputs it makes and when the last agreed position and velocity are received from the server, revert to them (since they are to be trusted) and reapply all the inputs and physics executed since then, to avoid the character rubberbanding as that state will be a certain amount of time in the past depending on the latency.

Since making this post, I’ve dug through all the prediction code for CharacterMovementComponent, and found that it uses it’s own pseudo-physics system to manually step a length of physics - as well as step physics normally - which was unfortunately not what I wanted to find as it converges back to the root issue of all this which is that CharacterMovementComponent doesn’t use the built in engine physics.

I can avoid using AddForce and AddImpulse for movement, and instead set velocity directly, but how can I manually simulate physics for a length of time, without actually progressing time? (In a single instant)

I need gravity, damping, and other actors to be taken into account, and I also need impulses to be applied to those other actors.

Alternatively, I’m still open to other ideas for how to save and reapply the input/movement since the last agreed state.

I’m starting to wonder if this is actually even possible…

Thanks.

I know this was posted long time ago but the question is still valid. Did you manage to solve this problem?

I’m with the exactly same problem, you can actually sync server and clients physics by processing input linked to time, so how I’m doing this, my server runs at a fixed FPS, this is quite common for any server, this is known as tick rate. The client shouldn’t be FPS capped and can’t be force to run at high FPSes as it’s hardware may not be able to do so. So when I send the client inputs I multiply it by the ratio between the client deltatime and the server deltatime so a 120 FPS client send half the input to the server and a 30 FPS client sends double the input to the server and everything works for any FPS, it’s a rough approximation as clients only send inputs 60 times per second and the deltatime ratio may vary a whole lot, but it works.
The problem now is exactly yours, I can’t replay movements in a single frame for server reconciliation, and my conclusion is that anything that is physics (simulation) dependent can’t be done in a single frame as the game is itself a simulation and the frame is a step.

So run to hills? Yes, to have more time to code and less people to bother you, I’m writing a deterministic movement system that will ease synchronization and provide replay functionality, it will be though but my conclusion is that networking demands deterministic movementation, for synchronization and replay, the only challenge will be replicating physics behavior as collisions which isn’t that challenge at all if the scenario is simple enough.

I’m not the holder of truth so if anyone have a more elegant solution, please save our lives.