Game Development Reference
In-Depth Information
model you can treat your entire game as a client/server multiplayer game, even if the
player is running the single player aspect of your game. The Source engine (Half-
Life 2, Team Fortress 2) does this using a concept called a listen server . This server
runs privately on the local machine, and the game client connects to it to play the
game. Of course, here you have the benefit of being able to separate out your game
logic from your display and audio logic, which allows you to easily swap out the game
for another with minimal effort by writing some new server logic.
Furthermore, cheat prevention can be implemented by checking the updates sent to
the server and ensuring that the game state remains clean. If the values seem wrong
or information from the client seems unusual, you can let the server fix the world
state or remove the player.
There are downsides to this method, however. As there is a single point of contact for
all players in a game, if this server goes offline or has an error, all players in the game
will lose their connections and have to stop playing. The real-time nature of most
video games makes traditional failover techniques unfeasible as the overhead to
keep multiple backup servers in sync can often be too high. This, of course, depends
on the game; for example, Massively Multiplayer Online Games ( MMOG / MMO )
are designed to run persistent worlds, and often utilize gameplay or world-building
techniques that allow for backup servers to be kept in sync and in use through slower
gameplay.
The peer-to-peer model
Another technique is the peer-to-peer model, or P2P for short. This model does away
with the host/client relationship and instead connects each player to every other play-
er, sharing the game data with everyone else and making decisions on local ma-
chines. This has numerous benefits, the most notable being the ability to handle loss
of connection for any player and still keep the game going. In this case, the world
state is communicated to every other player and each game client is responsible for
both the rendering side of the game and the gameplay logic and state.
In this case you can set up a quick game with friends without the need to sort out
an official server to host your game. Matchmaking , a technique where players are
matched together without all agreeing to connect to a server is often used here as it
allows for a master server to join everyone together, and then the peer-to-peer net-
working takes care of the rest. Data use is also spread among the players and, al-
though each machine has to send out data to every other player, techniques can be
Search WWH ::




Custom Search