Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
87 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 Dead Reckoning
 Using Cubic Splines

 Printable version

 


Possible Forms of Dead Reckoning

What the programmer wants to do is take a current position for an object and form a smooth path to where the object is supposed to be. Several techniques are available.

The most basic form of dead reckoning is the "point-to-point" method. As its name implies, this method involves only moving a player to a new point when a data-packet arrives. Given an average Internet lag of 200-300 ms this creates a noticeably "jerky" player. This method is by far the worst because unless a remote player is absolutely still, his onscreen representation is completely erroneous. The reason for the error is that data packets in a fast quake-style game arrive only 5-10 times per second, while even a slow game updates at 30 frames per second. The only way to make players move smoothly is to send one packet for every game frame. This is a terrible strain on bandwidth, thus the point-to-point updating method is nearly impossible to effectively implement in a real-time game.


NewPosition = OldPosition

The next level of precision is the "linear" method. This method involves creating a straight-line path to the next position. In terms of physics, this means that the velocity of an object is used to decide where it should next appear. This method reduces jitters caused by lag but has a tragic flaw: it assumes people will only move with a constant velocity. Thus, the generated and actual paths vary noticeably (although the game will be much improved over the "point-to-point" method). When playing a game that uses this method, players will seem to move in straight lines. Further, whenever a player starts a new linear path his velocity could change abruptly. The end result is a thoroughly unrealistic game.


NewPosition = OldPosition + Velocity*Time

A smart programmer might now ask, "why not just add acceleration to your path equations?" Such a method is possible, and will result in even smoother game play. This is called the "quadratic" method because the path created follows a quadratic function. Without detailing the math, this method also fails because even though a player's motion is represented more realistically, his final velocity is likely to be incorrect. This is because quadratic functions do not employ what physicists call "jerk", or the change in acceleration over time. This leads to the final solution: the cubic spline.


NewPosition = OldPosition + Velocity*Time + Acceleration*(time)2

Cubic splines offer one of the most realistic methods for creating a dead reckoning path. This is because they account for the starting position\velocity and the ending position\velocity. As a result, objects following a cubic spline path have no jitters, unless lag is especially severe.





Next : Using Cubic Splines




This article may not be reprinted commercially without the express permission of the author.
Copyright © 2000 Nicholas Van Caldwell