Timed jitter issue...

Hey guys,

I'm stumped. I've written an SDL program using a while loop to run my program. The typical game code. Everything works, using a frame-independent movement system that recalculates velocity based on fps, so the velocity stays the same regardless. Updating at 30 fps. Every 2nd second or so as my player moves, there's a 5-10 pixel jitter... it's almost every other second, nonstop, like clockwork. I can't seem to figure it out. I've changed the movement system to pixel based movement, taking out any calculations. I've changed the fps, used a filled-rect instead of an image... I just don't know what could cause this timed jitter... program sits at 3% cpu utilization on a quad-core processor... I have no ideas. Any input? I'll try writing a fresh program with barebones to see if it happens, but I've noticed this on numerous programs. Anyway, thanks for any help!

Edit: I'm sorry, I mentioned I changed the fps and no change. Sadly, this isn't true. I tried that on another program, but not this one. Changed the fps DOES in fact change the results. Greater fps results in an increased frequency. Sorry about that.

Update: I wrote a barebones source with SDL_Rect and simple 5 pixel movement. I've tried it on 3 different machines, each different tiers of performance. quad core with ssd, dual core with ssd, and a netbook with a standard hhd. Same result. As I'm moving the rect left and right, across the screen, based on the fps set, every second-2 seconds or so, the box jitters for a split second... like clockwork. Never fails. I'm truly stumped... is this possibly an SDL thing? I have no idea...

Another update:

1
2
3
4
if(second/fps>(SDL_GetTicks() - start))
      SDL_Delay(second / fps - (SDL_GetTicks() - start));
const unsigned int second = 1000;
const unsigned int fps = 30;



if I comment out the if statement, this problem goes away. My question is, is this if statement causing the problem? Or because this issue is fps based, by commenting out this statement, the fps jumps to a number so high the problem isn't seen?
Last edited on
Topic archived. No new replies allowed.