question

Kyle Pierre-Louis avatar image
Kyle Pierre-Louis asked

How do I create a time based Leaderboard with PlayFab? (Recording player's "Best Time")

I've been searching for a while now and I haven't found anyone else asking this question, let alone the answer to it. Maybe this is something so simple no one needs to ask about it, and I simply missed something obvious? I don't know.

The PlayFab leaderboard I'm using takes integers, but is there any way I can create a time based leaderboard instead of one that is Hi-Score based?

I've thought about grabbing the data from the leaderboard and formatting the score integer back into an accurate amount of time, then displaying that time as a string on the leaderboard, but all of this shouldn't be necessary, right? Also, that's very likely to be an inaccurate representation of the player's best time.

There are plenty of games that record the quickest time a player managed to complete the level, for example, so I'm sure there's just some setting I'm missing here within PlayFab's settings, but I can't find the solution anywhere.

Any help would be greatly appreciated.

How can I create a leaderboard that takes the player's longest/shortest amount of time to complete a level into account instead of their score?

Player DataLeaderboards and Statisticsgame manager
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

If you want to create a Leaderboard based on how much time players spent (The shorter the time, the better), then, creating that kind of Leaderboards directly is not supported at this time. But, as a workaround, you can create the Leaderboard with the negative value. For example, 50s and 100s in the leaderboard can be -50 and -100, now, the fewer time players spend, the better rank they get. When you need to display the Leaderboard, do that trick again to get the real time.

BTW, we have the Leaderboard V2 in coming, which can choose the Sort direction, It will better meet your needs. Please keep an eye on the Roadmap, once the feature is online, we will update that page in time.

>> I've thought about grabbing the data from the leaderboard and formatting the score integer back into an accurate amount of time, then displaying that time as a string on the leaderboard, but all of this shouldn't be necessary, right?

It is necessary, currently the Leaderboards only support integers, if you want to display 100s as “1 min 40s”, you need to implement it by yourself.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tourtellotronald2020 avatar image tourtellotronald2020 commented ·

Looks like v2 has been in preview for a long time now, like 2 years. The fact that tie scores work so poorly with current leaderboards is pretty bad.

I'm trying to have one leaderboard showcase the 25 scores around the player, and a 1 row leaderboard above it showing who has the high score. This seems easy enough until one leaderboard comes back showing you have the high score, and the other shows you're in 3rd. Due to a 3 way tie.

Is there any way around this? Im pretty sure i have to get 2 leaderboards since there doesn't seem to be a way to show the top score on the same leaderboard as my leaderboard around player, and its not great to show a leaderboard that the player isnt even on.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.