OpenFL Starling skip frames in Android


Recently I am developing 2 game with openfl and starling. But both of the game has the same issue, it skip frames , by skipping I did not mean it actually drop the frame rate,

When I open the app , it start start to skip for a very little time in every 1-2 sec but its not constant. And the skipping is not that noticeable but its actually annoying , I can see my objects are not moving smoothly.

But here is another thing, this problem almost gets solved if I minimize my game and open it again !!!

First I thought it was happening because of my mobile device, but I tested the same game in other 2 device and the result was same.

I am not sure why is this happening , any good reason for it ?

I am using OpenFL 6,5,0 and Starling 1,8,13


Is it possible this is occurring due to garbage collection, or some element of performance? Have you tried the HTML5 target? That might be easier to profile


Actually I did tried the HTML5 target and it works fine, I don’t face that problem , and the thing is, its not like I have too many objects on the screen or something very complex , even the simplest game shows the same problem , I even tried the demo comes with starling , it has the same problem.

I was thinking maybe its the enterframe event ? I was using delta time but that did not make any change, I haven’t tried to use a timer event.

Or maybe I should update the android NDK. I am using android-ndk-r11c-windows-x86_64
Current version is android-ndk-r15c-windows-x86_64.


Could you try the dev version of Starling 1.8?

There was a recent pull request that should improve GC performance dramatically


Will do , I will let you know , thanks.


I just checked the new pull request and performance seems to be a bit improved , since my game is very simple I do not see much change, But the actual problem dose not seems to be changed , the game still lacks, Maybe I have to take some time and figure out where this problem is coming from,

But in case it comes to your notice I will remind the problem again ,

In android the game seems to be skipping frames when it starts , but once the game is minimized the frame-rate becomes stable again. The problem is not that much noticeable but it is there.

I will check my code again, Thank you.


Does this occur with OpenFL samples?


OpenFL samples ?

No they don’t I guess , I have Heroku Shaders installed in my mobile it runs really smooth,

I guess its related to starling , because starling demo seems to have the same problem, Specially in sprite3d scene. Since the cube is rotating the problem can be noticed better then from other scenes.


Hey guys, I thought I’d report a similar issue and I’m not using Starling at all.

I created this extremely simple free app that’s basically an instrument that fires off notes in random directions as the player holds down on the screen:

I noticed that there seems to be some dropped frames in the session after first launch, affecting the smoothness of the animated notes moving across the screen. But if the app is minimized or the switched to another app, when returning to the app the frame rate is as smooth as butter. It’s easily reproducible by terminating the app, and launching fresh again.

I’m using OpenFL 6.5.1, Lime 5.9.1, and Android 4.1.2 (API 16)

I wonder if maybe there’s just something internally in OpenFL that happens when the app loses and regains focus that needs to happen when the app is launched.


Huh, that’s curious. Perhaps it’s possible that some kind of frame timer is getting triggered twice per frame? Could you check when ENTER_FRAME occurs, to see if they seem spaced out well?


Interesting you should say that, I noticed I was using a Timer object instead of ENTER_FRAME to animate the notes. So I updated the app to use ENTER_FRAME instead just to see if that made a difference. Sadly it didn’t help, and unfocusing the app and returning still fixes it :confused:

However, I placed some frame interval code in the app’s root ENTER_FRAME event and it actually holds a very solid 60fps / 16ms per frame (even moreso that HTML5/Neko/CPP, it doesn’t budge!). There doesn’t seem to be any indication of events executing more than they should, and they appear to be spaced out appropriately.

Now I’m thinking as the OP suggested, it seems extremely likely that frames are actually being dropped as opposed to there being any sort of actual lag. I’m at a lost on what else I could try from my end…


When you minimize, and come back, do you notice a difference in the frame timing, or frequency?

I believe this may be something in SDL (which could be fixed already by a newer release), or perhaps there’s a chance we are doing something wrong, but the internals of SDL is what I would presume first

EDIT: Oh, does this occur only with Starling, or with all OpenFL projects? If it’s more specific, perhaps there’s a chance that something like an ENTER_FRAME listener gets registered twice, though that would be a better explanation for things getting slower upon return


When I minimize and come back, numerically the frame intervals appear to range consistently between 16-17ms both before and after minimizing. I don’t think it’s possible to perceive a difference that tiny. And I’m not using Startling, just loading PNGs into some BitmapData objects. I recall that even when this project was simply 2 PNGs the same issue would occur.


This is a long thread, but may be related:

Do you have vsync enabled? Disabled? (<window vsync="true" />) We should probably updated SDL as well, to rule that out


Wow, vsync="true" worked! No more jitter! Prior to this I didn’t specify vsync (So I presume it was false).

Though I do get this warning in the console during build that I didn’t get before:

Note: D:\OpenFL\BattleTuba\bin\android\bin\app\src\main\java\org\libsdl\app\ uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Either way this is good enough for my purposes, thanks for the help @singmajesty!

Btw @Galib are you still struggling with this issue? What was your vsync setting?


I am still struggling and my vsync was in default , I mean I did not put any vsync settings.

I will give it a try and let you guys know !!


If it helps, we may make vsync default on Android :slight_smile:


Just tried , It did not work , same old problem ,

And I updated my JDK and NDK and now getting new errors , I can’t build them from haxedevelop , I had to build it in android studio.

this is the error I get in HaxeDevelop

h:\users\android\ndk\android-ndk-r16b-windows-x86_64\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\lib\gcc\arm-linux-androideabi\4.9.x\include\stdint.h:9:26: fatal error: stdint.h: No such file or directory