animation timing

This is a discussion on animation timing within the Game Programming forums, part of the General Programming Boards category; I use timeGetTime to balance my animations across multiple frame rates. I was having a serious problem with tearing whenever ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    411

    animation timing

    I use timeGetTime to balance my animations across multiple frame rates.

    I was having a serious problem with tearing whenever the cameras focus moved. I narrowed it down to the animation rate that was used to move the focus.

    My solution was to keep up with the last ten frame draw times and pass an average of those values as the animation rate.

    What sort of problems might I run into later on from this?

    It works great by the way.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    I would see it having the same problems as using the exact value of TimeGetTime, only less often. Perhaps I'm thinking about this the wrong way, but this is how I see it:

    Let's say you're running at 60 fps, and you're getting some tearing like you said. By averaging out 10 values, you shouldn't see the same problem until you hit 600 fps.

  3. #3
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    A suggestion about another solution that doesn't have any draw backs would be something like
    Code:
    float timeScale(int ideal) {
    	return (ideal/(float)g_FrameRate);
    
    }
    where g_FrameRate is the current fps (you dont have to keep track of last N fps's).
    You would use it like
    Code:
    playerVelocity += 2.3 * timeScale(g_60FPSisIdeal);
    animationTime += 1.5 * timeScale(g_60FPSisIdeal);
    etc.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Threads in MFC
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 12-28-2005, 05:03 PM
  2. Animation class not working
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 03-02-2005, 05:48 AM
  3. Games - timing
    By Magos in forum Game Programming
    Replies: 7
    Last Post: 03-06-2004, 10:32 AM
  4. 3D animation (difficult?)
    By maes in forum Game Programming
    Replies: 3
    Last Post: 09-08-2003, 10:44 PM
  5. Timing in Windows
    By steinberg in forum Windows Programming
    Replies: 3
    Last Post: 07-14-2002, 12:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21