Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Innaccurate fps to FlxG.stage.frameRate #3150

Open
helpmeiguess opened this issue May 23, 2024 · 4 comments
Open

Innaccurate fps to FlxG.stage.frameRate #3150

helpmeiguess opened this issue May 23, 2024 · 4 comments

Comments

@helpmeiguess
Copy link

  • Haxe version: latest stable
  • Flixel version: latest stable
  • OpenFL version: latest stable
  • Lime version: latest stable
  • Affected targets: desktop, others untested.

Take a basic project.
Make an openfl.display.FPS and add it in main.
In your Starting state, set FlxG.stage.frameRate to your monitors current hz.
In your project.xml, make sure vsync="true" for your target.
Compile. The FPS display will be accurate to your actual hz, sometimes with a difference of around 1 or 2.
In project.xml, change vsync to false.
Compile. The FPS display will be inaccurate.

144 stage.frameRate displays ~168, 60 does 64.
Test with whatever numbers you'd like. if you're skeptical, try 90 fps and then try 91. The display from 92 to 102. That's definitely not right.


Observed behavior:
Setting fps with vsync results in drastically different frame times than with FlxG.drawFrameRate or FlxG.stage.frameRate

144 hz vsync:
image

frameRate set to 144, no vsync:
image
Expected behavior:
Fps values maintain consistent and predictable using vsync or in game frameRate.

I don't know how this went unnoticed so long.

@Rudyrue
Copy link
Contributor

Rudyrue commented May 24, 2024

this is an openfl/lime problem
flixel can't really do anything about it

@DetectiveBaldi
Copy link
Contributor

this is an openfl/lime problem flixel can't really do anything about it

^
This issue can also be produced on a standard openfl create template.

image

Main.hx:

package;

import openfl.display.Sprite;

class Main extends Sprite
{
	public function new()
	{
		super();

		addChild(new openfl.display.FPS());

		stage.frameRate = 144;
	}
}

@Geokureli
Copy link
Member

Geokureli commented May 24, 2024

Someone wanna raise this up to openfl/lime?

Plz link this issue in there so it connects

@helpmeiguess
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants