question

dean avatar image
dean asked

Leaderboard Ordering with Min Aggregation

I have just set up a Min leaderboard, ie, from scores submitted the leaderboard regards a smaller value as better and ignores any larger values.

However when I pull down the leaderboard, it is still ordered from highest to lowest and so are the players Positions.

Surely a leaderboard with Min Aggregation should return results in order of lowest to highest, since we regard a lower value as better? At least, all the systems I have worked with do.

Can get around this client side, but I thought I would point it out anyway.

Leaderboards and Statistics
2 comments
10 |1200

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

Dominic Williamson avatar image Dominic Williamson commented ·

+1 for me too for this feature request

0 Likes 0 ·
Matt McElligott avatar image Matt McElligott commented ·

+1 for this feature as well. I think it should at least be an option on the Min Aggregation Leaderboards. Awesome workaround though, thank you @ottolb!

,

+1 for this feature as well. I think it should at least be an option on the Min Aggregation Leaderboards. Awesome workaround though, thank you @ottolb!

0 Likes 0 ·
brendan avatar image
brendan answered

Correct - all leaderboards are returned in highest to lowest order. While I tend to agree that a Min aggregation leaderboard would probably be better returned as lowest to highest, our commitment to no breaking changes means that we can't change the behavior of the default return. What we are considering for a future update is providing a new leaderboard queries (or possibly an optional parameter on the existing ones) to allow specifying ascending or descending ordering.

12 comments
10 |1200

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

dean avatar image dean commented ·

Yup. I figured it would be too late to change at this stage.

Another leaderboard setting for Ordering would do the trick.

I was hoping to fix this client side, buy changing the Position to (Total Entries - Position). But then I realised that I don't know what the Total Entries is unless I have the entire leaderboard downloaded. So the Position is kinda useless for me now :-(

0 Likes 0 ·
ottolb avatar image ottolb dean commented ·

Hi Dean,

right now I just submit the score multiplied by -1. And then return the correct value when get leaderboard lists.

So it'll ordered in the right way

2 Likes 2 ·
colinchiu avatar image colinchiu commented ·

Is there a roadmap of when we might be able to see leaderboard sorting order a parameter we can set?

,

Is there a roadmap for when we might see leaderboard sorting order as an optional parameter?

0 Likes 0 ·
brendan avatar image brendan ♦♦ colinchiu commented ·

Sorry, but until something is in active development, we really can't speculate on a release date, as that would run the risk of someone taking a dependency on a date we can't guarantee. Also, we prioritize in part based upon the number of developers who have asked for a given feature, and to be honest, we haven't had very many requests for this to date.

-1 Like -1 ·
Chris avatar image Chris commented ·

I also need this, and hope it will soon be implemented...

0 Likes 0 ·
hampusbankler avatar image hampusbankler commented ·

I was looking for this as well. In a racing gamemode, it makes sense to store the time (where low is better). I'll try @ottolb's solution with the -1 multiplier for now. Nice workaround that I didn't think about! Thanks!

0 Likes 0 ·
hampusbankler avatar image hampusbankler hampusbankler commented ·

One problem with the workaorund though, is that if you press the trashcan to delete an entry, it will set the entry value to 0 instead of something like int.MinValue. This will make the "deleted" entries come up on top, requiring client side filtering.

0 Likes 0 ·
brendan avatar image brendan ♦♦ hampusbankler commented ·

Yes, if you're using this workaround, you would need to "clear" a player's statistic by setting it to the max value, instead.

0 Likes 0 ·
Show more comments
lsummers avatar image lsummers commented ·

Ouch, this is the second time in a row I've come to this forum for a critical feature, only to find it missing. I'm confused why the aggregate minimum even exists if the leaderboards can't be returned.


I don't want to mess with my score results, and there is no way to query the number of entries in the leaderboard. So is the only solution then to pull the (entire) leaderboard, and only take off the last entry? Well, I suppose the good news it isn't like there are a lot of gulf-style scoring games. I know I know, it isn't a priority to the PlayFab team and isn't going to be added anytime soon. Just, frustrating that happens a lot on here.

0 Likes 0 ·
brendan avatar image brendan ♦♦ lsummers commented ·

Sorry, but there are a great many features on the list of things we'd like to do, but we have to prioritize. Our prioritization is based on the number of developers that are asking for a feature, the impact the feature will have for all developers, and our own strategic decisions (PlayStream, for example, enables a massive range of live game operations mechanisms, but wasn't something developers specifically asked for - it was simply clear that it would be a major game-changer for our development community, so we prioritized it). And since we haven't had a ton of requests for descending-ordered leaderboards, it hasn't been prioritized.

The min aggregation method is available for the same reason it was when Xbox Live added leaderboards (and also only had descending sort) - because there were cases where it was useful, and it was low-hanging fruit.

