game / pragma.party / PartyService /

PartyService #

internal class PartyService(pragmaNode: PragmaNode, instanceId: UUID, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, instanceCount: Int = pragmaNode.getDistributedServiceInstanceCount(PartyService::class), inviteCodeGenerator: InviteCodeGenerator = InviteCodeGenerator(instanceId, instanceCount), partyClient: PartyClient = PartyClient(), inventoryClient: InventoryClient = InventoryClient(), sessionClient: SessionClient = SessionClient(), partyInventoryClient: PartyInventoryClient = PartyInventoryClient(inventoryClient), matchmakingClient: MatchmakingClient = MatchmakingClient(), mutexFactory: MutexFactory = MutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand( routingUtils, instanceId, instanceCount, partyInventoryClient, inviteCodeGenerator, partyClient, ), setReadyStateCommand: SetReadyStateCommand = SetReadyStateCommand(), startMatchmakingCommand: StartMatchmakingCommand = StartMatchmakingCommand(matchmakingClient, sessionClient), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(sessionClient), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand( routingUtils, instanceId, instanceCount, partyInventoryClient, partyClient ), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), setPreferredGameServerZonesCommand: SetPreferredGameServerZonesCommand = SetPreferredGameServerZonesCommand(), setGameServerZoneToPingCommand: SetGameServerZoneToPingCommand = SetGameServerZoneToPingCommand(), partyProxy: PartyProxy = PartyProxyImpl(sessionClient)) : DistributedService, ConfigHandler<PartyConfig>

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

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

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 PartyService. 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: UUID, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, instanceCount: Int = pragmaNode.getDistributedServiceInstanceCount(PartyService::class), inviteCodeGenerator: InviteCodeGenerator = InviteCodeGenerator(instanceId, instanceCount), partyClient: PartyClient = PartyClient(), inventoryClient: InventoryClient = InventoryClient(), sessionClient: SessionClient = SessionClient(), partyInventoryClient: PartyInventoryClient = PartyInventoryClient(inventoryClient), matchmakingClient: MatchmakingClient = MatchmakingClient(), mutexFactory: MutexFactory = MutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand( routingUtils, instanceId, instanceCount, partyInventoryClient, inviteCodeGenerator, partyClient, ), setReadyStateCommand: SetReadyStateCommand = SetReadyStateCommand(), startMatchmakingCommand: StartMatchmakingCommand = StartMatchmakingCommand(matchmakingClient, sessionClient), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(sessionClient), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand( routingUtils, instanceId, instanceCount, partyInventoryClient, partyClient ), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), setPreferredGameServerZonesCommand: SetPreferredGameServerZonesCommand = SetPreferredGameServerZonesCommand(), setGameServerZoneToPingCommand: SetGameServerZoneToPingCommand = SetGameServerZoneToPingCommand(), partyProxy: PartyProxy = PartyProxyImpl(sessionClient))

Functions #

NameSummary

assignPartyLeaderV1

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

Assigns a target player as a leader of the party.

createV1

suspend fun createV1(session: PlayerSession, request: PartyRpc.CreateV1Request, sessionAction: SessionAction.Builder): 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 plugin calculations from occurring within that party.

joinWithInviteCodeV1

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

Joins a party with an invite code.

joinWithPartyIdV1

suspend fun joinWithPartyIdV1(session: PlayerSession, request: PartyRpc.JoinWithPartyIdV1Request, sessionAction: SessionAction.Builder): 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.

leaveV1

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

Leaves the current party.

respondToInviteV1

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

Responds to a party invite.

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.

returnFromMatchV1

suspend fun returnFromMatchV1(session: ServiceSession, request: PartyRpc.ReturnFromMatchV1Request): PartyRpc.ReturnFromMatchV1Response

Service endpoint used to return players to their party after they finish a match. 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

Allows a player client to set their quality of service map for different game server zones.

setPreferredGameServerZonesV1

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

Allows a player to declare their preferred game server zones.

setReadyStateV1

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

Sets ready state. Invokes PartyPlugin.canChangeReady before allowing the ready state update to apply.

startMatchmakingV1

suspend fun startMatchmakingV1(session: PlayerSession, request: PartyRpc.StartMatchmakingV1Request): PartyRpc.StartMatchmakingV1Response

Allows a party leader to start matchmaking.

updatePartySelectionsV1

suspend fun updatePartySelectionsV1(session: PlayerSession, request: PartyRpc.UpdatePartySelectionsV1Request): PartyRpc.UpdatePartySelectionsV1Response

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

updatePlayerSelectionsV1

suspend fun updatePlayerSelectionsV1(session: PlayerSession, request: PartyRpc.UpdatePlayerSelectionsV1Request): PartyRpc.UpdatePlayerSelectionsV1Response

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