Search Unity

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

Question about headless servers

Discussion in 'Multiplayer' started by 11nova, Aug 7, 2016.

  1. 11nova

    11nova

    Joined:
    Sep 9, 2015
    Posts:
    14
    Hello I have a question about headless servers. I have made games with photon before however I would like to create a game where it is full authoritive and no client is the server. So would I need to make a headless server in unity to act as my server side logic? And then upload that server to say AWS? Then how would I connect to that server? Would I need a networking library like Forge? Any info on how this all works would be great. Thank you.
     
  2. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    In b4 close
     
  3. 11nova

    11nova

    Joined:
    Sep 9, 2015
    Posts:
    14
    Sorry I was posting this on my iPad and it posted before I got a chance to finish typing.
     
  4. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    heh :) well ask away, I use unity headless with unet as dedicated authoritative servers.
     
  5. 11nova

    11nova

    Joined:
    Sep 9, 2015
    Posts:
    14
    So how does that work? Does the headless server act as the server side logic? Do you build and upload your headless server to a host like AWS or Azure? And then how do you connect to that server? Sorry for so many questions. I've been researching a lot but it would be nice to have some things cleared up.
     
  6. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Yep, write the server as a unity project, build to either windows or linux depending upon the host (I use ToggleBox, but there are many). Run the built server with the command line -batchmode -nographics to run it headless in the background.

    As long as you have the desired port open, and allow the project access through the firewall, your client project should be able to connect to it.

    Just for reference, I use NetworkServerSimple, and NetworkClient classes from uNet.
     
  7. 11nova

    11nova

    Joined:
    Sep 9, 2015
    Posts:
    14
    You rock! Thanks for all of the info. One more question. Do you use Unets matchmaking and have you used matchmaking that finds players with a similar level? I've only done random matchmaking that doesn't take into account the players level. Do you have any advice on how to get started with that?
     
  8. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    As I'm writing a multiplayer RPG, I don't use matchmaking services. I have my own login/chat server, and a separate server for each walled-garden zone. Clients maintain the connection to the login/chat server, and connect to the required zone server for game play.
     
  9. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    how do you handle multiple zone? i thought unet was limited to one scene per server ? do you use additive scene load or just have on server instance for each region ?
     
  10. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Do you mean on the client or on the server?
     
  11. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    on the server
     
  12. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    my login/chat server has only a single scene with half a dozen scripts running on it - mainly database handling, and uNet NetworkServerSimple.

    each zone server runs a single zone (in one scene) with the identical map that the client has for that zone (in an assetbundle). When instantiating the map, it strips everything but the colliders as nothing else is needed on the server.

    All the zone servers are the same project, but with different terrain assetbundle and config data file.

    I'm sure there are many different ways to accomplish the same thing, this is just my method.
     
    nirvanajie likes this.