Forum BigDB Highscore List Problem

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

Highscore List Problem

Postby default0 » August 7th, 2010, 1:06 pm

Hey

I have a small problem with my implementation of a Highscore table.

Well, right now, I load the top ten by an index and display this using a text-field.
This works well so far, but now I want to load the players rank, too.
No problem using loadSingle I can load his data, but now I want the text-field to show the player what rank he currently is (without having to do a possibly huge and non-scaling loadRange operation to load every object to guarantee that the player is inside), but I dont see a way to accomplish this.

Please help

Best regards
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany

Re: Highscore List Problem

Postby Oliver » August 10th, 2010, 12:16 pm

Hey Default,

You'll have to figure out a way to get the ranking information by using the operations available with BigDB, for instance, if you're always loading from the top you know that rank is 1+Offset.

We've also seen developers implement ranking by having a schedule that loops over users and updates their rank.

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Highscore List Problem

Postby lostwake » September 21st, 2010, 9:35 pm

We've also seen developers implement ranking by having a schedule that loops over users and updates their rank.


How exactly would I go about doing something like that? How would I set up a schedule, and whats the best to way find a users rank out of all other users with out demanding a great deal from the server?
lostwake
 
Posts: 5
Joined: August 21st, 2010, 4:41 am

Re: Highscore List Problem

Postby default0 » September 22nd, 2010, 9:12 am

lostwake wrote:
We've also seen developers implement ranking by having a schedule that loops over users and updates their rank.


How exactly would I go about doing something like that? How would I set up a schedule, and whats the best to way find a users rank out of all other users with out demanding a great deal from the server?


Eh, you cannot actually do that if your user count goes high.
It eats up large amounts of bandwidth anyways.

F.e. you could implement it like that (non-persistent game): Each time a new room is created, and last update of Ranking List is 6-12 hours or sth like that old, you go ahead and do an index search.
Then for each databaseobject it returns in the array you set a ranking value using a loop.
After that loop, you save the time this loop was performed and then next time youre attempting to load, BEFORE you use loadRange load the db object storing the time the last loop was performed, calculate how much time has passed since then and if this time is over x hours/days whatever you perform a new loop.
For persistent games you use a Timer after the check in gamestarted (very very slow timer) and then check the time there (or make the timer code run only when that time has passed) and do the loop in the timer, too.

In the end, even this costs a bunch of bandwidth, yet I guess this is the best solution to the case :)

Best regards
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany

Re: Highscore List Problem

Postby PeteHufnagel » April 13th, 2011, 4:42 pm

Have there been any new developments in this area? This seems like a major scenario, and I havn't come up with a solution which would scale well. The best one so far is the one mentioned earlier in the thread, but I predict weird bugs where the rank and the score are out of sync, so if you sort by score the ranks wouldn't be in order, or if you sort by rank the scores wouldn't, or if you are looking at different views your rank shows differently.

I'm having trouble imagining how it is hard to keep this information automatically along with indices in BigDB. It seems like if you can sort things you can know enough to figure out how many things came before.
PeteHufnagel
 
Posts: 9
Joined: March 22nd, 2011, 6:27 am

Re: Highscore List Problem

Postby Henrik » April 13th, 2011, 6:47 pm

PeteHufnagel wrote:I'm having trouble imagining how it is hard to keep this information automatically along with indices in BigDB. It seems like if you can sort things you can know enough to figure out how many things came before.

The underlying datastore for BigDB is distributed in nature, which means that when you do an index lookup, you pull results from several servers and combine before sending it back to the client. Making a count would require the exact same work, i.e. gather data from several servers and then combine. There are no global indexes where we can get this information in a quicker way.

Nothing's stopping you from calculating the count or rank yourself, except that the BigDB interface exposes the actual cost of this. Getting that data for the top items in an index is cheap, but the further down you go, the more it costs.

We would also love it if we could provide the data you want, but sadly this is one of the compromises you have to make if you want it to scale very well. We'd rather have BigDB perform great for everyone, all the time, instead of it becoming slower and slower for everyone the more data anyone puts into it.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to BigDB



cron