Question

I have a problem with a ranking system I am using.

Scenario:

An online game with around 10k players calculates a real time ranking of points when a certain event occurs. Events don't occur that often, around 1 time per minute. This ranking is kept in the cache for quick calculations, sorting and access.

Now players can form groups and play against each other, but the scoring system is the same, only the ranking is based for the players in that group.

At first I created for every group a separate ranking, effectively having the same scores as the complete ranking, but with different positions in the ranking.

This is trivial because there are over 1.000 groups and every time an event occurs all the groups would have to be updated.

So what I did now is when the group ranking is requested take only the players that are in that group from the complete ranking and show them. The positions would have to be re-counted.

That re-counting is where the problem is. Because the sub-list is by-reference from the complete ranking list I cannot change the position of the player in the sub-ranking without updating it in the complete ranking, because it's just a reference.

I came up with two solutions:

  • Create a copy from the record every time it is requested and do some output caching (not very desirable because the rankings are live)
  • Create a copy and store this in a cache which is reset when an event occurs.
  • Create a sub-list with just the positions which is updated when an event occurs.

And the last solution: do the position counting in the output instead in the business side. This would be the best solution, only problem is that on some pages this text appears: "You are on position # in the ranking" where # is your ranking position. This number would be tedious to get then.

Does anybody have any suggestions to this problem?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top