Hello everyone,
We are trying to decide on which way to implement local / city / region based leaderboards. We are well aware that “THESE” leaderboards can be less populated and not too big, if there aren’t many users playing from same country but in social based game this intends to be less of the case.
These leaderboards do not expire, they are forever there.
Currently how we see it there are two ways we could go, or to approach it:
- Using new leaderboards for each country code
- Running custom query
Using approach 1) it was all fine, until we hit the limit. There is hardcoded limit within nakama runtime to not list more than 10 000 users.
This is a bit hidden feature, might worth to be put into documentation.
Limit can be found Rank Limit
So first approach is stuck here, as if user is 10001 it will not return his position in the rank leaderboard.
Again this can be solved by running custom query to get only user position in these cases where it is not within first 10k.
But we are already using custom sql query to approach solution 1) then why not go with solution 2) already using query which does both and does not have any user limits.
The cost is obvious constant hitting of the database, and non caching of the data. but that can be limited within user client or even within server side.
So real question is:
- What do you think it is best way to be approached here option 1) or option 2) because same principle can be used for friends !?
The query we tried goes something like this:
select u.display_name, u.avatar_url, l.score from users u, leaderboard_record l
where u.location = $1 and l.owner_id = u.id and l.leaderboard_id = $2 order by l.score desc
- Versions: Nakama {3.15}, {Docker},
- Server Framework Runtime language Lua