Archived

This topic is now archived and is closed to further replies.

time based movement

This topic is 5590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been using GetTickCount() to base my time based movement upon. And it was working great, until I noticed an unfortunate problem. With decreses in fps, I also get decreases in movement speed I''m not talking serious fps drops either - normally the game runs at 100fps, but when it starts getting crazy on screen, it can drop to around 50-60fps. At these times, movement is sluggish and you can really see the slowdown - but surely that shouldnt happen? Its still going 50fps, the movements are still smooth, but they are going slower. Below is a guide to the code I use to get my per frame movement value (tick).
  
// start of game loop function

oldTick=GetTickCount();

// do my game loop stuff here


/*while ((GetTickCount()-oldTick)*tickSpeed<=0.0f)
{
	// loop for a very short period
}
tick=(GetTickCount()-oldTick)*tickSpeed;*/
// end of game loop function

  
I tried switching to QueryPerformanceCounter but my motherboards chipset doesn''t like it and it keeps skipping ahead I don''t know what might be causing this slowing of movements The whole point of using time based movements is to prevent slowing down during slower fps periods. Anyone have any ideas as to the cause, or perhaps an alternative?

Share this post


Link to post
Share on other sites