Party Reference #
Party service SDK #
Developers can use the Pragma Party API to implement Party service capabilities, such as assigning a party leader and leaving a party.
The table below contains a list of the SDK methods relevant to the Party service. These methods are available via the Party API for Unreal or the Game Loop API for Unity.
Call | description |
---|---|
Initialize | Initializes the client’s party API state and synchronizes party state with the platform. Must be called prior to using other functionality on the API. |
ForceSync | Forcibly synchronizes the player client party cache with the party information in the Pragma Engine backend. This includes refreshing pending party invite data. |
CreateParty | Creates a new party |
SendPartyInvite | Sends a party invite to a specific player |
CancelPartyInvite | Cancels a sent pending party invite |
RespondToPartyInvite | Accepts or rejects another player’s invite to a party |
JoinPartyWithInviteCode | Joins a party using an invite code |
JoinPartyWithId | Joins a party using a party ID |
LeaveParty | Leaves a party voluntarily |
AssignPartyLeader | Assigns a party leader |
KickPlayerFromParty | Forcibly removes a player from a party |
UpdatePartyPlayer | Updates custom party player information when in a party |
UpdateParty | Updates custom party information |
SetPartyPlayerReady | Sets the player’s Ready value |
SetPartyPreferredGameServerZones | Updates the GameServerZones value for the party |
SetPartyPlayerGameServerZoneToPing | Updates the GameServerZoneToPing value for the party |
EnterMatchmaking | Enters the party into matchmaking once all players are ready. Only a party leader can enter a party into matchmaking. |
LeaveMatchmaking | Removes a party from matchmaking |
GetMatchmakingInfo | Gets matchmaking queue information |
GetPartyCache | Gets the player’s party cache |
GetPendingPartyInvites | Gets a list of pending party invites for the player |
GetPartyInviteByInviteId | Gets party invite object by party invite ID |
GetPartyInviteByInviterId | Gets party invite object for invite sent by a specified player to the current player |
The Party Tasks explains how to use these calls to invoke Party Plugin methods and customize party functionality.
The Party Plugin #
The Party Plugin provides a location for developers to implement custom party functionality. The Party Service Tasks topic explains how to use the Party Plugin methods, along with the SDKs that invoke them.
method | description |
---|---|
initializeParty | Called when a new party is created, before any players have been added. Use to initialize any party state. |
onAddPlayer | Called before the player has been added to the party. Use to prepare the new player to be added to the party. |
handlePlayerSendInviteRequest | Called when receiving a player request to send a party invite. Use to determine whether the player should be allowed to send the party invite. |
onRemovePlayer | Called after a player has been removed from the party. Use to perform any necessary updates to the party state. |
updateParty | Called when receiving an update party selections request. Use to perform any necessary updates to the party state. |
updatePlayer | Called when receiving an update player selections request. Use to perform any necessary updates to the player or party state. |
canChangeReady | Called when receiving a change ready state request. Use to determine whether a player can change their ready state. |
handlePlayerCancelInviteRequest | Called when receiving a player request to cancel a party invite. Use to determine whether the player should be allowed to cancel the party invite. |
buildExtBroadcastParty | Called when broadcasting a change to the party. Use to build any ext data that should be shared about the party. |
buildExtPrivatePlayer | Called when broadcasting a change to the party member. Use to build any private ext data that should only be sent to the player. |
buildExtBroadcastPlayer | Called when broadcasting a change to the party member. Use to build any ext data that should be shared about a player. |
buildMatchmakingKey | Called when the party is attempting to enter matchmaking. Use to build the matchmaking key they will use to enter matchmaking. |
buildExtMatchmakingParty | Called when the party is attempting to enter matchmaking. Use to build any ext data the matchmaking system will need to know about the party. |
buildExtMatchmakingPlayer | Called for each player within a party when the party is attempting to enter matchmaking. Use to build any ext data the matchmaking system will need to know about each player. |
returnFromMatchmaking | Called when players are returning from matchmaking. Use to perform any necessary updates to the player or party state. |
returnFromGameInstance | Called when players are returning from a game instance. Use to perform any necessary updates to the player or party state. |
Player object #
The Player object includes a PlayerOverview
interface that allows Party objects to access a player’s social ID, player ID, and display name.
property | description |
---|---|
socialId | Social identifier of the player |
playerId | Game identifier of the player |
displayName | Player’s display name |
Party interfaces #
There are three main interfaces within the Party service: Party
, PartyPlayer
, and PartyInvite
. These interfaces represent parties, their players, as well as information about invitations sent for the party.
Party #
Party.Party
represents a party within the party service.
property | description |
---|---|
id | Unique identifier for the party |
players | List of PartyPlayer objects in the party |
invites | List of outstanding PartyInvite objects for players to join the party |
inviteCode | Auto-generated unique string for the party that players can use to join |
maxPlayerCount | Number representing the maximum amount of players for the party set via the PartyService config |
gameServerVersion | Game server version that maps to the PartyPlayer s gameClientVersion , according to the values in the PartyConfig. This value is updated whenever a player joins or leaves the party, or attempts to join matchmaking. |
overrideGameServerVersion | Boolean indicating whether to use the game server/client mapping specified in the PartyConfig |
preferredGameServerZones | List of game server zones that the party can play a match on |
ext | Custom ExtParty payload containing party data for the platform to use |
method | description |
---|---|
sendInvite() | Facilitates sending a party invite from an inviterPlayerId to a inviteePlayerId . This method must be called for an invite to be sent. |
cancelInvite() | Facilities canceling a party invite, identified by inviteId. This method must be called for an invite to be canceled. |
PartyPlayer #
Party.PartyPlayer
represents a player within the party service.
property | description |
---|---|
playerId | A user’s identifier within a specific game |
socialId | Unique social identifier for the player |
displayName | PragmaDisplayName object containing the player’s name and discriminator |
gameClientVersion | Version of the game client the player is currently running |
isReady | Boolean indicating if this player ready to play a match |
isLeader | Boolean indicating if this player is a leader in this party |
gameServerZoneToPing | Map of this player’s ping to various game server zones |
ext | Custom ExtPartyPlayer payload containing player data for the platform to use |
PartyInvite #
Party.PartyInvite
represents an invitation to join a party sent from one player to another.
property | description |
---|---|
id | Unique identifier for the party invite |
inviter | PlayerOverview for the player who sent the invite |
inviteePlayerId | Player ID of the player invited to join the party |
Configuration #
The PartyConfig
configuration class provides a place to define default values for the Party service. The following configuration values are available:
config | description |
---|---|
maxPlayersPerParty | Maximum players allowed in each party |
disableMaxPlayerCount | Whether to disable maximum player count limits in each party |
enableLocalGameServerVersions | Whether to allow local game clients to override their game server version for local development purposes |
repeatInviteDelaySeconds | Defines the delay (in number of seconds) between a player sending a party invite to another player consecutive times |
enableTransferPartyLeader | Whether to transfer party leader status from one player to another when invoking AssignPartyLeader |
gameServerVersionCompatibility | Map of all the server versions to compatible game client versions |
enableStalePartyExpiration | Whether to enable the party expiration feature |
stalePartyExpirationMinutes | Time, in minutes, to wait before terminating a party. 0 or negative values means parties will never timeout. Will be ignored if enableStalePartyExpiration is false. |
Extension data #
You can use Extension Data (exts
) to define custom data about players and parties as the party travels through the game loop. These fields are stored on the Party
or PartyPlayer
classes, and are passed to other plugins as necessary. See Party Service Tasks for sample implementation.
The following table lists the ext
payloads relevant to party and player information.
ext | description | example data |
---|---|---|
ExtCreateRequest | Party data passed from the player client to the Party Plugin’s initialize method during party creation | map or game mode |
ExtPlayerJoinRequest | Data related to the player joining the party. This ext is passed from the player client to the Party Plugin when the player is added to a party. | selected character |
ExtParty | Additional party data for the platform to use. This ext is populated when a party is created, and is stored in the engine for the life of the party. This data is for platform use and is hidden by default. | matchmaking style, game instance duration |
ExtPartyPlayer | Additional data about a single player in a party. This ext is populated when a player joins a party, and is stored in the engine for as long as the player is in the party. This data is for platform use and is hidden by default. | costume catalog id |
ExtBroadcastParty | Party data that is populated by the Party Plugin’s buildExtBroadcastParty method and passed to all player clients on the OnPartyChanged event when their party is updated (including party creation and destruction) | game mode, game instance duration |
ExtBroadcastPlayer | Player data that is populated by the Party Plugin’s buildExtBroadcastPlayer method and passed to all player clients when their party is updated (including party creation and destruction) Players receive a separate ExtBroadcastPlayer payload on the OnPartyChanged event for each player in the party. | selected character |
ExtPrivatePlayer | Private player data that is populated by the Party Plugin’s buildExtPrivatePlayer method and passed to a player client when their party is updated (including party creation and destruction). Each player receives only their own ExtPrivatePlayer payload on the OnPartyChanged event. | VoIP token |
ExtUpdatePartyRequest | Party data passed from a player client to the Party Plugin’s updateParty method. Information sent on this payload updates the data stored in the ExtParty proto. | updated game mode |
ExtUpdatePartyPlayerRequest | Player data passed from a player client to the Party Plugin’s updatePlayer method. Information sent on this payload updates the data stored in the ExtPartyPlayer proto. | updated inventory version, costume, character |
Events #
There are several party-related events that player clients can listen to. The following table contains bindable events relevant to the Party service, along with associated descriptions of when the event is triggered.
The following events are defined in the Party API for Unreal and the Game Loop API for Unity.
Event | Trigger | Data returned |
---|---|---|
OnJoinedParty | A player joins a party | Party |
OnPartyUpdated (Unreal) OnPartyChanged (Unity) | Party information changes, including creation and destruction Note: All other applicable On* events fire in addition to this one, so developers will need to account for handling multiple events at once. | N/A |
OnPartyInviteCodeChanged | A new invite code is made for the party | invite code |
OnExtBroadcastPartyChanged | The public ext party selections change | ExtBroadcastParty |
OnPartyPreferredGameServerZonesChanged | A party’s preferred game server zones change | Array of preferred game server zones |
OnLeftParty | Your player leaves the party voluntarily | N/A |
OnRemovedFromParty | Your player leaves a party for reasons outside of your control | Removal reason (REMOVAL_REASON_UNSPECIFIED , KICKED , LEFT , DISCONNECTED , or EXPIRED ) |
OnPartyPlayersChanged | One or more players join or leave the party | PartyPlayer for each player that joins or leaves |
OnPlayerJoinedParty | A new player joins the party. All players in the party can handle this event | PartyPlayer for the player that joined the party |
OnPartyPlayerDataChanged | Any player information changes | PartyPlayer for the player whose data changed |
OnPlayerLeftParty | A player leaves the party | PartyPlayer for the player that left the party |
OnExtPrivatePlayerChanged | A player’s private selections changes | ExtPrivatePlayer |
OnPartyInvitesChanged | A player creates or responds to an invite | invite ID, inviter’s player ID |
OnPartyInviteReceived | A party invite is received from another player | invite ID, inviter’s player ID |
OnPartyInviteCanceled | An inviter or party leader cancels a pending party invite | invite ID, inviter’s player ID |
OnPartyInviteRevoked | A party invite is revoked because a newer invite from the same inviter was received | invite ID |
OnPartyInviteAccepted | An invitee accepts the invite. Only inviters can handle this event | invite ID |
OnPartyInviteDeclined | An invitee declines the invite. Only inviters can handle this event | invite ID |
OnGameClientVersionUpdateRequired | The player client needs to update their GameClientVersion | N/A |
OnPartyClientVersionMismatch | Cannot find a game server version that is compatible with every player in the party | N/A |
OnEnteredMatchmaking | Party enters matchmaking | N/A |
OnLeftMatchmaking | Party leaves matchmaking | N/A |
OnMatchmakingFailed | There is a failure in matchmaking | Failure reason (UNSPECIFIED or GAME_SERVER_VERSION_NO_LONGER_COMPATIBLE ) |
Errors #
The following errors are relevant to the Party service.
- PartyService_PartyNotFound
- PartyService_AlreadyInParty
- PartyService_InvalidState
- PartyService_NotInParty
- PartyService_PlayerNotLeader
- PartyService_PlayersNotReady
- PartyService_FailedToEnterMatchmaking
- PartyService_InviteNotFound
- PartyService_PartyFull
- PartyService_InvalidSession
- PartyService_PartyClientVersionMismatch
- PartyService_OverrideGameServerVersionDisabled
- PartyService_GameServerNoLongerCompatible
- PartyService_LeavePartyFailed
- PartyService_PlayerNotFound
- PartyService_PlayerIsKicked
- PartyService_CanNotKickSelf
- PartyService_PlayersAlreadyInGameLoop
- PartyService_PlayerIsLeader
- PartyService_FailedToLeaveMatchmaking
- PartyService_SendInviteFailed
- PartyService_CancelInviteFailed