Jump to content
  • Advertisement
Sign in to follow this  
ade-the-heat

game nearing end - but jerky play

This topic is 5399 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 managed to get the frame rate fixed at 20 fps. So it sort of like plays smoothly - but the movement seems jerky - is this because I'm attempting to move the player too far per frame hence seemingly jumpy or is there another reason ? In any case -short of upping the fps to some large value what can I do about it ? cheers

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
that would rely on the speed of your character, but anyway if the speed is adjusted from the dT (DeltaTime between each frame) then your movement should be smooth whatever the framerate. Do you have more info on how you do move/rotate your char ?

Share this post


Link to post
Share on other sites
yes, it's not even a char as such - it's a first person view aeroplane. I'd love to give you the link to it but I've messed up my web site with it on..

Share this post


Link to post
Share on other sites
If you are using a timer with low precision such as GetTickCount, then if your FPS is too high, the timer will not be able to measure the time between frames accurately. So, it will jerk from 0 to some number back and forth, making your game look jerky. Try setting a minimum possible delta-t between frames.

Share this post


Link to post
Share on other sites
by the sounds of it it isn't a timer problem - I replaced my timer code with GetTickCount and timeGetTime and although the screen looked jerky (timer flipflopping from 0 to 6 or 7), it was still rendering at well over 100fps. When I replaced it with QueryPerformanceCounter the image was as smooth as the rendering speed.

If your FPS counter is fixed at 20, then try one of these:

1. Don't render anything. Clear the screen, flip the buffers, and keep it at that. If it's still at 20 then the problem lies somewhere else. If not, you're rendering too much :).

2. Make sure your screen is at a valid resolution, and that accumulation buffers arn't being created, the stencil buffer isn't bigger than 8 bits, and the depth is no more than 24 (32 for some cards).

3. Render everything at 640x480x16 with a 16-bit depth buffer and no stencil buffer.

4. If you are only refreshing the game when the timer says it's time (i.e. you are controlling your own frame rate), then yes, it could be a timer problem. I just ripped this code from the first project on my HD and it seems to work fine:


float time_delta = 0.0f;
float time_total = 0.0f;

LARGE_INTEGER time_old = { 0 };

void Timer_Update ()
{
LARGE_INTEGER time_new;
LARGE_INTEGER time_freq;

// If the timer hasn't been set yet, set it. No need up update
// time_delta and time_total as no time has yet passed.
if (!time_old.QuadPart)
{
QueryPerformanceCounter (&time_old);
return;
}

QueryPerformanceCounter (&time_new);
QueryPerformanceFrequency (&time_freq);

time_delta = (float) (time_new.QuadPart - time_old.QuadPart) / time_freq.QuadPart;
// time_delta *= 0.001f; // No need, line above puts it in seconds.
time_total += time_delta;

time_old = time_new;
}



extern time_delta and time_total to get to the values.

5. "In any case -short of upping the fps to some large value what can I do about it?" errr... just noticed this line. surely your FPS is your frame rate, therefor why would it be fixed in the first place?

I'm done.


Sorry about the double post - I must have wiped my cookies by accident.

Share this post


Link to post
Share on other sites
Hi, yes I'm fixing my frame rate at 20 using the QueryPerformanceCounter call.

To be honest - I think it's my equations of motion that are wrong for the airplane in question - I didn't do it the proper way for airplanes but used my own simplifications of them.
I'm at work at the mo'so can't do much - I'll try later on thsi evening...

cheers

Share this post


Link to post
Share on other sites
>>Hi, yes I'm fixing my frame rate at 20 using the QueryPerformanceCounter call.<<

DONT fix your framerate let the graphics run as fast as possible.
then u have 2 options either running your physics/movement etc at a fixed rate eg 30-50fps or updating it once per frame and basing movement off the time its been since the last frame


also using GetTickCount or timeGetTime or QueryPerformanceCounter aint also the issue

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!