iDevGames Forums
Alternative to NSTimer - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Alternative to NSTimer (/thread-1592.html)

Pages: 1 2 3 4 5 6


Alternative to NSTimer - AnotherJake - Jul 14, 2009 09:47 AM

warmi Wrote:The only posts worth deleting are the ones talking about bullshit and ignorance without contributing anything.

longjumper is a very long-time member here and has contributed way more than enough over the years to have earned the right to complain about whatever he pleases, and I happen to agree with him on this account. Wink

Also, guys, please refrain from swearing.


Alternative to NSTimer - DoG - Jul 14, 2009 01:21 PM

mpatric Wrote:I've seen this happen a lot on the iPhone, especially when doing some rapid prototyping. Before optimising the drawing code, if it takes close to 16.6 ms (which is the period for 60fps), the timer regularly fires with 33.3 ms intervals (double 16ms, as one fire has been skipped).

This is why mainly people oversample (trigger the timer at a much higher rate than required for 60fps), perhaps without realising it.

Just to make this clear for the last time: it's not a fault with NSTimer. Whenever you do drawing on the iphone, it's essentially VBL synced to 60Hz. If your timer fires just a bit too late, or your code takes too long to execute, it'll block until the next refresh period.

And I really don't know how you expect NSTimer to fire on a given thread *before* your code is done.

All the discussions, here, and on the Apple forums, are not because this is such a controversial topic, but because a lot of new developers can't seem to read the manual, or at least don't understand how any two technologies interact.


Alternative to NSTimer - reklis - Jan 8, 2010 08:34 PM

DoG Wrote:Just to make this clear for the last time: it's not a fault with NSTimer. Whenever you do drawing on the iphone, it's essentially VBL synced to 60Hz. If your timer fires just a bit too late, or your code takes too long to execute, it'll block until the next refresh period.

And I really don't know how you expect NSTimer to fire on a given thread *before* your code is done.

All the discussions, here, and on the Apple forums, are not because this is such a controversial topic, but because a lot of new developers can't seem to read the manual, or at least don't understand how any two technologies interact.

I just wanted to take a moment to update this thread and say that with OS 3.1 there is now the CADisplayLink (developer.apple.com) class which allows developers to synchronize their code with the refresh rate of the screen.

Cocos2d has adopted this, click here for an exerpt (gist)from CCDirector.m


Alternative to NSTimer - riruilo - Jan 11, 2010 01:52 PM

reklis Wrote:I just wanted to take a moment to update this thread and say that with OS 3.1 there is now the CADisplayLink (developer.apple.com) class which allows developers to synchronize their code with the refresh rate of the screen.

Cocos2d has adopted this, click here for an exerpt (gist)from CCDirector.m

Doing that has a little problem: http://chitika.com/research/2009/iphone-os-not-worth-10/

BTW, What is the best way to manage game loop in 2.2 version? (without taking in account 3.0 or further) And does anyone know which method use successful games, let's say Rolando or Monkey Ball.

Thanks a lot for your ideas.