Network Interpolation Issues

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
_untitled_
Posts: 32
Joined: Sat Jan 19, 2013 8:20 pm

Network Interpolation Issues

Post by _untitled_ »

Hi, Norbo!

I've ran into a somewhat game-breaking issue after testing my game with 100ms ping. As my server is completely authoritative over position, the client corrects its position to the server's position. Instead of snapping the player to the position, I have a "server_pos" variable, which stores the server's position + replayed movement, and the player interpolates its position towards the "server_pos" variable. The problem is, when I threw in some random network spikes, the interpolation could move the player into the terrain, which would cause the physics engine to try to push the player out, which would offset the interpolation, which would then try to do a harsher correction, etc. until the physics engine reports an NaN value for velocity.

This is essentially what I am doing:

Code: Select all

Vector3 serverPos;
Vector3 interpolationDistance;

void interpolate()
{
   serverPos += Position - lastPosition - interpolationDistance; // interpolated distance should not be factored into the target, as it will cause an infinite chain

   Vector3 preInterp = Position;

   Position = Vector3.Smoothstep(Position, serverPos, 0.3f);

   interpolationDistance = Position - preInterp;
}
https://dl.dropbox.com/u/59540455/net_i ... on_bug.mp4

As you told me before that you had some experience with physics networking, do you have any advice on how to deal with this? Would there be any serious repercussions
if the pushing players out of terrain is disabled?

Thanks!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Network Interpolation Issues

Post by Norbo »

As you told me before that you had some experience with physics networking, do you have any advice on how to deal with this?
It appears that the main failure in the video is the character continually being shoved into the ground as if the goal state was invalid. The most direct solution to this is to only pick valid goal states to begin with, or at the very least compromise when it is determined that a goal state cannot be reached. With decent heuristics governing the correction process, continuous attempts to put the character in an invalid state would stop quickly.

My main advice, though, would be to closely examine the reasons for the architecture's nature. The easiest and best solution may be to drop strict server authority. Moving away from complete strictness becomes more and more valuable as the simulation becomes more dynamic.
Would there be any serious repercussions if the pushing players out of terrain is disabled?
Yes. Everything would get mired in the ground after impacts of any significance.
Post Reply