Leaderboards

The Leaderboards plugin is specifically designed to implement PlayFab Leaderboards, which implements game statistics for games built using Construct 3 and Construct 2.


Interconnected with major platforms including Google Play, Game Center, Apple Login, Instant Games, Facebook, Facebook Instant Games, Steam, Xbox Live, Nintendo Switch, PS4 and of course PlayFab's own account and login system with email, username and password support  for your own game.


The Leaderboards plugin syncs all platforms integrated into your PlayFab title (game), making all changes available in your game and even groups of games under a studio.


PlayFab also has console support, just in case you want to port in the future, especially through porting services.

PlayFab API v2.png

Introduction

Step 1.png

The Construct Master Collection supports the full and easy integration of the PlayFab service for both Construct 3 and Construct 2.


Please click here to learn more about PlayFab.

Features


The Leaderboards plugin is specifically designed to implement PlayFab Leaderboards, which implements game statistics for games built using Construct 3 and Construct 2.


Interconnected with major platforms including Google Play, Game Center, Apple Login, Instant Games, Facebook, Facebook Instant Games, Steam, Xbox Live, Nintendo Switch, PS4 and of course PlayFab's own account and login system with email, username and password support  for your own game.

The Leaderboards plugin syncs all platforms integrated into your PlayFab title (game), making all changes available in your game and even groups of games under a studio.


PlayFab also has console support, just in case you want to port in the future, especially through porting services.


Here are some of the features of the PlayFab service:

  • Leaderboards

  • Global Leaderboards

  • Global Leaderboards Around Player

  • Local Leaderboards

  • Local Leaderboards Around Player

  • Friend Leaderboards

  • Friend Leaderboards Around Player

  • Statistics

  • Get Player Statistics

  • Get Player Statistics with version

  • Load Player Statistics

  • Update Player Statistics

  • Leaderboards with Profile Information

  • Leaderboards with Profile Constraints

  • Additional data with complete account and profile information for each player, managed by the PlayFab API object and server profile information constraints.

  • These data are accessible through the Server Response expression.

  • Server Response JSON data

  • Leaderboards with social accounts sync.

  • Steam

  • Xbox

  • Facebook

  • Server Response


For more information about all the integrated PlayFab service features, please click here to learn the introductory lessons to PlayFab.


Editor Features


Here are some of the features in the Construct editor:

  • All platforms support, including web, mobile and desktop.

  • Construct 3

  • Construct 2

 
 

How to use?

It is easy to use the PlayFab API plugin, you will only need to follow the steps below.

  1. Set up the PlayFab API plugin, please click to visit the documentation. This includes creating a PlayFab account, studio and title.

  2. Set up the Authentication plugin, please click to visit the documentation.

  3. Set up the server-side of PlayFab's Leaderboards, please proceed to the server setup guide below.

  4. Finally, you can now use the PlayFab API object, and include more PlayFab addons for more features.


 
 

Documentation

There is currently nothing to show, we will add more in the future.


Platform Automatic Sync


The Leaderboards plugin has its own statistic records for each player through PlayFab's servers, which is your company's personalized database. However, you can choose to also mix-in other leaderboards from other platforms like Google Play, Game Center, Facebook, Steam, Xbox. And if ported, Nintendo Switch and PS4.





Server Setup


The Leaderboards with PlayFab is implemented through syncing with the server, from there it should automatically be interconnected with all synced platforms such as Facebook, Google or PlayFab itself as your own personalized server.

Syncing platform integrations

To sync Leaderboards with other servers, you only need to integrate the platform into your title. To do that, you simple go to the Add-ons section of the PlayFab Console and add, to fully integrate include all the necessary credentials required. For example, when adding Facebook, simply go to PlayFab Dashboard > Add-ons > Facebook, install and fill in the required credentials, and you are automatically integrated.

Allow plugins to write into Leaderboards


To easily allow the Leaderboard plugin to write player statistics, you will need to allow this from the title settings. Alternatively, you may also write player statistics through the Cloud Script plugin or Azure Function plugin with cloud scripting. 1. Create an account in PlayFab, login if you already have one.


2. Click the title that you will use for your project.

3. The title's dashboard, also known as the game dashboard, should appear, then select the sidebar option Settings.



