- Home /
Custom master server
I am able to connect to a master server using serverPort = 23466 and my MultiPlayer game runs nicely. I now want to host my own master server on my spare PC laptop. I installed the master server files provided by the very kind Riekelt found here: http://forum.unity3d.com/threads/144321-Pre-Compiled-Unity3D-masterserver!
But I believe my game is still using the Unity provided master server because when I shut down my pc which runs the master server, my game still connects.
The read me supplied with the master server installation states the following: MasterServer.ipAddress = "127.0.0.1"; MasterServer.port = 23466; Network.natFacilitatorIP = "127.0.0.1"; Network.natFacilitatorPort = 50005;
But in the star trooper demo, I only see a var for serverPort. Where would I define the other vars like IP?
Thx for any help!
So I pasted the following:
$$anonymous$$asterServer.ipAddress = "127.0.0.1"; $$anonymous$$asterServer.port = 23466; Network.natFacilitatorIP = "127.0.0.1"; Network.natFacilitatorPort = 50005;
in an Awake function in my $$anonymous$$asterServerGUI.js script and it compiled with no errors. I run the master server/facilitator on my pc laptop. Then on my mac, I build to my ipad2 and run the same project in the editor to test the master server connection of the game.
When I try to connect the games the console in the editor reports:
Failed to connect to master server at 127.0.0.1:23466
Could it be I need to enable/open ports on pc or mac?
Answer by Bunny83 · Jan 25, 2013 at 04:05 PM
It seems you don't know what 127.0.0.1 is. This IP will always address your own PC / Tablet / whatever. You need to host the masterserver on a real fix IP address so everyone connects to the same IP.
So now I installed facilitator and masterserver on my mac and closed my pc laptop for now. They run properly and I can see in the console that it connects by reporting connecting to connection tester at ....
connected to masterserver at ...... inco$$anonymous$$g host list...... then iget two errors failed to initialize network interface is the listener port already in use its not possible to register a host until it is running.
Does that mean it would never work with my current computer/network?
Well, it seems you try to register your game at the masterserver before you actually called Network.InitializeServer on your server. There's not much we can say about that without seeing the code that produces those errors.
Btw, did you get those errors in Unity or in the $$anonymous$$asterServer console?