Search Unity

Question can be the computer a server and connect clients?

Discussion in 'Multiplayer' started by somedevelopergg, Nov 10, 2021.

  1. somedevelopergg

    somedevelopergg

    Joined:
    Oct 29, 2020
    Posts:
    25
    I recently wrote here for help. I had an idea to make it possible for the players to create their own servers (start the server. exe or something like that) so that others can connect to them, but I was told that this is impossible due to the encryption of the modem or the provider. but recently I came across games that were not tied to one server, but worked according to the scheme that I came up with. and I want to know - is it really possible? Of course, this requires at least one server that will collect player data about the created server and display it to everyone, but this is less of a problem.

    little scetch about it.
     

    Attached Files:

  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If it is the other thread I'm thinking of, you were asking about a client hosting the game and other clients somehow finding and connecting to it without a server involved. There's two approaches I'm aware of where you use a dedicated server to facilitate a client hosting the game. One is a relay server, and the other is generally called NAT Punchthrough.

    With a relay server, all clients connect to the relay server, and the relay server just acts as a middle man sending packets from all the clients to the one hosting the game, and from the host to the clients the packets are directed towards.

    With NAT Punchthrough the clients make initial connections to your NAT Punchthrough server, and through some voodoo trickery gets the clients to talk directly to each other using the ports the NAT router reserved for the client connections to the NAT Punchthrough server. This approach saves you a lot of server side bandwidth, but is more prone to failure than using a relay server, as some routers or network topologies won't support it.

    If I remember correctly you were using Mirror, and I don't know if Mirror has implemented either of these, but you could check their documentation or the main Mirror thread for mention of it. If this is a game for Steam, you could look at the Mirror documentation for the various transports it supports. Last I looked there were two transports specifically for Steam starting with Fizzy which use Steam's servers to do the heavy lifting on this kind of thing for you (note I have not tried either, I just remember seeing them in the documentation).
     
    Last edited: Nov 11, 2021
    somedevelopergg likes this.
  3. somedevelopergg

    somedevelopergg

    Joined:
    Oct 29, 2020
    Posts:
    25
    I apologize, maybe I'm a little stupid, but it's better to ask again so that there are no problems. As far as I understood the relay server handles more data on its own than punchthough. It is not necessary for me to use a mirror, I can both switch to other network engines and write everything myself, if the scheme of work requires it. I already thought that for networking games, steam servers can be used, because this is more profitable for both the creators and the players and the owners of the servers.