QueryPerformanceCounter((LARGE_INTEGER *) &llCurTime);
fFrameTime=(llCurTime-llLastTime)/(float) llTimerFreq;
llLastTime=llCurTime;
((CMainFrame *) m_pMainWnd)->m_wndView.Game_Run(fFrameTime);
skip jerky walk through (time based movements calculation)
I'm having a problem with the walk through movement of the a game loop. It’s a bit jerky or skippy. The movements are based off a time calculation. This problem does not happen on every computer (only a certain few, but on those few it’s consistent).
I’ve seen many posts on the latency of the internal clock; but I haven’t seen a way to fix this. Below is a rough idea of the game loop.
The app is a SDI app this is run in the app level class overriding the Run() function:
Any ideas? Thank you very much.
Yes. A laptop. It was happening on a desktop (single processor) but after cleaning up the process and defragging it stopped happening. The one that remains is on a laptop though.
Another thing to look out for is keeping track of time in seconds as a float. After a machine has been running for a day or two, the precision in the float can't represent the number of seconds and an accurate fraction of a second, and you'll see the time, and thus animations, updating at a much slower rate than the actual frame rate.
Laptops often change the CPU frequency for low power consumption. QPC is reading the number of ticks the processor has run. Since the CPU is increasing and decreasing it's clockrate all the time on a laptop, you're getting inconsistant results.
A similar problem exists on dual-core systems where you have different tick counts on each of the two CPUs.
Try another timing option like timeGetTime(). I'm sure DH will have a few other options to throw your way too.
A similar problem exists on dual-core systems where you have different tick counts on each of the two CPUs.
Try another timing option like timeGetTime(). I'm sure DH will have a few other options to throw your way too.
I don't see why this one is posted in "DirectX"... Moved to General Programming [smile]
Cheers,
Jack
Cheers,
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement