Skip to content

Commit 058e594

Browse files
committed
use MatchProperties Region and MaxPlayers
1 parent c0a57fe commit 058e594

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

modules/GameLiftAllocator/Project/GameLiftAllocator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public class GameLiftAllocator(IGameApiClient gameApiClient, IGameLiftFactory ga
4343
public async Task<AllocateResponse> Allocate(IExecutionContext context, AllocateRequest request)
4444
{
4545
// Determine AWS region from match properties or use default
46-
var region = request.MatchmakingResults.MatchProperties.GetValueOrDefault("region")?.ToString() ?? DefaultAwsRegion;
46+
var region = request.MatchmakingResults.MatchProperties.GetValueOrDefault("Region")?.ToString() ?? DefaultAwsRegion;
47+
48+
// maxPlayers is only available in match properties when using Cloud Code hosting
49+
// It is not present when using Multiplay hosting with Cloud Code override
50+
var maximumPlayerSessionCount = request.MatchmakingResults.MatchProperties.GetValueOrDefault("MaxPlayers") ?? DefaultMaximumPlayerSessionCount;
4751

4852
try
4953
{
@@ -62,7 +66,7 @@ public async Task<AllocateResponse> Allocate(IExecutionContext context, Allocate
6266
{
6367
PlacementId = request.MatchId, // Use matchId for idempotency
6468
GameSessionQueueName = GameSessionQueueName,
65-
MaximumPlayerSessionCount = DefaultMaximumPlayerSessionCount,
69+
MaximumPlayerSessionCount = Convert.ToInt32(maximumPlayerSessionCount),
6670
GameSessionData = gameSessionData
6771
};
6872

0 commit comments

Comments
 (0)