Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Online FAQ needs correction

Discussion in 'Multiplayer' started by JibbSmart, Jun 18, 2018.

  1. JibbSmart

    JibbSmart

    Joined:
    Feb 18, 2013
    Posts:
    26
    The FAQ on the Unity Multiplayer page has incorrect info about network topologies. It says it supports a "peer-to-peer topology", which it might, but it's describing a "client-server" topology.

    I'm no expert on this, but Glenn Fiedler is:
    Screenshot_20180618-085641.png


    So I also have a question: does Unity Multiplayer optionally also support peer-to-peer (all players communicating with all or most others) for games where this might be preferable over client-server?

    Thanks! :)
     
  2. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I believe this is just a semantics issue. Unity uses the term peer-to-peer to differentiate from dedicated server. The problem with calling it client-server is that the term could describe peer-hosted or dedicated host architecture. So you can say things like "client-server where the server is one of the players" but that's a bit of a mouth full.

    And peer-to-peer seems pretty accurate to me, the connections are from one peer to another. Ok, yeah, you can't send from every peer in a match to every other peer directly, but that was never claimed.

    That being said, I would love to see some "true" peer-to-peer set ups where every client is connected to every other client. I think there is potential to reduce latency in some cases, but I think in most games you're going to end up needing to designate one of the clients as a the "host" anyway because someone has to have authority over all the non-player owned stuff. Then you end up having to communicate with the "host" and have the host communicate the changes out to the other clients and you're right back where you started (at least for things that players don't own).

    Plus there are the NAT issues. Essentially every client is a host in a fully connected peer-to-peer network, so they all have to be connectable behind their routers. That means punchthrough and relays are a must.

    Also to actually answer your question: I think you could do it with unet but I'm not sure how well the authority system would handle it. I definitely wouldn't say it's supported out-of-the-box.
     
    Last edited: Jun 18, 2018
    Joe-Censored likes this.
  3. JibbSmart

    JibbSmart

    Joined:
    Feb 18, 2013
    Posts:
    26
    Or you could say what Glenn said and call it "player hosted server" ;)

    While one can argue there are technically peers connected to peers, the "peer-to-peer" designation of a network topology has been around for a long time, and to describe a kind of network that is topologically distinct from client-server. Dedicated server and player hosted server are not necessarily topologically distinct -- they can have the same network shape. For example, a lot of older games would have the player-hosted server as a separate executable on the same computer that they'd run and then connect to from the client executable. One computer has two nodes -- a player and a server -- but neither the server nor the clients actually care.

    Dedicated server and player hosted server are both generally the same shape -- one-to-many -- and generally have the same logic governing them -- authoritative server.

    The more traditional definition of peer-to-peer requires very different rules to client-server in terms of synchronisation, client authority, cheat detection, etc.

    The point is that the difference in design and implementation between player-hosted server and dedicated server are trivial (or non-existent) compared to the differences between both kinda of client-server model and what has traditionally been called peer-to-peer.

    My main source for this info is GafferOnGames' excellent article, What Every Programmer Needs to Know about Game Networking.

    I do appreciate your opinion on the naming :) I think it's the same line of reasoning that whoever wrote the FAQ probably had. To actually respond to your answer: that makes sense that it wouldn't support it out of the box, but could be fine with some work. Thanks :)

    It's my understanding that the problem of authority is intrinsic to the peer-to-peer topology, and the solution depends very much on the game. Sometimes it's not even a problem at all -- GGPO in one-on-one fighters trusts each player with their own character, and trusts them to follow the same rules of rolling back conflicts. Peer-to-peer lockstep in RTS games presents no huge need for a client to have more authority than the others for most normal gameplay, either.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unet with the LLAPI or NetworkServerSimple can be used in an every client connects to every client topology though. As already mentioned, good luck dealing with firewall/NAT issues.
     
  5. JibbSmart

    JibbSmart

    Joined:
    Feb 18, 2013
    Posts:
    26
  6. JibbSmart

    JibbSmart

    Joined:
    Feb 18, 2013
    Posts:
    26
    If Unity instead used what would more traditionally be called Peer-to-Peer topology (each client talking directly to all other clients) by default, what would the answer in the FAQ be if not "Peer-to-Peer topology"?

    If you're using a client-server topology and aren't providing dedicated servers (which was the norm for shooters for a very long time), it makes sense to call it Client-Server and clarify that it only supports player-hosted servers out of the box. Some people apparently call this "peer-to-peer", which also means something else topologically. So why use the ambiguous terminology? Many people asking the question "What network topologies does Unity Multiplayer support?" know that traditional peer-to-peer is one of the possibilities, and know it to mean precisely what the FAQ doesn't mean, so the FAQ shouldn't answer "Peer-to-Peer topology".

    EDIT: See how For Honor creatively uses what is fundamentally the same peer-to-peer lockstep typically used in RTS games: (PDF) https://twvideo01.ubm-us.net/o1/vault/gdc2017/Presentations/Doll_Determinist_vs_Replicated.pdf
     
    Last edited: Jul 25, 2018