Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?.

Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs.

As beginner which method should I stick to?(all I want is smooth animations).

share|improve this question
1  
possible duplicate of Fixed time step vs Variable time step –  user744 Dec 26 '10 at 16:38

1 Answer 1

up vote 14 down vote accepted

What's being shown as "FPS based" there is . . . well, basically, it's awful. It's pinning the game's speed to the performance of one particular computer. If you upgrade to a nice fast computer, your game will suddenly run in turbo speed, if you downgrade to a slower computer you'll be grinding around in slo-mo.

The real choice is fixed time step vs. variable time step, and at that point I will defer to this excellent post which goes into great depth.

share|improve this answer
    
Not only will things move fast or slow depending on the computer it is running, but all animations will move at the same rate - what that means is that some animations will run super fast, while some run a bit slower, making it look really odd. –  ShrimpCrackers Dec 27 '10 at 0:07
    
but isn't capping the frame rate going to account for this? –  silent Dec 27 '10 at 2:34
    
@sil3nt, only until you're running on someone with an unexpectedly slow computer, or until you start using enough CPU to drop below your framerate cap. –  ZorbaTHut Dec 28 '10 at 8:56
    
So then the frame rate based method is fine if the computer that the program is running on can handle the FPS? –  silent Dec 29 '10 at 4:48
    
@sil3nt, yes, if you can guarantee the computer can always handle the FPS, and you have a reliable way to lock to that framerate. This is enough qualifiers that I'd be very hesitant to use it, especially with how simple fixed time step is. –  ZorbaTHut Dec 30 '10 at 23:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.