86 Networking and Online Games: Understanding and Engineering
Latency Compensation Techniques input immediately, rendering player and opponent movements before getting authoritative responses from the server. Broadly, there are two categories of prediction that can take place. In the first prediction category, the client takes input from the player and predicts the server response related to only the player s units. We call this Player Prediction . In the second prediction category, the client predicts the location of units that are not controlled by the player, being controlled either by other players or by a computer. We call this Opponent Prediction (even if some of the other units are not necessarily on another team).1 6.2.1 Player Prediction The client can predict the server response, allowing the game client to respond to user input and render player actions before getting the authoritative response from the server. This allows the game to appear immediately responsive to the user input, not needing to take a round-trip to the server and back before impacting the game. In fact, the response can be as fast as a non-networked game, thus completely removing any network latency. Using prediction, however, means the game state on the server (and the state on other client machines) will differ somewhat from the game state on the client. The amount it differs depends on the round-trip latency and, to some extent, the user actions taken. The client must therefore fix up any discrepancies in the game state when it finally does get a response from the server. The player prediction process is depicted in Figure 6.4. Time User input Render input Process and validate input Message: user input Message: ok with updateFix up Figure 6.4 Client-server in which client renders input with predicted state before getting ok from server 1 Prediction of units controlled by others is often called Dead Reckoning [Dead reckoning, CLC99, DF98], but that name does little to help remember the technique, hence our term Opponent Prediction .
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services