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

Fix bulbs on Catmull sliders #27734

Merged
merged 3 commits into from Apr 10, 2024
Merged

Fix bulbs on Catmull sliders #27734

merged 3 commits into from Apr 10, 2024

Conversation

smoogipoo
Copy link
Contributor

Fixes #27712

For those with access, the optimisation I'm referring to is here: https://github.com/peppy/osu-stable-reference/blob/e53980dd76857ee899f66ce519ba1597e7874f28/osu!/GameplayElements/HitObjects/Osu/SliderOsu.cs#L1145-L1184

I'm not sure how I could ever add tests for this. If tests are necessary then please give a suggestion for what I could assert.

@smoogipoo
Copy link
Contributor Author

!diffcalc

Not sure if this will show any differences, but worth a shot...

Comment on lines +328 to +333
// At draw time, osu!stable optimises paths by only keeping piecewise segments that are 6px apart.
// For the most part we don't care about this optimisation, and its additional heuristics are hard to reproduce in every implementation.
//
// However, it matters for Catmull paths which form "bulbs" around sequential knots with identical positions,
// so we'll apply a very basic form of the optimisation here and return a length representing the optimised portion.
// The returned length is important so that the optimisation doesn't cause the path to get extended to match the value of ExpectedDistance.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that "At draw time" implies that the path normally doesn't have this optimisation applied. This actually has an effect.

In osu!stable the ball behaves like this:

2024-03-27.04-13-34.mp4

Notice how it does the weird loop at the knot, where there is technically still a bulb there. In osu!lazer it behaves like this:

2024-03-27.04-16-47.mp4

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a visual pass, it looks like stable is taking longer at the "bulb" points while lazer isn't. So before I dive into the code, can you explain where the extra time is spent in lazer? Or does the slider just get marginally shorter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the extra time is spent at the end of the slider in lazer, going by how it slows down.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this is what we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say that this behaves better than stable, but I'm still thinking about it

Technically it's possible to mimic stable's behaviour more closely, but I want to see how the other rulesets work in diffcalc first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still what we want. Applying the optimisation later on (in GetPathToProgress) would cause it to be applied to non-Catmull segments. This is probably the best that can reasonably be done.

That being said, the diffcalc sheet showed changes in catch which I didn't like. I've changed it to only apply the optimisation in the osu ruleset.

Copy link
Collaborator

@bdach bdach Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what I'm getting out of this review thread is...

  • Stable approximates the path in the same way that lazer does (in a way that affects all segment types, but catmull particularly as it's prone to these "bulbs"), but then it happens to delete the "bulbs" on catmull sliders as an optimisation, but it only does so at the point of displaying the slider path specifically, so actual input tracking uses the "bulbed" slider path.
  • lazer displays the approximated path as it was given it, i.e. with "bulbs", but the input handling is consistent with the visuals.

Is that understanding correct?

In that case I'm not thoroughly convinced that lazer needs changing here. To use an analogy, to me this is a bit like that "fake slider follow circle radius" thing wherein stable lies with its visuals as to how large the follow circle really is.

Classic mod toggle, maybe...?

Copy link
Contributor Author

@smoogipoo smoogipoo Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it only does so at the point of displaying visuals, so actual input tracking uses the "bulbed" slider path.

Correct.

but catmull particularly as it's prone to these "bulbs"), but then it happens to delete the "bulbs" on catmull sliders as an optimisation

The optimisation targets every path type and only deletes the bulbs by sheer luck. I'd actually say that the optimisation is more aggressive for other path types, but I digress. You can still bend the sliders to certain degrees and have the bulbs pop out again.

The optimisation traces back to the very beginnings of osu! (2007-09-02) likely targeted at improving performance more-so than visuals, because it was batched along with another that made sliders use AA'd paths (a6fe6288c026a3efc485981bcf2f76b9b29e377e):

(+) Sliders look a LOT nicer. Performance should be considerably higher too - although I still believe I have a bit of work to do in this area.

image
(2007-08-26, credit to osekai)

Classic mod toggle, maybe...?

I don't feel okay with maps looking weird just because they were using an old algorithm. I think for all intents and purposes this should be considered as part of the algorithm. Furthermore, as mentioned in #27711, there are even recent maps using Catmull.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to sum up, the effect of this change is such that visuals on lazer will now match stable, but the actual input handling will be slightly different (because lazer will still handle input to match what it displays, it doesn't do the dumb games stable does with showing one path and using another for input).

I think I could be fine with that, personally. I definitely don't want to play the stable dumb games, so it's either this PR or nothing as far as I'm concerned. @peppy thoughts?

@frenzibyte frenzibyte added area:beatmap-parsing .osu file format parsing and removed area:beatmap-parsing .osu file format parsing labels Mar 26, 2024
@frenzibyte frenzibyte requested a review from a team March 26, 2024 20:27
@smoogipoo
Copy link
Contributor Author

!diffcalc

Copy link

github-actions bot commented Mar 27, 2024

@smoogipoo
Copy link
Contributor Author

I've looked at some of the maps in the sheet above but I can't spot any differences. The differences are within error margins though - I don't think they're too important to care about.

@smoogipoo
Copy link
Contributor Author

!diffcalc
RULESET=taiko

@smoogipoo
Copy link
Contributor Author

!diffcalc
RULESET=catch

@smoogipoo
Copy link
Contributor Author

!diffcalc
RULESET=mania

Copy link

github-actions bot commented Mar 28, 2024

Copy link

github-actions bot commented Mar 28, 2024

Copy link

github-actions bot commented Mar 28, 2024

@smoogipoo smoogipoo added the blocked Don't merge this. label Mar 28, 2024
@smoogipoo
Copy link
Contributor Author

!diffcalc
RULESET=catch

Copy link

github-actions bot commented Apr 1, 2024

@bdach
Copy link
Collaborator

bdach commented Apr 2, 2024

Is this still blocked?

@smoogipoo smoogipoo removed the blocked Don't merge this. label Apr 2, 2024
@smoogipoo
Copy link
Contributor Author

Nope, my bad.

bdach
bdach previously approved these changes Apr 10, 2024
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me

@bdach bdach enabled auto-merge April 10, 2024 09:25
@bdach bdach disabled auto-merge April 10, 2024 09:39
@bdach bdach dismissed their stale review April 10, 2024 09:39

actually wait...

@bdach
Copy link
Collaborator

bdach commented Apr 10, 2024

Never mind. Was looking at conversion mappings for #27822 and saw some stuff I did not like but it was just a few slider ticks moving around on some funky catmull sliders so seems fine.

@bdach bdach merged commit b559bec into ppy:master Apr 10, 2024
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:beatmap-parsing .osu file format parsing size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catmull sliders with anchored points look incorrect compared to stable
4 participants