Multiple Server-Instances on one pc

I’m programming an online Game with some friends.

Server structure idea:

We have a Login/Lobby Server, Players Login on this Server. This we can do with php Scripts and a database. (This already works fine)

Then they start a Game. A new Server-Instance gets created for them on a Server-PC. The Lobby Server sends them a RPC and they connect to the new GameServer-Instace. But I don’t want to have one PC for every Game. So I need to start multiple Server-Instances on one PC.

After they finished their Game the reconnect to the Login/Lobby-Server and the GameServer sends the result of this Game back to the LobbyServer

Now my question: How can we create multiple Server-Instances on one Server ?
Is this even possible with Unity’s Networking ?

Picture of our NetworkStructure-idea

tl;dr
I need multiple Game-Servers on one PC. How can I do that ?

Edit: Working on a Diagramm of our Network-idea.

Your diagram is missing some fundamental topological things. Are your servers all in the same network? To which PCs a client can / should connect to? Do you use a NAPT router? If you have a NAPT router then all client-server communication will go through the router. How do you start a game server instance on another PC? Do you have some kind of service daemon running on the machines? You should draw a more clear border what's intern and where's the connection to the web.

–

1 Answer

1

Just start your server multiple times and make sure you use a different port for each instance.

This is one idea we're working at already. But how can we have it, that the Player doesn't need to open every Port ?

–

The player doesn't need to open any ports, only the server host. You said you have a PC which should run the server instances. To make the servers available from outside you have to port-forward all ports you might use to the host PC. For example, Valve uses this port range: UDP 27000 to 27015 One PC can't bind the same port twice at the same time.

–

How can I forward Ports with Unity ?

–

But the same port can be used for multiple servers if you setup a master-server that forwards all packets to the correct Machine/Process. Kind of like having a second router. No reason to do that unless you plan on hosting a massive game or loads of servers.

–

At the moment our biggest problem is to send the port data to the single Server-Instances. We don't know how to send the GameData to the GameServer.

–