question

brendan avatar image
brendan asked

Posting high scores

angry_penguin
started a topic on Sat, 11 April 2015 at 5:35 AM

I may have missed something here, but what's the intended process for posting a high score?

I understand that leaderboards are generated from User Statistics, so posting the scores should be done via UpdateUserStatistics. However, for high scores there's typically a rule associated with an updated value: we only want the score saved if it's an improvement on what's currently there (lower for times, higher for point values).

So, is the intended process for us to first request the current statistic, then only update it if necessary?

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

·
brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Sat, 11 April 2015 at 8:45 AM

The update of scores in statistics is currently "last" aggregation, meaning the last score written for a player is the one in the leaderboard, so you would want to check the score first, if the intent is to only replace it if it's an improvement. We do have a backlog item to add "min" (only update if the new value is lower), "max" (only update if the new value is higher), and "sum" (add the value posted to the current value) aggregation methods, but since we haven't heard from anyone for whom this is a requirement (likely because anyone needing a specific aggregation system is doing a check before the update), this hasn't been added to the schedule yet. If you do have a requirement around this, please do let us know what your integration schedule looks like by contacting us at devrel@playfab.com.

Brendan


5 Comments
Brendan Vanous said on Sat, 11 April 2015 at 8:45 AM

The update of scores in statistics is currently "last" aggregation, meaning the last score written for a player is the one in the leaderboard, so you would want to check the score first, if the intent is to only replace it if it's an improvement. We do have a backlog item to add "min" (only update if the new value is lower), "max" (only update if the new value is higher), and "sum" (add the value posted to the current value) aggregation methods, but since we haven't heard from anyone for whom this is a requirement (likely because anyone needing a specific aggregation system is doing a check before the update), this hasn't been added to the schedule yet. If you do have a requirement around this, please do let us know what your integration schedule looks like by contacting us at devrel@playfab.com.

Brendan


angry_penguin said on Sat, 11 April 2015 at 10:00 PM

The min/max/sum thing sounds like exactly what I was expecting. Like you say, though, it was easy enough for me to grab the number and check it myself, so it's not a big deal.

On a related note, have I missed a way to request only a specific statistic? It's not at all an issue for my current game since there'll only be a handful, but for games with many stats it might make sense to be able to request only specific ones.


Brendan Vanous said on Sun, 12 April 2015 at 11:51 AM

Sure, you can query for a single stat (or a set) using GetUserStatistics - there's a Client and a Server version, depending on your needs.

Brendan


angry_penguin said on Sun, 12 April 2015 at 3:03 PM

How do you specify which statistics you want? The linked docs don't list any parameters, and the wrapper in the Unity SDK doesn't accept any.


Brendan Vanous said on Sun, 12 April 2015 at 3:13 PM

Ah, my apologies - there is a planned update to provide exactly that (an array of statistics to be returned). This will be in an upcoming release. If this is key to your title (that is, if you have a lot of stats and so need to optimize with this), please do let us know your key integration dates at devrel@playfab.com.

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.