4. Select the API Features tab, then check the Allow client to post player statistics toggle.



5. Now select the sidebar option Leaderboards. Then, the leaderboards of the game, player ranking, including all the statistics of each user are now accessible.

You can control everything here as the administrator. 6. Finally, proceed with your learning and experimentation using the provided demo projects kit at the bottom-most section of the page.

 

Actions, Conditions & Expressions

Actions

press to zoom

press to zoom

press to zoom

press to zoom
1/3

The following action groups:

  • Friend Leaderboards

  • Leaderboards

  • Get Player Statistics

  • Get Player Statistic Versions

  • Update Player Statistics

  • Load Statistic

Friend Leaderboards

  • Get Friend Leaderboard - Retrieves a list of ranked friends of the current player for the given statistic, starting from the indicated point in the leaderboard.

  • Statistic Name - Statistic used to rank friends for this leaderboard.

  • Start Position - Position in the leaderboard to start this listing.

  • Max Results Count - Maximum number of entries to retrieve. Default 10, maximum 100.

  • Include Facebook - Indicates whether Facebook friends should be included in the response.

  • Include Steam - Indicates whether Steam service friends should be included in the response.

  • Specify Version - If set to "False", the latest version is selected. If "True", uses the specified Version below.

  • Version - If "Get Version" is equal to "True". Set here the version of the leaderboard to get.

  • Include Xbox - Indicates whether Xbox friends should be included in the response.

  • Xbox Token - Xbox token if Xbox friends should be included. Requires Xbox be configured on PlayFab.

  • Tag - The tag to differentiate the requests.


  • Get Friend Leaderboard Around Player - Retrieves a list of ranked friends of the current player for the given statistic, starting from the indicated point in the leaderboard.

  • Statistic Name - Statistic used to rank friends for this leaderboard.

  • Target Player - Choose the Player to target. "Player User" will target the current user while "PlayFab ID" will target the PlayFab ID indicated below.

  • PlayFab ID - If "Target Player" is "PlayFab ID". PlayFab unique identifier of the user to center the leaderboard around.

  • Max Results Count - Maximum number of entries to retrieve. Default 10, maximum 100.

  • Include Facebook - Indicates whether Facebook friends should be included in the response.

  • Include Steam - Indicates whether Steam service friends should be included in the response.

  • Specify Version - If set to "False", the latest version is selected. If "True", uses the specified Version below.

  • Version - If "Get Version" is equal to "True". Set here the version of the leaderboard to get.

  • Include Xbox - Indicates whether Xbox friends should be included in the response.

  • Xbox Token - Xbox token if Xbox friends should be included. Requires Xbox be configured on PlayFab.

  • Tag - The tag to differentiate the requests.


Leaderboards

  • Get Leaderboard - Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard.

  • Statistic Name - Statistic used to rank players for this leaderboard.

  • Start Position - Position in the leaderboard to start this listing.

  • Max Results Count - Maximum number of entries to retrieve. Default 10, maximum 100.

  • Specify Version - If set to "False", the latest version is selected. If "True", uses the specified Version below.

  • Version - If "Get Version" is equal to "True". Set here the version of the leaderboard to get.

  • Tag - The tag to differentiate the requests.


  • Get Leaderboard Around Player - Retrieves a list of ranked users for the given statistic, centered on the requested player. If PlayFabId is empty or null will return currently logged in user.

  • Statistic Name - Statistic used to rank players for this leaderboard.

  • Target Player - Choose the Player to target. "Player User" will target the current user while "PlayFab ID" will target the PlayFab ID indicated below.

  • PlayFab ID - If "Target Player" is "PlayFab ID". PlayFab unique identifier of the user to center the leaderboard around.

  • Max Results Count - Maximum number of entries to retrieve. Default 10, maximum 100.

  • Specify Version - If set to "False", the latest version is selected. If "True", uses the specified Version below.

  • Version - If "Get Version" is equal to "True". Set here the version of the leaderboard to get.

  • Tag - The tag to differentiate the requests.

Get Player Statistics

  • Get Statistics - Retrieves Player Statistics to return (current version will be returned).

  • Statistic - Get Player Statistics: Separate each Statistic Name by "|". Example: "Statistic1|Statistic2|Statistic3".

  • Tag - The tag to differentiate the requests.


  • Get All Statistics - Retrieves "All" Player Statistics to return (current version will be returned).

  • Tag - The tag to differentiate the requests.


