Simulate multiple ticks' worth of physics in a single tick? (Client-side prediction)

Hey guys,

So for a standard client-side prediction model to work, the client needs to be able to respond to the (always authoritative) server in a particular way.

For example; “I could create a buffer (a queue) of time-stamped moments, storing the physics info for the pawn, the active player inputs, and the time it occurred. I could then be compared the incoming server info with this info, and if it didn’t match, roll the physics back to that incorrect moment/tick, correct the data, then re-simulate based on the inputs stored for each successive moment/frame up until the present time/tick.” - [Networking] Interpolating replicated movement data in Pawn, without modifying source - C++ - Unreal Engine Forums

It’s the last part that doesn’t seem possible at this stage. How do I simulate multiple ticks’ worth of physics in one frame? I’m trying to roll-forward from the incorrect frame, as stated above, up to the current one, i.e.;

“The input and physics data I have stored on my client for the tick 2 frames ago is actually incorrect. I will set my new physics data to match the correct version for that tick (from server, delayed due to lag), then run the 2 frames needed, using the new physics info + my stored client inputs, to find where I ‘should’ be, and set my present-time data to match (move the actor, rotate it, etc).”

Any ideas?

Bump I’m looking for this as well.

Bump, I am also looking for this.

There’s quite a long thread on this here: Networked Physics with PhysX - C++ Programming - Unreal Engine Forums - def worth a read so you understand all the implications.

Also check out the source from this plugin to see how he’s accomplishing this.

https://github.com/TheJamsh/UE4-Networked-PhysX-Component

For anyone coming across this, TheJamsh’s repo seems to be gone, but this seems to be a fork/copy of it: GitHub - AlCaTrAzzALZ/UE4-Networked-PhysX-Component: A solution for PhysX Pawns with Prediction and Reconciliation in Unreal Engine 4.