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 storyboard commands occurring before the earliest point of visibility delaying gameplay #11990

Merged
merged 4 commits into from
Mar 11, 2021

Conversation

peppy
Copy link
Member

@peppy peppy commented Mar 9, 2021

In osu-stable, storyboard intros start from the first command, but in the case of storyboard drawables which have an initial hidden state, all commands before the time at which they become visible (ie. the first command where Alpha increases to a non-zero value) are ignored.

This brings lazer in line with that behaviour. It also removes several unnecessary LINQ calls.

Note that the alpha check being done in its own pass is important, as it must be the "minimum present alpha across all command groups, including loops". This is what makes the implementation slightly complex.

Closes #11981.

…lity delaying gameplay

In osu-stable, storyboard intros start from the first command, but in
the case of storyboard drawables which have an initial hidden state, all
commands before the time at which they become visible (ie. the first
command where `Alpha` increases to a non-zero value) are ignored.

This brings lazer in line with that behaviour. It also removes several
unnecessary LINQ calls.

Note that the alpha check being done in its own pass is important, as
it must be the "minimum present alpha across all command groups,
including loops". This is what makes the implementation slightly
complex.

Closes ppy#11981.
{
var first = Alpha.Commands.FirstOrDefault();

return first?.StartValue == 0 ? first.StartTime : (double?)null;
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure this check isn't needed, since a starting alpha command with other start values will still trigger an intro on stable.

In other words, if the starting alpha command starts with say, 1, this will behave as if there are no alpha-affecting commands, when there clearly is at least one.

Copy link
Member

Choose a reason for hiding this comment

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

I also tested when a fade command has both start and end values of 0 before any other fade commands, and it still causes an intro on stable.

Copy link
Member Author

Choose a reason for hiding this comment

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

To confirm, an alpha command starting at 1 makes the sprite invisible before the specified time?

Copy link
Member

@Walavouchey Walavouchey Mar 9, 2021

Choose a reason for hiding this comment

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

No, an alpha command starting at 1 will make the sprite initially visible (starting from first of any of the sprite's commands), 0 to 1 is vice versa.
If it's 0 to 0, it'll be invisible but still affect intro time.

Copy link
Member

@Walavouchey Walavouchey Mar 9, 2021

Choose a reason for hiding this comment

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

I misread the question, updated above comment. Answer is still no.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay sure, but I think this example will still work correctly with my implementation (and going forward, be more correct?).

Is that fail case you mention actually in any beatmap? If not, that's stable implemented incorrectly and should be considered fine to have "fail".

Copy link
Member

Choose a reason for hiding this comment

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

I guess any map with such patterns would simply have more of their storyboarded content visible. Alright then, seems correct.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing that jumped out to me in this thread, about that

If it's 0 to 0, it'll be invisible but still affect intro time.

case: are we talking about something like this?

Sprite,Background,Centre,"SB\leaf.png",320,240
 F,0,-1000,-500,0,0 // fake fade that doesn't do anything
 F,0,-500,0,0,0.5

In that case I'd expect the intro to start at -500 and not -1000, since the first command doesn't actually display the sprite, while it'd be -1000 using the current implementation... Is that something that storyboards rely on to start displaying earlier?

Copy link
Member

@Walavouchey Walavouchey Mar 10, 2021

Choose a reason for hiding this comment

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

Is that something that storyboards rely on to start displaying earlier?

I ran a couple greps for "fades from 0 to 0" in my song folder and found nothing of the sort (among about 530 sets with storyboards). I can't remember any such cases either.

Note that the only use for this would be to extend the intro time earlier than any storyboard sprites are visible, which would only cause a black background at the start (or just the diff background if it wasn't removed in the storyboard). That was basically the exact issue with the storyboard mentioned in #11981 in lazer.

If we're going by the logic of "only visible sprites can affect intro time" as peppy seems to suggest, then yes, that case would contradict that. The question is if it needs to be fixed in this implementation, since I'd wager that nobody uses it based on my sample size (or would need/want to use it).

On another note, checking for instances of the other cases I pointed out earlier would probably take more effort than some greps. Although I could check this programmatically on all the maps I have, I don't find it worth it if we don't care about implementing such hypothetical storyboards 1-to-1 with stable anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an interesting case for sure, but I'd like to hope that's out of scope for the time being (until it arises that it was actually necessary for a ranked beatmap to work as expected).

One would hope that noop transforms like that would be removed by the osu! editor, or whatever scripting program the storyboarder is using.

{
var first = Alpha.Commands.FirstOrDefault();

return first?.StartValue == 0 ? first.StartTime : (double?)null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

One thing that jumped out to me in this thread, about that

If it's 0 to 0, it'll be invisible but still affect intro time.

case: are we talking about something like this?

Sprite,Background,Centre,"SB\leaf.png",320,240
 F,0,-1000,-500,0,0 // fake fade that doesn't do anything
 F,0,-500,0,0,0.5

In that case I'd expect the intro to start at -500 and not -1000, since the first command doesn't actually display the sprite, while it'd be -1000 using the current implementation... Is that something that storyboards rely on to start displaying earlier?

osu.Game/Storyboards/CommandTimelineGroup.cs Outdated Show resolved Hide resolved
Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
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.

Commands on non-visible storyboard sprites can cause an intro when it shouldn't
4 participants