game / pragma.matchmaking / MatchmakingService /

MatchmakingService #

@ExperimentalCoroutinesApi

internal class MatchmakingService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, uuidProxy: UUIDProxy = UUIDProxy(), matchmakingQueues: MatchmakingQueues = MatchmakingQueues(), sessionClient: SessionClient = SessionClient(), partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), timeProxy: TimeProxy = TimeProxy.defaultInstance, randomProxy: RandomProxy = RandomProxy(), matchmakingSimulatorClient: MatchmakingSimulatorClient = MatchmakingSimulatorClient()) : DistributedService, ConfigHandler<MatchmakingConfig> , MatchReleaser

The MatchmakingService is a game loop service responsible for matching players together using configurable queues. The service maintains a collection of all active matchmaking queues, which it constantly iterates through on a configurable timer (MatchmakingConfig.matchmakingDelayMillis) attempting to make a match using the matchmaking plugin.

Constructors #

MatchmakingService

fun MatchmakingService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, uuidProxy: UUIDProxy = UUIDProxy(), matchmakingQueues: MatchmakingQueues = MatchmakingQueues(), sessionClient: SessionClient = SessionClient(), partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), timeProxy: TimeProxy = TimeProxy.defaultInstance, randomProxy: RandomProxy = RandomProxy(), matchmakingSimulatorClient: MatchmakingSimulatorClient = MatchmakingSimulatorClient())

Functions #

NameSummary

enterMatchmakingV2

suspend fun enterMatchmakingV2(session: ServiceSession, request: MatchmakingRpc.EnterMatchmakingV2Request): MatchmakingRpc.EnterMatchmakingV2Response

Enters a group of players into matchmaking.

enterMatchmakingWithGameInstanceV1

suspend fun enterMatchmakingWithGameInstanceV1(session: ServiceSession, request: MatchmakingRpc.EnterMatchmakingWithGameInstanceV1Request): MatchmakingRpc.EnterMatchmakingWithGameInstanceV1Response

Enters a game instance into matchmaking. This endpoint is invoked from GameInstanceRpc.EnterMatchmakingV1Request and results in an Matchmaking.GameInstance being placed into a matchmaking queue.

getCacheInfoOperatorV1

suspend fun getCacheInfoOperatorV1(session: OperatorSession, request: MatchmakingRpc.GetCacheInfoOperatorV1Request): MatchmakingRpc.GetCacheInfoOperatorV1Response

Queries information on matchmaking queues.

getMatchmakingInfoV2

suspend fun getMatchmakingInfoV2(session: PlayerSession, request: MatchmakingRpc.GetMatchmakingInfoV2Request): MatchmakingRpc.GetMatchmakingInfoV2Response

Queries information on matchmaking queues.

leaveMatchmakingV1

suspend fun leaveMatchmakingV1(session: ServiceSession, request: MatchmakingRpc.LeaveMatchmakingV1Request): MatchmakingRpc.LeaveMatchmakingV1Response

Called from PartyService when a player leaves or is kicked from a party. Removes the whole party from matchmaking.

leaveMatchmakingV2

suspend fun leaveMatchmakingV2(session: PlayerSession, request: MatchmakingRpc.LeaveMatchmakingV2Request): MatchmakingRpc.LeaveMatchmakingV2Response

Allows a player to leave matchmaking. Removes their whole party from matchmaking.

onSessionReconnected

suspend fun onSessionReconnected(notification: PlayerSessionRpc.SessionReconnectedV1Notification)

Notification handler for player reconnect. Removes parties in matchmaking from queue if any player reconnects.

onSessionTerminated

open suspend override fun onSessionTerminated(notification: PlayerSessionRpc.SessionTerminatedForServiceV1Notification)

Notification handler for player disconnect. Removes parties in matchmaking from queue if any player disconnects.

removeGameInstanceFromMatchmakingV1

suspend fun removeGameInstanceFromMatchmakingV1(session: ServiceSession, request: MatchmakingRpc.RemoveGameInstanceFromMatchmakingV1Request): MatchmakingRpc.RemoveGameInstanceFromMatchmakingV1Response

Called from GameInstanceService when a game instance has requested to leave matchmaking.

removeGameServerVersionV1

suspend fun removeGameServerVersionV1(session: ServiceSession, request: MatchmakingRpc.RemoveGameServerVersionV1Request): MatchmakingRpc.RemoveGameServerVersionV1Response

Remove a GameServerVersion from matchmaking. Any players that were in queue for game server versions being removed will be removed from the game loop and sent a MatchmakingRpc.MatchmakingFailureV1Notification.

updateMatchmakingGameInstancePlayersV1

suspend fun updateMatchmakingGameInstancePlayersV1(session: ServiceSession, request: MatchmakingRpc.UpdateMatchmakingGameInstancePlayersV1Request): MatchmakingRpc.UpdateMatchmakingGameInstancePlayersV1Response

Called from GameInstanceService when players join or leave a game instance that is in matchmaking.

updateMatchmakingGameInstanceV1

suspend fun updateMatchmakingGameInstanceV1(session: ServiceSession, request: MatchmakingRpc.UpdateMatchmakingGameInstanceV1Request): MatchmakingRpc.UpdateMatchmakingGameInstanceV1Response

Called from GameInstanceService to update a matchmaking game instance with new data.