🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multiplayer mobile games: P2P or client-server?

Started by
2 comments, last by Idov 7 years ago

Hi,
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 :)

Advertisement

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.

 

enum Bool { True, False, FileNotFound };

ok, thanks :)

This topic is closed to new replies.

Advertisement