Sign in to follow this  

Multiplayer mobile games: P2P or client-server?

Recommended Posts

I want to build a multiplayer (2-3 players) mobile game.
I'd like to know what is the most common architecture for this kind of games:
1. P2P : Players mobile devices communicate without a server's help.
2. Server-Client: Clients do not communicate directly with each other, but send each move they do to the server.

How do most mobile games do it?

thanks :)

Share this post

Link to post
Share on other sites

It depends on the game. "Party games" can work without a central match-maker. An example of such a game might be "Space Team" (which I recommend if you have some friends over and your neighbors don't mind some shouting.) You typically implement these using plain UDP broadcast, or some library/service that is in turn implemented on top of UDP broadcast. That means they work as long as all players are connected to the same WiFi network. It is theoretically also possible for one of the phones to act as an access point, and the other phones to connect to it, but in practice, this either doesn't work, or performs really poorly.

Real-time interactive games that don't rely on physical proximity will need a matchmaker server for matching up the players to each other. Once matched up, you have the choice of having one game instance "host" the game and the other players "joining" that hosted game ("client host",) OR each instance running its own game and "updating" the others about their actions ("peer-to-peer",) OR running the server centrally and having each player just send their updates to the server, and the server echoes the data to the other players. Peer-to-peer is the least robust, client hosts are nice for developers who have very little money, and central servers generally provides the most robust gaming experience with the least chance for cheating. But, in each of these cases, you at least need a server of some sort to match-make/introduce the players to each other. (Libraries or toolkits like Game Center or Play Services or whatever can do this for you in some cases.)

Finally, asynchronous multiplayer games -- anything from a "chess by mail" game to a "backyard monsters" base builder to a "farmville" semi-social game -- needs some server that stores the state of the game between player check-ins. Because the players aren't online at the same time, the client hosted method, and the peer-to-peer method, don't work.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this