Master Server/Connection Tester/NAT Facilitator - Solutions for the broke indie dev?

So I have a multiplayer FPS up on Kongregate (SpaceJunk) – right now there’s never more than a few people playing at any given time, so I just have them automatically connect to a server I run from home. Before I push to try and get more people playing, I obviously need to be able to support that extra volume. Ideally, I’ll use NAT punch through to allow people to host games with the least amount of hassle. I don’t really have any money to spend, so I’m hoping to find something that’ll work for free with my current resources. Right now SpaceJunk uses Unity networking exclusively. Would integrating something like Lidgren be useful in my case? I really only need help getting people connected to each other.

That requires three pieces -

Master Server - Right now I have the PHP master server running on my webhost and I really like it. The author says it uses Unity’s default NAT facilitator – I didn’t see any reference to the facilitator in the code so I have no idea if it actually uses the facilitator or if that’s even possible. Any insight to this would be helpful.

Connection Tester - Right now I’m using Unity’s. So far I’ve tested from 3 different friends places and it always returns ‘limited’ status (people won’t be able to connect). How common are routers that support NAT punch through? How reliable is the Unity connection tester? Would it be possible to have a connection tester similar to the PHP master server and host it on my webspace?

NAT Facilitator - This is the most mysterious piece for me as I’m not entirely sure what it does. Is it just for facilitating the initial connection between the client and server or does it continue to relay all communication…? If it’s the latter, it seems like it’s something that would be too expensive for someone like me… and even if I could afford it, it seems like it would add latency and harm gameplay. Would Unity’s facilitator be compatible with the PHP master server?

I really appreciate all feedback and help you guys can give me.

edit: I notice some applications have opened ports on my router without me having to do anything – any way I can have my game do that?

edit2: I’m hosting a server right now and people can connect. I have my desktop set as DMZ host. Connection test returns limited NAT… does that sound right?

I am not on my dev pc to assist you more but here’s some of my experiences:

Master Server: the only thing the php master server is used for is for the clients to access the database and get the information on who out there is hosting a server. The database contains all the info as far as external/internal and guid settings that are needed to do the rest of the work. If your using the default settings along with php master server its still connecting to the default master server and nat facilitator. You will need to download the master server and nat facilitator, compile them and start them up on your server.

Con Tester: I have the same experiences here it seems to come back limited but ive never had an issue with people connecting.

Facilitator: This really has nothing to do with the php master server, in unity you will use the settings out of the database to know how to connect to the server. I also have not gotten any lag or anything due to it but that probably really depends on your application.

Edit #1: I have never seen this done so don’t have much information on it.

Edit #2: Mine returns limited a lot but still have people connecting with no issues.

Hope this helps even a little.

That’s not true, when you use the php master server, you are using whatever web server you are hosting the php files and database on as ma master server and not using the ut public master server at all, but it does still use the ut facilitator if you are attempting bat punchthrough.

is there not a way to change the address of the facilitator?

Yes there is. Actually all 4 parts of the master server side can be reconfigured to run at a place you specify.

But if you do you must offer an own one, you can’t do con tester and facilitator through php and alike.

Yes but the php files dont create a master server… If so I must be completely missing something. So please legend let me know if im wrong. Im always up for learning new things.

I currently have a web server hosting the php master server php files. And then I have a game server that host the master server 2 completely different servers 2 completely different ips in 2 completely separate parts of the USA.

If you upload those php files to your server and use the code in the project you connect to the default server unity has not your own.

Also just to expand on what Dreamora said go here - Unity - Scripting API: Network and look under class variables that should help you on your way with what your asking.

I’m not sure what php master server files youre using, but the ones I’m using require you to have a MySQL database on the same web server that you are hosting the php files, and you need to properly configure the MySQL connection at the top of each of the php files. Then in my game, when someone registers a host it gets inserted into the database, and when someone is browsing for hosts they are pulled from my database for currently hosted games (NOT unity’s).

I might not have been as clear as I should have. The point I was trying to get across was that using the php master server files does not change what Master Server and NAT Facilitator your connected to because the code just uses the default settings for both.

Killer did these comments help you? Did you find the settings you were needing to?

If you upload those php files to your server and use the code in the project you connect to the default server unity has not your own.

This was your statement that confused me. By using PHP master server files and a MySQL database on my web server, I am not at any point connecting to the Unity Master Server to register, update, or retrieve hosts, they are all stored and retrieved from the database on my server (But I am still using the default facilitator for punchthrough).

Killer, you can change the facilitator IP here: Unity - Scripting API: Network.natFacilitatorIP

Yeah I see where the confusion was I should have re-read what I typed a little better. When I said the project I meant the unity code

  Network.InitializeServer(MaxPlayers, Port, !Network.HavePublicAddress()); 
  MasterServer.RegisterHost(GameType, GameName, Comments);

not the php files. Funny thing is I originally had the code from the unity-script pasted in to show what portion I was talking about but took it out because I thought it was to obvious what I was trying to say! :wink:

Oh yea, I an always learning. Thanks :).

Thanks, I completely forgot that you don’t have to change settings in the master server to connect to a different facilitator. Its all in Unity :smile:>

Ah, I set up my own GUI (not using his MainMenu.js file) so I wasn’t sure what you were talking about. You actually don’t need that line of code at all to use the PHP masterserver (the MasterServer.RegisterHost one), he left that in by accident (I asked him about it).

You don’t need to use any MasterServer.whatever commands to use the PHP master server, assuming you have it set up properly on your web server (and thus, you never need to connect to Unity’s master server).

Hmm… that conflicts a bit with what he said in another thread:

This is what he said to me over googletalk yesterday:

Ok cool :slight_smile: