You’re right in saying I got the fps confused with the average fps as that was what the other guy was doing but I’ll put a reply to this post with an fps one
To address that edit, it wouldn’t be representative of the average FPS or the FPS at all as all the starting values for when you join the game will remain constant and would lead to the fps counter not updating properly.
Proof as to why its wrong: https://gyazo.com/ffc2b9781fa54aeb7d91390bd9dfa858
-- 1 / dT
local gui = script.Parent
local format = "FPS: %.1f"
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
script.Parent.Text = string.format(format, 1 / deltaTime)
end)
-- frames += 1
local gui = script.Parent
local format = "FPS: %.1f"
local frames = 0
game:GetService("RunService").RenderStepped:Connect(function()
frames += 1
end)
while task.wait(1) do
gui.Text = string.format(format, frames)
frames = 0
end
-- average fps (yours + slight tweaking)
local gui = script.Parent
local format = "FPS: %.1f"
local frameHistory = table.create(60, 0)
local index = 0
local function ComputeAverage()
local average = 0
for _, deltaTime in ipairs(frameHistory) do
average += deltaTime
end
return average / 60
end
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
index = (index + 1) % 61
frameHistory[index] = deltaTime
gui.Text = string.format(format, 1 / ComputeAverage())
end)
The scripts used for each gui are shown above, based on these results, we can draw a few conclusions:
1 / dT is so bizarre it doesn’t even pick up the frame throttling that studio does by default when you unfocus the window, extending beyond studio and into a place where a player is experiencing a frame dip, they may not even know because their sporadic frame counter is saying 60 and 50, so it must be fine right?
Counting the frames seems to be the most accurate & readable at any given frame, and is efficient enough
Using the average framerate shows dip trends quicker, but less accurately about what’s going on in the current frame, and also may increase frametime on devices with weaker processors with all the table shifting going around just to count frames.
Also sorry about the quality of the video, that’s the best my recorder can go without freezing lol
I’m sorry if anyone had a problem or concern with this. I just tried to help some people that needed a quick minute Fps Counter. I know this isn’t the best and I’ll sure make it better next time.
Your FPS Counter is not that accurate. You could easily make it more accurate by using task.wait(1) instead. I will come back with a better solution a little bit later when I have access to Studio.
Or you know, using actually reliable methods of counting fps? There’stonsof posts that describe those more reliable methods. There’s even a official way of seeing your in-game fps that don’t rely on less reliable methods.
Also, wait() isn’t as evil as all of those ““top devs”” say.
Because it’s not the actual framerate. It’s instead the framerate for the physics solver (which is very inaccurate, and hence the word “physics” in the function name.)
Theres actually a better way to do this. Thats way simpler. And more accurate:
local FPSGui = script.Parent
while wait() do
FPSGui.Text = "FPS: " .. math.floor(workspace:GetRealPhysicsFPS()) -- gets the fps, and removes the decimals.
end
That function returns the speed of which the physics system is running at, this is not what is being outputted and processed by the gpu
the api reference summarises this function as
Returns the number of frames per second that physics is currently being simulated at.