Search Unity

How to run multiple hosts on single server? UNET

Discussion in 'UNet' started by Gorgor, Dec 23, 2016.

  1. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
    Hi,
    we are currently using UNET in simple mobile game where players can connect each other to fight together in groups agains monsters. So one of players is a host and other joins him. However we would like to take a step further and make our own dedicated server as host for all clients. What I am struggling to figure out is how to run multiple hosts on the dedicated server so everyone can joint his own game? It is easy to run single host on the server but we do not want every player connect to the same game. We need somehow tell UNET to create a new host for some players while let others join already existing host ( if they want to join the group and not create a new one). All these hosts must run on the same server (dedicated on VPS). Can someone help us? All I found out is the "visibility" feature of UNET which could serve as workaround solutions ( restrict what players can see and cannot see). But this would be quite a mess as all the clients would connect to single host and he must then manage what each client can see and what cannot, all running in one unity scene! There must be a better solution for this.
     
  2. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
    Anyone?
     
  3. jaybdemented

    jaybdemented

    Joined:
    Sep 2, 2013
    Posts:
    112
  4. Gorgor

    Gorgor

    Joined:
    Apr 28, 2012
    Posts:
    51
  5. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Each server would be its own instance of the game application running in its own process.
     
  6. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    Did you found solution?
     
  7. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Launch multiple server instances each listening on a different port. When I do this I setup the dedicated servers as headless builds and specify the port number to use as a command line argument to the server when it launches.
     
  8. tonythadee

    tonythadee

    Joined:
    Dec 17, 2020
    Posts:
    4
    hey, I'm using Mirror to do my networking. but as this post states, matchmaking is still an issue. I've seen tutorials on matchmaking on YouTube but even with Mirror's matchId property, collisions still occur between gameobjects that I'm trying to separate by match ( i suppose since I'm only running a single server instance ). I'm assuming there may not be a workaround and that using separate ports is the answer, but if anyone has a solution for using the same server instance for multiple matches it'd really be helpful.