Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rounding of slider velocity (when applied as scroll speed) #26616

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

peppy
Copy link
Member

@peppy peppy commented Jan 18, 2024

Was of course only done for the benefit of editor UI controls.

This affects both osu!taiko and osu!mania.

Closes #25862.

TODO:

  • Fix editor scroll speed slider bar adjusting to stupid numbers.

This affects both osu!taiko and osu!mania.

Closes ppy#25862.
@bdach

This comment was marked as outdated.

@bdach

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

@bdach

This comment was marked as outdated.

@bdach

This comment was marked as outdated.

@bdach
Copy link
Collaborator

bdach commented Jan 22, 2024

Note that I'm not PRing the osu-queue-score-statistics branch mentioned above (https://github.com/bdach/osu-queue-score-statistics/tree/fix-compile-failure) for now as it'll likely be changing for a second time as migration concerns in #26630 are addressed, so it seems counterproductive.

@bdach
Copy link
Collaborator

bdach commented Jan 22, 2024

Diffcalc runs failed again because the sheet generator is dependent on the old structure of the scores table...

2024-01-22T08:48:19.3728453Z execution-7608342382-7030-1-importer-1   | MySqlConnector.MySqlException (0x80004005): Unknown column 's.legacy_score_id' in 'on clause'
2024-01-22T08:48:19.3730826Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in /_/src/MySqlConnector/Core/ServerSession.cs:line 958
2024-01-22T08:48:19.3733927Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 43
2024-01-22T08:48:19.3736277Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 129
2024-01-22T08:48:19.3739642Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 458
2024-01-22T08:48:19.3743761Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56
2024-01-22T08:48:19.3746777Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 330
2024-01-22T08:48:19.3749152Z execution-7608342382-7030-1-importer-1   |    at MySqlConnector.MySqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 323
2024-01-22T08:48:19.3752047Z execution-7608342382-7030-1-importer-1   |    at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
2024-01-22T08:48:19.3757041Z execution-7608342382-7030-1-importer-1   |    at osu.Server.Queues.ScoreStatisticsProcessor.Commands.Queue.ImportHighScoresCommand.OnExecuteAsync(CancellationToken cancellationToken) in /tmp/tmp.lbIREt40LC/osu-queue-score-statistics/osu.Server.Queues.ScoreStatisticsProcessor/Commands/Queue/ImportHighScoresCommand.cs:line 119
2024-01-22T08:48:19.3761757Z execution-7608342382-7030-1-importer-1   |    at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments)
2024-01-22T08:48:19.3763874Z execution-7608342382-7030-1-importer-1   |    at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken)
2024-01-22T08:48:19.3765877Z execution-7608342382-7030-1-importer-1   |    at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
2024-01-22T08:48:19.3767394Z execution-7608342382-7030-1-importer-1   | --- End of stack trace from previous location ---
2024-01-22T08:48:19.3769461Z execution-7608342382-7030-1-importer-1   |    at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
2024-01-22T08:48:19.3771585Z execution-7608342382-7030-1-importer-1   |    at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context, CancellationToken cancellationToken)
2024-01-22T08:48:19.3774728Z execution-7608342382-7030-1-importer-1   |    at osu.Server.Queues.ScoreStatisticsProcessor.Program.Main(String[] args) in /tmp/tmp.lbIREt40LC/osu-queue-score-statistics/osu.Server.Queues.ScoreStatisticsProcessor/Program.cs:line 27
2024-01-22T08:48:19.3776586Z execution-7608342382-7030-1-importer-1   |    at osu.Server.Queues.ScoreStatisticsProcessor.Program.<Main>(String[] args)

I'm not fixing this on github before smoogi comes back, so I guess I'll have to run any and all sheets locally.

@bdach
Copy link
Collaborator

bdach commented Jan 22, 2024

@peppy
Copy link
Member Author

peppy commented Jan 29, 2024

@bdach I've pushed a WIP fix for the slider bar. See what you think of it. It works fine, except the textbox shows too much precision due to inaccuracies coming from SliderBar's output I guess (and the ToDecimal code):

decimal decimalValue = c.NewValue.ToDecimal(NumberFormatInfo.InvariantInfo);
textBox.Text = decimalValue.ToString($@"N{FormatUtils.FindPrecision(decimalValue)}");

@peppy peppy requested a review from bdach January 29, 2024 07:40
@peppy peppy added the next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! label Jan 29, 2024
@bdach
Copy link
Collaborator

bdach commented Jan 29, 2024

I continue to think that messing with the control is the wrong approach. I would propose this instead of the last commit:

