Can we PLEASE clear this confusion up! (UNET)

Hey guys, I have been looking into multiple networking solutions, and have got very mixed messages about UNET, and would like to start a discussion to clear up some of my confusion and other peoples.

What is UNET?

From my understanding there is 2 different parts of what people call “UNET”, which many people do not know, and lots of people tend to just call it all “UNET”:

  • UNET is the official networking library in Unity. It is completely free to use.

  • Unity Services (CCU, Matchmaking, Relay servers, etc.) is a collection of services that Unity provides on top of UNET; mainly player-hosted games and matchmaking that avoid the need for you to host a dedicated server. These services are paid and optional to use.

With that being said, you DO NOT need to use Unity Services to make a multiplayer game in UNET, and you can host your own dedicated servers through Amazon etc. or even host your own servers at home for your game and never have to pay any sort of CCU/Subscription cost/etc.
However, if you decide to host your own servers, you will not have some nice features that come with Unity Services such as matchmaking, relay servers, etc. which you would have to figure out yourself (Which is not overly difficult, and several Unity Asset Store packs to help with this) if you required them and were not hosting through Unity.

How many players can UNET handle?

This is a question I have wondered myself, and I still do not fully understand as I am no multiplayer expert at all.
This is a very hard question to answer, because it all depends on the “action level” of your game, for example a super intense action game with which requires tons of things to be sent over the network constantly, will have a lower max players than say, a simple card game that requires almost nothing to be sent, so with that being said of course this max players number can vary almost indefinitely.

Many people on these forums have told other users:

“UNET” can handle at most 10-20 players for a FPS game.

Now from my understanding (and this is where I am confused), if you were to ask that person why they think it could only handle this amount, they would say things such as because Unity Services Matchmaking, Unity Services limits the amounts of messages you can send, Unity Services high cost, etc. etc.

However, like I said I am no multiplayer expert, so I do not understand the more complex technical side of things, and this is the part I need to clear up for myself.

With that being said If I am not mistaken all these “constraints” are related to Unity services, not the UNET library itself.

So my question for some of the multiplayer experts out there would be, (and excuse my ignorance if this is a ridiculous question)
without using Unity Services, and just using UNET with some sort of custom matchmaking, servers hosted on Amazon, and some AOI (Area of Interest), is it a good library to use for a large scale multiplayer FPS game with say 50 players sending frequent messages, or is UNET HLAPI simply not built for things of the sort, or does it not make a big difference to other solutions on the market and it is just basically just another networking library?

Final thougts

I cannot count the amount of users that I have seen be turned off of UNET because they simply search it, and read that “UNET” cannot be used for a MMO or FPS because it can handle no more than x amount of users, or read that it has huge costs for subscriptions and CCU, or that you cannot have a dedicated server and do authoritative movement, etc.
These same people will go on to look at solutions such as Forge or Bolt, and wish the UNET could do these things (which it can!!) simply because the bridge between UNET, and Unity Services is very very unclear to many users.
When I first read about UNET, I was sure that it was almost the exact same as PUN, with no server sided logic, no authoritative movement, no self hosted or cloud hosted servers, etc. could be done, which is simply not the case, it can all be done using UNET.

I think the things I have talked about above is really keeping a lot of users from coming to UNET, and stopping it from growing as rapidly as it could be growing.

It would be great if we could have a discussion, so I could add to this post for anyone that has been as confused as I have been. Also please let me know if I have made any mistakes, I am by no means an expert.

Thanks, looking forward to hearing peoples thoughts on this.

I am not very experianced with the Unity Services. Only the libraries.
UNET at it’s core is the LLAPI (Low level API). It offers just a few simple calls in a class called the NetworkTransport. It allows you to send and recieve byte arrays and it handles connection and other things for you. This is developed by Unity. Specifically by aabramachev. The HLAPI however, is a opensource library built ontop of the LLAPI to make it easier to develop networked code by adding attributes that define where methods should be called. Command & RPC’s. Personally, I am having too much issues with the HLAPI, it does not offer me enough flexibility and it caused me to rewrite the network code using the LLAPI and using my own helper methods and similar to distribute network data to the MonoBehaviours. As for how many players, or rather. Connections UNET can handle. This depends. If we are talking technincal limit its about 4 milion (uint max value used to idetify clients). If we are talking realistic amounts for a game, this depends. If you are using a relay (Unitys or a inhouse) or none.

It depends how your game is written. If you run your server as a unity application with the server code, you have worse performance than if you run a console app with just geometry libs. But saying that UNET is unable to run more than 20 is BS. It depends on how your network code is written, what data is sent, how much data is sent, how often, how optimized the server and client code is etc. Running thousands of connections on Unet might not be a big problem if not much is going on in the game (such as a cardgame). If howver the server has 10k connections connected and each are trying to send their movement 20 times a second and then the server has to verify them, you might see isssues depending on Server hardware. Then there is another aspect, player hosted servers. This often requires STUN NAT Punchthrough, UPnP or a relay.

When people are saying that UNET can’t be used to write MMO’s they usual refer to the HLAPI. The HLAPI is designed to make it easy to write player hosted servers, and it can be difficult to write a server that can run hundred of thousands of connections using the HLAPI. But should be no problem using LLAPI.

2 Likes

Don’t forget the NetworkServerSimple class which can be used alone, and is also the root of the NetworkManager. This has all the nice connection handling, but without the game specific stuff (bloat) of NetworkManager. It’s of much greater use for dedicated servers.

As @TwoTen says; regardless of the networking system used, if you have 100 characters moving around, the server/host will be trying to send each client the movement of the others at whatever rate you’ve chosen (15 times per second for example) 100 * 15 messages to 100 clients = 150,000 messages per second - that’s a tall order for any system. Then you’ve got incoming messages from clients, as well as messages about non-players on top of all that.

Obviously you cheat and optimise to bring this figure down, but there’s a starting point.

1 Like

@TwoTen Thanks for the useful info, very informative!

Hi @TwoTen , when using UNet LLAPI, at what maximum rate(‘r’) is suggestible to call NetworkTransport.Receive() , to actually receive events at rate ‘r’ ?