Game Development Reference
In-Depth Information
Imagine playing Halo, and imagine you are about to shoot an RPG at your best
friend. If your friend is playing over the Internet and has a bad lag, your friend ' s
machine might not get the message that you fired the RPG until a few hundred milli-
seconds after you fired it. If you could watch both screens at the same time, you
'
d see
your RPG rocketing over to blow up your friend, but your friend wouldn
'
t see any-
thing at all, for just a short time.
Some 500ms later, your friend
s machine gets the message that you fired an RPG.
Since there was no way to predict this message, it must show the fired RPG but
begin to move the rocket fast enough to catch up to the rocket on the authoritative
server, or host.
That
'
'
s why playing shooter games is impossible when you have bad lag and you
'
re
'
not running the host! That
s also why no one will play with you when you run the
host over a slow connection, because it gives you an unfair advantage. The remote
machines simply don
t get the messages fast enough.
What this means to the remote game logic is that it has to make corrections in its
game state, perhaps breaking the
'
in order to get things back in sync. In the
previous example, the rule that had to be bent a bit was the acceleration and speed of
an RPG. If you
rules
'
ve ever seen an RPG turn a corner and kill you dead, you
'
ve experi-
enced this firsthand.
Other than that, the remote game logic interacts with the game view in pretty much
exactly the same way as the authoritative view; it sends the game view events and
changes in game state and accepts game commands from the view. Those commands
are then packaged and forwarded on to the server machine, specifically the remote
game view mentioned in the previous section.
You Need Multiplayer? Give Me a Few Hours
We designed our last card game for Microsoft using a rigorous
implementation of the game logic/game view system. When we started
working on the game, Microsoft wanted us to code it such that we could
create a multiplayer version of the game in as short a time as possible even
though we weren
t easy,
and all the programmers had to take some time to learn how to deal with this
very different architecture. After we shipped the project, I was curious how
well we
'
t shipping a multiplayer game. Believe me, it wasn
'
d done in creating something that was multiplayer-aware, even
though we
'
d never actually used the feature. One of our programmers spent
about two days and had our card game playing over the Internet. If that
'
'
s not
proof, I don
'
t know what is.
 
Search WWH ::




Custom Search