Game Development Reference
In-Depth Information
Figure 12.9 Peer-to-peer model.
One genre that commonly uses peer-to-peer is the RTS. The usual model used is
a so-called lockstep model, where the network update is broken down into dis-
crete “turns” of roughly 150ms-200ms. When any input actions are performed,
the commands are stored in a queue and are only executed once the turn ends. This
is why when you play a multiplayer game of StarCraft II , commands sent to units
aren't instantly processed—there is a perceptible delay before the units actually
respond to the command because they are waiting for the end of the lockstep turn.
Because the input commands are sent over the network, every client in the RTS
game is actually simulating all of the units. They are processing the inputs as if
every player were local. This also makes it possible to save all your opponents'
commands and view them in an instant replay after the match is over.
The lockstep method results in the clients all being tightly synchronized with each
other, and at no point will one player be ahead of another. Of course, there is a
downside to this synchronization as well—if one client starts lagging, every other
clientmustwaituntilthatplayercatchesup.Butthelockstepapproachisverypop-
ular for RTS games because it allows for a relatively small amount of data to be
transmitted over the network. Rather than sending all of the unit information, the
Search WWH ::




Custom Search