Skip to main content

Introduction

This document is intended for game developers who are currently using MPSD and want to move to using PlayFab Multiplayer and MPA for their multiplayer games. The document will cover the most common multiplayer scenarios and provide code snippets that show how to use PlayFab Multiplayer with MPA.

Multiplayer Session Directory (MPSD) Overview

  • Fully featured session service for sharing information needed to connect a group of users
  • Integrated with XBOX UI for invites and join functionality
  • Fully integrates with SmartMatch matchmaking
  • Sessions are derived from pre-defined session templates
  • Integrated functionality for connectivity detection and session flow
  • Available as service-to-service

Multiplayer Activity Service (MPA) Overview

  • Lightweight service to simplify XBOX Live integration for player activities, invites, and recent players
  • Coordinates with the shell and console operating system in sending/accepting invites and being joined
  • No session management or matchmaking
  • Available as service-to-service

PlayFab Multiplayer Overview

  • Full multiplayer lobby service that includes lobby search and browse functionality
  • Cross-platform, real-time service notifications with transparent API integration
  • Full matchmaking service that supports real-time notifications

Initialization

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for initialization.

Initialization - Example Code

Initialize the library with your PlayFab titleID and set the entity token that was received during PlayFab service login.

Lobby State Changes

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for handling events related to sessions/lobbies.

Lobby State Changes - Example Code

Notify the library that you are starting to process state changes. Handle each queued state changes then notify that you are done processing state changes.

Create Lobby

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for creating and joining a session/lobby.
No additional setup or configuration in PlayFab Game Manager is required to create a lobby. All configuration can be done in code.

Create Lobby - Example Code

Configure the lobby and set any initial lobby properties or member properties then create and join the lobby.

Find Lobbies

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer to search for sessions/lobbies.

Find Lobbies - Example Code

Set the search configuration then search for lobbies.
Then, once the state change for the event is returned, process any of the search results.

Lobby Search Keys

Only a restricted set of keys are allowed to be used when defining custom search properties.
  • For string properties, the following keys are supported: string_key1, string_key2, […] string_key30
  • For numeric properties, the following keys are supported: number_key1, number_key2, […] number_key30

Lobby Search Operators

Query strings for the FindLobbies APIs are structured in an OData-like syntax. The maximum size for the filter string is 600 characters. These OData operators can be used to compose query strings. The operators are case sensitive.
When comparing string properties, be sure to wrap the compared value in single quotes. For example, “string_key1 eq ‘SOME STRING VALUE’”. Numeric properties don’t need to be wrapped.
There are also predefined operators available to use. They must be prefixed by “lobby/” when specifying.

Sorting Search Results

OData style string that contains sorting for this query in either ascending (“asc”) or descending (“desc”) order. OrderBy clauses can be used for any of the search number keys or the predefined search keys that are numeric. To sort by closest to a number, a moniker distance can be used to sort by distance from the given number search key. You cannot use ascending or descending with the distance sort. This field only supports either one sort clause or one distance clause. If no sort is provided or if a tiebreak is needed for the given sort, the default sort would be descending based on creation time.

Sorting and Filtering Search Results - Example Code

Join Lobby

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for joining sessions/lobbies.
Joining a lobby requires a connection string. Typically, the host of the lobby will set this connection string on their activity or send it through an invite. To get the connection string you have to call PFLobbyGetConnectionString.

Join Lobby - Example Code

Set the initial join configuration and then join the lobby.

Update Lobby

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for updating a session/lobby.
PFLobbyPostUpdate can be used to update both lobby properties as well as member properties. You can update one or both types of properties with a single call to the function.

Update Lobby - Example Code (Lobby Properties)

Update Lobby - Example Code (Member Properties)

Matchmaking

PlayFab Multiplayer’s matchmaking APIs are relatively similar to MPSD’s matchmaking APIs.
Matchmaking Queues must be configured via PlayFab Game Manager.

Matchmaking State Changes

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for handling events related to matchmaking.

Matchmaking State Changes - Example Code

Notify the library that you are starting to process state changes. Handle each queued state changes then notify that you are done processing state changes.

Start Matchmaking

Start Matchmaking - Example Code

Matchmaking will not start until all specified in the membersToMatchWith field have joined.
Then, once a match has been found and the state change is returned, join the arranged lobby.

Cleanup

The following table shows a list of comparable functions used by MPSD and PlayFab Multiplayer for cleaning up and shutting down.
Make sure to leave any active lobbies and destroy any in progress matchmaking tickets before calling PFMultiplayerUninitialize.

Cleanup - Example Code

Activities

The following table shows a list of comparable functions used by MPSD and MPA to managing activities.
When setting an activity or sending an invite, make sure to use the connection string passed back from PFLobbyGetConnectionString.

Activities - Example Code

Invites

The following table shows a list of comparable functions used by MPSD and MPA to send and receive invites.

Invites - Example Code (Title UI)

Invites - Example Code (XBOX UI)

XGameUiShowMultiplayerActivityGameInviteResult uses the currently set activity. You must set an activity using XblMultiplayerActivitySetActivityAsync before using this function.

Recent Players

The following table shows how the Recent Player list is managed when using MPSD and MPA.
To avoid throttling, it is best practice to batch calls to XblMultiplayerActivityUpdateRecentPlayers.

RecentPlayers - Example Code

Last modified on August 20, 2026