From 78af3ce7b1ede3d35ebf23dccbe3245fdf0894a3 Mon Sep 17 00:00:00 2001 From: Xexxar Date: Tue, 13 Sep 2022 03:04:25 +0000 Subject: [PATCH 1/2] updated score processing code to use new logarithmic sum for pp --- .../UserTotalPerformanceProcessor.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs index 65bdc1cf..93ccea72 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs @@ -121,25 +121,25 @@ public async Task UpdateUserStatsAsync(UserStats userStats, int rulesetId, MySql .ToArray(); // Build the diminishing sum - double factor = 1; + double factor = 120; double totalPp = 0; double totalAccuracy = 0; + double weightTotal = 0; - foreach (var item in groupedItems) + foreach (var (item, i) in groupedItems.Select((value, i) => ( value, i ))) { - totalPp += item.pp!.Value * factor; - totalAccuracy += item.ScoreInfo.Accuracy * factor; - factor *= 0.95; + // This sum is an unbounded logarithmic style summation that uses factor and the index to weight each score. + weight = (1 + factor / (i + 1)) / ((i + 1 + factor / (i + 1)); + totalPp += item.pp!.Value * weight; + totalAccuracy += item.ScoreInfo.Accuracy * weight; + weightTotal += weight; } - // This weird factor is to keep legacy compatibility with the diminishing bonus of 0.25 by 0.9994 each score. - totalPp += (417.0 - 1.0 / 3.0) * (1.0 - Math.Pow(0.9994, groupedItems.Length)); - // We want our accuracy to be normalized. if (groupedItems.Length > 0) { - // We want the percentage, not a factor in [0, 1], hence we divide 20 by 100. - totalAccuracy *= 100.0 / (20 * (1 - Math.Pow(0.95, groupedItems.Length))); + // We want the percentage, not a factor in [0, 1], hence 100 in the numerator. + totalAccuracy *= 100.0 / weightTotal; } userStats.rank_score = (float)totalPp; From 852bfc4552c91c717f070719105f922c5a749f3c Mon Sep 17 00:00:00 2001 From: Xexxar Date: Thu, 15 Sep 2022 15:03:42 +0000 Subject: [PATCH 2/2] updated to latest version of curve --- .../Processors/UserTotalPerformanceProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs b/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs index 93ccea72..86835653 100644 --- a/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs +++ b/osu.Server.Queues.ScoreStatisticsProcessor/Processors/UserTotalPerformanceProcessor.cs @@ -121,7 +121,7 @@ public async Task UpdateUserStatsAsync(UserStats userStats, int rulesetId, MySql .ToArray(); // Build the diminishing sum - double factor = 120; + double factor = 52.5; double totalPp = 0; double totalAccuracy = 0; double weightTotal = 0; @@ -129,7 +129,7 @@ public async Task UpdateUserStatsAsync(UserStats userStats, int rulesetId, MySql foreach (var (item, i) in groupedItems.Select((value, i) => ( value, i ))) { // This sum is an unbounded logarithmic style summation that uses factor and the index to weight each score. - weight = (1 + factor / (i + 1)) / ((i + 1 + factor / (i + 1)); + weight = (1 + Math.Pow(factor / (i + 1), 2)) / (i + 1 + Math.Pow(factor / (i + 1), 2)); totalPp += item.pp!.Value * weight; totalAccuracy += item.ScoreInfo.Accuracy * weight; weightTotal += weight;