More precisely, I would like to know what must be modified in the ConnectGUIMasterServer.js script of Unity's networking example to have it work reliably with a home-hosted master server, whatever the players' locations (LAN or external).
Thanks in advance :-)
asked Dec 16, 2009 at 03:30 PM
A home hosted master server might be a little troublesome. One of the things the master-server helps you with is NAT punchthrough - which requires that the machine the master-server is running on has a direct connection to the Internet, which usually is not the case for "home-based server".
So, unless you've got an Internet provider that gives you a public IP for your specific server and unless you have that server directly connected (without any IP-forwarding or NAT), it'll be hard to get connections created through such a home-based master server to be reliable.
That said: You can use MasterServer.ipAddress and MasterServer.port to let Unity know the data of your local MasterServer. Just make sure this is done before you actually use the MasterServer (e.g. for connecting), so you'd probably put the relevant statements right in the beginning of ConnectGuiMasterServer.js; something like:
answered Dec 16, 2009 at 11:00 PM
If you want to make it accessable to the outer world and would like to use one of the free static domain redirectors for that (no-ip.org / dyndns), then you need to expand the code slightly, as the ipAdress property of the master server etc only accepts the regular tupples.
Also, you can not only set the master server adress and port but also the one of the connection tester and facilitator, which you will have to host along with the master server, should you require these functionalities.
The connection tester will obviously handle the connection test, while the facilitator is used for the NATPunchthrough.
Here is an example
answered Dec 17, 2009 at 12:12 PM