Search Unity

What networking API should we use?

Discussion in 'Multiplayer' started by Persegan, Jun 15, 2017.

  1. Persegan

    Persegan

    Joined:
    Feb 12, 2015
    Posts:
    14
    Hello, and thank you for taking the time for reading this.

    Me and a friend are designing a game that we'd like to be able to offer multiplayer options with, but we're unsure as to with what tools should we implement it.


    If we've been understanding networking concepts correctly, what we'd like to achieve ideally is either an easy way for our players to host servers and have clients join them, or peer to peer connections; but simply because we think having this could be scaled without the need of paying more (no ccu or data usage plans), but if that's not the case then this loses importance.



    In terms of networking we have Rivals of Aether as a reference, since the type of game is kinda similar and as far as we know they implemented their online mode with peer to peer connections in game maker studio (apparently game maker studio gives you some networking functions based on sockets to work with, and we were wondering if there was something similar to that for Unity? We did some research and were not able to find anything).


    Here are the things that we've done some research about, and our thoughts on them so far:


    Unity Networking: The default tools that Unity offers to work in networking. From what we've found, it seems like an okay solution but we don't like the CCU and data usage paying system. Also, in some places we found people talking about it as if it's just worse than Photon PUN in almost every way.


    Photon PUN: We've actually already worked in Photon PUN before, and we don't have that much experience with it but previous results were kind of okay for us. What deters us from it is that you have to pay based on concurrent users, and that in previous attempts we found that the default options for synchronizing movement were kind of meh (we're unsure about if we were doing something wrong though, we think we weren't, but who knows).



    Photon BOLT: Apparently peer to peer, we've heard some good things about it but we don't know much. What deters us from it is that you have to pay to have it and if we understood things correctly you ALSO have to pay depending on CCU. If it's a one time payment, it could be good though. It'd be nice hearing some opinions on this one.



    Forge Networking: If we understood correctly, it has no CCU limit and it's a one time payment, which seems nice in paper, but you have to host your servers yourself with this one? Can your players host servers, or do your have to have your own? We're not sure how it works, and we found it kinda hard to find information on this one. Also, a bit pricey; Not as much as other solutions, but still a decent amount of money for our current budget.


    uLink: We've only heard about this one in name, and we don't know much about it. What the webpage talks about seems nice, allowing you to implement peer to peer and authoritative server solutions, but it seems very pricey, with one license costing over 500$.


    TCP / UDP Sockets?: Since Unity works with C#, we're not sure if we could try to implement our own socket solutions? We assume this would be the closest thing to what Game Maker Studio offers, but we're not sure as to how to approach this, and there are things that Game Maker Studio offers like the network async events that we're not sure how we would implement in C#.


    If you've worked in a multiplayer game before using any of the tools we've mentioned or you know of another one that wasn't listed here that was useful for you, we'd appreciate reading your thoughts about it.
     
    dman8723, IAMBATMAN and TwoTen like this.
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Well, I am mostly familiar with Unet and sockets. So i'll try to help you with those.
    UNET
    Unet is a Networking Library. it's a way for you to write server code and they will handle reliable channels etc for you. There is no limits to this, no CCU etc. Then Unity is also offering Multiplayer Services such as a Relay and a Matchmaker to match the players together and remove the need for Port Forward with their relay. These have CCU limits.

    So basically UNET is simply a socket solution but with more bells and whistles.
    Sockets
    And yes, you can write your own Network Library like UNET using sockets.

    Now to the other libraries. I have VERY limited knowledge in these:
    Photon PUN

    To my understanding, from what i've heard etc, (Please read up on this, I am unsure). Photon forces you to utilize their Cloud Services and you can't get away from their CCU.

    Additional Libraries you might want to look into
    Here are some additional Network Libraries you might want to use if you only want Networking and not Cloud Services.
    Lidgren ( https://github.com/lidgren/lidgren-network-gen3 )
    Enet ( http://enet.bespin.org/, C# Wrapper Exists )

    If you are not using Cloud Services
    If you don't utlize any Cloud Services and you not port forwarding to your game. There are some ways to do this. To utlize the UPnP protocol to open ports automatically check Open.NAT

    Alternativly some network libraries have this built in. Forexample Lidgren has
    • NAT traversal support
    • Simple port forwarding using UPnP
    https://github.com/lidgren/lidgren-network-gen3/wiki/Features

    Hope this helped.
     
    akuno and Persegan like this.
  3. Persegan

    Persegan

    Joined:
    Feb 12, 2015
    Posts:
    14


    First of all, thank you so much for your answer! It was very helpful it and it allowed us to understand some things better. We still have some doubts left though, and I'm posting this reply with the hopes that if you find the time and will, you'll be able to help us more.


    So if we understood things correctly, the monthly fees that the networking solutions offer are in relation to using their cloud services, which are composed of matchmaking and relay servers.

    Would you (or anyone) happen to know if we could use the steamworks API's matchmaking and relay servers instead of the unity multiplayer services one, in case we had access to it? Do they have any cost associated? Furthermore, could the entirety of the networking be done with the steamwork's API?

    Between UNET, Lidgren and Enet, do you happen to have any preference? Could you tell us why?



    Aside from this, we were looking at Photon things, and we think the only photon product that let's you not use the photon Cloud services is Photon BOLT; both Photon Realtime and Photon PUN don't allow you to do that. If someone could confirm this for us, it'd be great.


    Once more, thank you for your time.
     
  4. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Okay, Let's start!
    You are understanding things correctly now by the looks of things. As for Unet. You can absolutley replace it with different matchmaking. All the UNET library needs to connect to a server is a IP and port. All the match maker is doing is have a list of them for you.
    And as for Steamworks. I have just gotten into steamworks myself so I have some inside knowledge. All their services to my knowledge is free (Except their dedicated server hosting). So yes, you can easily implement their matchmaker. Just whenver you start the server. Send a message to Steam saying "New server started, Here is the credentials to it". And then same for Client. "Give me a list of servers please". Nothing crazy going on. You could make your own as a standalone console application in a day or so.

    https://partner.steamgames.com/doc/features/multiplayer/matchmaking

    However, Steamworks does not have any Relay servers. They do NAT punchthrough which is another technique for to allow players to host without Port Forward (If you use Steamworks Network Library).

    And yes, Steamworks also has their own Network Library that you can use.
    https://partner.steamgames.com/doc/features/multiplayer/networking

    Now that's the facts. Now to my oppinions:
    It all depends on what you want to do and how. If you want the UNET High Level API (Command RPC). Then UNET is great for that. If you want to dig at the low levels then Lidgren and Enet seems very nice. You could also use Unet Low Level API.

    As for Photon, I have no clue.


    Hope this helped you!
     
    Last edited: Jun 16, 2017
    Stormy102 and Persegan like this.
  5. Persegan

    Persegan

    Joined:
    Feb 12, 2015
    Posts:
    14

    Thank you so much for all your help! That was very informative and useful, and now we have a much better idea of what we'd like to do. We'll investigate about Photon a little bit by ourselves, and then we'll try to reach a conclusive option for us. We're really grateful for your time and assistance!
     
  6. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    No problem. Best of luck bro!
     
  7. robochase

    robochase

    Joined:
    Mar 1, 2014
    Posts:
    244

    Steamworks does fall back to a relay server if Nat punchthrough fails. It mentions as such in the link you posted as well.

    I've been using steamworks for p2p for a while now (my game is still in development). it's pretty opaque about whether you're using a relay server or not when the connection is established. makes it a little hard to tell if their relay servers are any good or not.

    edit: i looked into this a little more and you can actually ask steamworks if they're connected directly or via relay. i'll have to add this check into my game and monitor it a bit to see how often it uses their relay servers.
     
    Last edited: Jun 16, 2017
    TwoTen likes this.
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Don't use uLink. It was great when I last used it, but the developers have apparently abandoned it (last build was in 2014).
     
  9. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    Unless you plan to make a free game, it should usually be doable to pay for multiplayer services. In case of anything Photon, you're getting a free API, support and in case of the Photon Cloud, we also run the servers for great connectivity.

    If you want to host in Unity, check out uNet and Bolt. Both have ongoing costs attached but both also need servers to relay connections should a direct connection fail. For uNet, there is a NAT/Punchthrough package in the Asset Store.

    I honestly can't recommend doing your own networking solution with sockets, etc. Even using lidgren or enet can be tough. If more people did this (on a professional scale), then we wouldn't have the discussion about how expensive everything is. ;) There are lots of little and bigger issues that you only figure out exist when you finally run into them. Just saying. It's probably not the work you want to do.
     
  10. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Well, if you are running dedicated servers and not player hosted: I don't see too much of an advantage of having cloud services. Relay is not needed and Matchmaking, well there are free ones such as Steam (if you launch on steam) or you can host your own.
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    If you'd like to, you can host Photon on your own servers: Licenses for that are available as one-time payment or as a subscription. The subscriptions are for developers who don't want to invest in a one-time fee and include major updates.

    Why are those licenses are CCU based (again)? The more CCUs and the more servers you run, the more you will get in touch for support and to make little feature requests, etc. Also: If we only had one price, we couldn't start with a lower pricing for smaller games either.

    There is a 100 CCU Free License, which you can use to get started. It doesn't sound like a lot but having 100 players at the same time is already an achievement for a game, usually. Once you get more, you should have sufficient sales to make up for software licenses.