ListLeaderboardRecords AroundOwnerAsync or ListTournamentRecords AroundOwnerAsync support bucket?

base on the bucket leaderboard best practice, may i ask any support for there 2 API

ListLeaderboardRecordsAroundOwnerAsync
ListTournamentRecordsAroundOwnerAsync

seems like there is no input parameter of ownerIds in the client lib signature, should we implement it by ourselves or any suggestions for these 2 APIs for bucket leaderboard/tournament?

Hello @mengxin,

This API is meant to return records above and below the owner, if you need multiple results you could have a custom RPC that invokes it for each entry in a list of userIds and returns the multiple results in a single response.

Best.

Sorry, little confused. This API will return records around the owner on full leaderboard right?

if we use the bucket leaderboard, the owner of the records around the current player may not in the bucket players list, then it is possible all the records returned from this API is not useful for the current player.

is there any way we can get the recorded around the owner and in the bucket userId list?

i am also thinking if there is no API, whether we can use the API leaderboardRecordsListCursorFromRank to achieve?

  1. ListLeaderboardRecordsAroundOwnerAsync → get the rank of current user
  2. leaderboardRecordsListCursorFromRank → get curser of the current user by rank (maybe rank - 10, if we want to get 20 around players)
  3. ListTournamentRecordsAsync use this API with the curse and ownIds to get the recorded around the owner.

is there any issue for this solutions?

I’m also a bit confused, yes the ListLeaderboardRecordsAroundOwnerAsync APIs return the records around the target ownerId in the request (the ownerId param), not the current session user.

If using bucketed leaderboards you should use the API with the leaderboardID from the leaderboard bucket that was attributed to that userId (ownerId in this case, unless I’m misunderstanding or you have a different bucket implementation).

Just for some clarification, the ListLeaderboardRecords will list all records of a leaderboard, and optionally takes a list of ownerIDs to also return those specific records. The order depends on the leaderboard sort order when created.

ListLeaderboardRecordsAroundOwnerAsync is to get the records around the target ownerId, and then optionally navigate up or down from there using a cursor (which essentially becomes the same as a invoking ListLeaderboardRecords with a cursor).

leaderboardRecordsListCursorFromRank is a utility function that can be used to build a cursor to then use with ListLeaderboardRecords to list the records after that rank.

OK seem like i have some something misunderstand about the bucket leaderboard, let me make example base on my understanding

leaderboader test
global 10 player and bucket to 3
p0 bucket is p7,p8,p9
p1 bucket is p5,p6,p8

p5 bucket is p0,p1,p9

global ranking is

p0,p1,p2,p3,p4,p5,p6,p7,p8,p9

now when player open the leaderboard, we want to show the current play and others around him,such as
when p0 open game,will see p0 p7. rank 1,2
p1 open to see p1,p5,rank 1,2 and
p5 opne to see p1,p5,p9. rank is 2.3.4

if i use p5 as owner id to get around,will it return p4,p5,p6? but p4 and p6 not in bucket of p5,
meanwhile the rank in record is golbal rank right?

if yes how we can get p1,p5,p9 directly without get full records of bucket of p5?

the real eamxple bucket may bigger such as 1000 player

If using bucketed leaderboards you should use the API with the leaderboardID from the leaderboard bucket that was attributed to that userId (ownerId in this case, unless I’m misunderstanding or you have a different bucket implementation).

Do you mean the bucket leaderboard is an independent Nakama leaderboard? the doc suggests only one leaderboard and bucket for each player with selected players as a view on the leaderboard. right

@mengxin you’re right, same leaderboard but different player buckets - in which case the ranks you should recompute based on the ordering of the results from the players in the bucket and disregard their actual ranks in the global leaderboard.

So if you have:
p0 bucket is p0,p7,p8,p9

You should fetch p0,p7,p8,p9 using the ownerIds param in leaderboardRecordsList and just order them and rank them relative to the other players in the bucket.

The players shouldn’t be aware of their rank on their global leaderboard but instead compete with players in their own bucket.

Our Hiro framework handles all of this for you ;).

1 Like

thanks explaination. seem like if bucket size is big such as1000 to 10000, better to create separate leaderboard better.

btw may i ask hiro is not free right? seem like no price about it, only support with cloud solution?

Hiro is a licensed product and it can be used outside of Heroic Cloud. Please contact sales@heroiclabs.com if you’d like to know more.