diff --git a/osu.Game/Screens/Edit/Timing/EffectSection.cs b/osu.Game/Screens/Edit/Timing/EffectSection.cs
index 7e484433f7..9d4ef5c62a 100644
--- a/osu.Game/Screens/Edit/Timing/EffectSection.cs
+++ b/osu.Game/Screens/Edit/Timing/EffectSection.cs
@@ -52,17 +52,44 @@ void saveChanges()
 
         protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint?> point)
         {
-            if (point.NewValue != null)
+            if (point.OldValue is EffectControlPoint oldEffectPoint)
+                scrollSpeedSlider.Current.ValueChanged -= updateControlPointFromSlider;
+
+            if (point.NewValue is EffectControlPoint newEffectPoint)
             {
                 isRebinding = true;
 
-                kiai.Current = point.NewValue.KiaiModeBindable;
-                scrollSpeedSlider.Current = point.NewValue.ScrollSpeedBindable;
+                kiai.Current = newEffectPoint.KiaiModeBindable;
+                scrollSpeedSlider.Current = new BindableDouble
+                {
+                    MinValue = 0.01,
+                    MaxValue = 10,
+                    Precision = 0.01,
+                    Value = newEffectPoint.ScrollSpeedBindable.Value
+                };
+                scrollSpeedSlider.Current.ValueChanged += updateControlPointFromSlider;
 
                 isRebinding = false;
             }
         }
 
+        private void updateControlPointFromSlider(ValueChangedEvent<double> scrollSpeed)
+        {
+            if (ControlPoint.Value is not EffectControlPoint effectPoint || isRebinding)
+                return;
+
+            effectPoint.ScrollSpeedBindable.Value = scrollSpeed.NewValue;
+        }
+
         protected override EffectControlPoint CreatePoint()
         {
             var reference = Beatmap.ControlPointInfo.EffectPointAt(SelectedGroup.Value.Time);

It appears to work...? And yes it probably doesn't support undo well but nothing really does right now. We can probably leave a todo for that (and even then it shouldn't be difficult to make work, just do some careful propagation in the converse direction).

@peppy
Copy link
Member Author

peppy commented Jan 29, 2024

That looks far better than what I had if it works 👍 .

@peppy
Copy link
Member Author

peppy commented Jan 29, 2024

@bdach wanna apply your patch? I can't seem to make it apply 😓 .

@bdach
Copy link
Collaborator

bdach commented Jan 29, 2024

Have applied with slight alterations. Turns out the simple unidirectional solution is even enough to support undo for now (albeit, only due to some special circumstances, as per attached inline comment).

@peppy peppy merged commit 811b313 into ppy:master Jan 29, 2024
10 of 11 checks passed
@peppy peppy deleted the dont-round-sv branch February 1, 2024 05:29
bdach added a commit to bdach/osu that referenced this pull request May 28, 2024
Compare: ppy#26616

This came up elsewhere, namely in
ppy#28277 (comment).

As it turns out, at least one beatmap among those whose scores had
unexpected changes in total score, namely
https://osu.ppy.sh/beatmapsets/971028#fruits/2062131, was using slider
velocity multipliers that were not a multiple of 0.01 (the specific
value used was 0.225x). This meant that due to the rounding applied to
`SliderVelocityMultiplierBindable` via `Precision`, the raw value was
being incorrectly rounded, resulting in incorrect conversion.

The "direct" change that revealed this is most likely
ppy/osu-framework#6249, by the virtue of
shuffling the `BindableNumber` rounding code around and accidentally
changing midpoint rounding semantics in the process. But it was not
at fault here, as rounding was just as wrong before that change
as after in this specific context.
TextAdventurer12 pushed a commit to TextAdventurer12/osu that referenced this pull request Jul 6, 2024
Compare: ppy#26616

This came up elsewhere, namely in
ppy#28277 (comment).

As it turns out, at least one beatmap among those whose scores had
unexpected changes in total score, namely
https://osu.ppy.sh/beatmapsets/971028#fruits/2062131, was using slider
velocity multipliers that were not a multiple of 0.01 (the specific
value used was 0.225x). This meant that due to the rounding applied to
`SliderVelocityMultiplierBindable` via `Precision`, the raw value was
being incorrectly rounded, resulting in incorrect conversion.

The "direct" change that revealed this is most likely
ppy/osu-framework#6249, by the virtue of
shuffling the `BindableNumber` rounding code around and accidentally
changing midpoint rounding semantics in the process. But it was not
at fault here, as rounding was just as wrong before that change
as after in this specific context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:gameplay next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

osu!taiko slider velocities are rounded to 2 decimal points, causing patterns to look staggered and unnatural
2 participants