Reversed order of the "ownerRecords" in the ListTournamentRecords

Hi everyone! I am a little confused about the behavior of the ListTournamentRecords request so I have a few questions.

  • I reported some score with 3 accounts and then tried to get a bucket for ListTournamentRecords.
    As a result I got 2 lists, where the ‘records’ list is correct but the ‘ownerRecords’ list is a reversed copy of the ‘records’ list. I can’t understand why is the ‘ownerRecords’ list reversed. Is it a normal behaviour or am I missing something?

  • Did I understand correct that using one tournament and getting results using buckets is more preferable than using many tournaments with limited amount of people?

Server version: 3.14.0+e2df3a29

The request body for the ListTournamentRecords:

{
  "tournamentId": "classicTournament",
  "ownerIds": [
    "eefe0a03-ad2f-46b3-b7e5-9a2187885933",
    "00000000-0000-0000-0000-000000000000",
    "50d376a3-2606-4dda-9958-33753abeebc8"
  ],
  "limit": 3,
  "cursor": "",
  "expiry": "1675094400"
}

The response:

{
  "records": [
    {
      "leaderboardId": "classicTournament",
      "ownerId": "00000000-0000-0000-0000-000000000000",
      "score": "39",
      "numScore": 4,
      "metadata": "{}",
      "createTime": "2023-01-30T15:49:05Z",
      "updateTime": "2023-01-30T15:55:14Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "1",
      "maxNumScore": 1000000
    },
    {
      "leaderboardId": "classicTournament",
      "ownerId": "eefe0a03-ad2f-46b3-b7e5-9a2187885933",
      "username": "Boss_3895",
      "score": "30",
      "numScore": 30,
      "metadata": "{}",
      "createTime": "2023-01-30T15:47:52Z",
      "updateTime": "2023-01-30T15:55:08Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "2",
      "maxNumScore": 1000000
    },
    {
      "leaderboardId": "classicTournament",
      "ownerId": "50d376a3-2606-4dda-9958-33753abeebc8",
      "username": "Pluzhok",
      "score": "3",
      "numScore": 1,
      "metadata": "{}",
      "createTime": "2023-01-30T15:48:47Z",
      "updateTime": "2023-01-30T15:48:47Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "3",
      "maxNumScore": 1000000
    }
  ],
  "ownerRecords": [
    {
      "leaderboardId": "classicTournament",
      "ownerId": "50d376a3-2606-4dda-9958-33753abeebc8",
      "username": "Pluzhok",
      "score": "3",
      "numScore": 1,
      "metadata": "{}",
      "createTime": "2023-01-30T15:48:47Z",
      "updateTime": "2023-01-30T15:48:47Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "3",
      "maxNumScore": 1000000
    },
    {
      "leaderboardId": "classicTournament",
      "ownerId": "eefe0a03-ad2f-46b3-b7e5-9a2187885933",
      "username": "Boss_3895",
      "score": "30",
      "numScore": 30,
      "metadata": "{}",
      "createTime": "2023-01-30T15:47:52Z",
      "updateTime": "2023-01-30T15:55:08Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "2",
      "maxNumScore": 1000000
    },
    {
      "leaderboardId": "classicTournament",
      "ownerId": "00000000-0000-0000-0000-000000000000",
      "score": "39",
      "numScore": 4,
      "metadata": "{}",
      "createTime": "2023-01-30T15:49:05Z",
      "updateTime": "2023-01-30T15:55:14Z",
      "expiryTime": "2023-01-30T16:00:00Z",
      "rank": "1",
      "maxNumScore": 1000000
    }
  ]
}

Hi, you’re getting the same 3 records in both lists because you only submitted the scores for those 3 and at the same time you’ve requested the same 3 owners. The order in the second list is not guaranteed in any way so it’s a coincidence that it is returned in the reverse order.

1 Like

Thanks, it means that if I use a leaderboard buckets feature I need to sort received ownerRecords manually before sending this list to a client. This is not covered by the documentation and by the example guide (Nakama: Bucketed Leaderboards | Heroic Labs Documentation).

And how about the second part of my question about preferable way to develop tournaments with rooms? Can you help me or maybe should I create another one topic for this question?

If you have a limited and known set of rooms, you can use multiple tournaments, but it’s your choice. Bucketed leaderboards is a design pattern used to segment the playerbase into a large and unknown number of buckets.

1 Like

Thank you! Now I am sure that the bucheted leaderbords are exactly what I need.