XBOX Live Helper library overview
The XBOX Live Helper library for PlayFab Party is designed to help games using PlayFab Party meet XBOX Live policies related to communication (XR-015 and XR-045). The XBOX Live Helper library is available on Nuget.org.Compatibility with the PlayFab Party library
While we strive to minimize breaking changes in our APIs, some changes made to the PlayFab Party API might cause the XBOX Live Helper library to return erroneous values. Refer to the below table to ensure that your libraries’ version are compatible.Keeping Track of XBOX Live Users
The PlayFab Party XBOX Live Helper library must be explicitly informed of the XBOX Live users currently participating in the Party session. It is recommended that titles inform the library by listening for changes to their multiplayer session document and reflecting that roster in the XBOX Live Helper library viaPartyXblManager::CreateLocalChatUser and PartyXblManager::CreateRemoteChatUser.
For local users:
PartyChatControlCreatedStateChange updates for remote chat controls.
For both local and remote chat users it’s important to keep in mind that the core Party library identifies users and chat controls via PlayFab Entity IDs where as the XBOX Live helper library identifies chat users with XBOX User IDs. Therefore translating between the two is often necessary. Refer to Mapping between XBOX Live User IDs and PlayFab Entity IDs for more information.
Creating PartyLocalChatControls from PartyXblLocalChatUsers
PartyXblLocalChatUser objects are often only useful when associated with PartyLocalUser and PartyLocalChatControl objects in the Party library. Generating PartyLocalUser and PartyLocalChatControl objects, requires titles to log in their users to PlayFab and retrieve their user’s entityId and titlePlayerEntityToken. Login can be performed via the PlayFab CPP SDK, but if a title intends to use XBOX Live credentials to log into PlayFab, they may use PartyXblManager::LoginToPlayFab to avoid pulling in an extra dependency.
The following sample shows how the XBOX Live Helper library can help you create PartyLocalUser and PartyLocalChatControl objects, from PartyXblLocalChatUser objects. For more information on creating PartyXblLocalChatUser objects, see Keeping Track of XBOX Live Users.
PartyXblManager::LoginToPlayFab you will receive a PartyXblLoginToPlayFabCompletedStateChange containing the result of the login operation.
Respecting an XBOX Live user’s accessibility preferences
ThePartyXblLocalChatUser object exposes some of the accessibility preferences of the XBOX Live user which are relevant to Party chat sessions. Titles can use this information to provide a better experience to their players by enabling some of Party’s accessibility features right away.
Respecting an XBOX Live user’s privacy settings and permissions
Per XBOX Live policies, titles must not allow communication over XBOX Live when the user’s privacy or permissions do not allow it. The XBOX Live Helper library helps you achieve that by allowing you to query the most restrictivePartyChatPermissionOptions between two users allowed by XBOX Live policies. Anytime this value changes, a PartyXblRequiredChatPermissionInfoChangedStateChange will be generated by the library. The updated PartyChatPermissionOptions can be obtained by a call to PartyXblLocalChatUser::GetRequiredChatPermissionInfo().
PartyXblRequiredChatPermissionInfoChangedStateChange will be generated to notify you that an updated PartyChatPermissionOptions value is now available.
PartyXblChatPermissionInfo structure contains two pieces of information:
- A
PartyChatPermissionOptionsmask that can be either passed as-is toPartyLocalChatControl::SetPermission()or that can be used as a binary mask if you already have aPartyChatPermissionOptionsvalue that you would like to use but want to make sure that you are respecting XBOX Live policies. - A
PartyXblChatPermissionMaskReasonvalue that provides extra information regarding the value ofPartyXblChatPermissionInfo::chatPermissionMask
Respecting cross-network communication permissions
Titles that support cross-network play and communication between XBOX Live and non-XBOX Live players need to check communication permissions prior to allowing communication between those players. The XBOX Live Helper library provides this information throughPartyXblLocalChatUser::GetCrossNetworkCommunicationPrivacySetting(). This method returns a PartyXblCrossNetworkCommunicationPrivacySetting enum with three possible value:
Mapping between XBOX Live User IDs and PlayFab Entity IDs
Many XBOX Live titles using PlayFab Party need to translate between XBOX Live Users IDs (used throughout the XBOX Live ecosystem) and PlayFab Entity IDs (used by PlayFab Party). UsingPartyXblManager::GetEntityIdsFromXboxLiveUserIds, titles can retrieve a list of PlayFab Entity IDs corresponding to a given list of XBOX Live User IDs. Titles are expected to already have a list of XBOX Live User IDs through the use of an external roster service, like the Multiplayer Session Directory. By associating the XBOX Live User IDs from the roster with their PlayFab Entity IDs, we can construct a mapping of all PlayFab Entity IDs corresponding to your game session’s roster. This mapping can then be used to associate PartyEndpoint and PartyChatControl objects with their corresponding XBOX Live users.
Each XBOX Live User ID will only map to a PlayFab Entity ID if this XBOX Live user has already been linked to a PlayFab account. A PlayFab account is automatically created and linked the first time
PartyXblManager::LoginToPlayFab is called for a given XBOX user. Alternatively, consumers of the PlayFab SDK can use the LoginWithXbox API to achieve the same results.PartyXblLocalChatUser will be used to authenticate with PlayFab. If the user was not previously logged in to PlayFab with a call to PartyXblManager::LoginToPlayFab, the XBOX Live Helper library will need to authenticate the user in the background.
PartyXblManager::GetEntityIdsFromXboxLiveUserIds you will receive a PartyXblGetEntityIdsFromXboxLiveUserIdsCompletedStateChange containing the result of the operation. This result can be used to construct or update your mappings.
Special considerations for Windows
On Windows, the XBOX Live Helper library needs helps from the title to obtain XBOX Live tokens. The library will request tokens by generatingPartyXblTokenAndSignatureRequestedStateChange. The title can use the XBOX Authentication Library (XAL) to fulfill these requests. Offloading this work to the title ensures that it remains in full control of any UI handling and consent prompt that is normally associated with user authentication.
PartyXblManager::CompleteGetTokenAndSignatureRequest() with the same correlationId that was provided to the title through the state change.