Simulate multiple ticks' worth of physics in a single tick? (Client-side prediction)
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." - https://forums.unrealengine.com/showthread.php?19955-Networking-Interpolating-replicated-movement-data-in-Pawn-without-modifying-source
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)."
There's quite a long thread on this here: https://forums.unrealengine.com/showthread.php?135955-Networked-Physics-with-PhysX - 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.
answered May 02 '17 at 08:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here