[gameprogrammer] Re: What is better

Chris Nystrom wrote:
> 2008/11/24 yasser gonzalez <yassergs@xxxxxxxxxxxxxxx>:
>> Hey, when you develop a game, what is more useful:
>> While loops or Timers?
> 
> I think it depends on the type of game. For an arcade game you need
> screen refreshes per amount of time, so you need a timer, while for a
> turn based game a loop is fine.

I would say it depends on what you mean by timers.  I mean, sleep() is a timer
(of low resolution), and it is incredibly useful inside a game loop.  Do all
your work, compute how long the work took, and then sleep for whatever span of
time is left until you need to update the game state again.

What little Game Boy Advance programming I've done has utilized a combination
of a main game loop and hardware interrupts that fired on a regular basis
(once every screen refresh).

The question is too broad to really answer - it's like asking "which is
better, a boat or a motorcycle?"  The answer kind of depends on whether you're
on city streets or an ocean. :-)
-- 
 Matthew Weigel
 hacker
 unique & idempot.ent

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: