1
\$\begingroup\$

I'm attempting to implement rollback networking for an FPS game right now, but I'm not entirely sure about how to proceed.

From what I know, it is bad practice to send over client positions whenever the player client performs an action. It is way more efficient to send over player actions and have the server do the simulations to match what is being seen on the client screen. However, the only caveat with that implementation is that when the server sends positions back to the client, due the ping delay, the positions the client receives will be in the past, so we store some previous player positions, check to see if the received position from the server, is accurate with our past assumptions, and if not, we correct it.

The part I'm having trouble with is the correcting part, because as far as I know, this means that I have to rubberband back to the old position and re-simulate any actions that I have pressed between now and then.

How exactly do I do the re-simulation step though? Most guides on line explain this using discrete examples, but its a little hard to wrap my head around what would happen in the continuous case. I guess with faster tick-rate servers, its not to bad, since we can approximate the game to do 1 action / tick.

Nevertheless, is there a way to "fast-forwards" the physics simulation for a singular object in Unity? One of my main concern is that stepping through all the past actions might take too long.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ There's no such thing as a continuous case here. Game simulations proceed in discrete steps. Your rollback should only be something like ~200 ms in the past, so at Unity's default FixedUpdate rate that's only 4 physics steps. Don't assume performance will be a deal-breaker until you test and measure it. \$\endgroup\$
    – DMGregory
    Apr 8, 2023 at 12:21

0

You must log in to answer this question.

Browse other questions tagged .