Is there an alternative to 1/TimeDelta()?

I’m trying to set up an FPS counter.

Using 1/TimeDelta() doesn’t provide much info as the only values returned are around 59.997 or around 30.997… Numbers are harder to read the more FPS fluctuates.

I’ve tried using this as another method

And the method suggested on Wiki

https://wiki.gdevelop.io/gdevelop5/tutorials/how-to-debug-poor-performance

But both of these do not return any FPS value. So I’m not sure if I’m doing something wrong here?

EDIT: I’ve also tried FPS extension, but that returns values of 60 FPS, or when it drops, 30 FPS. Again, not very useful.

If you don’t like the decimals in 1/TimeDelta()
You can round it down using this expression.

So in the Text Box: "FPS: " + ToString(round(1/TimeDelta()))

1 Like

I am rounding it up, I forgot to mention it. But the issue is not about decimals anyway. It is about that the only values displayed are 60 (no drop) or 30 (big drop).

There are no values in between like 59,58,…32,31.

I just tested it out with just a text box
the same "FPS: " + ToString(round(1/TimeDelta()))

And it’s working just fine.
There is no flat rates of 60 and when it drops it picks it self back up pretty quickly but still in whole numbers.
So, right now, It dropped down to 30fps and in a couple of seconds, it climbed back up to 60fps (ex. 31,36,37,40,48…etc)

I am not sure what you are doing for it to be displaying just 60 or 30. Are you adding anything else to the fps counter*?

2 Likes

I use the same command as you, with only text box.

This is because chromium has forced vsync. Framerate is locked to your displays refreshrate or half that (or half that again)

1 Like

Yup thats what I thought, I saw some older post where you mentioned it before and it says on Wiki too. Thats why I asked if im doing something wrong with the other two suggestions. Because it seems they worked for people in the mentioned post.

1 Like