Sign In Register

How can we help you today?

Start a new topic
Answered

Leaderboards not retrieving

Hi,


On Friday gamesparks stop retrieving something when I called "ListLeaderboardsRequest". Now despite I have two leaderboards created it only gives me access to one of them. By the way I what to have a third leaderboard that resets every week, can I use the same variable as the one that is the all time leaderboard or do I need to use another event variable for that?


Best Answer

Hi Ines,


The issue here was that the Leaderboard used to be set to Reset Weekly, and scores were posted, then after that (probably last Friday) it was changed to Calculate Weekly.

When a leaderboard is changed -be it how it calculates or adding another attribute to track- the system creates a new instance of the leaderboard as the data structure has changed. Any old leaderboard information will still exist in the NoSQL database, however it will be inaccessible to your users.

In your specific case, the issue has been resolved; though to prevent this from happening again, if you have leaderboards with data already being tracked, it's best to create a new leaderboard rather than change the old one.

The new data structure will invalidate the previous entries.


Apologies for the confusion.
We're working on a solution to warn users about the above scenario when editing a leaderboard that is already tracking data.


Thanks,


Oisin.


Hi Ines,


What versions of Unity and the SDK are you using?

Thanks,


Oisin.

I'm using Unity 4.6 and the latest SDK of Gamesparks. It's also not working on the test harness.

Hi Ines,

Sorry for the delay.


Do you think you could grant me access to your project please?
I'll need some more info to resolve this.

Are you using the new Unity 5 SDK that was released on Friday with Unity4.6?

Thanks.

Oisin

Hello Oisin,


Yes I can give you access but I think I need your email.


I'm using UNITY 4.6 and the version 3 of the gamesparks SDK.

Hi Ines,

oisin.bourke@gamesparks.com

Thanks.

Done!

Thanks, Ines, 


Still looking at this.
Hope to have an answer for you tomorrow.

Answer

Hi Ines,


The issue here was that the Leaderboard used to be set to Reset Weekly, and scores were posted, then after that (probably last Friday) it was changed to Calculate Weekly.

When a leaderboard is changed -be it how it calculates or adding another attribute to track- the system creates a new instance of the leaderboard as the data structure has changed. Any old leaderboard information will still exist in the NoSQL database, however it will be inaccessible to your users.

In your specific case, the issue has been resolved; though to prevent this from happening again, if you have leaderboards with data already being tracked, it's best to create a new leaderboard rather than change the old one.

The new data structure will invalidate the previous entries.


Apologies for the confusion.
We're working on a solution to warn users about the above scenario when editing a leaderboard that is already tracking data.


Thanks,


Oisin.

Ok but what I did (and maybe that was the problem) was that I want to create 4 leaderboards (one that calculates the score weekly and resets after ever every week, one that was the all time score and calculates weekly, one that was the percentage of games won that resets weekly and another with the percentage of games won of all time that calculates weekly) and I was using only two variables for those 4 leaderboards. Do I need 4 variables for this? How can I make the one that calculates percentages of games won? Can the leaderboard calculate the percentage given two variable? Is it possible to, for example, make the player lose points on the leaderboard if he doesn't login for some time?


Thanks

Hi Ines,


One way to calculate and reset:


Create a partitioned leaderboard with the variables you want, and an extra variable for "week", set it to String and set the default to ${formatToday("yyyyww")} This should do the trick and all previous leaderboards will be available via the listLeaderboardsRequest.



You can make a similar leaderboard for the percentages with week, win and loss. Set win and loss to sum. Then you could create an event called "getUserWinPercentageForWeek" with an attribute of week. In the Cloud Code for that event use GetLeaderboardEntriesRequest:


var entry = Spark.sendRequest({

 "@class": ".GetLeaderboardEntriesRequest",

 "leaderboards": [

  "leaderboard.1513"

 ]

});


"entry" will equal the response, use the data that comes back to calculate the win percentage.


Shane

I cannot understand exactly how this works. I check the documentation for partitioned leaderboards but still it is not very clear. Do you have a tutorial or something that I could follow? It may not be exactly for what I want but something similar just so I can understand the concepts.


Since you didn't answer I can assume that I cannot create a something that would make the player lose points if he doesn't login for some time?

For the player login you would modify the Cloud Code of AuthenticationResponse, you can then modify any script data you store on the player, we don't support modifying scores of an already existing leaderboard, the only way this would be achievable is if the Default Calc is set to sum but this would constantly add to your players score over the week.


For partitioning a leaderboard you set the week attribute Type to "String", set the Default Value to "${formatToday("yyyyww")}" and the Default Calc to "Grouped".


Then in your leaderboard that you want partitioned, you add this attribute and set the Group to "Partition".


When you post your score to your leaderboard, it will create a new sub leaderboard for every week.so if you call your leaderboard "weekly" this weeks leaderboard would be "weekly.201513".


Shane

Ok lets focus on one issue at a time. 


Can you explain me what the partitioned variable does on the leaderboard? What do you mean "post my leaderboard"? What I understood was that I just post a variable and that variable updates the leaderboard. There a calculate weekly and a reset weekly. Isn't that what I need?

Let's say our partitioned variable is called "level".

Any string you set as the partitioned variable with create a new sub leaderboard with that string as its heading. If your leaderboard shortcode is "highScoreLeaderboard" and you post your score and set the partitioned varable to "level1" your score will be posted to "highScoreLeaderboard.level.level1".

 Any time you post a score the partitioned variable will try to find a sub leaderboard of that name and if it doesn't it will create that sub leaderboard. The calculate weekly and reset weekly options cannot work on the same leaderboard. 

 Shane
Login to post a comment