I’m coding a guitar hero clone game. It’s working nice but in fast computers (at high frame rates) the animation is not constantly smooth. What I mean is that sometimes the notes scroll with bumps. I found out that the problem is probably related to my game loop which does not cap fps (since I’m updating passing frame time, I thought that was not necessary). When a drop occurs from, say 140 fps to 60 these bumps are noticable.
I took a look at this site: http://www.koonsolo.com/news/dewitters-gameloop/ and I’m trying to implement the “FPS dependent on Constant Game Speed” approach just to see if the problem is fixed.
The problem is that my game update and render are steady at 60fps while the soundcall back seems to be called much more than that. I’m using Audiere for Sound and SDL for timer/input.
I thought SDL_Delay would suspend the game thread until done, but it doesn’t seem so. Is there something I’m missing? Is SDL not a realiable lib for time?
Some sample or pseudo code would be very helpful to know what you are doing. From the documentation for SDL_Delay:
It may be delaying too much. Assuming you are using a while loop, have you tried just ‘continue’ing to slow down draws? If you do SDL_Delay(1) it may be taking longer and thus messing up your calculations.