I’m hoping someone who understands multiplayer on the iPhone can clarify a couple of questions that the docs and tutorials have missed. I have been working on and testing Networking options with the iPhone for several days but some things are still unclear. I have been able to start a working direct connection by typing in the server’s IP address but nothing more sophisticated.
Using iOS devices, can Unity Networking make games playable across a specific wireless LAN, i.e. playing with people in the same building, as well as across the wider internet? If it can, what connection methods do I need to use to build both modes?
Is the Master Server an application on Unity’s server that our game servers connect to or will it be running on one of the devices running my game
Will we need a dedicated server supporting the game, or will a player create a game and become the server?
The example project tries to help with iPhone multiplayer connections, but it is out of date so doesn’t work, and the “tutorial” that comes with it is mostly a list of instructions, frustratingly with no explanation as to how is is supposed to work.
If anyone could answer any of these questions I would be grateful, and I hope it will help other users in my position too.
It’s up to date and actually covers practical issues you’ll need to be aware of.
You have the choice of running a dedicated server, but you can also do peer to peer. The trick with peer to peer is that if you want to reach the wider internet, you’ll still need a server running, but its a special type of server Unity provides which is called a proxy server. This is used to facilitate communication when peer to peer NAT traversal isn’t possible (for example, anything involving AT&T 3G will need to go through a proxy as AT&T uses asymmetric randomized NAT). This server can easily be stood up on AWS, Rackspace or the like.
There’s also a “connection tester” server, Unity offers a public one, though it’s really slow, which can look for different ways to do NAT traversal, but in practice we’ve found it only works for some very edge conditions, so it’s not worth the extra hassle and slow connection times.
If you are only allowing local LAN play, then you don’t need to worry about the proxy, peer to peer should just connect, unless the player has a really unusual LAN setup, but this would be an edge case.
here it doesnt matter if u r playing on lan or internet, u jus need the ipadress of the peer u wanna connect to. u need not take care of mode of data transfer, unity will. u may have to write 3 -4 lines of code to run ur game in both online and offline.
master server is an application run on a remote ip by unity for the users to test the networking facility ( still it is reliable for commercial, atleast for me). u can run ur own master server if u want, unity provides all neccessary sources for free.
Dedicated server is just an option. it is not necessary that a server shd be dedicated to run ur game. mostly it depends on ur game. i dont think an iphone game would need a dedicated server (:P). usualy the peer that host becomes the server and all others connecting to it are clients( thts the basic of a network).
If u think connecting with ipaddress is not good just use master server, which will make ur work regarding connections simple.
Thanks for your help and those links. I’ve looked at the old version of the M2H tutorial, and I’m hoping we will be able to buy the up-to-date one from the asset store. Networking makes a lot more sense now!
But 1 thing that I still haven’t been able to overcome is the connection test always returns an error, followed by the error message “Failed to connect to master server at…[public IP]” Is this something to do with NAT settings?