How to make FPS Counter in Scratch!
Vložit
- čas přidán 23. 07. 2024
- 👉In this video, I'll show you how to make an FPS (frames per second) counter in Scratch! Give your feedback in the comments!
⏱Timestamps⏱
0:00 Intro
0:04 Explanation
0:18 Tutorial
2:06 Outro
😍BE A MEMBER TODAY! : - bit.ly/3yvkmXe
👉SUBSCRIBE👈 : - bit.ly/2YXiNS2
Our Studio 🎪 On Scratch (Join For Projects) : - scratch.mit.edu/studios/27307...
👾Discord : - / discord
🦜Twitter Profile : - / mcvincient
😻Scratch Profile : - scratch.mit.edu/users/FANJOUA/
🌍Website : - mcvincientscratch.weebly.com/
🎮Second Channel : - / mcvincient2
😎Scratch Project Review : - • Project Review S2
🕑Shorts : - • Shorts
🔫Top Down Shooter Series : - • Scratch 2D Shooter Game
🖥Scratch OS Series : - • Playlist
🍪Clicker Series : - • Playlist
👨Scratch Basics Series : - • Playlist
#indiedev #scratch
If you guys think I've made this tutorial before, YES I have. 3 YEARS AGO.
This is a remake (just like the TicTacToe video) and I'll be remaking more *very* old tutorials! (I'm doing this because the old videos are un-bearably bad)
mine doesn't work is it because i have scratch addons?
my opinion: i like your effort to educate the scratch world! it's helpful for everyone! but there's a tutorial for fps count in scratch wiki and that only uses 1 forever loop so it's more stable
@@KONGGAMING12 I did it a few years ago, (with scratch addons), and it worked???
0:24: Let's add this dancing "thing".
Champ99: 🗿
😭😭😂😂
Thanks mr Vincent! I made mine with clones
Like this:
when green flag clicked:
create clone of myself
forever {
switch costume to (letter 1 of FPS)
}
when I start as a clone:
change x by 15
forever {
switch costume to (letter 2 of FPS)
}
This will make the counter more realistic
This is actually a genius way to do it, I have done this before using an fps max limit and things and it worked way less well then the way that you have done it
Nicee! This was helpful! Ty for the tutorial:D
Glad it helped!!
You can get a more accurate FPS reading by putting a "wait (0) secs" in the "change [frame] by (1)" loop
cool because since it's more accurate, I don't need no limit (for now I guess)
THANK YOU!!!!
Awesome!
The max scratch FPS is 29.97.
THANK YOU SO MUCH FOR THE HEART!
how do you get 97 hundredths of a frame
Just googled the max framerate of Scratch.
@@Exilibr not every frame is sliced equally in to a second
some go over, some go under
I feel like you made a video about this already, I got some deja vu...
yes I did but as I said some while ago that.. "I'll be remaking old videos"
And here it is (idk why ppl didnt notice when I remade TicTacToe tutorial lol)
super usefull!!
you can do more easily if you make a loop and every frame you set a variable the value of the cronometer and then reset it, and then you can just divide the stored value by 1 / value
Just a few things I wanted to point out quickly:
When the number is high, that's because scratch doesn't wait after every loop like it normally does when none of the sprites are moving, effectively putting the project in turbo mode. Capping the FPS counter to 30 is a pretty bad way to deal with that. If you really need to fix that, just add a "set x position to (x position)" block somewhere in the script. Also, it might be a good idea to replace this entire thing with "set [fps] to timer; reset timer". That way your fps counter will update every single frame, and also be more accurate.
I spent way too much time writing this comment :|
Why is capping bad?
@@McVincient There's a lot of situations where you might want to see how much extra performance you have above the fps cap (when turbo mode is on, which effectively uncaps the fps). The higher the number, the faster your code
@@jaythecoderx4623 but scratch caps it automatically when you run any script at all, so for 99% people it doesn't really matter (also avoids confusion for the 8 year old scratch users)
@@McVincient If someone's adding an fps counter to their project, I'd assume they already have at least one block somewhere in their project. Capping it does work, it just removes some of the functionality you'd get from an fps counter that at least one person is going to use- but said person probably isn't going to be watching youtube tutorials to figure out how to do it so yeah lol. A realtime fps counter would be nice though
Also I have absolutely no idea why I'm writing an essay in the comments of a video tutorial on scratch but uhnsioavgriuvahgrsa
I have a better solution that can update the fps counter for every individual frame, at least for projects that don't use the timer / stopwatch thingy:
FPS = 1 / timer value
then reset the timer
so for example, the timer value after 1 frame is 0.033333... seconds, that equates to 30 FPS, and 0.166666... seconds would be 6 FPS
and it also allows you to update the FPS value after every frame instead of every second
Nice but mine is versatile
@@McVincient in what way
@@meehdrescher you can still use the stopwatch
@@jameshulk4 bruh who the hell uses the stopwatch
@@meehdrescher its good for ticks and other stuff that require timing
Nice.
cool👍
useful
for some reason the fps is like 100000 and i checked the code and turbowarp or 60fps is not on. Edit: I forgot to put a script in the background nvm
I have a question im pretty sure you used to do scratch project reviews will you ever do that again?
Yes I will release another episode in March/April
I'm kinda busy with my studies and so I cannot upload at all for a while
How much did that scratch vs unity short make
Less than 1$
what about using turbo mode which sets the fps to 60? if the code makes it so that the maximum amount of frames it can display is 31 then turbo mode will still display the frames as 31 even though the real value is ~60
yeah so set it to 60, or just remove the limit cuz it is needed only when there is no script running
@@McVincient understandable
Yesss
Noice
What about Scratch Add-ons, that makes max fps in scratch projects from 30 to 60?
Just change the limit to 60
@@McVincient I make the FPS counter limit 31 when editing in scratch, and when I publish the game to newgrounds or itch, I make the FPS counter limit 60 before.
The cps counter is simple
Have the clicks and cps variables
And when (put spritename here) clicked
Change (clicks) by 1
For the (almost accurate click rate counter)
Green flag clicked
Forever(infinite repeat)
Wait (1) seconds
Set (cps) to (clicks)
Set (clicks) to 0
+I thinked it by myself
actually cps is calculate by click/time so
if then {
change [clicks v] by (1)
}
set [CPS v] to (clicks/timer)
@@gamingwithraien4639 if I did that,after a few seconds,it would lose its accuracy.
But i maked the frame varible to a list and then it has no problems
why tho?
If the timer resets then, you should just do:
Forever
set FPS to (1/timer)
reset timer
If it doesn’t then:
Forever
set FPS to 1 / (time - oldTime)
set oldTime to timer
if you hate decimals then use floor
Timer is usually used for other things. I purposely didn't want this to be dependent on timer.
@@McVincient timer actually helps in deciding fps
@@McVincient you can use days since 2000 and do some arithmetic
Hi. when is the next project review coming. I submitted a project for it.
Not before April. I'm sorry, but I have my exams going on.
@@McVincient Oh, best of luck.
@@SargunCreations Thankyou!
Am I the only one who watches scratch tutorials without following them. Sometimes I follow them tho.
I myself didn't really follow the tutorials
Just understood the concept by watching them
it made my project less laggy
mine is locked on 60 FPS oh i think i know why my extensions
I have a better idea for it reset timer and frame values ever second and set fps to frames/timer
Idea:how to make JSAB in scratch
I just discovered that Backpack exists lmao ☠️
Me like
thanks for opera gx for sponsoring this video
????
i think limiting shown number of FPS is bad, it could cause some problems
No
FPS is just a variable here, so it won't cause any actual problem in the game
@@McVincient ik,but what about dev himself?I think it could cause problems when u need to rely on FPS,and its just not cool to lie to player about FPS?
@@heyer777 The limit is not necessary anyway, but I recommended to add it because some games do not have any loops at all, which spikes up FPS to 54000 or more, and to prevent that, you need to put a limit.
A dev reliant on the FPS won't face any issues with this, because scratch doesn't run over 30FPS, and the limit being 30, won't let it go over 30 anyway.
Why no one is talking about his old fps tutorial
coz its old
Just do reset timer, run all of the other code, then set FPS to the rounded value of 1 / timer.
I don't want to use timer cuz it might not work for ppl who use it for some other thing in their project
@@McVincient True, it may cause small glitches with little to no code, but if they have at least around 15 blocks, it will work.
ok but what if the game runs in 60fps
Set the max to 60
it keeps saying the fps is 1
Check your code
Thx for helping my dumba$$ brain to understand fps
Forever:
fps = round(1 / (timer - prevTime))
prevTime = timer
Timer cannot be used for this coz most projects have some use of it.
@@McVincient i'm pretty sure that it'll still work unaffected but okay
you could replicate the timer by using the elapsed variable
How to make spider man game in scratch
Nice Idea!
um why do i have 363285 fps
Cuz no script is running (and also cuz you didn't put the limiter)
@@McVincient It Happened At The Start Then It Became a Normal 20/30 FPS
I will make my game at 360 fps
no workt\
Check your code
It was over 3000 fps that's not what I wanted
Run a loop script
I am going to make a 3D game without using Pen Or Clones
@Dynamix624 its probally possible using a lot of sprites
@@elijah44gd79 I will use clones sorry
@Dynamix624 I will use clones sorry
Nice!!
bruh
I don't like limits on FPS... I want smoooooooooooth
Bruh it's the limit on the VARIABLE FPS, not the ACTUAL FPS
And we're putting it for more accurate readings