How to make FPS Counter in Scratch!

Sdílet
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

Komentáře • 118

  • @McVincient
    @McVincient  Před rokem +18

    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)

    • @KONGGAMING12
      @KONGGAMING12 Před rokem +1

      mine doesn't work is it because i have scratch addons?

    • @KatanafiedMC
      @KatanafiedMC Před rokem +1

      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

    • @PatheticallyPoorProductions
      @PatheticallyPoorProductions Před rokem +1

      @@KONGGAMING12 I did it a few years ago, (with scratch addons), and it worked???

  • @JacksonAcademy1
    @JacksonAcademy1 Před rokem +12

    0:24: Let's add this dancing "thing".
    Champ99: 🗿

  • @laalpattharkedevata
    @laalpattharkedevata Před rokem +8

    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

  • @-_lIl_-
    @-_lIl_- Před rokem +1

    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

  • @yastube
    @yastube Před rokem +1

    Nicee! This was helpful! Ty for the tutorial:D

  • @TobbyTukaywan
    @TobbyTukaywan Před rokem +6

    You can get a more accurate FPS reading by putting a "wait (0) secs" in the "change [frame] by (1)" loop

    • @wongqtr
      @wongqtr Před rokem

      cool because since it's more accurate, I don't need no limit (for now I guess)

    • @Car_lover750
      @Car_lover750 Před 3 měsíci

      THANK YOU!!!!

  • @CheesyV1676
    @CheesyV1676 Před rokem +5

    Awesome!

  • @theyinyang6000
    @theyinyang6000 Před rokem +15

    The max scratch FPS is 29.97.

  • @tigershelf
    @tigershelf Před rokem +13

    I feel like you made a video about this already, I got some deja vu...

    • @McVincient
      @McVincient  Před rokem +6

      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)

  • @user-ff5ee4dn4l
    @user-ff5ee4dn4l Před 7 měsíci +1

    super usefull!!

  • @edc324
    @edc324 Před 8 měsíci +1

    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

  • @jaythecoderx4623
    @jaythecoderx4623 Před 8 měsíci +2

    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 :|

    • @McVincient
      @McVincient  Před 8 měsíci

      Why is capping bad?

    • @jaythecoderx4623
      @jaythecoderx4623 Před 8 měsíci

      @@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

    • @McVincient
      @McVincient  Před 8 měsíci

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

    • @jaythecoderx4623
      @jaythecoderx4623 Před 8 měsíci

      ​@@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

  • @meehdrescher
    @meehdrescher Před rokem +8

    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

    • @McVincient
      @McVincient  Před rokem

      Nice but mine is versatile

    • @meehdrescher
      @meehdrescher Před rokem +1

      @@McVincient in what way

    • @jameshulk4
      @jameshulk4 Před rokem

      @@meehdrescher you can still use the stopwatch

    • @meehdrescher
      @meehdrescher Před rokem +1

      @@jameshulk4 bruh who the hell uses the stopwatch

    • @sparxstoot
      @sparxstoot Před rokem

      @@meehdrescher its good for ticks and other stuff that require timing

  • @Karlo645
    @Karlo645 Před rokem +1

    Nice.

  • @easy_play_with_computer
    @easy_play_with_computer Před rokem +1

    cool👍

  • @_SparkHere
    @_SparkHere Před rokem +1

    useful

  • @TWLynx
    @TWLynx Před rokem +1

    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

  • @PlanetXson
    @PlanetXson Před rokem +1

    I have a question im pretty sure you used to do scratch project reviews will you ever do that again?

    • @McVincient
      @McVincient  Před rokem

      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

  • @Awesomebricks1
    @Awesomebricks1 Před rokem +1

    How much did that scratch vs unity short make

  • @izaanhafid
    @izaanhafid Před rokem

    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

    • @McVincient
      @McVincient  Před rokem

      yeah so set it to 60, or just remove the limit cuz it is needed only when there is no script running

    • @izaanhafid
      @izaanhafid Před rokem +1

      ​@@McVincient understandable

  • @NokoribiJamaica
    @NokoribiJamaica Před rokem +1

    Yesss

  • @L1M.L4M
    @L1M.L4M Před rokem +1

    Noice

  • @LeshaTheBeginner
    @LeshaTheBeginner Před rokem +1

    What about Scratch Add-ons, that makes max fps in scratch projects from 30 to 60?

    • @McVincient
      @McVincient  Před rokem

      Just change the limit to 60

    • @jimmypoopasin
      @jimmypoopasin Před 11 měsíci +1

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

  • @user-kufihfmurb
    @user-kufihfmurb Před rokem +2

    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

    • @gamingwithraien4639
      @gamingwithraien4639 Před rokem

      actually cps is calculate by click/time so
      if then {
      change [clicks v] by (1)
      }
      set [CPS v] to (clicks/timer)

    • @user-kufihfmurb
      @user-kufihfmurb Před rokem

      @@gamingwithraien4639 if I did that,after a few seconds,it would lose its accuracy.

  • @scratchislifeoriginal
    @scratchislifeoriginal Před rokem +1

    But i maked the frame varible to a list and then it has no problems

  • @hseeyz
    @hseeyz Před rokem +1

    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

    • @McVincient
      @McVincient  Před rokem

      Timer is usually used for other things. I purposely didn't want this to be dependent on timer.

    • @hseeyz
      @hseeyz Před rokem

      @@McVincient timer actually helps in deciding fps

    • @ntprograms5589
      @ntprograms5589 Před rokem

      @@McVincient you can use days since 2000 and do some arithmetic

  • @SargunCreations
    @SargunCreations Před rokem +1

    Hi. when is the next project review coming. I submitted a project for it.

    • @McVincient
      @McVincient  Před rokem +1

      Not before April. I'm sorry, but I have my exams going on.

    • @SargunCreations
      @SargunCreations Před rokem +2

      @@McVincient Oh, best of luck.

    • @McVincient
      @McVincient  Před rokem +1

      @@SargunCreations Thankyou!

  • @abzcbe
    @abzcbe Před rokem +2

    Am I the only one who watches scratch tutorials without following them. Sometimes I follow them tho.

    • @McVincient
      @McVincient  Před rokem

      I myself didn't really follow the tutorials
      Just understood the concept by watching them

  • @LELGasper
    @LELGasper Před 8 měsíci +1

    it made my project less laggy

  • @Pyro-Azuki
    @Pyro-Azuki Před rokem +1

    mine is locked on 60 FPS oh i think i know why my extensions

  • @Nebula461
    @Nebula461 Před 14 dny +1

    I have a better idea for it reset timer and frame values ever second and set fps to frames/timer

  • @user-oc7hv6wf2q
    @user-oc7hv6wf2q Před rokem +1

    Idea:how to make JSAB in scratch

  • @CrispOtto
    @CrispOtto Před 5 měsíci +1

    I just discovered that Backpack exists lmao ☠️

  • @wyatt_random
    @wyatt_random Před rokem +1

    Me like

  • @johndesacada9893
    @johndesacada9893 Před 6 měsíci

    thanks for opera gx for sponsoring this video

  • @heyer777
    @heyer777 Před rokem

    i think limiting shown number of FPS is bad, it could cause some problems

    • @McVincient
      @McVincient  Před rokem

      No
      FPS is just a variable here, so it won't cause any actual problem in the game

    • @heyer777
      @heyer777 Před rokem

      @@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?

    • @McVincient
      @McVincient  Před rokem

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

  • @NominalDragon
    @NominalDragon Před rokem +1

    Why no one is talking about his old fps tutorial

  • @averagecodegame
    @averagecodegame Před rokem

    Just do reset timer, run all of the other code, then set FPS to the rounded value of 1 / timer.

    • @McVincient
      @McVincient  Před rokem

      I don't want to use timer cuz it might not work for ppl who use it for some other thing in their project

    • @averagecodegame
      @averagecodegame Před rokem

      @@McVincient True, it may cause small glitches with little to no code, but if they have at least around 15 blocks, it will work.

  • @IkaraPopsicle
    @IkaraPopsicle Před rokem

    ok but what if the game runs in 60fps

  • @mitchkiggins9661
    @mitchkiggins9661 Před 8 měsíci

    it keeps saying the fps is 1

  • @LOL_1243
    @LOL_1243 Před 2 měsíci +1

    Thx for helping my dumba$$ brain to understand fps

  • @BombasticTom492
    @BombasticTom492 Před rokem

    Forever:
    fps = round(1 / (timer - prevTime))
    prevTime = timer

    • @McVincient
      @McVincient  Před rokem

      Timer cannot be used for this coz most projects have some use of it.

    • @BombasticTom492
      @BombasticTom492 Před rokem

      @@McVincient i'm pretty sure that it'll still work unaffected but okay

    • @BombasticTom492
      @BombasticTom492 Před rokem

      you could replicate the timer by using the elapsed variable

  • @smokegaming12898
    @smokegaming12898 Před rokem +2

    How to make spider man game in scratch

  • @bluecoding2506
    @bluecoding2506 Před 11 měsíci

    um why do i have 363285 fps

    • @McVincient
      @McVincient  Před 11 měsíci

      Cuz no script is running (and also cuz you didn't put the limiter)

    • @bluecoding2506
      @bluecoding2506 Před 11 měsíci

      @@McVincient It Happened At The Start Then It Became a Normal 20/30 FPS

  • @joshuaharrison8013
    @joshuaharrison8013 Před rokem +1

    I will make my game at 360 fps

  • @Asrarulhaquejamara106
    @Asrarulhaquejamara106 Před 6 měsíci

    no workt\

  • @Duolingo14215
    @Duolingo14215 Před 10 měsíci

    It was over 3000 fps that's not what I wanted

  • @NominalDragon
    @NominalDragon Před rokem +1

    I am going to make a 3D game without using Pen Or Clones

  • @andreiinthedesktopworld1178

    I don't like limits on FPS... I want smoooooooooooth

    • @McVincient
      @McVincient  Před rokem

      Bruh it's the limit on the VARIABLE FPS, not the ACTUAL FPS
      And we're putting it for more accurate readings