[Gamelift] Stop players from entering a game session

0

I would like to stop players from entering a game session once a minimum number of players have joined. Here's an example:

  • The maximum number of players that could be in a given game session is 50.
  • The minimum number of required players to start a game session is 25.
  • Once the minimum of 25 players is reached, I would like to "close" the game session so that new players cannot join this game session

I know that in the matchmaking rule set, there is this logic:

    "teams" : [{
        "name": "allplayers",
        "maxPlayers" : 50,
        "minPlayers" : 25
    }],

However, with the above logic, players can still enter the game session after the 25 limit is reached. How can I "close" the game session once the 25 limit is reached? By "close", I mean that new players cannot join this running game session.

Thanks!

已提问 1 年前297 查看次数
1 回答
1

Hi!

There are a couple of ways you could potentially do this.

Once the game session has started, you can invoke UpdatePlayerSessionCreationPolicy through the server SDK with a DENY_ALL policy. This prevents the game session from accepting new players

Alternatively if this decision is being made outside of the game server itself (for instance a backend client service):

  • You could call the UpdateGameSession API with the required max player session count, to update the maximum number of players that can be connected simultaneously to the game session.
  • You could call the UpdateGameSession API with a DENY_ALL player session creation policy. This will prevent the game session from accepting any new players.

Thanks!

AWS
已回答 1 年前
  • Thanks! Will try this out and keep you updated!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则