game / pragma.party / PartyService /

PartyService #

internal class PartyService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, instanceCount: Int = pragmaNode.getDistributedServiceInstanceCount(PartyService::class), inviteCodeGenerator: InviteCodeGenerator = InviteCodeGenerator(instanceId, instanceCount), partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), sessionClient: SessionClient = SessionClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), multiplayerClient: MultiplayerClient = MultiplayerClient(), alertingMutexFactory: AlertingMutexFactory = AlertingMutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand(), enterMatchmakingCommand: EnterMatchmakingCommand = EnterMatchmakingCommand(), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand(), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), partyProxy: PartyProxyImpl = PartyProxyImpl(), partyCommandHelper: PartyCommandHelper = PartyCommandHelper(), gameServerCompatibility: GameServerCompatibility = GameServerCompatibility(), timeProxy: TimeProxy = TimeProxy()) : DistributedService, ConfigHandler<PartyConfig>

The PartyService is a game loop service where players may join up with each other, configure their game settings, and then enter matchmaking.

Updates to a party’s state are automatically communicated to all members of a party. The player who caused the state change (e.g. by creating the party, or updating their ready state) will receive a direct response containing the result of their action, and all the other players will receive a PartyRpc.PartyDetailsV1Notification containing updated party details.

The PartyService interacts with Inventory data. Whenever a player is added to a party, their latest player data is retrieved from the InventoryService and cached within the party. This cached value is mutable and may be updated by plugin code to react to changes in player data.

Constructors #

PartyService

fun PartyService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, instanceCount: Int = pragmaNode.getDistributedServiceInstanceCount(PartyService::class), inviteCodeGenerator: InviteCodeGenerator = InviteCodeGenerator(instanceId, instanceCount), partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), sessionClient: SessionClient = SessionClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), multiplayerClient: MultiplayerClient = MultiplayerClient(), alertingMutexFactory: AlertingMutexFactory = AlertingMutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand(), enterMatchmakingCommand: EnterMatchmakingCommand = EnterMatchmakingCommand(), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand(), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), partyProxy: PartyProxyImpl = PartyProxyImpl(), partyCommandHelper: PartyCommandHelper = PartyCommandHelper(), gameServerCompatibility: GameServerCompatibility = GameServerCompatibility(), timeProxy: TimeProxy = TimeProxy())

Functions #

NameSummary

assignPartyLeaderV1

suspend fun assignPartyLeaderV1(session: PlayerSession, request: PartyRpc.AssignPartyLeaderV1Request): PartyRpc.AssignPartyLeaderV1Response

Assigns a target player as a leader of the party.

cancelInviteV1

suspend fun cancelInviteV1(session: PlayerSession, request: PartyRpc.CancelInviteV1Request): PartyRpc.CancelInviteV1Response

Cancels a party invite.

createV1

suspend fun createV1(session: PlayerSession, request: PartyRpc.CreateV1Request): PartyRpc.CreateV1Response

Creates a new party.

developmentOverrideGameServerVersionV1

suspend fun developmentOverrideGameServerVersionV1(session: PlayerSession, request: PartyRpc.DevelopmentOverrideGameServerVersionV1Request): PartyRpc.DevelopmentOverrideGameServerVersionV1Response

Development override feature for game server versions. Manually overrides a party’s game server version, and disables any future game server version calculations from occurring within that party.

enterMatchmakingV1

suspend fun enterMatchmakingV1(session: PlayerSession, request: PartyRpc.EnterMatchmakingV1Request): PartyRpc.EnterMatchmakingV1Response

Enters a party into matchmaking.

getCacheInfoOperatorV1

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

Queries cached party data by party id.

joinWithInviteCodeV1

suspend fun joinWithInviteCodeV1(session: PlayerSession, request: PartyRpc.JoinWithInviteCodeV1Request): PartyRpc.JoinWithInviteCodeV1Response

Joins a party with an invite code.

joinWithPartyIdV1

suspend fun joinWithPartyIdV1(session: PlayerSession, request: PartyRpc.JoinWithPartyIdV1Request): PartyRpc.JoinWithPartyIdV1Response

Joins a party with a party ID.

kickV1

suspend fun kickV1(session: PlayerSession, request: PartyRpc.KickV1Request): PartyRpc.KickV1Response

Kicks a target player from the party.

leaveServiceV1

suspend fun leaveServiceV1(session: ServiceSession, request: PartyRpc.LeaveServiceV1Request): PartyRpc.LeaveServiceV1Response

Leaves the current party.

leaveV1

suspend fun leaveV1(session: PlayerSession, request: PartyRpc.LeaveV1Request): PartyRpc.LeaveV1Response

Leaves the current party.

onSessionReconnected

suspend fun onSessionReconnected(notification: PlayerSessionRpc.SessionReconnectedV1Notification)

Notification handler for player reconnect. Removes the player from the party they were in.

onSessionTerminated

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

Notification handler for player disconnect. Removes the player from the party they were in.

respondToInviteV1

suspend fun respondToInviteV1(session: PlayerSession, request: PartyRpc.RespondToInviteV1Request): PartyRpc.RespondToInviteV1Response

Responds to a party invite.

returnFromGameInstanceV1

suspend fun returnFromGameInstanceV1(session: ServiceSession, request: PartyRpc.ReturnFromGameInstanceV1Request): PartyRpc.ReturnFromGameInstanceV1Response

Service endpoint used to return players to their party after they finish a game. Broadcasts new party details to all players upon success.

returnFromMatchmakingV1

suspend fun returnFromMatchmakingV1(session: ServiceSession, request: PartyRpc.ReturnFromMatchmakingV1Request): PartyRpc.ReturnFromMatchmakingV1Response

Service endpoint used to return players to their party after they leave matchmaking. Broadcasts new party details to all players upon success.

sendInviteV1

suspend fun sendInviteV1(session: PlayerSession, request: PartyRpc.SendInviteV1Request): PartyRpc.SendInviteV1Response

Sends a party invite.

setGameServerZoneToPingV1

suspend fun setGameServerZoneToPingV1(session: PlayerSession, request: PartyRpc.SetGameServerZoneToPingV1Request): PartyRpc.SetGameServerZoneToPingV1Response

Sets a player’s ping latency map for different game server zones.

setPreferredGameServerZonesV1

suspend fun setPreferredGameServerZonesV1(session: PlayerSession, request: PartyRpc.SetPreferredGameServerZonesV1Request): PartyRpc.SetPreferredGameServerZonesV1Response

Sets a player’s preferred game server zones.

setReadyStateV1

suspend fun setReadyStateV1(session: PlayerSession, request: PartyRpc.SetReadyStateV1Request): PartyRpc.SetReadyStateV1Response

Sets a player’s ready state. Invokes PartyPlugin.canChangeReady before allowing the ready state update to apply.

syncServiceV1

suspend fun syncServiceV1(session: ServiceSession, request: PartyRpc.SyncServiceV1Request): PartyRpc.SyncServiceV1Response

Syncs party state from the platform to the client.

updatePartyPlayerV1

suspend fun updatePartyPlayerV1(session: PlayerSession, request: PartyRpc.UpdatePartyPlayerV1Request): PartyRpc.UpdatePartyPlayerV1Response

Updates a player’s selections details. Invokes PartyPlugin.updatePlayer to process updates.

updatePartyV1

suspend fun updatePartyV1(session: PlayerSession, request: PartyRpc.UpdatePartyV1Request): PartyRpc.UpdatePartyV1Response

Updates the party’s selections. Invokes PartyPlugin.updateParty to process updates.