Interface for a matchmaking system.
More...
#include <IMatchmakingService.hpp>
|
| virtual | ~IMatchmakingService ()=default |
| |
| virtual void | addPlayer (uint32_t playerId)=0 |
| | Add a player to the matchmaking queue.
|
| |
| virtual void | removePlayer (uint32_t playerId)=0 |
| | Remove a player from the matchmaking queue.
|
| |
| virtual void | tick ()=0 |
| | Process matchmaking queue and create matches Called periodically by the server.
|
| |
| virtual size_t | getQueueSize () const =0 |
| | Get the number of players waiting in queue.
|
| |
| virtual void | setMatchCreatedCallback (MatchCreatedCallback callback)=0 |
| | Set callback for when a match is created.
|
| |
| virtual std::pair< std::shared_ptr< Room >, bool > | findOrCreateMatch (uint32_t playerId, const std::vector< std::shared_ptr< Room > > &availableRooms, bool allowSpectator=true)=0 |
| | Find an available room or add player to matchmaking queue.
|
| |
Interface for a matchmaking system.
Definition at line 29 of file IMatchmakingService.hpp.
◆ ~IMatchmakingService()
| virtual server::IMatchmakingService::~IMatchmakingService |
( |
| ) |
|
|
virtualdefault |
◆ addPlayer()
| virtual void server::IMatchmakingService::addPlayer |
( |
uint32_t |
playerId | ) |
|
|
pure virtual |
◆ findOrCreateMatch()
| virtual std::pair< std::shared_ptr< Room >, bool > server::IMatchmakingService::findOrCreateMatch |
( |
uint32_t |
playerId, |
|
|
const std::vector< std::shared_ptr< Room > > & |
availableRooms, |
|
|
bool |
allowSpectator = true |
|
) |
| |
|
pure virtual |
Find an available room or add player to matchmaking queue.
Implements intelligent matchmaking strategy:
- Try to find a waiting room (instant join)
- If no waiting room, join as spectator to in-progress game (if allowed)
- If no matches available, add to queue for future match creation
- Parameters
-
| playerId | Player ID requesting matchmaking |
| availableRooms | List of currently available rooms to search |
| allowSpectator | Whether player can join as spectator if no waiting rooms |
- Returns
- Pair of (room, isSpectator) if immediate match found, (nullptr, false) if added to queue
Implemented in server::MatchmakingService.
◆ getQueueSize()
| virtual size_t server::IMatchmakingService::getQueueSize |
( |
| ) |
const |
|
pure virtual |
◆ removePlayer()
| virtual void server::IMatchmakingService::removePlayer |
( |
uint32_t |
playerId | ) |
|
|
pure virtual |
◆ setMatchCreatedCallback()
Set callback for when a match is created.
- Parameters
-
| callback | Function to call when match is ready |
Implemented in server::MatchmakingService.
◆ tick()
| virtual void server::IMatchmakingService::tick |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: