Help Needed with Game Server Infrastructure: Matchmaking, NLB, and Scaling Questions

0

Help Needed with Multiplayer Game Infrastructure: Matchmaking, NLB, and Scaling Questions

Hi everyone,

I'm working on a multiplayer game infrastructure and have several questions about the best practices for managing game server connections, matchmaking, and scaling. I'd really appreciate some guidance from experienced folks in the industry.


Setup and Requirements

Game Servers:

  • We use ECS tasks to host game rooms, with each task capable of handling up to 30 players.
  • The number of rooms (ECS tasks) scales dynamically based on player demand.

Networking:

  • We currently use an AWS Network Load Balancer (NLB) to route player connections to ECS tasks.
  • Players connect via a single endpoint (e.g., game.example.com:7777).

Matchmaking:

  • Our matchmaking service assigns players to specific rooms based on:
    • Room Capacity: Each room has a maximum of 30 players.
    • Player Type:
      • Premium players must connect to premium-only rooms.
      • Normal players must connect to normal-only rooms.
  • Once assigned, the matchmaking service provides the player with a token indicating their assigned room.

Retries and Failover:

  • If the NLB routes a player to the wrong ECS task (e.g., a full room or the wrong player type), the connection is rejected, and the player must retry until they connect to the correct room.

Token-Based Validation:

  • The ECS task (room) validates the player's token to ensure they are connecting to the correct room type (premium/normal) and that space is available.

Constraints:

  • We cannot use Amazon GameLift due to project constraints and must rely on ECS for hosting our game servers.

My Questions

1. How Does Matchmaking Manage Player Balancing?

  • Given the requirement to separate premium players and normal players into their respective room types, what’s the best way to ensure room assignments stay balanced and don’t result in wasted capacity (e.g., partially full rooms)?
  • Should the matchmaking service dynamically update a database like DynamoDB with room states, or is there a better approach to track room availability and player types?

2. Is Matchmaking Necessary?

  • If the NLB already routes players using least connections, is matchmaking really needed?
  • Wouldn’t the NLB alone, combined with auto-scaling and room capacity limits, be sufficient to ensure players land in available rooms?

3. How Does NLB Route to the Correct Room?

  • If matchmaking assigns a room beforehand and gives the player a token, how does the NLB ensure it routes the player to the exact ECS task hosting that room?
  • Without task-specific dynamic ports (the NLB uses a shared port like 7777 for all tasks), how can tokens ensure the correct task is chosen without retries?

4. Are Tokens a Valid Choice?

  • Is using a token a valid and reliable approach given that the NLB doesn’t support task-specific dynamic ports?
  • Are there industry-standard alternatives to ensure that players connect to the exact room assigned by matchmaking?

5. Retry Logic:

  • Since the NLB doesn’t handle retries or failover, who should implement the retry logic? Should it be entirely on the client side, or is there a better approach?

6. Removing the NLB:

  • Is it feasible to cut out the NLB entirely and have the matchmaking service provide clients with the direct IP and port of the ECS tasks?
  • What are the downsides to this approach in terms of reliability, scalability, and complexity?

What We’re Looking For

We’re a small team (4 people) looking for the simplest, most scalable, and efficient solution to support matchmaking, premium/normal player separation, scaling, and room routing using ECS and NLB. Any insights, recommendations, or examples of similar setups would be incredibly helpful!

Thanks in advance for your help! Let me know if you need more details about our infrastructure or requirements.


TL;DR:

Looking for advice on multiplayer game infrastructure using ECS and NLB. Questions about matchmaking necessity, token-based validation, retries, balancing player types (premium vs. normal), and how the NLB routes to specific ECS tasks when matchmaking assigns rooms. Also asking if tokens are valid given NLB doesn’t support dynamic ports and how best to handle retries. Constraints prevent us from using GameLift. Would love your insights!Enter image description here

1 Answer
0

Based on your setup and requirements, here are some insights and recommendations for your multiplayer game infrastructure:

  1. Matchmaking Management: Matchmaking is indeed necessary for your setup, especially given the need to separate premium and normal players. To manage player balancing and room assignments efficiently:
  • Use a database like DynamoDB to track room states, including capacity, player types, and availability.
  • Implement a matchmaking service that continuously updates this database and assigns players to rooms based on their type and available capacity.
  • Consider implementing a "fill-up" strategy where you prioritize filling existing rooms before creating new ones to minimize wasted capacity.
  1. NLB and Matchmaking: While the NLB can route based on least connections, it doesn't account for player types or specific room assignments. Matchmaking is crucial for your setup to ensure premium and normal players are separated and to manage room capacities effectively.

  2. NLB Routing to Correct Room: The NLB alone cannot ensure routing to a specific ECS task. To address this:

  • Implement a session directory service that maps player tokens to specific ECS task IP addresses and ports.
  • When a player connects, have your game server validate the token against this session directory.
  • If the connection is invalid, implement a retry mechanism on the client side.
  1. Token Validity: Tokens are a valid approach, but they need to be used in conjunction with a session directory service as mentioned above. This allows you to maintain the mapping between tokens and specific game server instances.

  2. Retry Logic: Implement retry logic on the client side. When a connection is rejected:

  • The client should request a new token from the matchmaking service.
  • The matchmaking service should then either reassign the player to a new room or confirm the existing assignment.
  • The client then retries the connection with the new or confirmed token.
  1. Removing the NLB: While it's technically feasible to remove the NLB and have the matchmaking service provide direct IP and port information, it's not recommended for several reasons:
  • Reduced flexibility in scaling and managing your infrastructure
  • Increased complexity in handling IP changes and task failures
  • Potential security risks by exposing your ECS tasks directly

Instead, consider using the NLB in conjunction with a session directory service to manage connections more effectively.

Given your team size and constraints, focus on implementing a robust matchmaking service that works alongside your NLB. This service should manage room assignments, track capacities, and handle player types. Utilize a database like DynamoDB to store real-time game session information, and implement client-side retry logic for connection failures. This approach will provide a scalable and efficient solution that meets your requirements for separating premium and normal players while effectively managing room assignments and scaling.
Sources
Game server - Games Industry Lens
Game server processes - Games Industry Lens
Monitoring - Games Industry Lens
Multi-Region and hybrid architecture for low-latency games - Games Industry Lens

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions