Search Unity

Working Over LAN, Now How Do I Connect Over Internet?

Discussion in 'Multiplayer' started by worldsbestboss, Apr 27, 2013.

  1. worldsbestboss

    worldsbestboss

    Joined:
    Mar 12, 2012
    Posts:
    88
    I've put together a simple little game that works over the LAN connection but I'm not sure how to add the ability to connect over the internet.

    Is there any tutorial that someone can point me to that will give instructions on how to connect two clients over the internet?

    From what I've read I need to connect each client to a master server, which then connects the clients to each other. If this is the case then I guess my question is how can I set a client up to connect to a master server? And how can I set up a master server/does unity provide a master server for testing and learning purposes?

    Thanks in advance for any help.
     
    Last edited: Apr 27, 2013
  2. realm_1

    realm_1

    Joined:
    May 18, 2011
    Posts:
    216
    you may want to learn first how general networking works. but anyways I can give you a short overview. may you heard about websites, sure you have, and maybe also about webservers. these webserver listen to port 80 and 443 for ssl and everytime they get an request over these ports they sent their website or request (this is just an example it could be any port but website services uses port 80 and 443 if configured ssl). the request comes mostly from the internet and not from a closed as you call it lan network. the point is that the request also could come from an internal network or even set the webserver only in an internal network up and is not accessable through the internet. it would work in the internal network. but if you want to make the server accessable through the internet you have to buy a domain at you or desired internet service provider (ISP) and configure the whole thing to work on your external IP address. This can be mostly done on the website of the internet service provider (ISP). If you now want to set up a gameserver accessable through the internet it is basically the same thing. additionally if you want to get the whole thing to work to need two servers on your server. the masterserver which basically just tells the clients with which server they should connect, the masterserver tells the clients the IP address of the gameservers. the second server would be the gameserver which can be used to actually play the multiplayer game. this server do the whole networking work. since the unity3d masterserver isn't that stable and just a testserver you can download the masterserver on their website for your own hosting. http://unity3d.com/master-server/ may I could help you. good luck.
     
    Last edited: Apr 27, 2013
  3. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    using master server to connect people to each over the internet is a solution. first youll need to register your master server like so:
    Code (csharp):
    1.  
    2. Network.InitializeServer();
    3. MasterServer.Register("GameType", "GameName", "GameComment");
    4.  
    and to connect to a server is just a normal way to connect, that extra line of MasterServer is register the server, so that others would be able to connect to it with a public ip address. also take a look at:
    Here
     
  4. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312