question

Nikita Matusevich avatar image
Nikita Matusevich asked

How to set the maximum number of players on the server?

Hello. I am finishing the initial server setup and I have a question: how can I specify the maximum number of players on the server when creating the server (StartGame)? In my game, each player is able to create his own server (for example, to play with his friends) and must set the maximum number of players. The global limit is 32 players (I installed through Game Mode). But the player must create a server with a maximum number of players, for example, 8. When I call GetCurrentGames, I don't get the "MaxPlayers" that the documentation says. As I understand it, I myself must specify "MaxPlayers" inside the server at startup. How can i do this?

apissdksunrealCustom Game Servers
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nikita Matusevich avatar image Nikita Matusevich commented ·

And one more question: how can I get a ticket to connect to the server from "GetCurrentGames"? I know that you can get a ticket from "StartGame" and "Matchmake", but this does not suit me.

1 Like 1 ·
Citrus Yan avatar image
Citrus Yan answered

Hi @Nikita Matusevich,

It looks like you are using Legacy Multiplayer, is that right? Based on your description and the docs, a possible way to “set” the maximum number of players would be defining more Game Modes specifying distinct max player count (like 2,3,4,…,32), when the player creates his own server ( call StartGame ), select the Game Mode that matches his custom max player count. See aslo: PlayFab matchmaker doesn't seem to know how many players server has.

And, you said “I don't get the "MaxPlayers" that the documentation says”, then what did you get exactly? Can you expose more details about that?

Moreover, according to the API reference GetCurrentGames, tickets are indeed not returned. A possible flow would be:

1) Call GetCurrentGames to retrieve running servers

2) Use Matchmake with to match make against that server instance, then use the ticketed returned to connect to that server.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nikita Matusevich avatar image Nikita Matusevich commented ·

Yes, I use Legacy Multiplayer, because I do not understand the difference between it and Servers 2.0. I succeeded in connecting to the match, thanks :) To the account of "MaxPlayers": I get all the data from the return of the GetCurrentGames function, except for "MaxPlayers" and "LastHeartbeat". I’m not interested in the latter, but I would like to know "MaxPlayers". However, I can pass this value to "GameServerData", but it would be better to get it in the usual way that the function provides.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Nikita Matusevich commented ·

So, you are saying that all the property are returned in this list except for "MaxPlayers" and "LastHeartbeat", is that right? If that's the case, can you provide your title id so we can investigate it, thanks.

0 Likes 0 ·
Nikita Matusevich avatar image Nikita Matusevich Citrus Yan commented ·

Ok, here is the project ID : "BDA22". Just create a new server and game to check. But when you start the game, be sure to add to the custom data:

{\"Map\":\"LVL_Test\"}
Otherwise, the server itself will shut down, because will not see this data.

0 Likes 0 ·
Nikita Matusevich avatar image
Nikita Matusevich answered

Ok, here is the project ID "BDA22". Just create a new server and game to check. But when you start the game, be sure to add to the custom data:

{\"Map\":\"LVL_Test\"}
Otherwise, the server itself will shut down, because will not see this data.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image Citrus Yan commented ·

Hi @Nikita Matusevich, I checked your title and configuration seems alright. However, I don't have permission to start a game server and check. It would be extremely helpful if you can provide the steps to reproduce associated with necessary screenshots, feel free to remove sensitive information. I'll report this to the engineering team to investigate

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.