My game hosts an in-game tournament twice a week (Wednesdays and Sundays), that lasts for 24 hours. The goal is for players to get as far as they can in the game within 24 hours. I use a leaderboard to track their progress for this specific 24 hour time period and to display in-game so that players can see how they place against others and compete against each other for larger prizes.
I use a Title Data key-value pair to trigger the start of the tournament, by updating one of the values to the date of the tournament. I need to do this within a few hours prior to the server time hitting each Wednesday or Sunday. When the game notices today is a Wednesday or Sunday and it matches the Title Data key-value pair date, it allows the player to enter the tournament and begins tracking his stats. My question is - is there any way to automate updating this Title Data key-value pair every Wednesday and Sunday? I'm totally unfamiliar with cloud scripts - can I use one of them for this? Have a script automatically execute when the clock hits midnight on Wed/Sun and update a Title Data value with the current date?
Also, is there any way to automate resetting leaderboards outside of the normal daily/weekly/monthly intervals? I reuse the same leaderboards for these tournaments, meaning I need to manually reset them prior to each Wednesday and Sunday (twice a week, so obviously the normal intervals would not work). If there was a way to select specific dates or patterns for resetting leaderboards - that would be fantastic.
I realize I probably set up these tournaments in a silly, inconvenient way with all these restrictions - but it is too late to change anything now :).
Please let me know your thoughts or if you need any more information.
Answer by Brendan · Jun 07, 2018 at 01:45 AM
So, Title Data can be written to from a Cloud Script that's triggered by a Scheduled Task. That's the reason it's available in the Server API - writing to Title Data due to a player action, to be clear, is not supported (Title Data is meant only for occasional updates, as it is a sharded and cached resource).
To reset a leaderboard on a daily time you decide (not 00:00 UTC, which is the built-in reset), you would need to use the Admin API call IncrementPlayerStatisticVersion. That's provided so that you can run it from your own tooling - we do want to add it to the Server API in future, but we need to build in some safeguards so that if someone were to accidentally try to use it too frequently it wouldn't be an issue.
Thank you, this was very helpful! Any idea on a timeframe when the IncrementPlayerStatisticVersion might be available in the Server API? The manual updating of the Title Data is pretty quick and easy, but resetting so many leaderboards is the somewhat time consuming and annoying part.
Sorry, but that hasn't been called out as a need by very many developers, so it hasn't been prioritized into the schedule yet. I'd recommend adding it to our Feature Requests forum, so that we can track on how many "likes" it gets.
Leaderboard Information in Push Notification 1 Answer
Leaderboard related Questions 1 Answer
Timed quest and semi online machmaking 3 Answers