I am reading up on multiplayer game architecture.

So far most of the articles i've found deal with the client-server model.

I'd like to know what are the limitations for using a p2p architecture? what "class" of games are possible (or more common) to implement using it? which aren't? and in general, what are its main differences and limitations against the client-server model.

closed as too broad by Josh Feb 10 '15 at 18:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Here's my two cents:

P2P:

  • Pros:
    • No need for a central server: this makes it much cheaper, and more viable for low-budget indie games.
    • Scales very well(up to a certain point when the average client just cant handle the bandwidth).
    • Very good for data distribution: Suits games where user-created content is dynamically synced.(also just look at torrents)
    • More Stable: It can never happen that the server is having problems and no-one can play(implementation dependent).
  • Cons:
    • Hard to implement: much harder to create a solid P2P architecture, than a server-client.
    • Its very hard to prevent cheating in such a system, unless you designate an authoritative peer, but then again you lose much of the benefits of scaling well.
    • Security is hard to achieve.
    • A clients internet connection can influence the game for others too.
    • Latency is usually much bigger(tough can be better when joining an internet game with multiple people from a lan network for example).

Server-Client:

  • Pros:
    • Easy to implement: Its as straightforward as it gets.
    • If implemented well, scales extremely well.(if the work can be distributed on multiple servers)
    • Cheating can be avoided easily.(relative to P2P)
    • Lower Latency: If the server has a solid connection the latency can be extremely low.
    • A player's internet connection never affects the other's game.
  • Cons:
    • Costs you money to run the servers: definitely not suitable for a free game.(unless you let the players set up a dedicated server, but that might be a security problem)
    • If the server has problems, everyone has.

I would consider P2P a good choice because the average internet connection is getting better and better, in the future P2P latency might not be a problem at all. Also much about P2P depends on the specific implementation.

There is also some architectures that combine P2P with Server-client.

A big risk of peer-to-peer games is that without a central authority in form of a neutral server, there is no way to prevent cheating. Each client can interprete the outcome of the game however it wants. Some games declare one of the clients the host and let him be the judge, but when that client is a cheater, they decide the outcome of the whole game.

With games which require low latency and high bandwidth, like any game which requires quick reaction from the players, you also have the problem that the host is just using a consumer-grade internet connection, not sitting in a datacenter with a high-performance backbone connection. That means the user-experience will suffer. This isn't so much of a problem in more strategy-oriented, "slower" games.

  • Using a consensus model, cheating is no more of a problem than it would be in a client-server model. – Jeroen Bollen Oct 1 '17 at 11:43

Implementing peer to peer multiplayer games is not easy and not applicable at the moment.

The problem you have is, that none of the peers knows all other peers so that you have multiple hops for each message which results in a higher latency compared to a client server model. See this paper for additional details.

Round-based games could easily use such a protocol since they dont depend on latency so much. Also they normaly have only a few hosts in a session so that one could broadcast every message to all other players.

Other games which use peer to peer just choose one of the Peers dynamically to host the game (i.e. CoD MW2), which results in problems like host-migration if the host disconnects.

  • 3
    What do you mean "not applicable at the moment"? There are lots of games that use P2P for networking. Also, "none of the peers knows all other peers" is worded wrong. While in practice relays need to be supported in order to improve robustness, it's entirely possible to have a perfect everybody-to-everybody network topology, especially with small peer counts or in LAN where there's no NAT routers interfering. – Tapio Dec 22 '13 at 17:02
  • @Tapio Of course it is possible to build a p2p-network for games but it would be limited in terms of latency, number of users or the environment in which it is used. For that reasons most games don`t use a p2p approach. – Horstinator Dec 22 '13 at 20:25
  • @Horstinator I know of a game which uses P2P for an FPS game, it solidly supports 50-100 players without any latency problems whatsoever.(Its called stickman warfare for anyone who cares) – akaltar Dec 22 '13 at 21:02
  • @akaltar Is it open source? Id like to see how they do it. – Horstinator Dec 22 '13 at 21:16
  • @Horstinator Too bad, but as far as I know it isn't. You could ask the creator on the forum(its a very small project, so someone should respond). – akaltar Dec 23 '13 at 0:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.