Sign In Register

How can we help you today?

Start a new topic
Answered

Leaderboard entry with extra data

I need to store some extra data along with player's leaderboard entry. In this case the character player used to get the score.


I have set up an event (postScore) with field for the character id (extraData, Number) and set Default Calc = Last. Then I have setup two leaderboards: All-Time and Periodic that resets in every few days (partitioned like periodicLeaderboard.period.123). Both leaderboards have a reference to the field "extraData" with Sort = None, Group = MIN. I am not entirely sure what some of these attributes do because some (Group?) seem irrelevant in my particular case.

With this setup it seems to work some of the time but now I run into an issue where it registered wrong value in All-Time leaderboard even though the score is the same in both leaderboards.


This question is similar to "How to submit and retrieve extra info to a leaderboard" but the answer there didn't help me here and the example is missing the Group-attribute in the leaderboard.

I would like to know exactly how to do this right. Thanks.


Best Answer

Hi Paavo,


We haven't forgotten about you. We made some changes to the Leaderboards recently and have added something that you will find extremely useful. You can now configure your event to have a Default Calc attribute called "Supplemental", you can see it below. This field will not contribute in any way to the score or ranking of a Leaderboard. It will work perfectly for storing your character data. I can also confirm you post a lower score as a different character, the Highscore character string won't be affected, it will only changed when a new High Score is set, I think this is exactly what you needed. Let me know if this works for you.



Thanks,

Liam



Hey Paavo,


Just so i can create exactly what you are looking for, could you let me know exactly what attributes you need?
From what i gather, you will be submitting a number called 'score' for example.
Then you want some extra data. That kind of data is this can what are you calling it? And you want the leaderboard entry to show this extra data, but it has nothing to do with the rank in the leaderboard.


Is this correct?

-Sean

Hi Sean,

That "extraData" refers to character player used to achieve the score (sorry for the generic naming). It is numeric because it refers to character's id number. You are right, it should not affect player's rank in any way. It should, however, always be paired with the score it was submitted with.

I figured that using "Default Calc = Last" clearly doesn't doesn't work because it seems to overwrite "extraData" with the last submission regardless the score.
Hey Paavo,

One last thing; Is there some reason that Calc = Last doesnt suit your needs? Is that attribute likely to change? I just mention it because without that things will get complicated.


Also, from your original post...


With this setup it seems to work some of the time but now I run into an issue where it registered wrong value in All-Time leaderboard even though the score is the same in both leaderboards.


What exactly is going wrong here? It it that the score is higher or lower than it should be, just just some random number?


Thanks,
Sean

Hi Paavo, 


Sorry to hear you're still having trouble here, if its working with two separate events (it would be using two different running totals here), that would lead me to believe that using one event (and therefore one running total) to populate both leaderboards could be causing the issue here. I'm going to recreate both of your events and leaderboards and see if I can replicate your issue and find a solution for you. I'll update you with my findings.


Thanks,

Liam

Okay, Thanks Paavo.

I will get back to you soon with an example.

-Sean

 

What I want is to have two leaderboards, one showing all-time high scores and another one that is reset every few days. These are already setup and working! All I want is just to display the character player used to achieve the scores.

It is not 100% clear to me what "Default Calc = Max" does so maybe it works here. I'm not sure. Currently the way it seems to work is that it gets the value of what was last submitted. For example:

Player achieves 900 points playing as a penguin (Now 900 is the high score and character used was penguin)
Later, player achieves 800 points playing as a seal (900 is still the highest score and character should remain as penguin but currently it doesn't)

Regarding the second question, there was nothing wrong with the score. The problem was that the character used to achieve the score was different in those two leaderboards.

(Workaround, that I can be certain works 100% of the time is to simply reserve the last digits of the score to store the character id like 900xxx where xxx would be the character used. This is how I used to do in GameCenter before.)

 

I meant "Default Calc = Last"

 

That shouldn't be necessary Paavo.

I'll get back to you shortly with a solution.

Sean

 

Hey Paavo, sorry about this, i have a solution for you, but i just want to ask if it suits you first.

I think i know a way to build what you are looking for using a partitioned leaderboard,
You would set the extra-data attribute in your event to 'Grouped', this will us to make the all-time and weekly leader-boards a partition.

Then in your leaderboard select extraData as a partitioned attribute.

So when you submit scores with the extraData attribute, your leaderboard will be partitioned by the extra-data. So instead of having data added onto the lb entry, you can just list the partitioned leaderboard for each character-type.

Does that suit?
Sean

 

I have time-based leaderboards already setup, so I think I know how they work. It sounds like I would end up having tons of leaderboards to manage while all I really need is having all scores in the same place regardless characters players use. That would be like "leaderboard.period.123.extraData.45"?

 

Thanks for the response,
however I think this still doesn't work. Here is example:

(There are two leaderboards: allTimeLeaderboard, periodicLeaderboard.period.{period})

postScore { score: 1000, charId: 10, period: 5 }
// Both leaderboards score = 1000, charId = 10 OK!
postScore { score: 800, charId: 9, period: 6 }
// PROBLEM: now allTimeLeaderboard has charId = 9 which should not have changed since the highest score there is still 1000
postScore { score: 900, charId: 11, period: 6 }
// Interestingly now allTimeLeaderboard has reverted to charId = 10 (maybe it takes the Min(charId)?)

I don't know if it works any differently if I convert charId into string?

 A quick test showed that converting these numeric values into strings in postScore-event did not fix the issue. Interestingly, it works exactly described as above.

Should I assume there is no out-of-the-box solution for this scenario and the solution in another topic I linked in my first post is acually wrong? I can go with my own hacky solution in this case because it's just one extra number (<1000) I need to store. Segmenting the leaderboard for each character is not what I want, I want them to be on the same leaderboard.

Answer

Hi Paavo,


We haven't forgotten about you. We made some changes to the Leaderboards recently and have added something that you will find extremely useful. You can now configure your event to have a Default Calc attribute called "Supplemental", you can see it below. This field will not contribute in any way to the score or ranking of a Leaderboard. It will work perfectly for storing your character data. I can also confirm you post a lower score as a different character, the Highscore character string won't be affected, it will only changed when a new High Score is set, I think this is exactly what you needed. Let me know if this works for you.



Thanks,

Liam


Login to post a comment