Description
The current networking architecture supports only a single game server that accepts connections from all clients. This design does not scale and creates a single point of failure.
Implement a gateway-based architecture that dynamically allocates game rooms across multiple backend game servers.
Note: This is an umbrella issue. Subsequent issues related to the gateway, server manager, room allocation, server discovery, state synchronization, and cleanup will be created as smaller tasks and should be considered subsets of this issue.
Proposed Flow
Creating a Room
- Client connects to the Gateway.
- Client requests a new room.
- Gateway generates a unique
roomID.
- Gateway requests an available game server from the Server Manager.
- Server Manager selects an available server and returns its IP/address.
- Gateway stores:
in a key-value store (e.g. Redis).
- Gateway returns the
roomID and serverIP to the client.
- Client establishes a direct connection with the assigned game server.
Joining a Room
- Client connects to the Gateway.
- Client sends the
roomID.
- Gateway looks up the room in the key-value store.
- Gateway returns the corresponding
serverIP.
- Client connects directly to the game server.
Cleanup
- Game servers periodically report their state (player count, capacity, etc.) to the Server Manager.
- When all players leave a room:
- The game server notifies the Server Manager.
- The Server Manager informs the Gateway (or updates shared state).
- The Gateway removes the
roomID -> serverIP mapping from the key-value store.
- The server is then available for future room allocations.
Benefits
- Horizontal scalability
- Better load distribution
- No single game server bottleneck
- Dynamic room allocation
- Automatic cleanup of unused rooms
High-Level Tasks
Future Improvements
- Least-loaded server selection
- Geographic routing
- Automatic server provisioning
- Health checks and failover
- Room migration during server failures
Description
The current networking architecture supports only a single game server that accepts connections from all clients. This design does not scale and creates a single point of failure.
Implement a gateway-based architecture that dynamically allocates game rooms across multiple backend game servers.
Proposed Flow
Creating a Room
roomID.in a key-value store (e.g. Redis).
roomIDandserverIPto the client.Joining a Room
roomID.serverIP.Cleanup
roomID -> serverIPmapping from the key-value store.Benefits
High-Level Tasks
Future Improvements