Daily Leaderboard Historic - Only one try for the score
J
Jorge Aldao
started a topic
almost 6 years ago
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
C
Customer Support
said
over 5 years ago
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.
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
Customer Support
said
over 5 years ago
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.
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.
Jorge Aldao
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
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
Customer Support
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
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2486 topics