Beginner's Guide to Game Programming Ep1 Part 7-B Regulating FPS in SDL
Uploader Comments (LusikkaMage)
All Comments (25)
-
problem with my game is that the fps slowly lower
-
Your website is screwed up and wont work
-
Your a life saver I didn't know why my player was moving so fast i had it set to sprite.x +=1; and it was still fast but this should work
-
Why dont write the game framerate indepent?
-
cool
-
0:38 - or you could set a tickrate for the game. Then it will only update after a interval of time. That way you can have a high or low fps without changing gameplay speed.
-
In the section where you give code for regulating fps, it should be SDL_Delay((int)((1000/FPS)-SDL
_GetTicks()+currentTick); , not -currentTick. Took me ages to catch that one - it would freeze the game because SDL_Delay's parameter was negative. -
Holy Grail of beginner game dev
right here.
-
you should make more of these with with openGL
-
Your random numbers tutorial seems to be private, leading me here!
Hi I´m a beginner to programming so I could be wrong. But is the code in SDL_Delay right? Shouldnt it be:
SDL_Delay( ((1000/MAX_FPS) - (SDL_GetTicks() - currentTick) ) ); or am I totally wrong? :)
vicmanbeer 2 years ago
oh you might be right, I'll have to look at it again.
LusikkaMage 2 years ago
seriously just use the turbo key...
MadPumpkinGames 2 years ago
For what? Sonic runs _too fast_ on my newer computers.
LusikkaMage 2 years ago