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(), inventoryClient: InventoryClient = InventoryClient(), sessionClient: SessionClient = SessionClient(), partyInventoryClient: PartyInventoryClient = PartyInventoryClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), mutexFactory: MutexFactory = MutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand( routingUtils, instanceId, instanceCount ), setReadyStateCommand: SetReadyStateCommand = SetReadyStateCommand(), enterMatchmakingCommand: EnterMatchmakingCommand = EnterMatchmakingCommand(), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand( routingUtils, instanceId, instanceCount ), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), setPreferredGameServerZonesCommand: SetPreferredGameServerZonesCommand = SetPreferredGameServerZonesCommand(), setGameServerZoneToPingCommand: SetGameServerZoneToPingCommand = SetGameServerZoneToPingCommand(), partyProxy: PartyProxy = PartyProxyImpl(), partyCommandHelper: PartyCommandHelper = PartyCommandHelper(), gameServerCompatibility: GameServerCompatibility = GameServerCompatibility()) : 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(), inventoryClient: InventoryClient = InventoryClient(), sessionClient: SessionClient = SessionClient(), partyInventoryClient: PartyInventoryClient = PartyInventoryClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), mutexFactory: MutexFactory = MutexFactory(), createPartyCommand: CreatePartyCommand = CreatePartyCommand( routingUtils, instanceId, instanceCount ), setReadyStateCommand: SetReadyStateCommand = SetReadyStateCommand(), enterMatchmakingCommand: EnterMatchmakingCommand = EnterMatchmakingCommand(), removePlayerCommand: RemovePlayerCommand = RemovePlayerCommand(), invitePlayerCommand: InvitePlayerCommand = InvitePlayerCommand( routingUtils, instanceId, instanceCount ), updatePartyCommand: UpdatePartyCommand = UpdatePartyCommand(), setPreferredGameServerZonesCommand: SetPreferredGameServerZonesCommand = SetPreferredGameServerZonesCommand(), setGameServerZoneToPingCommand: SetGameServerZoneToPingCommand = SetGameServerZoneToPingCommand(), partyProxy: PartyProxy = PartyProxyImpl(), partyCommandHelper: PartyCommandHelper = PartyCommandHelper(), gameServerCompatibility: GameServerCompatibility = GameServerCompatibility())

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 calculations from occurring within that party.

enterMatchmakingV1

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

Enters a party into matchmaking.

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.

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, sessionAction: SessionAction.Builder): 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.

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.