Senior
Formalization of matchmaking system requirements: how to search for a match, what to do if no opponent is found, how to validate moves, is a timer needed, how to update ratings, is a game history needed, what to do in case of disconnect?
sobes.tech AI
Answer from AI
For matchmaking systems, it is important to formalize the following aspects:
-
Matchmaking:
- Use a waiting queue with filters based on rating, region, level, and other parameters.
- Periodically expand search criteria if no opponent is found within a set time.
-
If no opponent is found:
- Notify the player about the delay and offer to wait or exit.
- Automatically expand search parameters (e.g., increase allowable rating difference).
-
Move validation:
- The server should verify the correctness of each move according to game rules.
- Discard incorrect or suspicious moves.
-
Timer:
- A timer is necessary to limit move time to prevent hangs.
- When time expires, the move is considered skipped or a loss.
-
Rating update:
- Use algorithms like Elo, Glicko, or their modifications.
- Update the rating after the game based on the result and rating difference.
-
Game history:
- Store the sequence of moves for analysis, repetitions, and dispute resolution.
- Can be used for AI training or statistics.
-
Disconnect:
- Implement a timeout for reconnection.
- If the player does not return, count as a loss or draw according to rules.
- Possible substitution with a bot to continue the game.
Example of a simplified Go match search structure:
func findMatch(player Player, queue []Player) *Player {
for _, opponent := range queue {
if isCompatible(player, opponent) {
return &opponent
}
}
return nil
}
Where isCompatible checks search criteria (rating, region, etc.).