Game Development Reference
In-Depth Information
'
You
ll see the same game logic/game view architecture, but there is a new implementa-
tion of the game logic and a new implementation of the game view. Both are needed to
create remote versions of their single-player brethren.
Remote Game View
On the server machine, the remote player should appear just like an AI agent. The
remote view receives game events from the game logic and responds with commands
back to the game logic. What happens inside the remote view is completely different
from the AI agent view or the human view.
Game events received from the game logic are packaged up and sent via TCP or
UDP to a client computer across the network. Since game events on a local machine
can be somewhat bloated, there should be some processing of the event data before it
is sent out. First, redundant messages should be removed from the message stream. It
makes no sense to send two
events when the only one that matters is
the last one. Second, multiple events should be sent together as one packet. If the
packet is large enough, it should be compressed to save bandwidth.
The remote game view also receives IP traffic from the remote machine, namely the
game commands that result from the controller input. One difference in the remote
game view is that it should never trust this command data entirely. The game logic
should be smart enough to do some sanity checking on impossible commands, but
the remote view can take a front-line approach and attempt to short-circuit any
hacking attempts, such as detecting badly formed packets or packets that come in
with an unusual frequency. Once the game commands have gone through some
kind of anti-hacking filter, they are sent on to the game logic.
Object Move
Remote Game Logic
In this model, the game logic is an authoritative server; its game state is the final
word on what is happening in the game. Of course, the client machines need a
copy of the game state and a way to manage delays in Internet traffic. This is the
job of the remote game logic.
The remote game logic is quite similar to the authoritative game logic. It contains
everything it needs to simulate the game, even code that can simulate decisions
when it must. It has two components that the authoritative game logic doesn
t have:
something to predict authoritative decisions, and something to handle corrections in
those decisions. This is easier to see with a concrete example.
'
 
 
 
Search WWH ::




Custom Search