2

I'm having some unexpected performance issues with my haxeflixel game when building a windows (cpp) target with the following settings

    <window if="cpp" width="480" height="270" fps="60" background="#000000"
        hardware="false" vsync="true" />

I notice that when I'm re-sizing the window to bigger resolutions, or going full-screen up to 1920x1080p, the game becomes slower and lagging. However according to the flixel debug console, the frame rate is the same for all the resolutions.

Something even more interesting is that my flash export runs much more fluid, while I expected the cpp target to run faster.

It's a 2d platform game with about 6 tilemaps (The biggest tilemap is 1600x1440) and 32x32 or 16x16 sprites. I did not expect to have performance issues on any modern system. So I'm concerned that I'm doing something wrong like missing an obvious setting.

Is this normal? Are there any key rendering performance factors I should check? Please fell free to ask me for any details if you think this would help.

using Haxeflixel 3.3.12

yannicuLar
  • 2,903
  • 3
  • 29
  • 48

2 Answers2

1

I think this may be a common problem among all the C++ targets. I experienced this with the Linux native target for my game as well. My solution was to disable anti-aliasing via

<window antialiasing="0" />

Of course, this works best with pixel art and not 3D or HD stuff. And then there's still the potential problem of performance dipping at higher resolutions (retina displays and whatnot). But this might be sufficient as a stopgap solution.

Jon O.
  • 11
  • 3
  • Thanks, but this didn't work for me. The only setting that made a difference for me, was setting `hardware="true"`. But again, I don't think that a 2d tilemap game should need GPU hardware to run smoothly – yannicuLar Mar 06 '16 at 18:09
0

I've been testing my app settings with different configurations, when I've finally found out that turning off the vsync option would make the biggest impact. There is some vertical jittering, but the game runs fast finally, and windows target is faster than flash.

Turns out that my current laptop has an IntelHD GPU, and the vsync feature seems to be broken. I remember that my previous PC, equipped with a low end AMD GPU didn't have this issue.

I will consider adding an in-game option to switch vsync, so that non-intel users could benefit from vsync.

Other things that seem to have helped are:

  1. Switching off antialiasing as @Jon O suggested
  2. Turning hardware on

For reference, my current setting is

<window if="cpp" width="960" height="540" fps="60" background="#000000" hardware="true" vsync="false" antialiasing="0" />
yannicuLar
  • 2,903
  • 3
  • 29
  • 48