Design for the ranking systems and server statistics.For now I intend to scan EACH active server (about 10.000-20.000 of those) once every 2 minutes (this idea might change once I start actually scanning on a large scale).
There will be several types of ranking (ranking is week based weeks running from monday to sunday):*
CLQ1 (point collection speed): based on how fast someone can collect points (old CLQ method)
*
CLQ2 (relative game ranking): how good you are at reaching the top of the list
*
ELO: a common statistical method used for chess, football, etc.
* Absolute number of points collected in a week
* Absolute number of seconds played in a week
CLQ1 and CLQ2 only look at your best games, ELO looks at all your games.
Key managementThere will be a key for each player, each server, each map and each week. A key is a number. Each key is stored in a separate HYPERSTORE object and a separate MYSQL record to allow extreme rapid name -> key transformations. Key generation will be the only atomic (slow) operation.
For each player, each server: MYSQL
* top 3 best positions (all weeks but the current) based on CLQ1, CLQ2 and ELO (this means the highest someone can achieve here is to become #1 in 3 different weeks, this can be used to determine the all time best players on servers)
For each week, each map, each server: HYPERSTORE / MYSQL
* number of minutes played
* average number of players on map
For each server: HYPERSTORE (2 layers for long term stats and short term stats)
* current server rank (based on last weeks statistics)
* last seen (timestamp)
* current map
* missed scans (possible server is down, 1-2 missed scans is assumed to be a mistake, 3 a real problem)
* scanning speed class
CLASS 1: missed at most 2 scans, at least 3 players, once per 2 minutes
CLASS 2: missed at most 10 scans, once per 10 minutes
CLASS 3: missed at most 20 scans, once per hour
CLASS 4: missed at most 30 scans, once per day
CLASS 5: missed at most 40 scans, once per week
CLASS 6: status unknown (e.g. new address), scanned manually
CLASS 7: manual scan failed, scanned manually in exception mode
* last total points
* last complete list of player/point combination's
* last 3 number of player measurements (current, previous, one before that), the median of those 3 is the number of players that is assumed to be on this server for long term statistics, e.g. to ignore map changes somehow other stat sites do not seem to take this into account
* average number of players per 10 minutes for the last 25 hours (compressed into 250 bytes, compression is based on a logarithmic scale)
* average number of players per hour for the last 32 days (compressed into 768 bytes)
* average number of players per day for the last 365 days (compressed into 365 bytes)
* average number of players per week for ever and ever (compressed into 1 byte per week)
* server rank for the last 55 weeks (compressed into 110 bytes, max rank being 50.000)
For all weeks (including current), each player, each server: MYSQL
* estimate total minutes played
* estimate total points collected
* ELO, CLQ1 and CLQ2 position
For current week, each player, each server: HYPERSTORE
* total minutes measured
* total game starts (assume 60 seconds of unseen game play per start)
* total points collected
* current ELO rating (the average ELO rating of all players compared with your own ELO rating to determine where you should have ended, example if you end #10 with 10 players each having 1000 your rating will become 888, see also:
http://www.kosteniuk.com/EloCalc/elo.php)
* CLQ1: top 10 segments of 720 seconds with a an estimate of points per second for that segment
* CLQ2: top 10 relative game rankings (You take the number of points of the worst player of the best 25% players, take the number of players who have at least 25% of the points this player has, this number is the amount of points the #1 player gets. The #2 player gets 1 points less, etc. Of these points the top 10 (best 10 games in this week) is kept. So the general idea is that the number of "serious" players you have beaten determines how well you played. Since this is complicated an example:
#1 - 120
#2 - 100
#3 - 90
#4 - 89
#5 - 70
#6 - 40
#7 - 30
#8 - 20
#9 - 12
#10 - 3
#11 - 1
#12 - 0
The worst player of the best 25% (top 3 in this case) has 90 points. 25% of 90 is 22.5 so we only look at the top 8 players and ignore the bottom 4 players. So player #1 gets 8 points for this game, player #2 gets 7 points for this game, etc.)
Remarks:* since the entire server state can be compared players entering and leaving can be detected
* if a server is invisible for > 720 seconds, assume all players have left and entered
* if the total points on the server is reduced a lot (meaning a new round has started) collect the last complete list of player/point combination's to update the stats (ELO and CLQ2)