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

Adjust catch playfield and catcher layout to further match osu!(stable) #24895

Closed
wants to merge 8 commits into from

Conversation

frenzibyte
Copy link
Member

@frenzibyte frenzibyte commented Sep 23, 2023

This PR is not quite final, but I've spent so much time on this hitting many dead-ends to the point I thought opening a PR and leaving it for someone else to provide a better idea would be wiser (it hurts to give up, but I've never been good at this kind of stuff in the first place).

Some of the changes in here may not make any sense, but that's as far as I could go with them. I'll briefly explain each commit in here.

Adjust catcher origin position to match 1:1 with stable

In stable, the catcher's origin position is always set to Y = 16, as per the following code:

CleanShot 2023-09-23 at 23 52 52@2x

We cannot immediately use that number in SkinnableCatcher, because we use dimensions that are technically different from stable (they're same as stable but with stable scale numbers factored in). The factor to convert from stable dimensions to lazer dimensions is basically 0.35x, see this xmldoc and stable's definition of catcherWidth for more information.

We can simply convert stable's origin position using that factor, resulting in Y = 5.6, dividing by BASE_SIZE results in Y = ~0.525

Fix legacy catcher sprites getting shrunk

This is a no-brainer, stable doesn't resize any of its sprites, meanwhile lazer is shrinking them down to fit the catcher's catching range boundaries (i.e. BASE_SIZE).

Adjust catch playfield layout to further match stable

This is where things get quite quirky. In stable, the playfield is positioned vertically at essentially 18.75% of the window's height (see this note and stable's code).

This must be done in osu!(lazer) in order for the catcher's positioning to match stable.

But it's actually not enough...

CleanShot 2023-09-24 at 00 13 15@2x

...the above is also required for the catcher's position to get as close to stable as possible, and I cannot say anything beyond that I only got that value from eyeballing the catcher between stable and lazer.

That offset sounds redundant, but it shows that this whole change is not enough, or that it's misguided for a certain reason.


I could go ahead and revert all changes other than the one that actually fixes catcher size being different on legacy skins, but I'm not sure how gameplay would sit with catch players once lazer goes ranked, so I thought it's better to focus on matching playfield layout with stable as well.

@peppy
Copy link
Sponsor Member

peppy commented Sep 26, 2023

@frenzibyte This needs revisiting, not sure if due to #24706 being merged or due to the catcher not being limited by that PR, but:

osu Game Tests 2023-09-26 at 08 32 48

@peppy
Copy link
Sponsor Member

peppy commented Sep 29, 2023

To elaborate on the above: maybe this is "correct" behaviour based on the classic skin's sprite offsets, but needs to be double-checked.

@frenzibyte
Copy link
Member Author

From a quick glance at what's happening, that looks to be indeed "correct" behaviour. In osu!(stable), the origin position of the catcher is set to exactly 16 pixels from the top of the sprite (in 1x version, where catcher is 306x320), regardless of its height or anything else.

Also confirmed visually by scaling sprite to 8x its size and checking in gameplay on stable:

CleanShot 2023-09-30 at 00 25 15@2x

@bdach bdach self-requested a review October 3, 2023 06:05
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
OriginPosition = new Vector2(0.5f, 0.06f) * Catcher.BASE_SIZE;
// Sets the origin to the top of the catcher's plate to allow for correct scaling.
OriginPosition = new Vector2(0.5f, 0.0525f) * Catcher.BASE_SIZE;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The derivation of this 0.0525f magic constant should be spelled out in comments. I refuse to spend time on reconstructing the math. The OP only links random xmldoc:

see this xmldoc and stable's definition of catcherWidth for more information.

I don't know how you get from any of these above to 0.0525f.

If you have this stuff calculated and cross-referenced already, the least you can do is to provide it for double-checking.

Copy link
Member Author

Choose a reason for hiding this comment

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

This part is ballparked and can be reverted I believe, the comment already states it's a close value, but I guess that's not quite clear.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

@frenzibyte Are you going to redo visual comparisons after attempting the revert?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, yeah.

Comment on lines +18 to +20
// stable applies a 0.5x factor to all gamefield sprites (assuming game field is 512x384),
// and also a constant 0.7x factor for catcher sprites specifically.
Scale = new Vector2(0.5f * 0.7f);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where are these factors in stable code?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have opened this PR before we seemed to have allowed referencing osu!(stable) code over the codebase (in a recently merged PR that I have forgot its name), so I did not reference by line.

Comment on lines +57 to +58
// there is no explanation to this offset, but applying it brings lazer nearly 1:1 with stable.
const float stable_offset = 6f;
Copy link
Collaborator

Choose a reason for hiding this comment

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

May have something to do with #9763. That said I can't find the original offset in stable source so may be a red herring.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Question is, if this is the same thing then which out of 6 and 8 are more correct. I highly doubt it differs per ruleset.

Copy link
Member Author

@frenzibyte frenzibyte Oct 3, 2023

Choose a reason for hiding this comment

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

Hmm, you may be onto something. I'll look into this further more, there is something I want to check.

Copy link
Collaborator

Choose a reason for hiding this comment

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

"6" was apparently ballparked. So I'm betting on the fact that one (or both?) values were ballparked.

Copy link
Member Author

@frenzibyte frenzibyte Oct 7, 2023

Choose a reason for hiding this comment

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

Turns out the vertical offset that is applied in osu! ruleset is specific to it, stable does not apply any similar adjustment to catch (see this).

@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 4, 2023
@@ -81,5 +83,11 @@ private void load()
},
};
}

protected override void Update()
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Surely this can be avoided by adjusting the visual elements to use centre origin...

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't look too much, you might have better clues on how this one can be adjusted than I do.

@frenzibyte
Copy link
Member Author

I am going to close this PR as I have figured out the source of the discrepancy and want to split the changes such as the playfield layout change becomes a follow-up of all the other changes, in order to help with review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

osu!catch catcher size does not match stable
3 participants