This is a paid asset, but now you can download Multiroom PvP Example Free.
Detail this asset from Unity Store: Original Link
Multiroom PvP Example v1.03
Since UNET deprecation, asset was rewritten for Mirror Networking. Mirror asset will need to be imported first Link
Multiroom PvP is an example (not complete project) on how to use Mirror/UNET to create multiple game rooms in a single Mirror/UNET server. It’s meant to be used as a learning resource to get you inspired or help to increase your knowledge of networking with UNET. To make networking development easier, [Easy Unet Packets] is also included in this package.
Why would someone try multi-room setup? (in general)
If a game room is small, it might make more sense to have multiple game rooms in a single server. Take for example a small 1 vs 1 game, which consumes about a 100 MB of RAM. You could only run 10 instances (rooms) in a 1 GB RAM server, which is wasteful and only allows 20 players to play concurrently. If all of your rooms are on one unity instance, you no longer have the overhead of Unity, and can run hundreds of game rooms. With this example, I’ve tested 200 players constantly running around, and here are the stats:
[200 players, 26% CPU, 184 MB RAM on a 5$/month VPS.]
If a game is relatively small, it’s easier to have things running in one server. This way, you don’t need to spend time working on master servers and synchronization between servers. It should give you more time to work on the actual gameplay, not the infrastructure of it. If you get lucky and your game becomes more popular, it’s easy to spread servers across multiple regions or to upgrade the VPS plan. If a need arises – no one stops you from having a master server managing your multi-room servers.
Is multi-room setup just for 1 vs 1 games?
No. Example only deals with 1 vs 1 game, but you can use similar technique to make 5 vs 5 game, 10 player deathmatch or something similar
What are the limitations of this method?
Ask yourself a question – does it make sense to copy the room multiple times in one server? Will it break something? (navmesh, terrain and etc.) For example, if terrain is large, it wouldn’t make sense to multiply it in the server. If your game relies on having AI (bots), can you make sure that your navmesh implementation works on duplicate rooms?
Warning: Focus was put into making this example as simple as possible, so it has no character animations or effects – just basic game mechanics for a 1 vs 1 game (see video attached).
Warning: It’s for people who are interested in self-hosting the server (not using Unity Multiplayer services)