# Dead reckoning cubic spline confusion

This topic is 3073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

http://www.gamedev.net/reference/articles/article914.asp

and it seems fairly interesting and i may or may not try to implement it...however it seems to me that its not exactly dead reckoning...as it needs two points. I thought dead reckoning was an approximation of your position while only knowing your previous position,time,speed and the current speed and time, So essentially only getting one data packet and guessing where you are until the next data packet comes through. Unless the point is to approximate ones position until the next packet comes through and then using the current position(which is approximated using dead reckoning) and then perform the cubic spline smoothing algorithm towards the next point.

cheers

##### Share on other sites
Quote:
 I thought dead reckoning was an approximation of your position while only knowing your previous position,time,speed and the current speed and time,

As far as I know dead reckoning describes the effect of sending only data if the delta difference of the data overcomes a certain threshold.

On the other hand you need to fill the gap between the last and the next data block being received on the client. This often includes prediction of data, i.e. movement.

One simple way to predict the movement of an object is just to take it last known position and velocity and move the object along with the given velocity. The problem with this naive approach is, that when your object turns it is a very bad approximation.

The next better one is to extrapolate the position along a spline (looks more naturally), but to construct a proper spline you need more than one position/velocity. If you take the two last received positions and velocities, you can construct a nice spline which is a good approximation of the movement of turning objects. In this case you do not interpolate between the two positions (alpha=0..1), but you extrapolate after the last position.

To extrapolate you need to add new positions to the end of the spline, i.e. by predicting the next movement position. Let's say you have two positions/velocity pairs. From this you can generate 6 points by applying the velocity infront and after the according point. Use this 6 points to create a cubic spline on which you interpolate the current position. The last point of this 6 is a pure prediction.

[Edited by - Ashaman73 on July 13, 2010 4:55:45 AM]

##### Share on other sites
Actually, when you use dead reckoning in your application, you do have the two points and the two velocities needed for cubic splines.

Lets say object A is part of your simulation. At time t0, you receive an update from the server, saying that A is at position (1 ; 1), and is moving at velocity (0.5 ; 0.5). Using this information, your client will believe that at t1, A is at (1.5 ; 1.5), and at t2, A is at (2 ; 2).

Now let's say that between t0 and t2, the player controlling A has taken a sharp turn, and is now at (3 ; 1), and travelling at velocity (2 ; 0).

If you receive an update from the server with this new position, you will need the client to move A from (2 ; 2), velocity (0.5 ; 0.5) to (3 ; 1), velocity (2 ; 0). That's your two positions and velocities right there.

You could just snap the player to that location, but the result is not very nice looking. Another option is to perform the interpolations described in the article you linked.

##### Share on other sites
I dislike cubic splines, because when they are wrong, they are REALLY wrong, really fast!

Instead, I recommend the "bi-linear" method of interpolation. Basically, you calculate "Given the information I know now, where would the entity be one RTT into the future?" Then you set the entity on a course/velocity that will make it reach that point at that time.

The Forum FAQ have some links to this, and other, interpolation methods. (This particular method has the catchy name "EPIC" if you want to search for it)

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633659
• Total Posts
3013209
×