Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

What networking API should I use to make server system like this...

Discussion in 'Multiplayer' started by IAMBATMAN, Jun 22, 2017.

  1. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    I'd like to have the same server system as unturned.

    I could download unturned, turn a shortcut of unturned into headless mode, forward some ports or rent a dedicated server, and a few other little things. And my server would show up in the server list in unturned.

    I'm looking forward to making a drop in and drop out small open world shooter. What package would be best to do something like above, where there's a masterserver that lists all player hosted servers on it and the community can make servers when ever they want and keep them running 24/7?
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,764
    If you're looking for a master server you should definately take a look at Master Server Framework, since it's free and awesome, and you can get it from the asset store. Keep in mind that you would have to implement some of the features by yourself, and also host a server on your own. Or rent a VPS.
     
  3. TwoTen

    TwoTen

    Unity Technologies

    Joined:
    May 25, 2016
    Posts:
    1,168
    Any Networking API. Unet would work fine. Just detect whether you are running headless. And use Start params for Port. Then make a matchmaking server. (There is a dirty one for Dev testing in on my github in the signature). Or use Steams or playfabs (or any service). And you're good to go.

    Just on server start. Send a message to the matchmaker. Then pop it a heartbeat every 5-20 seconds to let it know it's still there. Then when it shutsdown, once again let it know.
     
  4. IAMBATMAN

    IAMBATMAN

    Joined:
    Aug 14, 2015
    Posts:
    272
    UNet would be fine?! That's good news!

    Is there some kind of guide for this? I just don't know where to start.
    I've made multiplayer games with photon, and simple ones with UNet.
    But both times all the server business was handled for me. So I'm new to this part.
     
  5. TwoTen

    TwoTen

    Unity Technologies

    Joined:
    May 25, 2016
    Posts:
    1,168
    Guide for what? There is a dirty matchmaker you can use for free on my github. Atleast for development.
    To start the server just use NetworkManager.singleton.StartServer(). And to connect the client. Just get a list of servers from the matchmaker. Spawn some form of UI button. And when pressed. Take that servers IP and port and set it. Then call NetworkManager.singleton.StartClient().
     
unityunity