Fps Erratic and Low in CPP and Neko Builds (vsync disabled)

I’ve noticed a strange problem with all of my projects’ fps in neko and cpp testing. They hover around 50fps when I have the project set at 60fps.

Here is the weirdest part… If I move the mouse around rapidly in the window, the fps slowly rises and stays at the intended fps (60) until I stop moving the mouse. This happens even in completely new empty projects.

I have seen problems with fps before on the forums with the solution being to disable vsync, but doing this had no effect on my problem.

What is going on… I need a reliable fps measurement in order to test the game I am working on. The fps looks great in the flash target, but the only target I really need to work is cpp…

I have the same problem. I tested the Nape phys engine and I noted this behavior with mouse and fps, but I thought it was bad Nape performance.

Hey guys,

A little technical info:

In the “legacy” native target, there is a “poll” event that occurs A.) every time there is a system event (including mouse and key events) and B.) every time a “wake up” is triggered.

The “poll” will possibly result in a frame, if enough time has elapsed. Another event is scheduled to wake up at the next frame.

This is precise enough that some times the wake up may not occur at the perfect moment.

Lime 2 handles timing on the native side, telling the application when it is time to render. I think it is more reliable/consistent, and does not need poll events

I’m unclear on why a brand new project doing nothing consistently shows 10 fps lower than what the project is set to. Is it just that the fps is inaccurate due to "poll"ing on the cpp target, or is my project actually slowed by 10 fps?

Edit: I did a test with moving objects and discovered that in fact my project is slowed by 10 fps… Any ideas on how to alleviate this issue for building for cpp targets would be much appreciated.

I’m also confused regarding the technical info you provided because I have Lime 2.3.3…

Here is my haxelib list output:

haxelib_client: [3.2.0-rc.3]
hxcpp: [3.2.81]
lime-samples: [2.3.0]
lime: [2.3.3]
openfl-compatibility: [1.0.1]
openfl-html5: [1.4.2-beta]
openfl-native: [1.4.0]
openfl-samples: [2.2.2]
openfl-tools: [1.0.10]
openfl: [3.0.3] (also tested using openfl: [2.1.1])

I don’t know too much about the inner workings of openfl. Thanks for any help you can provide!

Are you doing a normal build (like with an OpenFL sample) or are you using the -Dlegacy flag when you build?

I have tried both and the problem remains.

With -Dlegacy it actually responds to me changing the fps at all though, so I could potentially set the fps to 100-120 and set up a timestep situation to smooth movement. Without -Dlegacy the fps sits at around 40-50 no matter what I set it to, even 30, but there’s no harm in using -Dlegacy, so that doesn’t matter for me so much.

Edit: Also suddenly upon checking my empty project again, the fps sits reliably at 60 or slightly above with no flags “lime test neko”. The program ignores what I set the fps to, but at least the fps isn’t erratic and it’s at what I want. I don’t understand the reasons behind any of these things or why it would change, but this is good news for me anyways…