Store Additional Data On Leaderboard
A Leaderboard currently only supports storing a single value as score, so if you want to show additional information in your leaderboard we have a couple of ways that will allow you to do that depending on what data you want to show.
If you want to store additional sortable numeric data like accuracy, targets hit etc. we suggest you create additional leaderboards for each of these metrics and then merge them when showing the data to users. Depending on what is being sorted you call that leaderboard using the
/listendpoint and then decorate the returned data using data from the second leaderboard using the
We want a leaderboard with the following data:
accuracy. Create 2 leaderboards:
The default sorting is by score, so when we want to display the leaderboard in the game we first call
/list?count=100to get the top players on the score leaderboard.
After getting the result we can then decorate the data from the accuracy leaderboard using the
/membersendpoint. Call that with members returned in the first call to
/listand then merge the data.
If the user then sorts by accuracy we simply reverse the order of calls, so first we use the
/listendpoint for accuracy and then decorate with the
/membersendpoint calling the score leaderboard.
If you want to store additional non sortable data, currently the only solution is to manually enrich the leaderboard data with a separate data source.
Last modified 3mo ago