How to make a simple FPS counter

Here is the link to a simple FPS counter

(The project explains everything)

7 Likes

Cool tutorial, thanks for sharing!

5 Likes

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.

6 Likes

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)

1 Like

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).

1 Like

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

1 Like

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.

2 Likes

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.

2 Likes

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).

2 Likes

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

2 Likes