Get Player Statistics : From Stack

  • Add Statistic Name - Add Statistic Name to Stack for the retrieval request of "Get Statistics From Stack".

  • Statistic Name - Unique name of the statistic.

  • Add Statistic Name Version - Add Statistic Name and Version to Stack for the retrieval request of "Get Statistics From Stack".

  • Statistic Name - Unique name of the statistic.

  • Version - The version of the statistic to be requested.


  • Get Statistics From Stack - Retrieves Player Statistics from added Statistic Name and Version Stacks.

  • Tag - The tag to differentiate the requests.

Get Player Statistic Versions

  • Get Statistic Versions - Retrieves Player's Statistic Versions from Statistic Name.

  • Statistic Name - Unique name of the statistic.

Update Player Statistics

  • Add Statistic Update Stack - Add Update Statistic Stack. Statistic Stack for the "Update Player Statistics" action.

  • Statistic Name - Unique name of the Statistic.

  • Value - Statistic Value for the Player.


  • Add Statistic Update Stack with Version - Add Update Statistic Stack with a version property. Statistic Stack for the "Update Player Statistics" action.

  • Statistic Name - Unique name of the Statistic.

  • Value - Statistic Value for the Player.

  • Version - The version of the statistic to be updated.


  • Update Statistics - Updates the values of the specified title-specific statistics for the user. By default, clients are not permitted to update statistics. Developers may override this setting in the Game Manager > Settings > API Features.

  • Tag - The tag to differentiate the requests.

Load Statistic

  • Load Statistic - Filters the Statistics locally from the latest of any "Get Statistics actions" to return the "Statistic Name", "Statistic Version" and "Statistic Value" by the input "Statistic Name".

  • Statistic Name - Unique name of the Statistic.


  • Load Statistic with Version - Filters the Statistics locally from the latest of any "Get Statistics actions" to return the "Statistic Name", "Statistic Version" and "Statistic Value" by the input "Statistic Name" and "Statistic Version".

  • Statistic Name - Unique name of the Statistic.

  • Version - The version of the statistic to be loaded.


Conditions

The following condition groups:

  • Leaderboards

  • Load Statistic

  • Get Statistics

  • Get Statistic Versions

  • Update Statistics

press to zoom

press to zoom

press to zoom
1/2

Leaderboards

  • On Get Leaderboard - Triggers when the Get Leaderboard Succeeded.


  • On Get Error - Triggers when the Get Leaderboard failed with an error.


  • Is Leaderboard Type - Checks the type of Leaderboard of the "On Get Leaderboard".

  • Type - Either "Leaderboard", "Leaderboard Around Player", "Friend Leaderboard" or "Friend Leaderboard Around Player".


  • Is Getting Leaderboard - Checks if there is an ongoing leaderboard request.

  • For Each Score - Loops through all the Leaderboard Scores.



Load Statistic

  • On Loaded - Triggers when the Statistic has been loaded successfully. The values can be retrieved using the expressions under "Load Statistic".

  • Statistic Name - Unique name of the Statistic.


  • On Load Failed - Triggers when the Statistic has failed to load. Probably either the "Name" can't be found or the "Version" is not available.

  • Statistic Name - Unique name of the Statistic.

  • On Any Loaded - Triggers when any Statistic has been loaded successfully. The values can be retrieved using the expressions under "Load Statistic".

  • On Any Load Failed - Triggers when any Statistic has failed to load. Probably either the "Name" can't be found or the "Version" is not available.


Get Statistics

  • On Get Statistics - Triggers when the Get Player Statistics Succeeded.

  • On Get Error - Triggers when the Get Player Statistics failed with an error.

  • For Each Statistic - Loops through all the Player Statistics.


Get Statistic Versions

  • On Get Statistic Versions - Triggers when the Get Player Statistic Versions Succeeded.

  • On Get Error - Triggers when the Get Player Statistic Versions failed with an error.

  • For Each Statistic Version - Loops through all the Player Statistic Versions.


Update Statistics

  • On Update Statistics - Triggers when the Update Player Statistics Succeeded.

  • On Update Error - Triggers when the Update Player Statistics failed with an error.

