Game Development Reference
In-Depth Information
Figure 12.8 Client prediction extrapolates the position of the opponents in
between server updates.
Aslong as the updates are frequent enough, the client should have a fairly accurate
representation of the opposing players at all times. However, if the updates are in-
frequent due to a bad connection, the client prediction will be incorrect. Because
the server is the final authority, the client must ultimately fix any discrepancies
between the prediction and the actual positions. But if the prediction works well
enough, it will appear smooth and seamless to the player.
This concept can also be extended to actions performed on the local end. If we
want the gameplay to feel very smooth, as soon as a player presses the spacebar to
throw the dodge ball, the throwing animation should begin onscreen. If the client
waits until the server confirms the dodge ball throw, it might seem like the game is
being unresponsive. The solution to this is that behind the scenes, while the server
is actually verifying that the throw is valid, the local client can begin animating the
dodge ball anyway. If it turns out that the throw was illegal, the client can correct
the problem. But so long as the player is properly synchronized, the perception
will be that the game is extremely responsive when dodge balls are being thrown.
Even though the server/client model is a very popular approach, there are some
issues to consider. First of all, some games allow a single computer to be both the
server and the client. In this case, there is a perceptible host advantage , which
means that the player who's both the server and the client will have all their ac-
tions instantaneously processed by the server.
Search WWH ::




Custom Search