[gameprogrammer] Re: Fixed Rate Logic

hmm ok

what i had figured for processing the event queue was something like...


while( !GameOver)
{
 while(eventqueue && eventqueue->fire < Now())
 {
   //process one event
 }
 //render everything
}

if you had an event in there that had a firing rate of 1ms and put
itself back into the queue every time it ran, im assuming the
processing of that event would take > 1 ms and so then you'd be caught
in a loop forever.


On 12/6/06, David Olofson <david@xxxxxxxxxxx> wrote:
On Thursday 07 December 2006 00:43, Alan Wolfe wrote:
> for processing the queue do you just go until the first item is >
> current time and then you render a scene?

That's the idea. (Same deal as with my "normal" fixed frame rate logic
solutions, without priority queues.)


> just curious cause if something wanted to be put on the queue 1ms
> from "now" it seems like the game may never get caught up enough to
> render a scene, it'd just keep updating that 1ms update.

Why would that happen? Events to be processed later than "now" will
just be left alone, regardless of when they were inserted.

Basically, the priority queue is just a more scalable and more optimal
implementation of the old school "check all live objects every frame"
approach I use in Fixed Rate Pig and Kobo Deluxe (which got that
logic directly from XKobo.) Enqueue an event, or change a
timer/counter somewhere. Same thing; it just means someone will
somehow discover that it's time to do something when it's time to do
it. :-)


//David Olofson - Programmer, Composer, Open Source Advocate

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'

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




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


Other related posts: