- Home /
Setting up a Unity Masterserver - how to do it correctly?
Hi everyone,
I have been struggling with creating a multiplayer game for a long time now. I didn't really know how to do it, and how all the network related stuff works, so I started to watch tutorials (like this one, that explained a lot: http://cgcookie.com/unity/2011/12/20/introduction-to-networking-in-unity/) and read documentations.
I am now able to set up a MasterServer (content downloaded from the unity website) on my laptop. So i have two consoles running: one MasterServer.exe and one Facilitator.exe. I can connect to the masterserver and register my game from any device within my home network, or outside. Also, when having two or more devices connected to each other via the masterserver WITHIN my home network, everything seems to be working fine - it's like having a decent multiplayer game.
But there comes the problem. When switching my android device(Yes, I made a build for android) to 3g instead of wifi (so that is is not a part of my home network anymore) it CAN connect to the masterserver (I have port forwarded everything correctly! :D , and you can see the masterserver.exe and facilitator.exe receiving and sending data ) but it cannot connect to my game running on my laptop. The error "Receiving NAT punchthrough attempt from target XXXXX failed" shows up.
So here are my questions:
-Is it true that the Master Server won't work if it is in a NAT network? (see: http://www.raknet.net/raknet/manual/natpunchthrough.html) So do I need to host it somewhere? or can disable NAT in some way to make the server work properly?
-Is using the masterserver actually a good idea? Isn't it too outdated or is it unstable or always having problems? anyone having experience with this?
-Is it a better option to hire a server - something like photon or smartfox?
This is what I'm trying to reach: Making a simple multiplayer scene where clients "all over the world" can connect to, whether they are in a home network, outside using mobile internet, or something else...
Any help is appreciated!
Thank you so much in advance!!
The master server is intended to sit on the internet somewhere that all machines can connect to. Unity networking is good for small numbers of players connecting to play a game together, so perhaps up to 16 players. One of the players will act as a server, and will talk with the masterserver to help other players find it.
thanks, i figured that already, but i doesn't seem to be working since no one one the internet is able to use it properly :(
so do i get this right that someone can not create a server when he's in a NAT-network(behind router) in a simple and fast way? What i would like to achieve is a game where you can simply host a game yourself and invite 2-3 friends via a link or ip or sth similar and they join your game. So i'd not need to have game-servers. Only maybe a master-server to share the ip to the clients. Is this even possible? I always thought you could just send your public ip to a friend and he could easily join, but it seems like it's not that easy online...
Answer by Weirdo-Studios · Jun 28, 2013 at 05:23 PM
The thing I recommend and am currently using is Photon. Check it out on the asset store but in essence it is a server which works in the cloud and they host for you completely free (20 connections at once) and you can then pay for more licenses if you want it. These give you 200, 500 connections or unlimited something like that.
Answer by justust · Sep 23, 2013 at 10:13 AM
Perhaps a to late answer but the master server seems to work just fine for you, its just giving the address and port to the game server on your laptop with port and everything. Same as any other lobby would do.
But then you want to connect to that server and the problem occurs. That is you can not find the server running in you gameclient on your laptop. You would I presume have to port forward that port to your laptop in your router.
@N13s Hi,
Could you please help me in setting up master server. I followed the following tutorial https://www.youtube.com/watch?v=ScijsRwrsho but still i am unable to connect to master server
Thanks in Advance
Your answer
Follow this Question
Related Questions
Custom master server 0 Answers
How to solve networking issues? 0 Answers
How to control "portable hotspot" function on Android? 1 Answer
NAT Punchthrough failed 0 Answers