Game Development Reference
ario, the clients are not running any simulation code (ideally), but they get the state of
each dynamic object from the server (position, rotation, and so on.) and display that object
in that state. The connections between devices are shown in the following diagram:
Once the server updates the simulation, every client receives the new game state and up-
dates their objects locally. This removes synchronization problems almost completely,
since only one device is running the simulation. It is also more bandwidth friendly for cli-
ents which do not have to communicate with every other client.
Both peer-to-peer and client-server can be useful in different situations. Peer-to-peer is
suitable for games which are designed to run on LAN or do not update their entities every
frame, but only occasionally, as in turn-based games and point-and-clicks. The benefit of
using peer-to-peer is the fact that it's slightly simpler to set up than client-server. In most
cases though, choosing client-server over the peer-to-peer model is better as it introduces
fewer problems later on.
Now that we have a basic idea of what networking is and how it can be used, let us talk a
bit about the Transport layer of the networking model.