Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Master Server for Service on Windows Servers

Discussion in 'Assets and Asset Store' started by zumwalt, Jan 27, 2011.

  1. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    Here are the 2 files needed to make this work for 3.x of Unity, you will need Visual Studio 2003 or above to build up the Master server code that you can obtain from Unity, this header file and cpp file is designed to allow you to run the master server and facilitator from one executable and have nat punch through that works natively. Second file is the compiled version, the Deploy folder contains the masterserver service along with a readme file, in that file it explains where to put the masterserver folder, what to run at the command line and where to run it. This will add the masterserver as a service on your windows server and then you can open up services and set the service to start up automatically. Since Unity does not change the packet descriptors except from major version to major version, this should be good for all 3.x releases.

    The ports that I have in the compiled version are 25000 for the master and 25001 for the facilitator. You can use the M2H tutorials to connect up to your master server and host your games through it. Don't worry about using the connection testers, they seem to be funky. I am the point of contact for this code, so any problems or concerns, questions etc, direct them to me, not Unity.
     

    Attached Files:

  2. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Awesome asset, bru!
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Thanks for sharing zumwalt
     
  4. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    You have mail zumwalt :p
     
  5. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Woah, this looks great. I wonder if it would work with linux?
     
  6. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    Thank you zumwalt!
     
  7. TwisterK

    TwisterK

    Joined:
    Oct 26, 2010
    Posts:
    110
    Just tried it, but it seem like my game can't connect to the my master server, here is my code to use custom master server. Help?

     
  8. alaindum

    alaindum

    Joined:
    Sep 4, 2011
    Posts:
    15
    I will test that on my windows PC , and thank you ,
    but I have a dedicated Linux server .

    Have you ,zumwalt , a "version" for Linux ?????
     
  9. simom85

    simom85

    Joined:
    May 27, 2010
    Posts:
    283
    I'm not able to change the Masterserver port from tha MasterServer.cpp file! Can you explane me how to do? thanks
     
  10. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Having the same problem. Any suggestions?
     
    Last edited: Oct 30, 2011
  11. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    im facing the same issue, have followed all the instructions on the "Deploy.zip" file and everything is ok, but when i try to connect from unity it says Failed to connect to master server at xxx.xxx.xxx.xxx:25000

    any thoughts?
     
  12. ar0nax

    ar0nax

    Joined:
    May 26, 2011
    Posts:
    485
    same here, i set my IP to the masterserver, since i started the service on my pc, and it's not working :|

    anyone found how to make it work ? (might be firewall??)
     
  13. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    i tried this on a win 2008 server and cant connect, disabled firewall and still nothing, i just tested on my local win pc and same result..

    checked the logs but seems like the .exe is not reachable somehow or something is not matching..

    im trying to install visual studio to compile the server myself and see what happens, you guys check this post

    http://forum.unity3d.com/threads/108225-So-now-unity-masterserver-not-working

    im going to try to do what that guy did.. and see what happens.

    ill keep you updated! working on it!
    =)
     
  14. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    ok just a quick update.. i finish the visual studio express 2008 c++ installation, just open the unity masterserver project and click build.

    took some time but at the end got my masterserver.exe just perfect.

    now, i tried with this one and voila! unity just connected and worked like a charm!

    now, i realize that masterserver.exe is a 1.3mb file so im not sure about this one here in this post.. but in the other hand, the unity one keeps a console window open, so you can check the connections status there, and this one generate a .txt file, so i dont know if thats the reason of the diference of filesize, however, just wanted to let you know guys that all you gotta do is install visual studio express c++ 2008 wich is free from microsoft and the download is like 200mb and build the master server files from unity page and you will get your masterserver.exe file.

    =)
     
  15. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    The problem isn't that I can't build my own master server. The problem is I can't build my own master server that runs as a service. I have the unity master server and facilitator running fine. I don't have them combined as one, and running as a service... But, with software I found via Google, I was able to get them both running as services anyways. So in the end I am fine. But it would still be nice to have this source code work.
     
  16. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    i see.. well i havent been able to get them run as service aswell.. i think ill have to keep those windows open and keep an eye on them.. keep restarting those applications every... i dont know.. 5 days?

    Killer1390.. one question.. i have the facilitator and the master server running ok in the server, as separated processes windows.. but i still not able to connect through internet in my multiplayer game..

    checked ports and ips and are ok.. im wondering.. check this posted by leegod:

    MasterServer.ipAddress = "127.0.0.1";
    MasterServer.port = 23466;
    Network.natFacilitatorIP = "127.0.0.1";
    Network.natFacilitatorPort = 50005; // your own port number


    do you know what he meant with " your own port number" ? is that maybe i have to use the facilator port "50005" as the one to connect in the server port?

    i dont get it.. im going to give it a try..
     
  17. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Hi zyndro. Since you built your own master server and facilitator, you are able to edit the C++ source code. In the code, you can change the port the master server, and facilitator connects to. Make sure they match what you code.
     
  18. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    yes and i did it, the weird thing is i can see the server hosted game created, but i still get a different port number, so i cant join the match..

    im so confused.. i have facilator and masterserver apps workiing on the server, both report connections when i host games, but when i try to join i get a totally different port..

    so weird..
     
  19. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    When someone hosts a game, they should be able to chose their own port for hosting. That doesn't have much to do with the master server except that the master server contains the information on that. When you have a facilitator up and running, it doesn't matter whether or not the port is forwarded, because it does... some sort of magic... and lets you connect through the router or what ever.

    So, I guess what I am trying to say, is what exactly is the problem?
     
  20. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    ok let me explain.

    i host a game with out problems.
    from the client through internet i can see the game created without problems, the problem is, the port is different so that avoid me stablish connection.

    for example.

    i create a game and my ip is 10.0.0.15:25005

    when i search games with a client, i see hosted game created 10.0.0.15:46372 ( or some randome port ) so, i cant connect.

    this happens only through internet, on wifi works ok.

    as far as i know this happens because of a nat problem, and for that is the facilitator.. but some how i dont know why mine is not working.


    that was exactly what happened with the master server from unity, i was testing there and all was ok.. suddendly one day the port just was different and i wasnt able to connect anymore to my hosted games.

    dreamora said that could be because people was using the unity masterserver for production, and that is not the intention, so they turned off the facilitator, so the people cant connect anymore through internet.

    i hope i have had explained myself, english is not my mother language!
    thanks in advance!

    =)
     
  21. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    Oh... that is extraordinarily interesting. Are you perhaps hosting the master server and facilitator on one of the computers in your house? If so, I would guess that is the problem. Get someone to try and create a game on your master server, and see if it happens then. My guess is it would be fine. It is probably just because it is a local connection.
     
  22. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    no killer1390, they are not in my home.. i have rented a vps located in dallas for this projects.

    =(

    would you be interested in give it a try? i can provide you the ips..

    =)
     
  23. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    pm them, you don't want it going in the public. I will gladly try it for you.
     
  24. aaaa9813

    aaaa9813

    Joined:
    Nov 18, 2011
    Posts:
    15
    thank you, but where is M2H tutorials? I can't find it;
     
  25. aaaa9813

    aaaa9813

    Joined:
    Nov 18, 2011
    Posts:
    15
    Where is the M2H tutorials,please!
     
  26. RingOfStorms

    RingOfStorms

    Joined:
    Oct 23, 2010
    Posts:
    584