But to be clear, no, it is not possible to pull the entire leaderboard. That would mean generating a massive number of API calls per player, which could get your title throttled or blocked. If a feature is something you need, I'd recommend adding it (or liking it, if it's already there) in our Feature Requests space.

-1 Like -1 ·
lsummers avatar image lsummers brendan ♦♦ commented ·

I mean well with what I am about to say, but putting a 2 year old feature request into your companies backlog and waiting for it to one day be addressed is not a proper use of my time and undermines the purpose of a BaaS.

A BaaS should simplify and scale back-end services. When trivial functionality is missing then it stops serving that basic purpose.

This is only one of many trivial items that is over 2 years untouched and really has no excuse to remain unresolved. Sorting ascending, descending. And basic CRUD operations - these are not feature requests, this is prototyping 101, and should have failed any QA process I've ever seen. I started working with PlayFab a few days ago to assess its viability and I'm not impressed.

There are open source / free alternatives (nakama / deployd / etc) raw services (firebase etc) and competitors (gamesparks etc) that don't have this incomplete prototype problem. This feels like a staffing or money issue. I'm not sure PlayFab is production ready... and it questions the risk of reliance - IMHO of course

0 Likes 0 ·
adeel3786 avatar image
adeel3786 answered

Just came across this post and was going through the same issue. My game is best on time so the quicker the time, the higher the player should rank. I tried using the x by -1 but the issue with the "0" value was a long and necessary process to handle. However, I managed to overcome this by reversing the order of the statistics gathered from PlayFab.

I'm Using Unreal Engine, so my values get stored into an Json array. There is a simple node called "Reverse for each loop".


Solution:

Once I gathered my leaderboard data into an array[1], I created another function with the reverse loop node and before my very eyes it reversed the order into another array[2]. I then fed array[2] to fill my leaderboard. :) Happy times.




6 comments
10 |1200

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

brendan avatar image brendan ♦♦ commented ·

Can you clarify what you mean by "fed array[2]"? The design of the system is that each client would be triggering (usually to Cloud Script, but it could be via a custom game server) the update of a player's statistics. It sounds like your solution involves writing stats for all players in the game at once, which isn't supported.

0 Likes 0 ·
lsummers avatar image lsummers brendan ♦♦ commented ·

To be fair, nothing is supported in this thread including min score support in general.

So. There's that.

0 Likes 0 ·
brendan avatar image brendan ♦♦ lsummers commented ·

Actually, no - you can easily store inverse scores and simply invert them for display. That's a common technique used by racing games in this type of leaderboard - store the time as (max time - player's time). That gets you the correctly ordered list of players, in a descending score leaderboard.

We will be supporting ascending score leaderboards in a future release. In the short term, our goal is to work with developers to help them achieve their design goals within the existing system.

0 Likes 0 ·
Show more comments
evan avatar image
evan answered

+1 for this feature request

10 |1200

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

Andreas Gullberg Larsen avatar image
Andreas Gullberg Larsen answered

I came here for the same feature request, however, I had not thought of the simple workaround of storing inverse scores. I believe that should work for me, so thanks for the tip.

10 |1200

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

Davit Datunaishvili avatar image
Davit Datunaishvili answered

I had the same issue and fixed it by setting maximum value as a default and multiplaying to -1

Okay, but I do not understand why it is so difficult to make aggregation leaderboard and float numbers as an option.

I mean, I am sure PlayFab has professional programmers. I do not believe that it is very difficult thing to fix but at the same time it is very important for users. Can't you spend some hours for fixing these important issues for all these years?

Weird!

10 |1200

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

Chris avatar image
Chris answered

I agree! This wait for a feature for over 5 years is getting ridiculous...

That's a pretty simple feature to implement, and frankly I don't understand that it hasn't been thought of from the beginning...

And for the "not breaking things" sake, just add a boolean argument to the call, specifying minAggregation, defaults at false....

We shouldn't have to "hack" this in.

10 |1200

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

beharstudios avatar image
beharstudios answered

Came across this thread in the need for this feature. I've worked with 3 leaderboard APIs so far and it was a fundamental feature to control the order in all of them.
@brendan this feature has been asked 6 years ago. Clearly something is wrong with the prioritization process if such a small feature hasn't been implemented yet (I assume it's a week worth of work plus testing?).
You can probably do a data query to see how many users upload results with a minus sign to understand the demand, but then again, isn't it just faster to implement it?

Hopefully we can get a better ETA for that matter.

Thanks,

Noam

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.

beharstudios avatar image beharstudios commented ·

BTW- I tried the inversed method and it creates a different problem- I can't easily look at the leaderboard in the Web portal and read the scores and look for potential cheats. This is pretty annoying.
Please folks, we not asking for much, let's just add this boolean to the request.

0 Likes 0 ·
temby644 avatar image
temby644 answered

Seems to work ok if you do the following:

result.leaderboard.Reverse()

And then when displaying the Place in the scores: result.Leaderboard.Count - item.Position

10 |1200

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

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.