Where to put my game loop?

Posts: 5
Joined: 2009.01
Post: #1

I've been looking through the posts here at questions on rending and getting sprites on the screen with opengl.

It occurred to me that in the sample opengl framework and how I was looking at it was basically having one place to do my game related stuff as well as drawing stuff. I saw people mentioning things about rending vs the game loop and keeping them separate...

I'm curious where people are putting those main loops for the game logic. I'm still relatively new to iphone development, so if there's an obvious place, I may be missing it.


Quote this message in a reply
Posts: 3,591
Joined: 2003.06
Post: #2
Here's a good article on the subject: http://www.sacredsoftware.net/tutorials/...tion.xhtml

The basic idea is that you do your draw routine as normal, but inside draw, before you start drawing, you call update however many times necessary to keep it timed right. Frame rate will vary, but the tick rate at which you update your game remains constant.
Quote this message in a reply
Posts: 5
Joined: 2009.01
Post: #3
ahhh... ok, that makes sense.

thanks AJ. and that looks like a good site, too. Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Game loop and performance wonza 12 9,057 Dec 9, 2009 11:02 PM
Last Post: AnotherJake
  How do you manage events and game loop? riruilo 2 4,171 Nov 23, 2009 04:16 PM
Last Post: riruilo