From 7c14fd28ba8f901b9846f90a101dcf2d27be1385 Mon Sep 17 00:00:00 2001 From: Alayan-stk-2 Date: Sat, 9 Jun 2018 10:43:19 +0200 Subject: [PATCH] Ranking formula refinements (#3288) * Reduce the maximum scaling time from 600s to 500s 8m20s is already much longer than nearly all ranked races will be, so it matters most for eliminated players. It would be too punishing if kept to 600 with the new time scaling method. * New helper function for ranking computations * Make short races less important for ranking points And long races more important --- src/network/protocols/server_lobby.cpp | 20 +++++++++++++++----- src/network/protocols/server_lobby.hpp | 3 ++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index 54a12fe85..1699d82e4 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -970,13 +970,13 @@ void ServerLobby::computeNewRankings() { result = 0.0; ranking_importance = mode_factor * - MAX_SCALING_TIME * MAX_POINTS_PER_SECOND * player_factors; + scalingValueForTime(MAX_SCALING_TIME) * player_factors; } else if (!players[j]) { result = 1.0; ranking_importance = mode_factor * - MAX_SCALING_TIME * MAX_POINTS_PER_SECOND * player_factors; + scalingValueForTime(MAX_SCALING_TIME) * player_factors; } else { @@ -994,10 +994,11 @@ void ServerLobby::computeNewRankings() (player1_time - player2_time) / (player2_time / 20.0); result = std::max(0.0, 0.5 - result); } + + float max_time = std::min(std::max(player1_time, player2_time), + MAX_SCALING_TIME); ranking_importance = mode_factor * - std::min( - std::max(player1_time, player2_time), MAX_SCALING_TIME) * - MAX_POINTS_PER_SECOND * player_factors; + scalingValueForTime(max_time) * player_factors; } // Compute the ranking change scores_change[i] += @@ -1070,6 +1071,15 @@ double ServerLobby::getModeSpread() return 1.4; } // getModeSpread +//----------------------------------------------------------------------------- +/** Compute the scaling value of a given time + * Short races are more random, so we don't use strict proportionality + */ +double ServerLobby::scalingValueForTime(float time) +{ + return time * sqrt(time/120.0) * MAX_POINTS_PER_SECOND; +} // scalingValueForTime + //----------------------------------------------------------------------------- /** Manages the distribution of the base points. * Gives half of the points progressively diff --git a/src/network/protocols/server_lobby.hpp b/src/network/protocols/server_lobby.hpp index 4a5823fd4..c4e39b21c 100644 --- a/src/network/protocols/server_lobby.hpp +++ b/src/network/protocols/server_lobby.hpp @@ -106,7 +106,7 @@ private: /* Ranking related variables */ // If updating the base points, update the base points distribution in DB const double BASE_RANKING_POINTS = 4000.0; - const double MAX_SCALING_TIME = 600.0; + const double MAX_SCALING_TIME = 500.0; const double MAX_POINTS_PER_SECOND = 0.125; /** Online id to profile map, handling disconnection in ranked server */ @@ -197,6 +197,7 @@ private: double distributeBasePoints(uint32_t online_id); double getModeFactor(); double getModeSpread(); + double scalingValueForTime(float time); void checkRaceFinished(); public: