feat: (#3854) add UnifiedAnimationParentComponent , add UnifiedAnimationChildComponent#3855
feat: (#3854) add UnifiedAnimationParentComponent , add UnifiedAnimationChildComponent#3855s1r1m1r1 wants to merge 7 commits intoflame-engine:mainfrom
Conversation
…orrectly handle prefixes and different asset types. [flame-engine#3844]
Prepared all packages to be released to pub.dev Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
spydon
left a comment
There was a problem hiding this comment.
This PR is lacking a description.
Also, we're aiming to not use abbreviations anywhere.
| /// A version of [SpriteAnimationComponent] that uses an external [animationTicker]. | ||
| /// This allows multiple components to share the same ticker, synchronizing | ||
| /// their animations and reducing the number of [update] calls. | ||
| class SynchronizedSpriteAnimationComponent extends SpriteAnimationComponent { |
There was a problem hiding this comment.
Can you explain what the point of this component is? You can already pass in a ticker to the original component.
There was a problem hiding this comment.
The ticker is injected through the constructor. Instead of the component creating its own animation, it is passed a SpriteAnimationTicker that is managed by a parent controller or a global system.
SpriteAnimationTicker that is managed by a parent controller or a global system
Shared State: When render(Canvas canvas) is called, the component asks its _animationTicker for the current sprite to draw. Since the ticker is shared, _animationTicker.getSprite() returns the exact same frame for every component in that frame.
Zero Per-Component Logic: Because playing is false, the expensive update(dt) loop (which calculates time elapsed and frame indexes) is skipped for all 3000 components. Only the single shared ticker is updated once per frame in the parent.
GPU Performance: Because every component is drawing the same region of the same image, the GPU can process these commands much faster (often using a single SpriteBatch call), leading to the jump from ~30 FPS to hundreds or thousands.
afcfbb5 to
37b6907
Compare
20d667e to
545f68d
Compare
545f68d to
9749376
Compare
|
I decided to do some further research. |
SSA
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues