I want to create online 2D game with Unity. I have dedicated server running Ubuntu 16.04, and the clientside of the game will work in browsers using WebGL. I also prefer to use HLAPI and NetworkManager,NetworkIdentity etc because of simplicity.
So my plan is to write very similar code for server/client and just run separated Unity process in headless mode on the server with no graphics to accept connections. I want to use Unity’s physics engine to calculate entire game process on the serverside to avoid synchronization issues.
I’ve already figured out how to make it work when single Unity process with one NetworkManager object for the server runs striclty one game room, where all players see each other and are located in one virtual space. I’ve also read about Unity Multiplayer Service’s matchmaking.
But how can I do something like separate game rooms with one server Unity process on my own machine? Can NetworkManager has instances linked to different game objects (e.g. maps) in one scene?
How can I do this? Should I switch to LLAPI ? So, if I can’t use built in network identifications, network transform, auto spawn and other HLAPI functions, I would better write my own client-server communication with WebocketSharp
But maybe I can get rid of it. It is very common use case — many players in different rooms with one server — isnt it?
You can do it with HLAPI. There is no magic barrier preventing you to do certain things.
The HLAPI is also Open Source. Check the NetworkManager sourcecode to get some insight.
As for how to do things, that’s your job as a developer to do design decisions. I can give advice or answer technical questions. But I wont develop your game
I did this. Using only hlapi and unet.
Created my own gameroom objects.
Not difficult, really.
Used rebuildobservers to let only people in the same game room see the objects created.
You have to use onaddobserver also, because net clients do not call rebuildobservers…