I’m working on a game and sometimes very hard calculations need to be done whereafter my fps seriously drops.
Therefore I made a code to calculate the fps, but it doesn’t work. First I have a fps of for example 50, then 250 and then 130.
Why is my fps not a little bit constantly?
This is my code:
counter = counter + 1
if newtime<os.clock() then
By the way, sorry for my poor English
Hi, here is an easier way to calculate FPS:
-- Put an FPS counter in the corner of your screen
local fps = 1/DeltaTime
text(fps, 10, 10)
I recommend putting it in a
string.format otherwise the number will jump around as the number of digits changes. Something like
It also helps to mod Simeon’s code to
Thanks all of you. Now it works very well.