How to set fps rate in B+?
how to set fps rate?
BlitzPlus Forums/BlitzPlus Beginners Area/how to set fps rate? Check out 'Frame Limiter' at my programming tutorial...
Remember you can set the fps for your game but not the refresh rate of the screen! This is a bumber as in the old days your Amiga game would be at 25fps and so would the screen meaning smooth scrolling and animations. Not so on the PC unless you do a really high speed game loop and chuck out a frame every time the screen refreshes, but this is still not "perfect".
Is it 25fps still ?
How to do if fps>60 or more?
How to do if fps>60 or more?
Most PCs refresh at a minimum of 60Hz (normal for TFTs) or higher for monitors (up to 100Hz). You game loop could run at 200 or higher frames per second and output a frame when needed. Check out the FAQ on the blitz home page and follow the link called "Can I set the monitor refresh rate from within Blitz? "
;rck109d Global fullScreenMode = 2 ;windowed Global screenBitDepth = 32 ;bitdepth for window, overridden to desktop default in windowed mode ;--------Graphics Initialization------------ Graphics 1024,768, screenBitDepth, fullScreenMode Global timer_draw = CreateTimer(120) ;delay draw call Global timer_FPS = CreateTimer(1.0) ;delay to set HUD fps to current fps Global framesTicked = 0 ;keeps track of frames over last second Global FPS# = 0.0 ;Frames Per Second to display Repeat WaitEvent() ;save CPU, those timers will trigger execution when needed ;other code here, beneficially on other timers for good thread-like stuff If TimerTicks(timer_FPS) > 0 Then FPS = framesTicked framesTicked = 0 ResetTimer timer_FPS EndIf If TimerTicks(timer_draw) > 0 Then Cls ;dont CLS elsewhere, ;If Windows forces redraw, ;let the Last frame remain up as long as possible ;code here to draw things DrawPlrHUD() ;code here to draw things Flip(False) ;immediately draw to the screen framesTicked = framesTicked + 1 ; take note of another frame drawn ResetTimer timer_draw ;make timer_draw wait another 1/120th of a second before coming in here EndIf Until KeyHit(1) ;stop the program on ESC key ;;;; ;;;; ;;;; ;;;; Function DrawPlrHUD() Text 0,0,"Frames Per Second: " + FPS# Text 0,20,"Escape ESC to exit" End Function
Most PCs refresh at a minimum of 60Hz (normal for TFTs) or higher for monitors (up to 100Hz).
While it's not too common for a CRT to have higher than a 100Hz refresh rate, you definitely can't count on it -- some monitors can go up all the way to 200Hz in some resolutions.... (19” Vision Master Pro454 for example)