Skip to content

Shorten storyboard sprite lifetimes during gameplay to reduce stutter#38012

Draft
SK-la wants to merge 3 commits into
ppy:masterfrom
SK-la:Improved-StoryboardSprite-performance
Draft

Shorten storyboard sprite lifetimes during gameplay to reduce stutter#38012
SK-la wants to merge 3 commits into
ppy:masterfrom
SK-la:Improved-StoryboardSprite-performance

Conversation

@SK-la

@SK-la SK-la commented Jun 6, 2026

Copy link
Copy Markdown

Sprites that fade out often keep scale/move transforms running long after they become invisible. EndTimeForDisplay now ends at the last visible alpha (mirroring StartTime), so LifetimeManagementContainer stops updating them.

Gameplay uses a dedicated DrawableStoryboard that enables RemoveCompletedTransforms so finished transforms can be reclaimed; the base type still keeps them for replay seek.

Add StoryboardSpriteLifetimeTest with .osb fixtures using test-image.png to cover decoder paths, invisible-alpha fallback, and drawable LifetimeEnd.

This PR alleviates the issues associated with osu/issues/37952.

Improvements observed under debugging are limited and need to be tested after release. At the point where the problem occurred, the frame rate increased from 10 FPS to 100 FPS, barely maintaining normal input and judgement.

Sprites that fade out often keep scale/move transforms running long after
they become invisible. EndTimeForDisplay now ends at the last visible alpha
(mirroring StartTime), so LifetimeManagementContainer stops updating them.

Gameplay uses a dedicated DrawableStoryboard that enables
RemoveCompletedTransforms so finished transforms can be reclaimed; the base
type still keeps them for replay seek.

Add StoryboardSpriteLifetimeTest with .osb fixtures using test-image.png
to cover decoder paths, invisible-alpha fallback, and drawable LifetimeEnd.
@SK-la

SK-la commented Jun 6, 2026

Copy link
Copy Markdown
Author

After:
image
image

@SK-la

SK-la commented Jun 6, 2026

Copy link
Copy Markdown
Author

Before:
image
image

@EVAST9919

Copy link
Copy Markdown
Contributor

There was an attempt at this by me, which got reverted since lazer and stable handle transforms differently.
I would encourage you to check these prs and the reasoning behind the revert (mostly me not being able to handle all the edge cases). You can find some tests there which must be passed.
#27454
#27753
#27797

Basically this

Next time this optimisation is attempted, a test case needs to be provided for the case broken in #27627 and the further case mentioned in #27753. Neither was done this time around.

Lazer handles transforms differently from stable, and that will likely need to be fixed first otherwise optimisations are more likely to further regress behaviour than not.

SK-la added 2 commits June 7, 2026 15:32
Cover the cases called out in ppy#27797 when ppy#27454 was reverted:
- multi-flash sprites must not end at the first fade-out (ppy#27627)
- later fades with non-zero StartValue must extend display lifetime (ppy#27753)
Cover the original multi-flash fade sequence, visible alpha endings, and drawable animation lifetimes so display truncation cannot regress silently.

The file `osu27627-multi-flash-sprite.osb` directly uses the example from osu#27627, which makes it more intuitive to understand. If these tests prove to be overly complicated, we can remove either one of the `TestOsu27627MultiFlashSpriteLifetime` / `TestMultiFlashSpriteLifetimeIsNotTruncatedAtFirstFadeOut` tests.
@SK-la

SK-la commented Jun 7, 2026

Copy link
Copy Markdown
Author

I found the beatmap mentioned in #27797 on the official website: https://osu.ppy.sh/beatmapsets/1388590#osu/2867851 (it should be the same one).

The original client is 2026.525.0-tachyon. In the same position, it is like this:
image

I need to further test the storyboard.

@SK-la

SK-la commented Jun 7, 2026

Copy link
Copy Markdown
Author

I found the beatmap mentioned in #27797 on the official website: https://osu.ppy.sh/beatmapsets/1388590#osu/2867851 (it should be the same one).

The original client is 2026.525.0-tachyon. In the same position, it is like this: image

I need to further test the storyboard.

The current PR version looks like this:
image

Regarding #27797, further testing revealed that the current PR introduces a new issue: truncating lifetime + RemoveCompletedTransforms causes some wizard images to fail to display again.

So this PR temporarily does not meet the merge requirements: optimization does not generate a new pending fix.

At present, this PR seems like sacrificing some visual effects in certain scenarios to balance performance, which is not good. It takes some time to try to find new solutions.

@bdach

bdach commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Judging from the last reply in this thread this is not ready. Converting to draft.

@bdach bdach marked this pull request as draft June 9, 2026 09:55
@bdach bdach added type/performance Deals with performance regressions or fixes without changing functionality. area:storyboard labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:storyboard size/L type/performance Deals with performance regressions or fixes without changing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants