From 5978983e4948c9c9fad9224170237a986631f799 Mon Sep 17 00:00:00 2001 From: Ayaka-chan-24 <72512337+Ayaka-chan-24@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:06:56 +0900 Subject: [PATCH 1/5] Add PP Calculation - Added pp calculation from osu!catch - Added multiplication by clockrate to StarRating --- .../SentakkiDifficultyAttributes.cs | 24 ++++++++++ .../SentakkiDifficultyCalculator.cs | 6 ++- .../SentakkiPerformanceAttributes.cs | 26 ++++++++++ .../SentakkiPerformanceCalculator.cs | 47 +++++++++++++++++++ 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyAttributes.cs create mode 100644 osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceAttributes.cs create mode 100644 osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyAttributes.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyAttributes.cs new file mode 100644 index 000000000..5728d5d3c --- /dev/null +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyAttributes.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; + +namespace osu.Game.Rulesets.Sentakki.Difficulty +{ + public class SentakkiDifficultyAttributes : DifficultyAttributes + { + public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() + { + foreach (var attribute in base.ToDatabaseAttributes()) + yield return attribute; + + yield return (ATTRIB_ID_DIFFICULTY, StarRating); + } + + public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) + { + base.FromDatabaseAttributes(values, onlineInfo); + + StarRating = values[ATTRIB_ID_DIFFICULTY]; + } + } +} diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyCalculator.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyCalculator.cs index 8ff9f20b0..619a7aa32 100644 --- a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiDifficultyCalculator.cs @@ -19,9 +19,11 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat { int maxCombo = beatmap.GetMaxCombo(); - return new DifficultyAttributes + double baseSR = beatmap.BeatmapInfo.StarRating * clockRate; + + return new SentakkiDifficultyAttributes { - StarRating = beatmap.BeatmapInfo.StarRating * 1.25f, // Inflate SR of converts, to encourage players to try lower diffs, without hurting their fragile ego. + StarRating = baseSR * 1.25f, // Inflate SR of converts, to encourage players to try lower diffs, without hurting their fragile ego. Mods = mods, MaxCombo = maxCombo }; diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceAttributes.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceAttributes.cs new file mode 100644 index 000000000..ee42fcca0 --- /dev/null +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceAttributes.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Game.Rulesets.Difficulty; + +namespace osu.Game.Rulesets.Sentakki.Difficulty +{ + public class SentakkiPerformanceAttributes : PerformanceAttributes + { + [JsonProperty("base_pp")] + public double Base_PP { get; set; } + + [JsonProperty("length_bonus")] + public double Length_Bonus { get; set; } + + public override IEnumerable GetAttributesForDisplay() + { + foreach (var attribute in base.GetAttributesForDisplay()) + { + yield return attribute; + } + + yield return new PerformanceDisplayAttribute(nameof(Base_PP), "Base PP", Base_PP); + yield return new PerformanceDisplayAttribute(nameof(Length_Bonus), "Length Bonus", Length_Bonus); + } + } +} diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs new file mode 100644 index 000000000..c78256b7a --- /dev/null +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Platform; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Screens.Play.HUD; +using osu.Game.Screens.Ranking.Expanded.Statistics; + + +namespace osu.Game.Rulesets.Sentakki.Difficulty +{ + public class SentakkiPerformanceCalculator : PerformanceCalculator + { + + public SentakkiPerformanceCalculator() + : base(new SentakkiRuleset()) { } + + protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes) + { + var sentakkiAttributes = (SentakkiDifficultyAttributes)attributes; + double accuracy = score.Accuracy; + int countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss); + + double multiplier = 1.0f; + double baseValue = Math.Pow(5.0f * Math.Max(1.0f, sentakkiAttributes.StarRating / 0.0049f) - 4.0f, 2.0f) / 100000.0f; + double value = baseValue; + double lengthBonus = 0.95 + 0.3 * Math.Min(1.0, sentakkiAttributes.MaxCombo / 2500.0) + (sentakkiAttributes.MaxCombo > 2500 ? Math.Log10(sentakkiAttributes.MaxCombo / 2500.0f) * 0.475f : 0.0f); + value *= lengthBonus; + value *= Math.Pow(0.97, countMiss); + if (sentakkiAttributes.MaxCombo > 0) + value *= Math.Min(Math.Pow(score.MaxCombo, 0.35f) / Math.Pow(sentakkiAttributes.MaxCombo, 0.35f), 1.0f); + value *= Math.Pow(accuracy, 5.5); + double totalValue = value * multiplier; + + return new SentakkiPerformanceAttributes + { + Base_PP = baseValue, + Length_Bonus = lengthBonus, + Total = totalValue + }; + } + } +} From 04e622511901cb71609dced4ca74977216fa1b11 Mon Sep 17 00:00:00 2001 From: Ayaka-chan-24 <72512337+Ayaka-chan-24@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:08:07 +0900 Subject: [PATCH 2/5] Delete SentakkiPerformanceCalculator.cs This file has been moved to the "Difficulty" folder --- .../SentakkiPerformanceCalculator.cs | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 osu.Game.Rulesets.Sentakki/SentakkiPerformanceCalculator.cs diff --git a/osu.Game.Rulesets.Sentakki/SentakkiPerformanceCalculator.cs b/osu.Game.Rulesets.Sentakki/SentakkiPerformanceCalculator.cs deleted file mode 100644 index 3aab22889..000000000 --- a/osu.Game.Rulesets.Sentakki/SentakkiPerformanceCalculator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using osu.Game.Rulesets.Difficulty; -using osu.Game.Scoring; - -namespace osu.Game.Rulesets.Sentakki -{ - public class SentakkiPerformanceCalculator : PerformanceCalculator - { - public SentakkiPerformanceCalculator(SentakkiRuleset ruleset) - : base(ruleset) - { - } - - // TODO: Create an actual performance calculator - protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes) => new PerformanceAttributes { Total = 0 }; - } -} From b9801ebe6128f2b7a3e92a00afe3b756600d6b16 Mon Sep 17 00:00:00 2001 From: Ayaka-chan-24 <72512337+Ayaka-chan-24@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:08:59 +0900 Subject: [PATCH 3/5] Update SentakkiRuleset.cs --- osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs b/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs index b95b159d5..20e4c0996 100644 --- a/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs +++ b/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs @@ -69,7 +69,7 @@ public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new SentakkiReplayFrame(); - public override PerformanceCalculator CreatePerformanceCalculator() => new SentakkiPerformanceCalculator(this); + public override PerformanceCalculator CreatePerformanceCalculator() => new SentakkiPerformanceCalculator(); public override IEnumerable GetModsFor(ModType type) { From dc1595034d361d018d512649f581d6927b6e3d44 Mon Sep 17 00:00:00 2001 From: Ayaka-chan-24 <72512337+Ayaka-chan-24@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:44:27 +0900 Subject: [PATCH 4/5] Update SentakkiPerformanceCalculator.cs --- .../Difficulty/SentakkiPerformanceCalculator.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs index c78256b7a..b73fd43b1 100644 --- a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs @@ -15,7 +15,6 @@ namespace osu.Game.Rulesets.Sentakki.Difficulty { public class SentakkiPerformanceCalculator : PerformanceCalculator { - public SentakkiPerformanceCalculator() : base(new SentakkiRuleset()) { } @@ -26,9 +25,9 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s int countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss); double multiplier = 1.0f; - double baseValue = Math.Pow(5.0f * Math.Max(1.0f, sentakkiAttributes.StarRating / 0.0049f) - 4.0f, 2.0f) / 100000.0f; + double baseValue = Math.Pow((5.0f * Math.Max(1.0f, sentakkiAttributes.StarRating / 0.0049f)) - 4.0f, 2.0f) / 100000.0f; double value = baseValue; - double lengthBonus = 0.95 + 0.3 * Math.Min(1.0, sentakkiAttributes.MaxCombo / 2500.0) + (sentakkiAttributes.MaxCombo > 2500 ? Math.Log10(sentakkiAttributes.MaxCombo / 2500.0f) * 0.475f : 0.0f); + double lengthBonus = 0.95 + ((0.3 * Math.Min(1.0, sentakkiAttributes.MaxCombo / 2500.0)) + (sentakkiAttributes.MaxCombo > 2500 ? Math.Log10(sentakkiAttributes.MaxCombo / 2500.0f) * 0.475f : 0.0f)); value *= lengthBonus; value *= Math.Pow(0.97, countMiss); if (sentakkiAttributes.MaxCombo > 0) From 863422199d14321caf19cc15d82e2eaf8ea35623 Mon Sep 17 00:00:00 2001 From: Ayaka-chan-24 <72512337+Ayaka-chan-24@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:17:29 +0900 Subject: [PATCH 5/5] Update SentakkiPerformanceCalculator.cs - Add combo progress instead of strain (Will be removed when difficulty calculation is implemented) - Delete unnecessary usings --- .../Difficulty/SentakkiPerformanceCalculator.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs index b73fd43b1..8582a1fde 100644 --- a/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Sentakki/Difficulty/SentakkiPerformanceCalculator.cs @@ -1,14 +1,8 @@ using System; using System.Collections.Generic; -using System.Linq; -using osu.Framework.Platform; using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -using osu.Game.Screens.Play; -using osu.Game.Screens.Play.HUD; -using osu.Game.Screens.Ranking.Expanded.Statistics; namespace osu.Game.Rulesets.Sentakki.Difficulty @@ -24,7 +18,6 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s double accuracy = score.Accuracy; int countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss); - double multiplier = 1.0f; double baseValue = Math.Pow((5.0f * Math.Max(1.0f, sentakkiAttributes.StarRating / 0.0049f)) - 4.0f, 2.0f) / 100000.0f; double value = baseValue; double lengthBonus = 0.95 + ((0.3 * Math.Min(1.0, sentakkiAttributes.MaxCombo / 2500.0)) + (sentakkiAttributes.MaxCombo > 2500 ? Math.Log10(sentakkiAttributes.MaxCombo / 2500.0f) * 0.475f : 0.0f)); @@ -33,7 +26,11 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s if (sentakkiAttributes.MaxCombo > 0) value *= Math.Min(Math.Pow(score.MaxCombo, 0.35f) / Math.Pow(sentakkiAttributes.MaxCombo, 0.35f), 1.0f); value *= Math.Pow(accuracy, 5.5); - double totalValue = value * multiplier; + //Until difficulty calculation is implemented, + //multiply combo progress instead of strain. + //(I think it is strange that the first combo gets 600pp.) + double comboProgress = (double)sentakkiAttributes.MaxCombo / score.GetMaximumAchievableCombo(); + double totalValue = value * comboProgress; return new SentakkiPerformanceAttributes {