I develop a serious multiplayer game for a research. I need many users to be able play in the same time.
What is the maximum acceptable number of players that a unity application can hanlde when they play simultaneously.
there is no answer to this question, sorry. Anywhere from 2 to 100000
There is no limit to how many players can play A Multiplayer game, It depends on how many Servers you set up.
Depends on Game and what you are using as a Network and the stuff you are syncing.
Try and Error is the way to go here…
Thank you for your replies! A big part of my research is the creation of a serious game that it is going to be published on Facebook (uploaded by a server(s) from the university).
I have tried it on single game mode and works. Do you think that a fb application can handle so many gamers? (no fee for participation, is only for academic research).
We still dont know which Networking system you’ll be using, nor do we know, what kind of game you will be doing. You can sync a few String fine, while playermovement and a lot of flying(physically calculated) will result in heavy lagging with many player.
Please be more specific what you want to do and how, so we can actually help you.
Depends on so many unknown factors as to almost be unanswerable.
But assuming you are talking about using the inbuilt unity networking with a headless unity instance as a server, some potential limits are…
Number of objects each client can see or know about. Are all the other players visible on screen or spread out across vast distances or in different “rooms”? I have found that when you start to get to even 500 objects with physics, unity starts to creek, and that’s without having to sync all that data over the net. Normally you would try to keep it so each client only knew about <100 other players even in a MMO. But your server will still have to track everyone even if you don’t make it authoritative and even if you don’t have the server handle physics you still have to receive all the client input, update each player and send all the updates back to all the clients in a single thread, if every client knows about every other client then this alone will bring your server to its knees very quickly.
Number of sockets on a server normally on a Linux machine you only have ports 32,000 though to 65,000 or there abouts available to use and each time a connection is used it cannot be used again for 1 or 2 minutes (all configurable) after the client has disconnected so using the defaults you can only guarantee that 533 sockets will be available at any one time if there are frequent connects/disconnects.
So if you are using a single transform for each player and server side physics you are looking at about getting a max of 200-300 players out of a single server.
But using unity’s networking you can have multiple rooms or groups so each player doesn’t have to know about every other player and you can then even move people between servers, so if your hosting your game across multiple servers and your game can be partitioned into “rooms” you can have as many servers as you like, you are then only limited by how many networked objects a single client can know about at one time, which is still going to be <200 probably.
If you want an open world and don’t want “rooms” and don’t care about using unity as the server or using unity’s networking and write your own using .net sockets (as I have done before using Jitter Physics and Lidgren networking library) then using multi-threading and spatial partitioning such as a quad-tree for querying which server side objects each client needs to know about and some config changes on the server to max out the number of usable sockets you can get a single server handling upto 1,500 - 2,000 clients but you will still need multiple servers and some way of handing control of objects seamlessly between them to go beyond that. But you still have a limit on the number of physics objects can can interact in the same space at the same time. Other than that you are just back to the limit being the number of players a single client can know about.
I once wrote a tech-demo game called Asteroid wars and I could get each client (unity) handling upto about 400 simple networked objects before it started to really creek.
I hope you dont mind me adding an extra question sine ArmsFrost post was really informative for me
For an open world MMO as you said, the server dont need to handle the physics of the players, but It needs to handle the physics of the NPC and broadcast it…
So if you use instances or rooms, your single server handles all the rooms or instances mobs physics? Or you have to run a different “server” for each instance?
Or would you open a new thread for each new room?
(BTW unity supports threading?)
Edit: when I think about it, is every “Update” function (every file) runs on its own thread??
Sorry if I am going way off topic here
Whether or not you can get away with not having the server handle physics is down to your game, but for something like an MMO I would have though you would want the server to be authoritative and handle everything to prevent hacking. Then your NPC’s can be treated like any other client or an official “bot” if you will, you just have a separate server hosting the AI and all the logic for NPC’s but as far as the world server is concerned they are just other clients that can move and interact with any other client.
You can split both servers and the rooms over multiple physical hosts, one physical machine might host 10 server each with 20 room’s or areas of your game players rarely go and another physical machine might only host 1 server with 1 very popular area of your game.
Yes, Mono supports multi-threading so in a script in an Update method you can spawn a number of threads let them all run and then wait for them all to end before moving on, but obviously the main unity game loop is a single thread so each Update method is run in turn. However as i think you point out running multiple game servers even on the same physical machine will run each in its own thread so you are just using the OS to multi-thread your game.
Thank you!
Thats pretty much what I had in mind…
I really wonder how the really big open world MMO handles the servers and the load
Do they hold a server of each Instance/word AI?
In a game that you go into portals and change maps, each map have its own server to handle AI physics?
And if its authoritative so also the players?
I have a question, 20 CCUs means 20 players by room or 20 total players??
20 total players.
Try not to necro threads. For updated information on Unity Multiplayer check out their service home page here.