i am trying to port a game from Flash/AS3 to OpenFL/Haxe.
And i had problems using SWF animation for HTML5. If several animations are running, then the speed of the game decreases.
I am using a test example https://github.com/vlkozlov/HaxeTest
When 50 simple animations start, FPS reduced to 5.
haxedef name=“canvas” and stage.frameRate = 30 raise FPS to 20.
Real game animation will be even slower.
The SWF system has not been designed with optimizations in mind for many fast animations. There probably is a lot of low-hanging fruit in there. The focus has been on accuracy, and allowing instance IDs and other methods where you can bind animations in code.
It would be nice if we could get testing on this pull request:
There also are a lot of changes in this fork, designed specifically around MovieClip animation:
I believe all the code is isolated within openfl.display.MovieClip for the runtime performance. I would love to see additional performance here, but I think one of the biggest things holding this back has been a lack of good tests for SWF assets, so we can try and confirm that we have not caused regressions.
We solved the problem with playing МovieClip.
We tested pull request with corrected method __updateSymbol. The speed increase was small.
Therefore, we used cached MovieClip. Each frame of MovieClip has been converted to BitmapData. The speed has greatly increased.
That seems like a good plan for now. I’d love to see improvements come to MovieClip’s performance in the future, but for now that’s a known way to speed things up! You can also convert to one large BitmapData and use Tilemap
I am facing a weird behavior where some movieclips retain 60 fps and some not, even being smaller than those with reduced FPS. I can’t see any difference in the FLAs so I’d like some help on how I can convert them to bitmapdata as per you suggestion.