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

Avoid updates (and update notifications) from appearing in more gameplay cases #30073

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented Oct 1, 2024

Second attempt at #29657 taking on feedback from #29657 (comment).

  • RFC, haven't tested update flow yet.

Closes #29341.

Comment on lines 391 to 393
BeatmapManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying;
SkinManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying;
ScoreManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying;
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Note that this stops imports from running during break time and on the fail screen, which is an extra win.

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.

just a cursory read of structure, haven't examined the logic in detail yet (or tested)


namespace osu.Game.Screens.Play
{
public enum LocalUserPlayingStates
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bit weird for this enum name to be in plural, I'd normally expect LocalUserPlayingState...?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

I originally had it plural to avoid the classic namespace conflict with field (was called PlayingState). Can go with non-plural not, sure.

@@ -94,6 +94,7 @@ public abstract partial class Player : ScreenWithBeatmapBackground, ISamplePlayb
public IBindable<bool> LocalUserPlaying => localUserPlaying;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd argue this should no longer be public (or even exist).

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Yeah, it's gonna touch a lot of tests though (take a quick look and see if you thing it's worth it)

Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as I can see the extent of it is mostly asserts, right? If that is accurate then I think it's worth getting rid just to lower the redundancy around here. I'll have to cross-check all of the existing conditional changes anyway to make sure nothing slipped by so that seems like a rather minor inconvenience from both authoring and reviewing angles.

Comment on lines 393 to 394
// For scores, we need to allow imports during "Break" state else local user's scores will never be imported.
ScoreManager.PauseImports = p.NewValue == LocalUserPlayingStates.Playing;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is weird, can the state not transition to NotPlaying on gameplay completion or something?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Can try and make that happen sure.

@@ -508,7 +508,7 @@ private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)

private void updateGameplayState()
{
bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value;
bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value && !GameplayState.HasPassed;
bool inBreak = breakTracker.IsBreakTime.Value || DrawableRuleset.IsPaused.Value || GameplayState.HasFailed;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm with failing being considered as "break" I'm not sure the ScoreManager.PauseImports change is entirely correct. I'd say any sort of gameplay completion should transition the state to NotPlaying...?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

The reason I didn't originally add failing is that I thought we'd want things like imports to stay blocked while at the fail screen (else they may continue into the start of the next play). I think it's also quite crippling when imports run during HighPerformanceSession. But maybe this is an edge case we just allow to happen for now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

we'd want things like imports to stay blocked while at the fail screen

Except for the part where you can request the failed play to be imported at the fail screen which will presumably deadlock now.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Yeah, probably need a test and just doing as you say for now.

@bdach
Copy link
Collaborator

bdach commented Oct 4, 2024

Not sure of the status or urgency of this, are you looking to still check off the todo item in the OP or should I consider doing so part of review?

@peppy
Copy link
Sponsor Member Author

peppy commented Oct 4, 2024

I'll test this now, forgot.

@peppy
Copy link
Sponsor Member Author

peppy commented Oct 4, 2024

In testing it looks to work as expected.

Tested using inserted Task.Delay() to make sure I had enough time to get to gameplay. If you test, it's as simple as running dotnet run on osu-deploy and "installing" the game (however that is required by your testing platform).

We have downgrades enabled so it will detect the last published version and start to download / update to it.

@peppy peppy added next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! and removed next release Pull requests which are almost there. We'll aim to get them in the next release, but no guarantees! labels Oct 4, 2024
Comment on lines 14 to 15
private Bindable<bool> localUserPlaying = null!;
private IBindable<LocalUserPlayingStates> localUserPlaying = null!;
Copy link
Contributor

@smoogipoo smoogipoo Oct 7, 2024

Choose a reason for hiding this comment

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

What happened here? The class doesn't exist? See android build failure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably something something missed in the rename because osu.Desktop.slnf.

Suggested change
private Bindable<bool> localUserPlaying = null!;
private IBindable<LocalUserPlayingStates> localUserPlaying = null!;
private Bindable<bool> localUserPlaying = null!;
private IBindable<LocalUserPlayingState> localUserPlaying = null!;

probably fixes.

@smoogipoo smoogipoo self-requested a review October 7, 2024 07:45
At this point the update is already started in the background but I
guess we can still block the notification from interrupting the user.
@smoogipoo
Copy link
Contributor

From a structural perspective, I really really don't like this one.

We have way too many states flying around right now:

Resulting in a 19 file diff that is pretty rough to review.

Not mentioned here: what is a "local user playing state"? why is it not a "gameplay state"? we already have a GameplayState why can't that be used? do we really need to wrap one bindable in an interface like this?

While I'm going to grit my teeth and continue powering through this one given that it's the second attempt, in the future I suggest we use SessionStatics for this.

smoogipoo
smoogipoo previously approved these changes Oct 7, 2024
A `false` value marks the user as being on the latest release, and
notifies them as such when clicking the button in settings. In reality,
we don't know whether this is the case yet - we're just deferring the
check.

Somewhat minor change because the chance of a user manually going into
settings and clicking the button is very small.
@smoogipoo
Copy link
Contributor

Have made a few changes here, please check the last few commits @peppy

@@ -10,7 +10,7 @@ namespace osu.Game.Input
{
public partial class OsuUserInputManager : UserInputManager
{
protected override bool AllowRightClickFromLongTouch => PlayingState.Value == LocalUserPlayingState.NotPlaying;
protected override bool AllowRightClickFromLongTouch => PlayingState.Value != LocalUserPlayingState.Playing;
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Arguable. I set this to avoid the silly hold ring from showing during breaks. And there's nothing at pause / fail that needs right click.

But if you feel strong about this then I'm fine with this change I guess.

Prefer review comments for stuff like this instead

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.

Notifications can kick players from live games
3 participants