Search Unity

Help Wanted how does the lobby-based multiplayer work?

Discussion in 'Multiplayer' started by JasonBruse, Nov 13, 2020.

  1. JasonBruse

    JasonBruse

    Joined:
    May 7, 2019
    Posts:
    5
    Hi there,
    I am currently working on a multiplayer game. But I don't have any network experience before. The game I make will have many matches at the same time and there will be about 10 players in each match.

    I took a look at Mirror and MLAPI. they all only worked on one single dedicated server with a single IP. what if I have multiple matches at the same time? Will I run multiple server with different IP?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,574
    I haven't used MLAPI, but an instance of a Unity build has a single world space. There's been some suggestions in previous threads to make it seem like there is only 1 game running to the player while the server actually has several all together, but the cleaner approach is to just have 1 server instance per match. Your master/lobby server makes the matches, then launches or otherwise allocates a game server instance on the server, the players then all connect to the game server, and play it through. When the game server is done it either exits or cleans itself so it is available to the master/lobby server to be allocated again. You'd use the same IP but different ports if you want everything on the same physical server.

    One problem with that approach is it is not very memory efficient, since each server instance is basically loading all the same stuff into memory as the other server instances.
     
    luke-unity likes this.
  3. JasonBruse

    JasonBruse

    Joined:
    May 7, 2019
    Posts:
    5
    Thanks for your explanation. It is very helpful.

    in this case, will all the physics synced from server to the client?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,574
    You can do the physics on the server, and then sync the positions of the objects to the clients, yes.
     
unityunity