From e4ecc305d21623795adcf1e5e25b4cad352ee0b7 Mon Sep 17 00:00:00 2001 From: CupidEXE <109048352+CupidEXE@users.noreply.github.com> Date: Mon, 6 Jul 2026 19:21:41 +0200 Subject: [PATCH] Normalize Scores --- scripts/game/Runner.cs | 16 ++++++++++++++-- scripts/game/ui/Grid.cs | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/game/Runner.cs b/scripts/game/Runner.cs index c7b11711..13361d08 100644 --- a/scripts/game/Runner.cs +++ b/scripts/game/Runner.cs @@ -7,6 +7,8 @@ public partial class Runner : Node3D { + private const uint MaxScore = 1_000_000; + [Signal] public delegate void AttemptStatsUpdatedEventHandler(Attempt attempt); [Signal] public delegate void SkipAvailableEventHandler(Attempt attempt); [Signal] public delegate void HitResultChangedEventHandler(int noteIndex, HitResult hitResult); @@ -439,11 +441,21 @@ public void Stop(bool results = true) } } + public uint CalculateHitScore(float factor, uint comboMultiplier, uint combo, double modsMultiplier) + { + double maxScorePerNote = Attempt?.Map?.Notes.Length > 0 ? MaxScore / (double)Attempt.Map.Notes.Length : 0; + double comboFactor = 1 + combo / 100d; + double speedFactor = ((Speed - 1) / 2.5 + 1); + double rawScore = maxScorePerNote * comboMultiplier * comboFactor * factor * modsMultiplier * speedFactor; + + return (uint)Math.Round(rawScore); + } + private void onHitResultChanged(int noteIndex, HitResult hitResult) { float lateness = Attempt.IsReplay ? Attempt.HitsInfo[noteIndex] : (float)(((int)Attempt.Progress - Attempt.Map.Notes[noteIndex].Millisecond) / Speed); float factor = 1 - Math.Max(0, lateness - 25) / 150f; - uint hitScore = (uint)(100 * Attempt.ComboMultiplier * Attempt.ModsMultiplier * factor * ((Speed - 1) / 2.5 + 1)); + uint hitScore = CalculateHitScore(factor, Attempt.ComboMultiplier, Attempt.Combo, Attempt.ModsMultiplier); switch (hitResult) { @@ -454,7 +466,7 @@ private void onHitResultChanged(int noteIndex, HitResult hitResult) Attempt.Combo++; Attempt.ComboMultiplierProgress++; Attempt.LastHitColour = SkinManager.Instance.Skin.NoteColors[noteIndex % SkinManager.Instance.Skin.NoteColors.Length]; - Attempt.Score += hitScore; + Attempt.Score = Math.Min(MaxScore, Attempt.Score + hitScore); if (!Attempt.IsReplay) { diff --git a/scripts/game/ui/Grid.cs b/scripts/game/ui/Grid.cs index 08045f46..ec7a869d 100644 --- a/scripts/game/ui/Grid.cs +++ b/scripts/game/ui/Grid.cs @@ -43,7 +43,7 @@ private void onHitResultChanged(int noteIndex, HitResult result) { float lateness = Runner.Attempt.IsReplay ? Runner.Attempt.HitsInfo[noteIndex] : (float)(((int)Runner.Attempt.Progress - Runner.Attempt.Map.Notes[noteIndex].Millisecond) / Runner.Speed); float factor = 1 - Math.Max(0, lateness - 25) / 150f; - uint hitScore = (uint)(100 * Runner.Attempt.ComboMultiplier * Runner.Attempt.ModsMultiplier * factor * ((Runner.Speed - 1) / 2.5 + 1)); + uint hitScore = Runner.CalculateHitScore(factor, Runner.Attempt.ComboMultiplier, Runner.Attempt.Combo, Runner.Attempt.ModsMultiplier); switch (result) {