Forum ‹ BigDB ‹ Specific player's rank (again)
7 posts
• Page 1 of 1
Specific player's rank (again)
Just in case that something has changed: (last forum post on this topic is from February)
Can i get specific player's rank without loading all players (up to that specific player) or saving ranking value?
I mean, player's ranks are already sorted by index, why it's not possible to just load position?
I thought i could show rankings only for players who will have some decent amount of points (because those are the players who cares about ranking) and only in case they are in first 1000. Is this possible solution for Plus plan?
Can i get specific player's rank without loading all players (up to that specific player) or saving ranking value?
I mean, player's ranks are already sorted by index, why it's not possible to just load position?
I thought i could show rankings only for players who will have some decent amount of points (because those are the players who cares about ranking) and only in case they are in first 1000. Is this possible solution for Plus plan?
-

Maras - Paid Member
- Posts: 18
- Joined: October 14th, 2011, 5:52 pm
Re: Specific player's rank (again)
Sorry, no, it's not possible to perform any sort of aggregate functions over BigDB objects, or load them based on position in an index, and it's unlikely we will ever offer that.
-

Henrik - .IO
- Posts: 570
- Joined: January 4th, 2010, 1:53 pm
Re: Specific player's rank (again)
Ok, thanks.
And what do you think about my solution? (first 1000 ranks, decent score)
And what do you think about my solution? (first 1000 ranks, decent score)
-

Maras - Paid Member
- Posts: 18
- Joined: October 14th, 2011, 5:52 pm
Re: Specific player's rank (again)
That seems ok. You probably want to make the objects in that table as small as possible so that it uses less bandwidth to load it.
-

Henrik - .IO
- Posts: 570
- Joined: January 4th, 2010, 1:53 pm
Re: Specific player's rank (again)
The reason you cannot load a position is that BigDB is massively distributed. IE your data set could be on many different servers. An count operation would then be extremely heavy as you would basically need to ask all servers to do the count operation individually, then combine the results.
There are however some pretty clever ways of working around the issue by populating data sets yourself. Most of them does however require your logic to happen on a server such that the data is at least a bit secure. Anyway, one method of implementing a system that can give an approximation of your rank compared to the total player base is the following:
When submitting scores
1: Separate your score space into steps. IE 0-1000, 1000-2000, 2000-3000 etc.
2: When a new score is submitted load the matching database object, add one to it and save it.
2a: If scores are unique to a player, load the object matching the previous score and subtract one from it to remove score.
When calculating location
When you need to calculate approximate location, load all objects with scores equal or lover than the current score. Sum the values to get the offset
There are however some pretty clever ways of working around the issue by populating data sets yourself. Most of them does however require your logic to happen on a server such that the data is at least a bit secure. Anyway, one method of implementing a system that can give an approximation of your rank compared to the total player base is the following:
When submitting scores
1: Separate your score space into steps. IE 0-1000, 1000-2000, 2000-3000 etc.
2: When a new score is submitted load the matching database object, add one to it and save it.
2a: If scores are unique to a player, load the object matching the previous score and subtract one from it to remove score.
When calculating location
When you need to calculate approximate location, load all objects with scores equal or lover than the current score. Sum the values to get the offset
Have more questions? Join us at #player.io on the freenode irc network. Making something cool with Player.IO? I would love to talk! My Skype handle is q-rious
-

Benjaminsen - .IO
- Posts: 808
- Joined: January 12th, 2010, 11:54 am
- Location: Denmark
Re: Specific player's rank (again)
Thanks for this explanation, I finally understand it!
This is clever solution, but I though about it a little, and I will make leaderboard for top 100 + ranks in profile for these first 100 players.
Thanks again!
This is clever solution, but I though about it a little, and I will make leaderboard for top 100 + ranks in profile for these first 100 players.
Thanks again!
-

Maras - Paid Member
- Posts: 18
- Joined: October 14th, 2011, 5:52 pm
Re: Specific player's rank (again)
Maras wrote:Thanks for this explanation, I finally understand it!
This is clever solution, but I though about it a little, and I will make leaderboard for top 100 + ranks in profile for these first 100 players.
Thanks again!
Normally you would do a hybrid solution, i.e. have a top list for top 100 and an approximation for the reminder.
Have more questions? Join us at #player.io on the freenode irc network. Making something cool with Player.IO? I would love to talk! My Skype handle is q-rious
-

Benjaminsen - .IO
- Posts: 808
- Joined: January 12th, 2010, 11:54 am
- Location: Denmark
7 posts
• Page 1 of 1