Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@minetoblend
Copy link
Contributor

@minetoblend minetoblend commented Aug 28, 2025

Trying to find the cause of this has been haunting me for well over a year now but I finally figured it out: Turns out PooledDrawableWithLifetimeContainer.CheckChildrenLife() is doing things in the wrong order.

Currently, the container first updates its children's alive-status and then updates the lifetime manager, which will add all drawables that should become visible on the current frame. The alive-status of the newly added drawables remains unchanged however and they have to wait until the next update loop for the container to re-run step 1 to become visible.

By reversing the order of those 2 operations the new drawables will get made alive immediately, and will appear on the same frame.

In practice this has very little impact. It's only really noticeable in the editor, and even there a bunch of conditions need to be met to actually notice it:

  • two overlapping hitobjects need to be removed and inserted on the same frame. The overlap is needed so the flicker is actually noticeable
  • if the game runs it's update loop faster than v-sync there's a decent chance the frame this is happening on will be skipped

That being said, those conditions can be met reliably by converting a slider to a stream with the game running in single-threaded mode and with v-sync enabled. I'm also pretty sure it's what caused the flickering in the polygon tool prior to #30214 (see video on the pr).

While the impact is negligible I do think that the current implementation is incorrect and this is worth fixing.

Before

2025-08-28.23-30-03.mp4

After

2025-08-28.23-30-11.mp4

…fe being in wrong order

Previously CompositeDrawable.CheckChildrenLife() would be run before lifetimeManager.Update() which lead to the new drawables being inserted into the container but not being made alive immediately, leading to the drawable not becoming visibile until the next update loop.
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@peppy peppy requested a review from smoogipoo August 29, 2025 05:42
@peppy
Copy link
Member

peppy commented Aug 29, 2025

@smoogipoo requesting a second set of eyes on this since it deals with gameplay drawables and you have pretty good knowledge of the ins and outs here.

Copy link
Contributor

@smoogipoo smoogipoo left a comment

Choose a reason for hiding this comment

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

Makes sense

@smoogipoo smoogipoo merged commit d5575b4 into ppy:master Aug 29, 2025
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants