Game Development Reference
In-Depth Information
Networking in games
Networking (which includes the internet) has many uses in games, from having a simple
high-score table to running a server for a Massively Multiplayer Online ( MMO ) game.
The most interesting (and arguably most difficult) use of networking is for creating multi-
player games. The difficulty comes from the fact that we have to show the same scene on
multiple screens at any given time. This is extremely difficult when we have a lot of dy-
namic objects, events, players dropping in and out, and varying quality in the underlying
networks. Programmers have been trying to solve these issues by introducing different net-
working design architectures, the most common of which are: peer-to-peer and client-serv-
er architectures.
Peer-to-peer was mostly used in the early days of network programming. In this architec-
ture, each client (a device) communicates with every other client to update its local simula-
tion of the game. Here is a diagram showing the connections between six clients (30 con-
nections in total):
This works well with a small number of clients, but bandwidth can become an issue when
we bring more players in (most notably on slow networks, such as the internet). Further-
more, the architecture runs into problems when dealing with synchronization. For example,
one client might detect a collision between two objects at a particular moment, which
doesn't happen on another client. Choosing which one is correct is not easy, since they are
both running independently from each other and both simulations are technically valid
ones. Apart from that, clients can easily cheat since there is no authority in the system and
they can selectively ignore the states sent by the other clients. To solve these problems, and
to streamline the process, an alternative networking model exists—the client-server.
The client-server model operates on a very simple basis—one server runs the simulation
with all the logic and clients simply use that simulation to display their scene. In this scen-
Search WWH ::




Custom Search