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 ?
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.
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.
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.
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.
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
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.
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