Take handicap into account for rankings

This commit is contained in:
Alayan 2019-01-06 18:15:20 +01:00
parent b555851f57
commit 7715c1c505
2 changed files with 8 additions and 0 deletions

View File

@ -1685,6 +1685,8 @@ void ServerLobby::computeNewRankings()
double player1_time = race_manager->getKartRaceTime(i);
double player1_factor =
computeRankingFactor(race_manager->getKartInfo(i).getOnlineId());
double player1_handicap = ( w->getKart(i)->getPerPlayerDifficulty()
== PLAYER_DIFFICULTY_HANDICAP ) ? HANDICAP_OFFSET : 0;
for (unsigned j = 0; j < player_count; j++)
{
@ -1704,6 +1706,8 @@ void ServerLobby::computeNewRankings()
double player2_scores = new_scores[j];
double player2_time = race_manager->getKartRaceTime(j);
double player2_handicap = ( w->getKart(j)->getPerPlayerDifficulty()
== PLAYER_DIFFICULTY_HANDICAP ) ? HANDICAP_OFFSET : 0;
// Compute the result and race ranking importance
double player_factors = std::min(player1_factor,
@ -1751,6 +1755,9 @@ void ServerLobby::computeNewRankings()
// Compute the expected result using an ELO-like function
double diff = player2_scores - player1_scores;
if (!w->getKart(i)->isEliminated() && !w->getKart(j)->isEliminated())
diff += player1_handicap - player2_handicap;
double uncertainty = std::max(getUncertaintySpread(race_manager->getKartInfo(i).getOnlineId()),
getUncertaintySpread(race_manager->getKartInfo(j).getOnlineId()) );

View File

@ -134,6 +134,7 @@ private:
const double BASE_RANKING_POINTS = 4000.0;
const double MAX_SCALING_TIME = 500.0;
const double MAX_POINTS_PER_SECOND = 0.125;
const double HANDICAP_OFFSET = 1000.0;
/** Online id to profile map, handling disconnection in ranked server */
std::map<uint32_t, std::weak_ptr<NetworkPlayerProfile> > m_ranked_players;