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: