dth-pingpong-backend/docs/hybrid-matchmaking.md

91 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2025-01-26 00:56:28 +01:00
# Hybrid Ranking System: Matchmaking Suggestions
## Overview
This proposal outlines a hybrid ranking system for matchmaking in a ping pong app. The system integrates **Elo ratings** for 1v1 matches and **OpenSkill (OSK)** ratings for 2v2 matches. The goal is to use Elo as a supporting metric for matchmaking suggestions in 2v2 scenarios, providing fair and balanced matches for players.
---
## Problem Statement
OpenSkill is ideal for tracking player ratings in 2v2 matches due to its ability to handle uncertainty (![](https://latex.codecogs.com/svg.image?\sigma)) and dynamic team compositions. However, it does not directly account for individual player skill history from 1v1 matches.
The problem lies in matchmaking for 2v2 games when:
1. Player data is sparse (e.g., fewer 2v2 matches played).
2. Players' individual skill levels (from Elo) are significantly mismatched within or between teams.
By combining Elo and OpenSkill, we can make more informed matchmaking suggestions.
---
## Proposed Solution
### Approach
We propose using Elo ratings from 1v1 matches as an additional weighting factor when suggesting 2v2 matchups. This involves the following steps:
1. **Team Strength Calculation**:
- Use Elo to calculate the **average team Elo**:
![](https://latex.codecogs.com/svg.image?\bg{white}\text{Team&space;Elo}=\frac{\text{Elo}_{\text{Player1}}+\text{Elo}_{\text{Player2}}}{2})
2. **Weigh Elo into OpenSkill Predictions**:
- Combine OpenSkill predictions with Elo to generate an **Adjusted Compatibility Score**:
![](https://latex.codecogs.com/svg.image?\bg{white}\text{Adjusted&space;Score}=w_1\cdot\text{OSK&space;Prediction}+w_2\cdot\text{Elo&space;Difference&space;Factor})
- *w_1* and *w_2* are weights balancing the influence of OpenSkill and Elo.
3. **Match Balance Assessment**:
- Predict the expected win probability for each team using OpenSkill and adjust it with Elo to suggest fairer matches.
4. **Rank Match Suggestions**:
- Generate a list of potential matchups ranked by their balance score. Favor matches with close Elo and OpenSkill ratings.
---
### Example Scenario
#### Player Data
| Player | Elo | OSK (![](https://latex.codecogs.com/svg.image?\mu),![](https://latex.codecogs.com/svg.image?\sigma)) |
|--------|-------|-----------------------|
| A | 1600 | (30, 5) |
| B | 1500 | (28, 6) |
| C | 1550 | (29, 4) |
| D | 1400 | (27, 5) |
#### Step 1: Form Teams and Calculate Team Elo
- **Team 1**: A + B → Team Elo: ![](https://latex.codecogs.com/svg.image?\bg{white}\frac{1600+1500}{2}=1550)
- **Team 2**: C + D → Team Elo: ![](https://latex.codecogs.com/svg.image?\bg{white}\frac{1550+1400}{2}=1475)
#### Step 2: OpenSkill Predictions
- Team 1: Combined ![](https://latex.codecogs.com/svg.image?\mu)= 29, ![](https://latex.codecogs.com/svg.image?\sigma) = 5.5$
- Team 2: Combined ![](https://latex.codecogs.com/svg.image?\mu) = 28, ![](https://latex.codecogs.com/svg.image?\sigma) = 4.5
Predicted win probability using OSK: **Team 1 is favored.**
#### Step 3: Adjust with Elo
- Elo gap: 1550 - 1475 = 75
- Adjust prediction to slightly favor Team 1 more based on the Elo difference.
#### Step 4: Suggest Matches
Rank all potential 2v2 matchups based on their **Adjusted Compatibility Score**.
---
## Benefits of the Hybrid System
- **Fairness**: Prevents unbalanced teams by considering both 1v1 and 2v2 performance.
- **Adaptability**: Handles sparse data effectively by leveraging Elo as a fallback metric.
- **Dynamic Suggestions**: Offers matchmaking suggestions based on both team composition and player history.
---
## Next Steps
1. Implement the matchmaking algorithm:
- Calculate compatibility scores for all possible 2v2 matchups.
- Use Elo to filter and refine suggestions.
2. Define weights *w_1* and *w_2* for Elo and OpenSkill integration.
3. Test the system with real player data to evaluate balance and fairness.