Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Unity Multiplayer What are the pros and cons of available network solutions/assets

Discussion in 'Connected Games' started by Serinx, Jan 7, 2019.

  1. Serinx

    Serinx

    Joined:
    Mar 31, 2014
    Posts:
    479
    I'm wanting to start a multiplayer project but with the new Unity Networking system coming out I'm struggling to decide which solution to go with.

    I'd like to build a simple list of the best solutions and assets and their pros and cons so that I (and others) can make the best choice for their projects.

    I'll start off the list with my limited knowledge, but please help me fill in the pros and cons and any other solutions you know of.

    Eventually I'll turn it into a matrix to make it easier to read.

    Cheers

    UNET (Deprecated)
    Pros - matured with plenty of examples and tutorials
    Cons - will not be supported going forward
    - HLAPI has not been well received
    Model - Peer to peer

    Photon PUN2
    Pros - matured with plenty of examples and tutorials
    - free 100 CCU making it easy to test your game
    Cons - Difficult to implement cheat prevention
    Model - Client to client via cloud server

    Mirror
    Pros - UNET + 940 bug fixes and improvements.
    Cons - No Lobby and only one client per Connection. which were native UNET HLAPI features that have been stripped out.
    Model - Client/Server

    New Unity Networking (What's it actually called?)
    Pros - Will be supported going forward
    Cons - In alpha stage, minimal documentation and tutorials available
    Model - Client/Server

    SmartFoxServer
    Pros:
    - Fully authoritative
    - Fully extensible with custom server-side logic
    - very mature (available since 2004) with a lot of examples of increasing difficulty
    - exhaustive documentation
    - integrated HTTP tunneling
    - protocol cryptography
    - specific MMO-oriented API
    - extended lobby features: rooms, buddies, messaging, match making, etc
    - database integration
    - free 100 CCU edition
    - both perpetual and elastic licenses
    - fast update cycle in case of bugs
    Cons (?):
    - different approach with respect to other solutions listed above
    Model:
    - client/server

    MLAPI
    Pros - similar structure to UNET but with many more features and greater stability.
    Cons - No Custom Messages or SyncedEvent
    Model - Client/Server

    MLAPI, Mirror and UNET HLAPI Comparison Matrix

    By the way, I want my game to have an authoritative server as it will be competitive, a backend database to store player information and gear, and about 10 players max in a game. Any suggestions for the best solution in this case?
     
    Last edited: Jan 14, 2019 at 1:34 AM
  2. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    249
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,079
    Photon PUN actually built on a custom enet for reliable UDP (allowing TCP and other options transparently, which enables support for more platforms) and it's best described as "client to client via server". The connections are not direct (so no NAT and no problems when the "host" drops out of a match) but the server is agnostic to the specific game's logic. It's also not just a relay, as it can buffer messages and store custom properties.
     
    Serinx likes this.
  4. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    66
    SmartFoxServer
    Pros:
    - Fully authoritative
    - Fully extensible with custom server-side logic
    - very mature (available since 2004) with a lot of examples of increasing difficulty
    - exhaustive documentation
    - integrated HTTP tunneling
    - protocol cryptography
    - specific MMO-oriented API
    - extended lobby features: rooms, buddies, messaging, match making, etc
    - database integration
    - free 100 CCU edition
    - both perpetual and elastic licenses
    - fast update cycle in case of bugs

    Cons (?):
    - different approach with respect to other solutions listed above

    Model:
    - client/server
     
    Serinx likes this.
  5. Serinx

    Serinx

    Joined:
    Mar 31, 2014
    Posts:
    479
    Cheers, I haven't seen that one. I'll add it to the list and check it out!
     
  6. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    2,816
    UNET + 940 bug fixes and improvements.
     
    Joe-Censored and Serinx like this.
  7. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,016
    Serinx likes this.
  8. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    338
    Mirror is getting a lot of traction as it builds on the culture and community centered around UNET. It is under constant development and the authors are accessible via discord.

    Whichever solution you go for, as you know, it has to be understood inside and out. I'd advise placing the level of available support and existing examples at the top of your criteria.

    Edit: UNET / mirror is not peer to peer. You have the flexibility to integrate with a myriad of hosting services like Amazon Game lift, AWS cloud compute, Digital Ocean etc...

    My UNET development servers authenticate via Steam and run dedicated instances on Amazon Web services. I have the flexibility to move it to just about any other hosting provision I like without being locked into a particular SDK.
     
    Last edited: Jan 12, 2019
    Serinx and vis2k like this.
  9. RR7_

    RR7_

    Joined:
    Jan 9, 2017
    Posts:
    15
    Mirror Cons: No Lobby and only one client per Connection. which were native UNET HLAPI features that have been stripped out.
     
    Serinx likes this.
  10. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    @TwoTen Does MLAPI have any demo projects? Does it support a hybrid TCP/UDP system where we can use TCP for things like chat/inventory/file transfer etc... and UDP for player movement/actions etc...?

    And made easy ?
     
  11. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    4,230
    Socket Class Pros:
    - Create your own custom implementation that is optimal for what your game needs
    - No waiting on 3rd parties for bug fixes
    - No black box code you can't investigate while troubleshooting networking issues
    - No worries that your network API will get deprecated, leaving your project in limbo

    Socket Class Cons:
    - Requires more time investment to develop your higher level API than using a premade API
    - Requires at least mid tier C# skills
    - Includes more fiddling with byte arrays than you may be interested in
    - Less available help than going with an established network API with a community around it

    https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket?view=netframework-4.7.2
     
    Last edited: Jan 17, 2019 at 11:34 PM
  12. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    112
  13. Lelepoop

    Lelepoop

    Joined:
    Nov 14, 2016
    Posts:
    89
    LiteNetLib

    Pros
    • No dependency on Unity
    • Gives you all the control
    • It works
    • Included writer and reader objects for managing data in packets
    • Auto packet fragmentation
    • Reliable, unorder, fragmented and non-fragmented flags
    • Do it yourself
    Cons
    • Do it yourself
    • Expects you to know how networking works
    • Have to setup an ownership handshake procedure yourself
    • Connection IDs are longs and arent garuanteed to be unique (0.8 rectified this)
    Model: Client-Server

    The fact that this networking middleware is external and doesnt rely on Unity means that I dont need to worry if its deprecate or experimental (like the current twilight zone of the networking APIs in Unity). It also helps that I'm able to use this API in an external application in order to host my networking process when using the editor, which allows me to compile and keep the active connections running after a hot reload.
     
    dadude123 likes this.
  14. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,016
    Demo projects are not really available. It can use hybrid TCP/UDP yes, but it's not supported out of the box. By default, we instead use a channel based approach where you can set the QoS.
     
  15. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    yeah sorry updated demo projects are an essential to me, networking isn't easy and trying to make sense of another multiplayer framework without a quick demo project to see what it has as features to see it working and then look at the working code is a huge help. I did notice you had pretty old demo project for mlapi that was the github account but again should ideally be an example project folder that just comes bundled with the latest releases that way it works with the latest source and can be removed in the project, probably helps if the example project doesn't need any changes to project settings aswel.

    It seems no framework is really supporting it out of the box or providing a example project of it working, I wouldn't know how it could be supported going by the fact it isn't already supported makes me think it's not that easy to add in the framework otherwise it would already be.
     
  16. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    66
    SmartFoxServer 2X provides TCP and UDP out of the box and you can decide which requests use either of the two.
    Demos are available for multiple platform, Unity included. The FPS demo specifically uses both TCP and UDP.
    http://docs2x.smartfoxserver.com/ExamplesUnity/fps

    Cheers
     
  17. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,016
    I don't see why you want TCP? What's wrong with RUDP?

    As for figuring out how the lib works. That's what we have the wiki for https://midlevel.github.io/MLAPI/wiki/
     
  18. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    Will give that a look at then.
     
  19. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    the comment was more about the example demos.. RUDP might be fine overall.
     
  20. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    Had a bunch of conflicts with Websockets with Smartfox because every framework wants to use the freaking names for things and not use namespaces.. not really good seeing as it's a bunch of dll's

    And the Unity examples are downloading at 130kb/s :(
     
  21. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    66
    I am not sure what you mean by that, what conflicts? Care to clarify?

    Thanks
     
  22. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,200
    it was conflicting with https://github.com/RevenantX/LiteNetLib which I'm currently using in the project.. and uprooting it out at this point would be a hassle, I'd rather move things over to another framework that is in the same project bits at a time if I'm going to switch