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

Different delta time on browser and native with same fps #19

Open
Dreaded-Gnu opened this issue Dec 21, 2024 · 2 comments
Open

Different delta time on browser and native with same fps #19

Dreaded-Gnu opened this issue Dec 21, 2024 · 2 comments

Comments

@Dreaded-Gnu
Copy link

Hello
I'm using echoes in browser and in a server application. While playing a bit around I discovered that 60 fps in browser lead to delta time of update calls of 0.01 seconds, while on native platforms it is 0.04. To get a nearly equal behaviour in browser I had to cap the fps of echoes to 30 which then leads to non smooth movements.

What can be done here, so that browser and native applications behave more similar when using echoes?

@player-03
Copy link
Owner

Echoes uses a Timer to schedule updates, then uses Timer.stamp() to calculate elapsed time. Perhaps one of those behaves differently in the browser?

Here's a simplified version to help narrow it down.

var count:Int = 0;
var lastUpdate:Float = Timer.stamp();
new Timer(16).update = function():Void {
	final startTime:Float = haxe.Timer.stamp();
	count++;
	trace(count + ": " + (startTime - lastUpdate));
	lastUpdate = startTime;
};

@Dreaded-Gnu
Copy link
Author

Dreaded-Gnu commented Dec 22, 2024

Okay, the laggy movement was due to some miscalculation on my side. Nevertheless I had to reduce the fps for browser target from 60 to 25 to get a similar timing compared to native. Have to look deeper into it, maybe I find something that could fix the issue.

Meh, just found out that lime is overwriting the haxe timer class, maybe that is the root of the issue.

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

No branches or pull requests

2 participants