Jerky Movement Code

BlitzMax Forums/BlitzMax Programming/Jerky Movement Code

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The problem is this : your screen does not get updated with the graphics the same speed as your program is producing them. The refresh rate of most people's screens is probably going to be 75 or 85 - but let's use an example of 60.

If you program your game to use a set speed of 50 frames a second, what will happen is that every 1 in 5 frames will be doubled, compensating for the extra 10 frames per second. This is what causes the notable jerkiness.

The ultimate solution is to find out what refresh rate the graphics card/drivers/directx/opengl/whatever have chosen to kick into - however this doesn't seem to be possible in directx7, don't know the situation for dx9 or ogl - if you could find out the exact number you can adjust all the timing in your game by that amount... but since you can't, well, there's other ways. You -could- force the refresh rate setting to a number chosen by you - but you have to be extra careful that the gfx card or monitor can handle it - and even if the drivers tell you it can be handled, they could be lieing. This is what BlitzMax tries to rely on. It seems to be the preferred way...

Another option is to run your game at 1000 fps =] That will look smooth on anybody's system (if it can handle the computations) =]