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 Choosing the right multiplayer solution for open-world game

Discussion in 'Multiplayer' started by Azumikkel, Apr 16, 2021.

  1. Azumikkel

    Azumikkel

    Joined:
    Apr 5, 2018
    Posts:
    2
    Hi,

    I want players to be able to connect to each other when they get close to each other inside the world (MMO). I don't need them to interact in any meaningful, complicated or precise way apart from being able to see each other (transmitting the position and rotation of four gameobjects) and at worst bump into each other.

    It would be cool if it could be done with p2p, since it isn't a competitive game or one where it's important to have a reliable stable connection with other players, so that I can avoid server costs and maintenance, but I don't know if that's possible for this type of connecting. I am also willing to pay for server hosting if it's a better solution, if someone could recommend a service.

    Would it be possible to do this with Mirror? Would you recommend dedicated or p2p? And if so, where might I find hosting for a dedicated server or a relay server?
     
    Last edited: Apr 16, 2021
  2. dante66

    dante66

    Joined:
    Mar 25, 2014
    Posts:
    8
    Do you really want to go in this direction?
    In any case, you will need to send your player position somewhere.

    Using p2p:
    You could use a MM service with a dynamic ticket, so you can update the position. Of course, do not send your transform, but a zone id or something like that. When, 2 players are in the same zone, you can match them by electing a host, and make the other player join him. You will need to use a relay server like you said to maintain the connection if they can't connect together.
    Since connecting 2 players in p2p can take some time, you may end up by having an obsolete match, so make sure to use big enough zones.

    Using a dgs:
    If you don't target a lot of players, you can think about having a big server (MMO like) and use a feature like Network Proximity Checker to only discover and see players close to you. I think that Mirror can do the job (or MLAPI).
    You also can imagine having dynamic servers for each zones (if your world is not too big) and make your player switch from one server to another one.
    See multiplay for ex (https://unity.com/fr/products/multiplay)

    But if you want a cheap solution, keep in mind that having a p2p solutions is harder to develop (do you need to migrate your host?), and really depends how many players do you want to connect ?
    Having to manage dgs fleet is also hard... and it costs money.

    So, if you are alone, and don't have a lot of experience, you should not go in that direction in my opinion.
     
    Azumikkel likes this.
  3. Azumikkel

    Azumikkel

    Joined:
    Apr 5, 2018
    Posts:
    2
    I think you're right, and the best solution for me would be to curb my ambitions a bit and just settle for a simple p2p solution that lets friends join each other. Thank you very much for your detailed answer