R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::IMatchmakingService Class Referenceabstract

Interface for a matchmaking system. More...

#include <IMatchmakingService.hpp>

Inheritance diagram for server::IMatchmakingService:
Inheritance graph
Collaboration diagram for server::IMatchmakingService:
Collaboration graph

Public Member Functions

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.
 

Detailed Description

Interface for a matchmaking system.

Definition at line 29 of file IMatchmakingService.hpp.

Constructor & Destructor Documentation

◆ ~IMatchmakingService()

virtual server::IMatchmakingService::~IMatchmakingService ( )
virtualdefault

Member Function Documentation

◆ addPlayer()

virtual void server::IMatchmakingService::addPlayer ( uint32_t  playerId)
pure virtual

Add a player to the matchmaking queue.

Parameters
playerIdPlayer ID to add

Implemented in server::MatchmakingService.

◆ 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:

  1. Try to find a waiting room (instant join)
  2. If no waiting room, join as spectator to in-progress game (if allowed)
  3. If no matches available, add to queue for future match creation
Parameters
playerIdPlayer ID requesting matchmaking
availableRoomsList of currently available rooms to search
allowSpectatorWhether 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

Get the number of players waiting in queue.

Returns
Queue size

Implemented in server::MatchmakingService.

◆ removePlayer()

virtual void server::IMatchmakingService::removePlayer ( uint32_t  playerId)
pure virtual

Remove a player from the matchmaking queue.

Parameters
playerIdPlayer ID to remove

Implemented in server::MatchmakingService.

◆ setMatchCreatedCallback()

virtual void server::IMatchmakingService::setMatchCreatedCallback ( MatchCreatedCallback  callback)
pure virtual

Set callback for when a match is created.

Parameters
callbackFunction to call when match is ready

Implemented in server::MatchmakingService.

◆ tick()

virtual void server::IMatchmakingService::tick ( )
pure virtual

Process matchmaking queue and create matches Called periodically by the server.

Implemented in server::MatchmakingService.


The documentation for this class was generated from the following file: