SuperTuxKart
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
Ranking Class Reference

Public Member Functions

void computeNewRankings (std::vector< RaceResultData > &data, bool time_trial)
 Compute the new player's rankings used in ranked servers.
 
void cleanup ()
 
void fill (uint32_t online_id, const XMLNode *result, std::shared_ptr< NetworkPlayerProfile > npp)
 
bool has (uint32_t online_id)
 
double getDelta (uint32_t online_id)
 
const RankingEntry getScores (uint32_t online_id) const
 
const RankingEntry getTemporaryPenalizedScores (uint32_t online_id) const
 

Static Private Member Functions

static double getModeFactor (bool time_trial)
 Returns the mode race importance factor, used to make ranking move slower in more random modes.
 
static double getModeSpread (bool time_trial)
 Returns the mode spread factor, used so that a similar difference in skill will result in a similar ranking difference in more random modes.
 
static double getTimeSpread (double time)
 Returns the time spread factor. More...
 
static double scalingValueForTime (double time)
 Compute the scaling value of a given time This is linear to race duration, getTimeSpread takes care of expecting a more random result in shorter races.
 
static double computeH2HResult (double player1_time, double player2_time)
 Computes the score of a head-to-head minimatch. More...
 
static double computeDataAccuracy (double player1_rd, double player2_rd, double player1_scores, double player2_scores, int player_count, bool handicap_used)
 Computes a relative factor indicating how much informative value the new race result gives us. More...
 

Private Attributes

std::map< uint32_t, RankingEntryAndProfilem_entries
 
std::map< uint32_t, RankingEntrym_old_entries
 

Member Function Documentation

◆ computeDataAccuracy()

double Ranking::computeDataAccuracy ( double  player1_rd,
double  player2_rd,
double  player1_scores,
double  player2_scores,
int  player_count,
bool  handicap_used 
)
staticprivate

Computes a relative factor indicating how much informative value the new race result gives us.

For a player with a high own rating deviation, the current rating is unreliable so any new data holds more importance. This is crucial to allow reasonably fast rating convergence of new players, provided they play accurately rated opponents.

When the opponent has a high rating deviation, the expected scores are likely off. Therefore, the information from such a result is much less valuable.

We also reduce rating changes when the player ratings are very different, even after considering the uncertainties from rating deviation. This is multi-purpose :

  • With a very high rating difference, random race events (very poor luck, disconnects) are very likely to be the cause of any upset, so the rate of legitimate upsets is unreliable. No rating method is safe.
  • Attempting to "farm" much lower rated players against which a practical 100% winrate may be reached (outside of random events) becomes very ineffective. Instead, to gain rating points, the player has incentive to play well-rated opponents.
  • The primary goal is to ensure that two players of equal rating would be about evenly matched in head-to-head. If two strong players each beat a much weaker third player, very little information is gained on how a direct head-to-head between the strong players would go. For the purposes of this rating computation, we assume that the informational value of a race is roughly proportional to the likelihood of the weaker player winning.

A downside of this method is that a legitimate loss to a much lower rated player won't change the rating much, but these are rare enough that it's better to miss them than to reward "farming" and to incorrectly reward wins due to external factors.

In a race with many players, a single event can have a significant impact on the results of all the H2H. To avoid races with high players count having too strong rating swings, we apply a modifier scaling down accuracy.

Finally, while handicap is allowed in ranked races and a rating offset is applied to keep expected results realistic (without incentivizing playing handicap-only), the results of such races are much less reliable.

◆ computeH2HResult()

double Ranking::computeH2HResult ( double  player1_time,
double  player2_time 
)
staticprivate

Computes the score of a head-to-head minimatch.

If time difference > 2,5% ; the result is 1 (complete win of player 1) or 0 (complete loss of player 1) Otherwise, it is averaged between 0 and 1.

◆ getTimeSpread()

double Ranking::getTimeSpread ( double  time)
staticprivate

Returns the time spread factor.

Short races are more random, so the expected result changes depending on race duration. TODO: collect real-world data on the relationship between race duration and the likelihood of winning of players, and fit the formula based on it.


The documentation for this class was generated from the following files: