Android performance with Haxeflixel 4.4.0

  • Hi all!

    I was so excited with the release of the 4.4.0 version that updated to it without thinking twice. The upgrade went smoothly.

    The main target of the game is Android, and the performance of new builds using 4.4.0 is pretty bad. The framerate drops from 60 (with v4.2.0) to 25-30ish fps in v4.4.0. The slowdown is pretty noticeable while playing. Other targets, as html5 or windows/mac native are not affected by this slowdown.

    I'm not using any special graphical features, shaders, blend modes, or even tilemaps. It's just FlxSprites with scaling and some minor alpha and FlxBackdrops. FlxTweens, also.

    What should I look for in order to restore the 60fps mark? Are there any specific things that should be done differently in 4.4.0 than 4.2.0?

    Thank you!

  • administrators

    What OpenFL / Lime versions are you using? If not latest, could you try updating?

  • I did the upgrade using $ haxelib update, and now I'm working from a clean installation.

    $ haxelib list
    flixel-addons: [2.6.0]
    flixel: [4.4.2]
    hxcpp: [3.4.188]
    lime-samples: [6.2.0]
    lime: [6.4.0]
    openfl: [8.3.0]

    Same result in both cases.

  • administrators

    I'd be curious to know what results you're getting with the Tilemap branch:

    It's rather experimental / unstable, but it uses a different renderer (Tilemap instead of drawQuads), so there's a chance you'd see an improvement.

  • I just tried it. I had to disable FlxBackdrop rendering from flixel-addons, though.

    On desktop it's mostly the same although there are some graphical glitches with bitmap text characters.

    On mobile there's a slight speed bump (35-40fps instead of 25-30), but the scaling makes everything blurry (this does not happen on desktop).

    Is there something I should look for in my code (like, I don't know, avoid using FlxBackdrops or scaling or something?) that may be causing problems?

  • administrators

    @rafadelahoz You could try disabling particular "features" (text rendering, large sprites, etc) to try and isolate what exactly is making it slow. Not aware of anything in particular that would be slower with new OpenFL 8 right now.

  • I'll try and do that. I will report if I find something interesting.

    Thanks for your answers!

  • Hi rafadelahoz on what version of Android and android device do you test the game?
    I have the same problems basically.
    flixel 4.4.2
    openfl 8.3.0
    lime 6.4.0

    the game lags very badly basically unplayable.
    When it freezes there are no traces from the update function.

    Tested on Android 4.2.2, device with 2GB ram.

    The same game build with
    flixel 4.3.0
    openfl 3.6.1
    lime 2.9.1

    on the same device works flawlessly.

  • Hi @Netforza,

    I tested on a wide range of devices, from android 4 to 8 and low to mid-high hardware specs.

    I got the same results, specially very low framerate when compared to builds with the older tools. I got no actual crash or frozen status.

    Trying to find problematic elements by disabling things and features isolatedly yielded no results.

    I have returned to the flixel 4.3 environment, but it seems Google Play will not accept android-19 builds from August. Nice situation!

    I'll keep investigating (after the game is published!)

  • I'm not sure if this is a possible reason, but I noticed with cpp builds when running full screen I get lag, too. This is with latest libs.

    Just a hunch here, but maybe it's something to do with the full screen implementation??

    For simple games with simple collision, I was able to set fps to 30 for reasonable game play. For my bigger game with lots of collision action, it's not able to handle the collisions without missing sometimes.

    I hope someone can figure this out. I wish I knew more so I could.

  • I noticed the same lag today with a windows build.

    Strangely, HTML5 build works better.

    alt text

  • administrators

    @agustín-pérez-fernández Could you try to disable vsync in your Project.xml?

  • @Gama11 @Agustín-Pérez-Fernández

    For windows build I only notice lag when full screen. For full screen vsync="false" does help, but I notice artifacts in my game. I think my laptop with onboard video is part of the problem. I also notice that moving the game to my other monitor, connected via HDMI, it's worse. Another thing I tried that helped was to set FlxG.drawFrameRate = 40 but the movement is a bit choppy.

    Still, Android is terribly laggy even if I set drawFrameRate to 30, unless it's a very basic game.

  • I’m getting a similar drop in FPS on iOS after upgrading.

    I’ll try profiling in Xcode and see if that turns up anything obvious.

  • I'm also getting slowdowns when building with 4.4.0 for iOS targets.
    In my case it's not as bad as it's on Android: slowdowns happen randomly and last for a couple of seconds.
    It happens on real HW and the simulator.

  • I'm having the same performance issue with the latest versions: haxelib list
    firetongue: [git]
    flixel-addons: [2.7.1]
    flixel-tools: [1.4.2]
    flixel-ui: [2.3.1]
    flixel: [4.5.1]
    hscript: [2.3.0]
    hxcpp: [4.0.4]
    lime: [7.1.1]
    openfl: [8.6.4]
    systools: [1.1.0]

    Everything is ok if I downgrade...

    I also checked that has the same performance issue.


  • I have same problem since haxeflixel 4.4.0... on windows build my game fps is 55-60. But on android it drops 30-35.
    Everything is ok when i downgrade to
    flixel 4.3.0
    openfl 3.6.1
    lime 2.9.1

    Does anybody know, what is solution?

  • @netforza Have you any solution about this case?

  • Same issue with the latest versions: haxelib list

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.