game / pragma.matchlifecycle / MatchLifecycleService /

MatchLifecycleService #

internal class MatchLifecycleService(pragmaNode: PragmaNode, instanceId: UUID, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, matchEndMetrics: MatchEndMetrics = MatchEndMetrics( Metrics(pragmaNode.metricsRegistry), LoggerFactory.getLogger(MatchEndMetrics::class.java) ), matchEndCommand: MatchEndCommand = MatchEndCommand(), matchesInProcess: MatchesInProcess = MatchesInProcess(), sessionClient: SessionClient = SessionClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), matchCapacityClient: MatchCapacityClient = MatchCapacityClient(), partyClient: PartyClient = PartyClient()) : DistributedService, ConfigHandler<MatchLifecycleServiceConfig>

MatchLifecycle service is a game loop service responsible for creating matches, sending match connection details to players, and handling any match end processing.

Constructors #

MatchLifecycleService

fun MatchLifecycleService(pragmaNode: PragmaNode, instanceId: UUID, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, matchEndMetrics: MatchEndMetrics = MatchEndMetrics( Metrics(pragmaNode.metricsRegistry), LoggerFactory.getLogger(MatchEndMetrics::class.java) ), matchEndCommand: MatchEndCommand = MatchEndCommand(), matchesInProcess: MatchesInProcess = MatchesInProcess(), sessionClient: SessionClient = SessionClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), matchCapacityClient: MatchCapacityClient = MatchCapacityClient(), partyClient: PartyClient = PartyClient())

Functions #

NameSummary

connectMorePlayersV1

suspend fun connectMorePlayersV1(session: PartnerSession, request: MatchLifecycleRpc.ConnectMorePlayersV1Request): MatchLifecycleRpc.ConnectMorePlayersV1Response

Called by a game server to confirm the connection details and match ext data for the found players.

createMatchV2

suspend fun createMatchV2(session: ServiceSession, request: MatchLifecycleRpc.CreateMatchV2Request): MatchLifecycleRpc.CreateMatchV2Response

Create a new match and find a game server for the match run on.

declineReconnectV1

suspend fun declineReconnectV1(session: PlayerSession, request: MatchLifecycleRpc.DeclineReconnectV1Request): MatchLifecycleRpc.DeclineReconnectV1Response

Prevent the player from reconnecting to the match. Match reconnect must be configured to OPTIONAL. A notification with the match ID and player ID will be sent to the game server running the match.

enterMatchmakingV1

suspend fun enterMatchmakingV1(session: PartnerSession, request: MatchLifecycleRpc.EnterMatchmakingV1Request): MatchLifecycleRpc.EnterMatchmakingV1Response

Allows a match to reenter matchmaking to find and add more players. This endpoint will call the Matchmaking Service to add the match to the requested queue as an Active Match.

foundMorePlayersV1

suspend fun foundMorePlayersV1(session: ServiceSession, request: MatchLifecycleRpc.FoundMorePlayersV1Request): MatchLifecycleRpc.FoundMorePlayersV1Response

Called by the MatchmakingService when an Active Match has found some additional players to add from the queue.

leaveMatchmakingV1

suspend fun leaveMatchmakingV1(session: PartnerSession, request: MatchLifecycleRpc.LeaveMatchmakingV1Request): MatchLifecycleRpc.LeaveMatchmakingV1Response

Request made by the Game Server to remove a Match from matchmaking. The MatchmakingService may complete any pending changes to the match before it is removed.

matchAllocationFailureV1

suspend fun matchAllocationFailureV1(session: ServiceSession, request: MatchLifecycleRpc.MatchAllocationFailureV1Request): MatchLifecycleRpc.MatchAllocationFailureV1Response

Signals a match has failed to start. Invoked by the MatchCapacityService.

matchConnectionDetailsV1

suspend fun matchConnectionDetailsV1(session: PlayerSession, request: MatchLifecycleRpc.MatchConnectionDetailsV1Request): MatchLifecycleRpc.MatchConnectionDetailsV1Response

Provides the current match details for a player.

matchEndV4

suspend fun matchEndV4(session: PartnerSession, request: MatchLifecycleRpc.MatchEndV4Request): MatchLifecycleRpc.MatchEndV4Response

Signals a match has completed. Invoked by the game server.

matchKeepAliveV1

suspend fun matchKeepAliveV1(session: PartnerSession, request: MatchLifecycleRpc.MatchKeepAliveV1Request): MatchLifecycleRpc.MatchKeepAliveV1Response

Invoked by the game server to indicate that a match is still operating normally.

matchReadyV2

suspend fun matchReadyV2(session: PartnerSession, request: MatchLifecycleRpc.MatchReadyV2Request): MatchLifecycleRpc.MatchReadyV2Response

Signals a match is ready to join. Invoked by the game server.

onSessionTerminated

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

Notification handler for player disconnect. Marks player as REMOVED from match.

onSessionV1Reconnected

suspend fun onSessionV1Reconnected(notification: PlayerSessionRpc.SessionReconnectedV1Notification)

Notification handler for player reconnect. Attempt to reconnect them to their match, if they were in one.

playerLeaveV1

suspend fun playerLeaveV1(session: PartnerSession, request: MatchLifecycleRpc.PlayerLeaveV1Request): MatchLifecycleRpc.PlayerLeaveV1Response

Processes a match end for a subset of players within a match. Does not end the match.

removedMatchFromMatchmakingV1

suspend fun removedMatchFromMatchmakingV1(session: ServiceSession, request: MatchLifecycleRpc.RemovedMatchFromMatchmakingV1Request): MatchLifecycleRpc.RemovedMatchFromMatchmakingV1Response

Update the status of a Match to reflect that it is no longer in matchmaking. Silently continues if match is no longer tracked.

verifyPlayerPartnerV1

suspend fun verifyPlayerPartnerV1(session: PartnerSession, request: MatchLifecycleRpc.VerifyPlayerPartnerV1Request): MatchLifecycleRpc.VerifyPlayerPartnerV1Response

Called by the game server to verify that connecting players are not misrepresenting their pragma identity.