Network strategies for smartphone games

Hello there,

I am working with Unity for several months now, and I am finally working on the network part of my game. As I discover the common trap linked to network development (NAT and server reachability…) I wonder what is the best (or at least, the most common) strategy for a multiplayer game on smartphones.

The common strategy for PC/Mac games is to allow players, via an option pannel to configure their connectivity options. Also the game often warn players when connectivity is bad so they can configure their routers or their computer to play. Then it’s easier for developers to build up a p2p communication between players thanks to option pannel and the computer nature.

But you can’t ask players to configure their router or some other physical device when they are playing on a phone right? I mean, as long as you can play via 3G or Wifi and don’t have a clue about your connectivity options (when you are using a public wifi access for example) you often can’t modify gate access or stuff like that to enhance network reachability.

The few test I’ve done on my game (helped with some friends) led to complete connectivity failure due to NAT. As my phone uses wifi I’m not sure if ports are reachable or if my router allows NAT connexions because I’m not always at home, using my own wifi (the one I love, the one given by a well configured router).

So how do “real” games do stuff like multiplayer games on mobile? Is the most common solution to have a dedicated server reachable by everyone everywhere? What to say to players (who probably have bought a multiplayer game) when they actually can’t play with others?

Unity networking is pretty solid for small multiplayer, which is what it’s designed for. Of course if you want hundreds of users you would need to go with an out of box solution like Photon, Smartfox, or roll your own. If you’re designing a session based game with 4 users like Castle Crashers it would work fine. I’ve never had a problem being disconnected or whatnot and generally it connects on the first try with no issues. Try the Ultimate Networking package on the asset store, that did the trick for a small multiplayer game.

Buy Pro, then get Photon Cloud. They don’t like to publicize this fact but built-in internet multiplayer on iOS/Android with Unity just plain doesn’t work and making it work has never been a high priority. If it was, the Social API would already support GameCenter matchmaking.

It’s also the reason why the $400 version of Unity iOS does not include use of System. Net but the $3000 version does.