Advertisement

Jumpy graphics

Started by February 29, 2000 09:16 PM
4 comments, last by NewDeal 25 years ago
Im working on this 2D space shooter. Up until now ive run the game at max speed getting a framerate round 90 fps (limited by the monitor). I tried to limit the framrate to a constant 40 fps by adding a timer function. I got the fps down to 40 but now the graphics r "jumpy". I dont get this since many of the sprites r only moving 1 pixel each frame -and 40 fps should be more than enough to make it look smooth. Does anybody have a good explanation to this ? thanks
Are you still waiting for the Vertical Refresh, (like you said, you were limiting to your monitor) try turning it off, dont know if that would help, does anyone?
Advertisement
What about trying with triple buffering and making your own blit functions .............should increase the performance..............:-)

have fun with the game Mikael ;-)
Hookups:
That has already crossed my mind. But since the game runs smooth when im not using the timer function i dont really think the blt routines r the problem. Same with triple buffering. The problem must be the timer function. This is how i did.

LARGE_INTEGER startloop, endloop, frequency, dtime;

double loopsecs; // time to run through loop

QueryPerformanceFrequency(&frequency);

Main_game_loop()
{
QueryPerformanceCounter(&startloop);

// game stuff here (draw next frame ect)

QueryPerformanceCounter(&endloop);

dtime = endloop.QuadPart - startloop.QuadPart;

loopsecs = (FLOAT)dtime / (FLOAT)frequency.QuadPart;
}

// now ill move my ship

ship.posx+= loopsecs * 20 (where 20 is the speed of the ship)

Thanx
hehe

OK ... think i might found out what''s wrong ... since the ship.xpos variable is an int the floating part of the distance will be cut off when im blitting. Isnt it possible that this causes the ship to move somewhat unregular. I mean. If the distance to move in pixels is around say 1.5 for each loop, this could mean that the number almost randomly gets rounded up/down to 1 or 2.

Doesnt that sound reasonable ?
Hi!

In my little space shooter I was having the same problem.. what I found was:

a) If I use bltfast to copy the backbuffer in the main buffer the motion looks ''jumpy'' but I got more frames/sec.

b) If I use Flip then the action is smooth although it''s slower..This is because I have no enough VRam to hold all the images.(only 1Meg)

Now I''m using bltfast to copy images to the backbuffer (I implemented my own clipper) and the Flip function to copy to the main buffer. It''s fast enough and It will run smooth on all pc''s -hope so =P -

Well, hope this help you a little.. laters!
"Old programmers don't die,they just terminate and stay resident."

This topic is closed to new replies.

Advertisement