views:

46

answers:

2

So I am trying to implement a global highscore for my game in google apps engine java. The information I want to retrieve is twofold:

  1. Which position did the user place?

  2. How many percent of all records did he beat?

The second question is solved if I solve the first one, and find a way to count the total number of rows in the database. But I know how to do neither. An ineffective solution is easy to implement, but I would prefer something that could handle a big table without slowing down.

Cheers,

A: 

The following two answers address counting rows in a database in App Engine:

  1. http://stackoverflow.com/questions/795817/google-appengine-how-to-count-a-databases-entries-beyond-1000
  2. http://stackoverflow.com/questions/751124/how-does-one-get-a-count-of-rows-in-a-datastore-model-in-google-appengine
Ron Romero
Counting all the highscores better than the one submitted every time you want to know its rank is a recipe for extreme slowness.
Nick Johnson
+2  A: 

See this question:

http://stackoverflow.com/questions/609735/how-to-implement-internet-high-scores-in-google-app-engine

In particular you could try porting this library (or the parts of it you need) to Java:

http://code.google.com/p/google-app-engine-ranklist/

Saxon Druce