The PiaReckoning module provides features for minimizing communication traffic by estimating the state of game objects using dead reckoning.
The position and orientation of game objects must be synchronized between stations at all times. However, sending this data with every game frame consumes a large amount of communication bandwidth. By using dead reckoning instead, the sending station can sub-sample the data sent, and the receiving station can fill in the gaps between the received data. This reduces communication frequency and preserves bandwidth.
The extent to which communication traffic can be reduced using PiaReckoning depends on the specifications of the game. For a normal action game, the amount of communication traffic can be reduced to anywhere from around 1/5 to 1/10 the original amount.
Dead reckoning is a technique for estimating the current position and orientation of a target object using previously determined information about its position and orientation.
The sending station compares the estimated value based on a past sample value to the current, actual value. If the difference between them is larger than a specified threshold value (the reckoning threshold), the station adds a new sample value and sends data to the receiving station.
The receiving station performs the same estimation as the sending side each time the sample value is updated and uses the current value calculated from the estimation.
Figure 9-1. Path Estimation shows an example of estimating the path of an object from three sample values using an algorithm that finds a quadratic function fitting the sample data. t1, t2, and t3 represent the times the sample values were updated and sent.
Use the ReckoningCloneElement::SetValue() function to set one of the values configured for the game object as the sample value. This saves a specified number of sample values (and the corresponding timestamps) starting from the most recent value. These are then sent to the receiving station. The receiving station saves a specified number of the received sample values and then estimates the current value from the sample values by calling the ReckoningCloneElement::GetValue() function.
Figure 9-2. Value Estimation Overview shows an example of estimating a value from two sample values using linear extrapolation. When the way the input values are increasing changes, an additional two sample values are sent. At time 1, a sample value of 10 is used and sent. At time 2, a sample value of 20 is used and sent. When these two sample values arrive at the receiving station at time 4, linear extrapolation correctly estimates the current value to be 40.
Starting at time 5, values are no longer increasing. As a result, new sample values are obtained and sent at times 5 and 6. At time 6, however, no new sample values have arrived at the receiving station. Because earlier sample values are being used, the current value is incorrectly estimated to be 60. Using dead reckoning in this way can result in the temporary use of an estimated value that differs from the actual value.
By time 8, the new sample values have arrived at the receiving station and can correctly estimate the current value to be 50.