Forum BigDB Specific player's rank (again)

Discussion and help relating to the PlayerIO database solution, BigDB.

Specific player's rank (again)

Postby Maras » January 10th, 2012, 2:27 pm

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?
Maras
 
Posts: 93
Joined: October 14th, 2011, 5:52 pm

Re: Specific player's rank (again)

Postby Henrik » January 10th, 2012, 6:57 pm

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: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Specific player's rank (again)

Postby Maras » January 10th, 2012, 11:54 pm

Ok, thanks.

And what do you think about my solution? (first 1000 ranks, decent score)
Maras
 
Posts: 93
Joined: October 14th, 2011, 5:52 pm

Re: Specific player's rank (again)

Postby Henrik » January 11th, 2012, 11:18 am

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: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Specific player's rank (again)

Postby Benjaminsen » January 11th, 2012, 2:43 pm

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
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Specific player's rank (again)

Postby Maras » January 11th, 2012, 2:53 pm

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!
Maras
 
Posts: 93
Joined: October 14th, 2011, 5:52 pm

Re: Specific player's rank (again)

Postby Benjaminsen » January 11th, 2012, 2:55 pm

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.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Specific player's rank (again)

Postby mlegrand » November 19th, 2013, 10:21 pm

Henrik wrote: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



I don't follow. :(
Can someone who understands what this means explain it to me?

Thanks :)
mlegrand
 
Posts: 4
Joined: August 3rd, 2013, 7:39 pm

Re: Specific player's rank (again)

Postby mlegrand » November 19th, 2013, 11:08 pm

Ok maybe I get it. Say this is our sample list of users:
user1 100
user2 200
user3 500
user4 1200
user5 1400
user6 1600
user7 2500
user8 2600
user9 3200
user10 3700

When they add their scores, we increment the counter in their associated bucket.
So.. user7's score came in and upped the count in the 2000-3000 bucket from 1 to 2.

[0000-1000] count = 3
[1000-2000] count = 3
[2000-3000] count = 2
[3000-4000] count = 2

When we want to find a player's ranking we see what bucket they are in.
So.. lets say user 4 wants to know his rank.
His score puts him in the 1000-2000 bucket.

We add the number of users who have better scores than that up. In this case the counts we maintained in the buckets 2000-3000 and 3000-4000 .. so 4.

Then we start looking using 4 as our number. Which.. if we were talking 10 million users instead of 10 would save us a lot of searching.

Does that sound correct?
mlegrand
 
Posts: 4
Joined: August 3rd, 2013, 7:39 pm


Return to BigDB