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

What's the best way to set up peer to peer multiplayer, that's also easy for the end user?

Discussion in 'Multiplayer' started by GameDevSA, Apr 21, 2022.

  1. GameDevSA

    GameDevSA

    Joined:
    Dec 12, 2016
    Posts:
    252
    I've always wanted to do online multiplayer. The big thing that's held me back is the thought of having to fork out money for servers. From what I understand, peer to peer sounds like the way to go for me, but it's a very big area to dive into with no guidance.

    I've heard of different systems out there like Photon for online multiplayer. If I was going to look at doing peer to peer for Unity, what should I be aware of? Where should I get started? Recommended assets and tools? Pitfalls?

    Also, is it going to be as simple as, two people want to play a game together, click "Join / Host" and start playing? Don't want players needing to know any technical knowledge.

    Furthermore, I assume this means I might need to have a friends list to join games, assuming that I am only trying to set this up between friends, not with randoms? If so, can you re-use the Steamworks friends list for example?

    If you have any recommended reading links, I'm down for that, so long as it's not too over my head with the technical terms. I am completely new to networking and online stuff (except for having written some C++ raknet code back in the day while studying, simulating online multiplayer but on the same PC with a virtual host). I do know what dead reckoning is, and did a reasonable job of setting that up with Raknet (but that was ages ago). I imagine there's a lot I've got to learn.
     
    Last edited: Apr 21, 2022
    TiggyFairy likes this.
  2. GameDevSA

    GameDevSA

    Joined:
    Dec 12, 2016
    Posts:
    252
    Anybody?
     
  3. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    478
    I've been trying to use an asset called Mirror from the store. It is confusing, but it does have its own Discord.
     
  4. uncannyforest

    uncannyforest

    Joined:
    Mar 6, 2020
    Posts:
    2
    Hey, you and I are in a similar boat.

    I've been making a simple game for the purpose of learning how to do multiplayer. I got some initial code working using Netcode for Game Objects. This past Monday, I spent an hour on four potential relay solutions:
    (1) Unity Relay
    (2) Photon Fusion
    (3) WebRTC
    (4) FishNet

    I found I got the farthest with Unity Relay, so that's what I'm pursuing for now. I'm currently working on solving lag (looks like you may be ahead of me on that, since you know some about dead reckoning). Other than solving lag, I've got my game working to play over the internet. The Unity Relay tutorials and this video helped a lot:


    A lot of people are recommending FishNet right now, which is new, has a lot of features, and has a reasonable pricing model (most features are free). It might have better built-in handling of lag than Unity's solutions do, so I haven't ruled it out yet.
     
  5. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    478
    Thanks a lot for that. I had a lot of trouble with Netcode for Game Objects, but I'm willing to have another go. Mirror seems pretty good, but I don't have the time to deep-delve into it right now. The only one I'd say avoid is NormCore. Not because it doesn't work, but because you can't delete it from projects even if you only installed it and did nothing with it.
     
  6. uncannyforest

    uncannyforest

    Joined:
    Mar 6, 2020
    Posts:
    2
    Honestly Netcode for GameObjects's main appeal to me is how easy it was. If you're having trouble with it, I'm not sure there's much left to recommend it on, and another system might be better! I do have doubts about whether it has the features I need, especially with the strong recommendations for FishNet floating around. I'm trying to get as fast as possible to a working multiplayer game, but once I get the hang of it I'll reevaluate to see whether a "less easy" solution is actually better for me.
     
  7. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    478
    My trouble is that it throws a load of exceptions at me the moment I install it. I dunno if that's normal or not, but I can try again. Mirror also seemed to have better support etc.