Forum BigDB Limiting scores to top 100

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

Limiting scores to top 100

Postby actionsprite » December 5th, 2010, 8:31 am

Is there an example of the best way to create a top 100 table for high scores (both a daily and all time)?
Seeming as there is a limit to the number of objects you can store on the free account I need to be able to keep the top 100 only (or it could be 1000). I'm guessing you'd need to add the score, then grab all the items using a 'points' index or some such, and then delete those items that are greater than the desired length. It seems like a lot of manual labor each time a score is submitted - wondering if there is a smarter way to go about it?
actionsprite
 
Posts: 21
Joined: June 26th, 2010, 1:01 am

Re: Limiting scores to top 100

Postby Oliver » December 16th, 2010, 1:15 pm

If you want to just have a list of the top 100 scores, what you do is this:

a) add an index on score.
b) Insert values whenever a user gets a score
c) whenever you want to (could be after each score submission, could be less often), issue a DeleteRange(...) call that'll delete all the entries that aren't in the top 100 scores. (you'll most likely have to load the top 100 first so you know where the cutoff point is).

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

Re: Limiting scores to top 100

Postby lei » January 7th, 2011, 10:30 am

Hello! I have questions of a similliar nature.

Is it true there is a sort of limit on the number of objects, as the OP seems to believe?

Also, each PlayerObject in my game has an object called Stats in it, where various scores are stored. Is there an easy way i could index these, or am forced to create a new highscores table?

Thank you for a reply!
lei
 
Posts: 14
Joined: December 1st, 2010, 9:49 am

Re: Limiting scores to top 100

Postby lei » January 7th, 2011, 10:51 am

Ah, i think i solved the scores indexing bit, so nevermind that.
lei
 
Posts: 14
Joined: December 1st, 2010, 9:49 am

Re: Limiting scores to top 100

Postby Oliver » January 7th, 2011, 11:36 am

So lei, all your questions are answered?

We don't have a limit on objects, except based on which account plan you're on. You can always upgrade if you need more objects!

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

Re: Limiting scores to top 100

Postby lei » January 7th, 2011, 12:54 pm

Ah, so there is in fact a limit.
Does every nested object count towards that limit, or just the basic PlayerObject for example?
If it does, i suppose one is compelled to structure his data most economically.

Thanks for the reply.
lei
 
Posts: 14
Joined: December 1st, 2010, 9:49 am

Re: Limiting scores to top 100

Postby Oliver » January 7th, 2011, 12:56 pm

Only the root objects count towards this limit. That is each individual object in each of your tables count as one object, no matter how many nested objects each of them has.

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


Return to BigDB



cron