Search Unity

multiplayer on non-dedicated server

Discussion in 'Multiplayer' started by ivanilsongabrielpontes, Jul 19, 2019.

  1. ivanilsongabrielpontes

    ivanilsongabrielpontes

    Joined:
    Jul 19, 2019
    Posts:
    1
    Hello! I'm a beginner with unity, and I'd like to know if you have a way to create a non-dedicated server game. A player is host. That way I would have some way to have 50+ players on the server? The game is intended to be isometric, low-poly vision, a kind of battle royale.

    not have to synchronize animations, just positions. Get me that doubt :)
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    First off, if you're a beginner with Unity do not start with a networked multiplayer game, for the same reason a beginner architect shouldn't start with a skyscraper and a beginner pilot shouldn't start with an F-22. Start with something simple, master and complete that, then move on to the most complex projects you can create in Unity.

    But to answer your question, it comes down to the fundamentals of networking on the Internet. Pretty much everyone on the Internet has their computer behind a NAT enabled router. That means their computer cannot just host a server which other people on the internet can connect to. The client tries to do that, the message hits the NAT router, and the router has no idea what to do with it.

    There are several strategies for getting around this, but other than the host of the game manually getting into their router config and setting port forwarding and everyone else manually typing in the host's IP address, every other strategy involves setting up some form of dedicated server for organizing the games and establishing connections at minimum. Research "NAT Punchthrough" for getting around this issue with a minimum of dedicated server use, but still requiring a server. Alternatively there is the "relay" strategy which the deprecated Unity Multiplayer Service uses.

    There's 3rd party services you can use instead of setting up your server, but they don't work by not having a server, you're just outsourcing the server instead of setting it up yourself. The Photon Cloud flavors are the most popular example.

    You can create a classic LAN game, where NAT routers aren't an issue, but your 50 players implies you want this to be an internet game.
     
  3. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    50 players on a client-hosted server is possible if you're not targeting mobile devices. Otherwise it's going to be quite the technical achievement to be able to do that, unless you're just targeting very high end phones. And even with those I am not sure it's entirely feasible.