Sign In Register

How can we help you today?

Start a new topic
Answered

Daily Leaderboard Historic - Only one try for the score

Hi,


We are developing the following module in our game:


A Daily Challenge in which the player only has one chance per day to submit his score from an arcade game play. The top ten players of each day will get rewarded. We also want an historic of every days top ten results.


We are using the timed leaderboards for all this, set to one day reset, but we have some questions:


For the historic feature: How can we get the leaderboard data just before the leaderboard gets restored? Should we have our custom collection for this? and if this is the case, how can we get the leaderboard data just before it gets restored? 


For the only one chance per day: We are thinking in blocking this from Unity (we are using Unity as game engine), but we want to secure it also from the cloud code. Is the best way for doing this in the cloud code, in our "DAILY_SCORE" event, and check if the user has some entry in the leaderboard? 


Thanks


Best Answer

 

Hi Jorge,


You may be more interested in using a partitioned leaderboard, once set up the shortcode could be dailyLeaderboard.20032015, setting the date programatically. To make sure this is adhered to across the globe you could create a call that returns the date from GameSparks which uses UTC.


Then to return leaderboard data from previous days you can use a getLeaderboardRequest and supply the any date in the past.


You can read more about partitioned leaderboards here: https://docs.gamesparks.net/howtos/leaderboards-howtos/how-to-partition-leaderboards


As for ensuring the user can only play the game once a day, in the Cloud Code for the event where the user submits their score you can set some custom scriptData on the user's profile, something along the lines of "lastDateScoreSubmitted"


var player = Spark.getPlayer();


player.setScriptDate("lastDateScoreSubmitted") = new Date();


Then you can check if that equals todays date, if it does, send an error message instead.



Shane


1 person has this question
1 Comment

Answer

 

Hi Jorge,


You may be more interested in using a partitioned leaderboard, once set up the shortcode could be dailyLeaderboard.20032015, setting the date programatically. To make sure this is adhered to across the globe you could create a call that returns the date from GameSparks which uses UTC.


Then to return leaderboard data from previous days you can use a getLeaderboardRequest and supply the any date in the past.


You can read more about partitioned leaderboards here: https://docs.gamesparks.net/howtos/leaderboards-howtos/how-to-partition-leaderboards


As for ensuring the user can only play the game once a day, in the Cloud Code for the event where the user submits their score you can set some custom scriptData on the user's profile, something along the lines of "lastDateScoreSubmitted"


var player = Spark.getPlayer();


player.setScriptDate("lastDateScoreSubmitted") = new Date();


Then you can check if that equals todays date, if it does, send an error message instead.



Shane