Is your game "slightly" jerky, jumpy, or shaky? Here's a fix!

Started by
30 comments, last by oxygen_728 20 years ago
oxygen_728,

What have you set D3DSWAPEFFECT and D3DPRESENT_PARAMETERS:resentationInterval to when creating the D3D device in running these tests? There is an issue involving timer granularity that can cause the exact "stuttering" behavior you are seeing.

I would also encourage you to simply up the priority of your application through the right-click option in Task Manager rather than changing from within your app. Watch what happens to the other apps on the system. Realize that a user can always do this themselves if the app is jerky. Even if your app is running fullscreen, users running other apps on multimon systems are going to be hosed in getting those apps to respond properly while you''re running at a higher priority.

If you want to know more about the Windows thread scheduler start here. The scheduler in XP has probably changed somewhat since that article was written. You might try looking on MSDN for updated info.

Lastly, it would be worthwhile to get a system-wide profiler like Intel''s VTune and profile your app to see exactly what process/thread is interrupting your app and making it stutter. I think you can download a free evaluation version of VTune from Intel''s website.
Advertisement
Ok, I have a few suggestions...

I don''t think setting priority from your app is the best idea, better let the OS handle that.

There are a few things however that could smooth out your gameplay. I have been running into the ''jitter'' problems ever since starting to use D3D. The jitters are cause by granularity in elapsed times, like you mensioned before you get 5ms frames, and then some are like 40ms, even 75 sometimes.

Here''s what I do to fix those problems:

- Check your Time function, be in QPC or timeGetTime or GetTickCount for duplicate readings. Sometimes these function return the same exact value, or return weird negative values. This happens more than some people think, so check for that.

- Average out your elapsed time readings. I usually average out 1/2 second of elapsed times, so if your game is running at 100 fps, i take the last 50 elapsed times and average them. Basically this keeps your ElapsedTime pretty much constant, without crazy jumps. Huge for making the game really smooth.

- Use camera, that accelerates and decelerates to smooth out the scrolling, this helps with ''ghosting''

I cant think of anything else right now, but when I do i''ll mension it. These are things that i currently use in my code, and they make a huge difference.

Changing priorities will help, but I don''t suggest doing so, let the OS manage that, there are a few things that can be done though without that.

hope that helps,
~Dima

This topic is closed to new replies.

Advertisement