Expressions

press to zoom

press to zoom

press to zoom

press to zoom
1/3

The following expression groups:

  • Leaderboards

  • Leaderboards : Tags

  • Load Statistic

  • Get Statistics

  • Get Statistic Versions

  • Server Response

  • Request

Leaderboards

  • getDisplayName - Return the Leaderboards : Display Name, if available.

  • Index - The item index to get from the list.


  • getPlayFabID - Return the Leaderboards : PlayFab ID, if available.

  • Index - The item index to get from the list.


  • getPosition - Return the Leaderboards : Player Position, if available.

  • Index - The item index to get from the list.

  • getValue - Return the Leaderboards : Status Value, if available.

  • Index - The item index to get from the list.


  • getAvatarURL - Return the Leaderboards : Avatar URL, if available.

  • Index - The item index to get from the list.


  • loopLeaderboards - Return the Loop Index for the list on "For Each Leaderboards".

  • countLeaderboards - Return the Length of the list on "For Each Leaderboards".

  • getNextReset - Return the time the next scheduled reset will occur. "" if the leaderboard does not reset on a schedule.

  • getVersion - Return the version of the leaderboard returned.



Leaderboards : Tags

  • countTags - Return the number of tags the player has.

  • Index - The item index to get from the list.


  • getTag - Return the full value of the tag, including namespace.

  • Index - The item index to get from the list.

  • TagIndex - The index to choose from the list of tags.



Load Statistic

  • retStatName - Return the Loaded Statistic Name.

  • retStatValue - Return the Loaded Statistic Value.

  • retStatVersion - Return the Loaded Statistic Version.


Get Statistics

  • getStatName - Return the Statistic Name.

  • Index - The item index to get from the list.

  • getStatValue - Return the Statistic Value.

  • Index - The item index to get from the list.


  • getStatVersion - Return the Statistic Version.

  • Index - The item index to get from the list.


  • loopStatistics - Return the Loop Index for the list on "For Each Statistics".

  • countStatistics - Return the Length of the list on "For Each Statistics".


Get Statistic Versions

  • verStatName - Return the Statistic Name. The Name of the Statistic when the version became active.

  • Index - The item index to get from the list.


  • verStatVersion - Return the Statistic Version. The Version of the Statistic.

  • Index - The item index to get from the list.


  • verActivation - Return the Activation Time. The time when the statistic version became active.

  • Index - The item index to get from the list.


  • verDeactivation - Return the Deactivation Time. The time when the statistic version became inactive due to statistic version incrementing.

  • Index - The item index to get from the list.


  • verSchedActivation - Return the Scheduled Activation Time. The time at which the statistic version was scheduled to become active, based on the configured ResetInterval.

  • Index - The item index to get from the list.


  • verSchedDeactivation - Return the Scheduled Deactivation Time. The time at which the statistic version was scheduled to become inactive, based on the configured ResetInterval.

  • Index - The item index to get from the list.

  • loopStatisticVersions - Return the Loop Index for the list on "For Each Statistic Versions".


  • countStatisticVersions - Return the Length of the list on "For Each Statistic Versions".


Server Response

  • ServerResponse - Return the "Server Response" from every request from the PlayFab Server. The server response can also be shown in the "Chrome Developer Tools : Console", if in "debug mode".

Request

  • Tag - Return the "Tag" of the latest request.

Load

  • Load - Returns the statistic value from a specified statistic name, retrieved from the latest leaderboard request.

  • StatisticName - Unique name of the Statistic.

Object   Properties

Plugin Properties

1/0
 
 

Showcase

Due to the high demand of Leaderboards and is frequently asked, we have made an easy demo project. This teaches the basics of both the plugin collection and the PlayFab service.


Learning this project will help you understand the workflow of the plugin, then you can proceed to learn the advanced features yourselves, including syncing Leaderboards alongside 3rd party services like Google Play, Game Center, Facebook, Steam, Xbox, etc. And as well as getting leaderboards globally, around players, friends, etc.


We still recommend you understand how it works through PlayFab's official documentation, and learn more of the advanced features not covered in the documentations. However, we hope to at least get your feet wet with this demo project. We understand that not everyone would like to lear