PDA

View Full Version : RAEL() and games


w_reade
2002.09.09, 09:12 PM
that's RunApplicationEventLoop(), btw.

So, is it a good idea?

that is: as far as I can tell, you call RAEL() and it calls other functions depending on (1) events and (2) timers.

If I simply had a timer which called a function DoFrame() thirty times (say) every second, what sort of a speed penalty would there be, compared to a function like the following?



void MainLoop(void)
{
while (!done)
{
GetTime();

DoFrame();
WaitNextEvent();
HandleEvent();

TwiddleThumbsUntilTimeForNextFrame();
}
}



Or is RAEL() absolutely fine for games? I can see plenty of convenience advantages to it, but I have no idea about speed. If anyone knows, do let me know. Cheers!

OneSadCookie
2002.09.09, 09:21 PM
Counterintuitive as it may seem, using RAEL will actually speed up your game (except possibly over WNE(60)).

The reason is that if you don't give time to the OS, it starts taking time from you (bad runaway program! No CPU for you! One year!).

If you behave nicely (and RAEL is the nicest), you'll get plenty of time.

Note that it's perfectly fine to set up a 1ms timer and draw your frame when you get called back from that (essentially as often as possible).

w_reade
2002.09.09, 09:35 PM
wonderful, thanks.

ps why are you sad? are you lonely 'cos there's only one of you?

Steven
2002.09.09, 10:44 PM
LOL
BTW, I think your subtitle should read...
'Salty Confection'
My opinion,
Steven

Josh
2002.09.09, 10:46 PM
Originally posted by w_reade
ps why are you sad? are you lonely 'cos there's only one of you? I think this has come up before and we are yet to get an answer...

OneSadCookie
2002.09.09, 11:18 PM
BTW, I think your subtitle should read...
'Salty Confection'

Whoops. Changed :)

OneSadCookie
2002.09.09, 11:27 PM
ps why are you sad? are you lonely 'cos there's only one of you?

You people are so persistent!

http://www.noodles.co.nz :D