NSTimer hiccups/choppy/jerky
Well, I'm using an NSTimer for my gameLoop and for a while now I've been thinking it was a problem with my gameLoop for the random hiccups I get.
I've tried frame dependent AND independent game loops and still I cannot figure out why I get these hiccups.
It may be something ELSE causing the issue, like my tile engine which constantly builds AND renders or my scrolling implementation.
Just some pseudo code:
I build 2 layers of around 900 quads each and can run 60 FPS no problem so its not the drop in FPS from what I can tell.
Any help would be much appreciated
I've tried frame dependent AND independent game loops and still I cannot figure out why I get these hiccups.
It may be something ELSE causing the issue, like my tile engine which constantly builds AND renders or my scrolling implementation.
Just some pseudo code:
Code:
- (void)init {
lastTime = 0.0f;
}
- (void)startLoop {
timer = [NSTimer scheduledTimerWith...selector:@selector(gameLoop)...];
}
// Frame dependent loop
- (void)gameLoop {
CFTimeInterval time = CFAbsoluteGetTimeCurrent();
float delta = (time - lastTime);
[self updateLogic:delta];
[self drawView];
lastTime = time;
}
- (void)stopLoop {
[timer invalidate];
}
// How i scroll my map (camera) which I use gluLookAt
- (void)updateLogic:(float)delta {
if (mapX < X + 0.1) {
mapX += 0.1 * delta;
}
}I build 2 layers of around 900 quads each and can run 60 FPS no problem so its not the drop in FPS from what I can tell.
Any help would be much appreciated
Use CADisplayLink instead.
I have already been down that route and there is no difference.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| NSTimer fine, CADisplayLink having some issues | monteboyd | 5 | 7,655 |
Aug 31, 2010 07:05 PM Last Post: Skorche |
|
| Alternative to NSTimer | demonpants | 78 | 37,900 |
Jan 11, 2010 01:52 PM Last Post: riruilo |
|
| Using an NSTimer to progressively draw a view | StevenD | 4 | 3,742 |
May 14, 2009 07:57 AM Last Post: StevenD |
|
| OpenGL render loop - NSTimer vs rendering thread | smallstepforman | 27 | 20,745 |
Feb 2, 2009 10:22 AM Last Post: ThemsAllTook |
|

