Lobby server responsible for user authentication, matching, and all features except in-game functionality.
- Login Processing: User authentication and session management
- OAuth Support: Support for external authentication providers like Facebook, GameCenter
- Session Management: User session creation and management
- Periodic Matching Attempts: Client polls at regular intervals, matching succeeds when conditions are met
- Match Registration and Wait: Client registers for matching and waits via Redis subscription, gRPC message stream
- Redis Pub/Sub: Notify waiting users via Redis pub when next client's matching attempt succeeds
- Server Status Management: Battle server status monitoring
- Game Session Management: Game session creation and management
- Result Processing: Game result storage and statistics
- Authentication Service: User authentication processing
- Matching Service: Matching logic processing
- Game Session Manager: Game session management
- Redis Cache: Session and matching data cache
- Match Request: Client requests with matching criteria
- Match Search: Search for other players matching criteria
- Match Success: Notify when conditions are met
- Game Session Creation: Request game session creation to battle server
// Client periodically requests matching
while (!isMatched) {
var matchResult = await lobbyClient.RequestMatch(matchCriteria);
if (matchResult.IsSuccess) {
// Handle match success
break;
}
await Task.Delay(1000); // Wait 1 second
}// Register for matching
await lobbyClient.RegisterForMatch(matchCriteria);
// Wait via Redis subscription
using var subscription = redisClient.Subscribe("match_notifications");
await subscription.OnMessage(async (channel, message) => {
// Handle match success notification
});cd Lobby
dotnet runappsettings.json: Default configurationappsettings.Release.json: Production environment configuration
Lobby/
├── Lobby.csproj # Project file
├── appsettings.json # Default configuration
├── appsettings.Release.json # Production configuration
├── GrpcHostedService.cs # gRPC hosting service
├── Modules/ # Business logic modules
│ ├── Authentication/ # Authentication related
│ ├── Matching/ # Matching related
│ └── GameSession/ # Game session related
├── OAuth/ # OAuth authentication
│ ├── ExternalProvider.cs
│ ├── ExternalProviderFacebook.cs
│ └── ExternalProviderGameCenter.cs
├── Service/ # Service layer
├── Query/ # Data queries
├── WebAPIClient/ # Web API client
└── UnitTest/ # Unit tests
- .NET 6.0 or higher
- gRPC
- Redis
- Entity Framework Core
- gRPC communication
- Redis cache
- OAuth authentication providers
- Communication with Battle server
- Structured logging support
- Matching success rate tracking
- Authentication failure logs
- Concurrent user count
- Matching wait time
- Matching success rate
- Authentication processing time