86 Networking and Online Games: Understanding and Engineering
88 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games Predicted Algorithm Sample user input Pack up data and send to server Determine visible objects and game state Render scene Receive updates from server and upack Fix up any discrepancies Repeat. As an illustration of the effects of latency on this architecture, consider the screen- shots in Figure 6.5, in which both game consoles (the client and server) are connected to the same television. In the figure, the client s display is the larger picture, while the server s display is inset in the picture-in-picture. The client puts a man in motion (causing a football player to go from left to right across the screen), the result is that the client sees the in-motion player movement first, and subsequently, the player is one or two steps ahead on the client s display than he is on the server s display. We have manually drawn a box around the man in motion on each display to indicate the player of interest. Notice how the boxed player for the client in the large picture is further to the left than the boxed player for the server in the inset picture. The notable additional step the player prediction approach has that the basic client server approach does not is the step to fix up any discrepancies . These discrepancies may occur because the server still has the master copy of the game state, and this master copy may differ from the predicted copy the client has. As an example, suppose the user moves an avatar to the right. The game at the client sends this movement Figure 6.5 Depiction of state inconsistency (Madden NFL 2003). The large picture showing the first player s view differs from the second player s view, shown by the smaller, inset picture. A black box (drawn manually, not by the game) highlights the main difference
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services