GameSalad & PlayFab: Leaderboards

Posted by

Although the title says “Leaderboards”, I plan to cover things that I have made to simplify the file. I realize that many people that use GameSalad are not really interested in coding minutia.

If you want to show the same columns and values as my example you don’t need to change anything. Just create a leaderboard in PlayFab called “HighScore”, a table with the same name and at least 3 columns in GameSalad, and replace your integration file with my latest: cordova-app.js.

To send a score to the PlayFab leaderboard call Platform – Post Score with the game score as the attribute and the leaderboard id of “sendScore.”

Screen Shot 2020-04-13 at 9.31.29 PM

To retrieve the Leaderboard and populate the table call Platform – Post Score. I navigated and selected the attribute for HighScore table and type in leaderboard id of “getTable.”

Screen Shot 2020-04-13 at 9.37.43 PM

And finally, this is what it looks like:

Screen Shot 2020-04-13 at 10.01.23 PM


At the bottom of the post, you can read how to make changes, but first I want to mention the other steps I did to make the integration easier.

You can now set your app id at the very top of the integration file.

I also revamped how attributes are saved and loaded. At the top of file, there is an array with game attribute names followed by their ids. Any game attribute you want to save you just need to add it to the array.

var attributeMappings = {“avatar”:“id187673”, “gameAttribute2”:“id569651”};

To save the attribute from GameSalad you call Platform – Post Score. This time for the attribute, the value of the attribute you want to save in the score field and the name in the Leaderboard ID field.

Screen Shot 2020-04-13 at 9.50.34 PM

When the app launches it will pull any saved values for that particular player and populate the attributes.

Not mentioned above you can also configure the leaderboards and specify what columns show, the order of the columns, and how many results are returned.

  1. On the top of the file you will notice something like this:
    • var tableMappings = {

          “HighScore” : {







      var leaderboardName = “HighScore”;

  2. Notice the word “HighScore”. This is the name that I gave the leaderboard in PlayFab and the table name in GameSalad. If you chose a different name for your leaderboard you would have to change this value.
    • Screen Shot 2020-04-13 at 9.04.22 PM
    • Screen Shot 2020-04-13 at 9.05.06 PM
  3. The other important value list is the “tableColumnsValues” property. This is the order that the values that come from PlayFab will be filled per row in your table. In my case, “position” (position in the leaderboard) will be filled in the first column, followed by DisplayName and then the “StatValue” (score). You can find the possible values that are returned in the documentation.
  4.  And finally the “maxResults”, this is the number of rows that PlayFab will return.

This is only the beginning.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.