charles dexter ward
- user since
- Mon May 20 2002 at 04:34:39 (6.5 years ago )
- last seen
- Wed Dec 4 2002 at 23:15:04 (6 years ago )
- number of write-ups
- 12 - View charles dexter ward's writeups (feed)
- level / experience
- 0 (Initiate) / 46
- mission drive within everything
- to flip, to flubble!
- specialties
- I specialise in generalisation
- school/company
- School of soft knocks
- motto
- I'm a lumberjack an' I'm okay...
- most recent writeup
- November 20, 1999
__ (00) - Vote Cthulhu for president. "The stars are right; /||\ why vote for the lesser of two evils?" Mindflayers: Make sexy brain eating tentacle love - Not war! Constant speed in games Solving this problem for a modular program is simple; another division just has to be made, has already been made most likely. Seperating the main game loop into two parts, the logic loop, and the graphics loop. Running the logic loop a set number of times a second, and the graphics loop whenever possible, but no more than once after a logic loop. (I mean really, what is the point?) to wit:
int play_game()
{
int actual_game_time = 0, okay_to_draw = TRUE;
while(!done)
{
while (actual_game_time < target_game_time)
{
logic_loop();
actual_game_time++;
ok_to_draw = TRUE;
}
if (ok_to_draw)
{
graphics_loop();
ok_to_draw = FALSE;
}
}
return 0;
}
|