I am completing some beginner projects with c++ and SDL and I've read most of the lazy foo and sdltutorials. Up until now I used "frame independent movement" (as one of the tutorials explains) in the games I've made. Searching around I saw that the code in many tutorials uses regulated frame rate (using SDL_Delay). I was thinking witch method is better? Since with "frame independent" the program can run in my pc at about 175 fps isn't it better to just leave it uncapped?
I am in a learning process right now and I'd like to learn from people here on this matter. Thanks in advance!
I would say it almost entirely depends on the game you have.
Normally you want to allow the user the option of turning vsync on, the only real reason for vsync is to prevent screen tearing(which arguably is not as big a problem as it once was.) Most games tend to leave it disabled at the start and let the user enable it if they require it.
- No tearing: Tearing is one of those issues where if you aren't seeing it, you don't care, but if you do see it, it completely wrecks the game. Thus having it at least available can be important, but keep in mind that if it doesn't occur then vsync is a total waste short of being nice to the video card.
- Frame capping: The problem with Vsync is that the video card literally has to wait for the monitor to finish a refresh before it can swap the buffers and display the new image, this works all fine and dandy if your video card is kicking out -over- 60 FPS, but if it dips below the video card will be stuck dropping down to a number like 30 FPS due to the way refresh rates work. A lot of people find wasting possibly half the frames they could create in a time period a big issue, especially if your monitor isn't subject to tearing!
Personally I don't at all agree with some of the other posters here that you should consider capping framerate simply due to the fact a user's hardware might overheat, I see that as a hardware flaw and problem more than a software one.
Does that mean you shouldn't take it into consideration? Of course not, there is something to be said about vsync being enabled on things like game menus, these places of course should be expected to render at a very high rate compared to being actually ingame, and enabling vsync or at least putting a frame cap on might be beneficial here.
But like I said, what it comes down to is what you think the behavior might be. Frankly I have not once in the last few years seen screen tearing on any game with vsync disabled, it is almost a moot issue to most people anymore, and why it is usually optional. But consequently if you were making pong or something you wouldn't need it running at 300 FPS either.
I'm sorry if I'm not really pointing to one option or the other, I definitely think if you don't want to give the players a choice to enable it or disable it then what you leave it "stuck" at is a matter of personal opinion and it comes down to if you are more worried about low FPS or screen tearing.