Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question [Fishnet] How can I implement P2P multiplayer for my simple game?

Discussion in 'Multiplayer' started by pygosclune, Mar 25, 2024.

  1. pygosclune

    pygosclune

    Joined:
    Mar 25, 2024
    Posts:
    1
    Hi, briefly about me so you catch the context, I've been in web dev for a few years now, about a month ago I started learning C# and wanted to make my own 2D game, so I did what most beginners do, I watched a tutorial. Okay, so I have my really simple game and some basic understanding of what is going on in Unity, however, I thought it would be useful to learn some multiplayer technology (and implement it in my simple game) so that I can create some CO-OP game in the future. I'm pretty sure I only want to publish my game on Steam, so using the steam lobby (or SteamAPI, I'm new, I don't really see the difference) would make sense (however, I'd love to learn universal methods as well). Since producing the game is a big expense anyway I wouldn't want to pay extra for servers, so I thought of a P2P solution, because I would like a player to host his own server, and others to join him (the game will be a typical COOP for friends, so no need to worry about cheaters). However, I'm aware of things like, different types of NAT, required port forwarding, etc. and I'd like to avoid a situation where a casual player would have to deal with this. So I found out about FishNet, however, I still don't know if it will fit my assumptions. Is what I described even possible? And has any documentation/guide been created on this subject? I know that there have been quite a few tutorials on the topic of multiplayer, but I have not found one that discusses in depth the topic of hosting a server by the player (where the player has a role as a server and as a client).
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,533
    Yup :) that's possible.

    FishNet pairs with FishySteamworks which is turn uses Steamworks.NET or a paid solution like Heathen Steamworks (built on top of Steamworks.NET). The APIs are pretty good at removing the complexity from the process.

    For tips on integrating with Steam, FishNet has a Discord and you can often find what you want just by searching their discord. There's also the docs. And don't forget to study their official examples to avoid headaches.