Here is the link to a simple FPS counter
(The project explains everything)
Here is the link to a simple FPS counter
(The project explains everything)
Cool tutorial, thanks for sharing!
Great tutorial, and it works great.
Here’s a more accurate version:
You might be wondering why I used 966.666667 milliseconds instead of 1 second.
That’s because it’s to compensate for the 2 extra frames it takes for each loop.
1 - 2/60 = 0.9666666666666… (966.66666666…ms)
FPS (Frames Per Second) will depend on your device and the operations being done in the project. Lag occurs when operations take more than 1 frame (16.66666667 ms) to complete.
This can happen due to massive cloning, attempting to do lots of operations on multiple clones at once, etc.
I wonder if another option is to subtract 2 from the frames (as 2/60 assumes that each frame takes 1/60 seconds to execute)
It can definitely be done that way. I just did it in simplest form. (Evaluating math operators in AE’s project builder would’ve done the same thing).
Yeah I guess the main thing with changing the Wait block is that if each frame does not take 1/60 seconds to execute (e.g. it takes longer because of lag), then the frame rate would not be accurate
That’s actually a good point. I just updated mine. I went for 1000 ms (1 second), and for each loop I set the frames variable to -2 instead of 0.
It stabilized at 60 FPS on my iPad Pro, and when I enabled Low Power Mode (as I knew that limits the device’s FPS), it stabilized at 30 FPS (as expected).
The best example of lag I came across was the massive lag that occurred from bringing multiple clones to the front every frame. The frame rate started out fine, but then started dropping significantly (it was gradually getting worse). I experienced this while playing Spy Guy 96’s Perilous Parallelogram project a while back.
Another thing about FPS:
High FPS means the project is running smoothly
Low FPS means the project is very choppy (meaning there are pauses here and there that are too hard to miss), aka very laggy. The lower the number, the more laggy it becomes. Sometimes, when it gets too low, the program will just straight up crash.
I just made a little video of a method I just learned.
It’s fast, but sometimes inaccurate.
I’ll post it once CatBox is up again (502 Bad Gateway Error).
Hmm… looks like Catbox is going be down for a long time. Hopefully I’ll be able to upload a video by tomorrow…
Oh well, here’s a project link instead: FPS Test by Crosbyman64
When the flag is clicked, the timer is reset, a variable, in this example, “Previous Timer,” is set to 0 and and a forever loop starts.
In this loop, another variable, in this example, “FPS,” is always set to 1 divided by the current value of the timer subtracted by the value of the “Previous Timer” variable, and the “Previous Timer” variable is set to the current timer.
After this block’s script is run, the timer is reset. The value of the “FPS” variable is roughly the value of the current FPS Counter.
Cool, Welcome and thanks for sharing.
Cool, now I’m wondering how this works…