Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to stop FPS counter from flickering?
- firedestroyer1
-
Scratcher
72 posts
How to stop FPS counter from flickering?
In one of my projects, I have an FPS. It works using a fairly normal method;
However, in my projects the FPS flickers very fast between similar numbers; 29, 30, 31, or if I'm using 60 FPS, 59, 60, 61, 62. You get the idea.
While it's nice to see such fast and constant FPS updates, they're flickering so fast that it makes it a chore to read the FPS. So my question: how do I make the FPS counter read a more constant, yet still accurate, number?
I can share the project if necessary, but I don't think it's relevant to the question, which is more general.
foreverwhy is that grey circle there how do i get rid of it
set [FPS] to (round (((1) / ((timer) - (old timer)))))
set [old timer] to (timer)
do all the things to do every tick
end
However, in my projects the FPS flickers very fast between similar numbers; 29, 30, 31, or if I'm using 60 FPS, 59, 60, 61, 62. You get the idea.
While it's nice to see such fast and constant FPS updates, they're flickering so fast that it makes it a chore to read the FPS. So my question: how do I make the FPS counter read a more constant, yet still accurate, number?
I can share the project if necessary, but I don't think it's relevant to the question, which is more general.
Last edited by firedestroyer1 (July 9, 2022 23:36:47)
- musicROCKS013
-
Scratcher
1000+ posts
How to stop FPS counter from flickering?
You could make it round to the nearest 3, with this:
set [FPS v] to ((round ((FPS) / (3))) * (3))
- Spentine
-
Scratcher
1000+ posts
How to stop FPS counter from flickering?
You can take the average fps of the last second. Even though the actual fps won't be represented, it won't flicker.
- RT_Borg
-
Scratcher
1000+ posts
How to stop FPS counter from flickering?
Hi firedestroyer1,
Easier than a running average, but probably all you need:
And display the monitor for display-fps. (If you want to show “fps” in the monitor, just rename the old one to “instant-fps” or something, and call the display variable “fps”.
– RT_Borg
Easier than a running average, but probably all you need:
when green flag clicked
forever
set [display-fps v] to (fps)
wait (0.25) secs // or however long
end
And display the monitor for display-fps. (If you want to show “fps” in the monitor, just rename the old one to “instant-fps” or something, and call the display variable “fps”.
– RT_Borg
- firedestroyer1
-
Scratcher
72 posts
How to stop FPS counter from flickering?
Thanks both of you!
Even with rounding, it was still flickering, but I didn't want to use excess forever loops, so I went with this:

Basically it checks the FPS every 10 ticks and does an average.
Thanks for the help!
Even with rounding, it was still flickering, but I didn't want to use excess forever loops, so I went with this:

Basically it checks the FPS every 10 ticks and does an average.
Thanks for the help!
- Discussion Forums
- » Help with Scripts
-
» How to stop FPS counter from flickering?



