Unity dedicated server - players

Im looking for solution how get from dedicated server information about the players/max players.
I was looking in multiplay hosting, service web API and didn’t find anything. I trying used server protocol query but didn’t work for me all time waiting on recevice.

What is the best solution for get information about the players/max players from the server to listing servers and show current players ?

Hi @Tobiasz2817

First, I wanted to clarify that Multiplay Hosting does not generally have a max limit of players that can connect to a server, this would be game code enforced. The MaxPlayers value in Server Query Protocol would be maintained by the game binary updating that value, but there are no system level enforcements or tracking of player connections based on that specific value.

Next, can you confirm your specific use case here? Is this for an administration interface used by you to monitor all running games or is this for a player facing server browser type feature?
Something like a Counterstrike server browsing feature players can view and join any given server if a slot is available?

For an administration use case, you’d need to leverage the admin api Unity Services Web API docs to get the list and then using SQP would work. However, there is not any 1 single api call to fetch this information.

For a player client use case, is your game using Unity? If so, the new Multiplayer Services SDK ( Multiplayer Services sessions for the Unity Engine ) allows for creating sessions and backfilling dedicated Multiplay game servers. The Sessions api would allow browsing a list of all sessions and show the number of players connected.

For a player client use case and not using Unity Engine, you could use our Lobby service via the REST apis Unity Services Web API docs and a service account to keep track of servers by creating a Lobby from the server runtime when it launches, place ip connection info into the lobby data, and use the Lobby from the game clients to browse and connect to servers.

In the scenario of using Unity Sessions or Unity Lobby, you would be restricted to 100 (soon to be 150) player connections per session.

1 Like