Search Unity

I need suggestions about matchmaking and P2P connection

Discussion in 'Multiplayer' started by Paulx774, Jun 12, 2021.

  1. Paulx774

    Paulx774

    Joined:
    Mar 18, 2021
    Posts:
    103
    I'm working on an Android game and I want to implement a real-time multiplayer system. I've been reading about the networking and have been searching for networking solutions. I'm a bit confused about the subject and I need some suggestions.

    As far as I know, the direct P2P connection is not possible with Android devices (mostly). It is difficult and can cause some security problems such as exposing the players' IPs. I need a relay server to connect the players together. So, the networking architecture of the game should be master server (listen-server) logic. (I'm also not thinking of implementing direct P2P connection).

    The game is a 4-player co-op game and each game takes around 15 minutes. The DAU of the game can go up to 100+ (not more than 200), and the MAU is between 1,000-2,000. So, the networking solution should meet my needs.

    The implementing-wise, I think, there are only 2 solutions to implement the multiplayer system I want.

    First one is: Matchmaking and Relay Server
    There will be only one option in the game. "Find match". When a player clicks the button, the matchmaking system will add the player in the queue. As soon as 2 players or more are matched, I need to create a lobby on the relay server and connect the players to the lobby. If there is an empty slot in a lobby, the matchmaking system should still see the lobby, fill the empty slots.

    Second one is: Relay Server and Host List
    There will be two options in the game. "Host Game" and "Join Game". When a player click the host game button, a lobby will be created on the relay server, and the player (host) will start waiting for players. In this case, the other players should see the created lobbies. So, I need to keep a list of hosts and show the list to the players in the game. I have no idea about how I can store and show the list in the game.

    I'm using PlayFab for my backend solution. PlayFab has its own matchmaking system and relay server (PlayFab Party) system, however, there's a missing part about connecting the players together. Either the both of the solutions, I always need an extra system.

    For the first solution, PlayFab can match the players, however, it only returns a match ID to the matched players. Who's going to be the master server and creating a lobby after the matchmaking are manual. To fill that missing part, I need an extra system to decide who's going to be the master server, and I need to give the required parameters to the other players in order to connect to the lobby. Also, the matchmaking system doesn't backfill the lobbies. When the matchmaking is done, it's done. No more players can have the same match ID even though there's an empty slot in the lobby (in other words, even though the ticket has still empty slots).

    The PlayFab supports a dedicated server solution, however, that's a bit pricey for me, and I just want to connected the players together with the P2P connection.

    For the second solution, PlayFab Party feature can allow the players to host their game (creating lobbies). However, the PlayFab doesn't hold any list of created lobbies (networks). To fill that missing part, I need an extra system.

    I'm open to hear any other networking solutions. I just wanted to point out the backend solution I'm using. Maybe, filling those missing parts can be more cheaper than using a whole new networking system. Please, share your experiences about networking solutions. I would like to hear all of them.

    Also, if there is any technical errors in my solutions, please let me know. I'm still learning the networking.
     
  2. meta44

    meta44

    Joined:
    Sep 11, 2018
    Posts:
    23
    Hey, I'm new to multiplayer stuff as well, and I'm wondering what system you ended up going with. I'm trying to use PlayFab, and I'm finding their dedicated servers are too pricey for me, so I think I'm going to switch to some sort of P2P system, but I really have no idea how that works.