Game Development Reference
In-Depth Information
Second, all clients will see the game run at the speed of the most-latent client because
commands from each player must be collected before advancing in order to ensure
synchronicity. As a result, extra precautions must be taken to keep clients from
cheating by pretending to have higher latency and waiting for the other computers'
commands before making a decision. The latency issue also creates trouble when one
machine is taking a particularly long time to return a command. In such a situation,
the game may have to drop that player. Since the reason for using lock-step is that
the entire game state is too large to transfer over the network while maintaining
synchronicity, it may not be feasible for a player to join (or re-join) after a game has
already started.
The other approach to game networking is a client-server prediction model, which
usually works like this:
1. The client triggers some input (such as pressing a key or moving the mouse)
that changes the game state.
2. The client input is sent to the server.
3. Optionally, the server forwards the input to the other clients.
4. The server processes the inputs it receives from all players, reconciles
them, and produces a new, authoritative description of the game's state
at a specific time.
5. If the server forwarded other clients' inputs, the clients receive those inputs
and continue updating the local game state by predicting what the server
thinks the state should be.
6. The server periodically sends the latest complete description of the
authoritative game state to each client.
7. The client adjusts its state to sync with the server's official state.
The main difference here compared to lock-step is that clients can advance the game
independently, and the entire game state can be sent from the server to ensure each
player sees something pretty close to what the others see. This is a better model for
action games like FPSs or games with many players like MMOs because players
generally experience less dramatic latency effects.
 
Search WWH ::




Custom Search