[erlang-questions] How would you do it?

Wojtek Narczyński <>
Mon Jul 2 21:41:28 CEST 2012


On 2012-07-02 12:29, Max Bourinov wrote:
>
> I need to build a ranking system for online game.
>

If this is a 1 vs 1 game, you might be interested in Elo Rating system. 
If it is team vs. team, it gets more complex.

I am not sure how gamer 4KB Profile fits into ranking. Well, okay, maybe 
it is a good idea to keep gamer profiles and ranks in the same data 
structure, but they don't have to be updated with the same message.

I would expect an interfrace along these lines:
{set_status, GamerID, offline / ready / playing} - info for match making
{get_opponents, GamerID} -> [{OpponentID, Rank}] - select some potential 
opponents, ready to play
{update_rank, MatchID, WinnerID, LooserID} -> {NewWinnerRank, 
NewLooserRank} - ranks after a match, Elo here

Pleasantries (you may not dispense with):
{register, GamerID, Profile}
{unregister, GamerID}
{set_profile, GamerID, Profile}
{get_profile, GamerID} -> Profile
{get_rank, GamerID} -> Rank
{get_top, N} -> [{GamerID, Rank}]

Sorting and searching is going to be the easy part, the performance can 
easily be assessed by an automated test.

I have never done anything even remotely gaming related, so don't listen 
to me.

--Regards,
Wojtek Narczynski



More information about the erlang-questions mailing list