Game Engine Architecture

(Ben Green) #1
337

TranslateMessage (&msg);
DispatchMessage (&msg);
}

// Measure real delta time in milliseconds.
do
{
newtime = Sys_Milliseconds ();
time = newtime - oldtime;
} while (time < 1);

// Run a frame of the game.
Qcommon_Frame (time);

oldtime = newtime;
}

// never gets here
return TRUE;
}

voidQcommon_Frame (int msec)
{
char *s;
int time_before, time_between, time_after;

// [some details omitted...]

// Handle fixed-time mode and time scaling.
if (fixedtime->value)
msec = fixedtime->value;
else if (timescale->value)
{
msec *= timescale->value;
if (msec < 1)
msec = 1;
}

// Service the in-game console.
do
{
s = Sys_ConsoleInput ();
if (s)
Cbuf_AddText (va("%s\n",s));
} while (s);
Cbuf_Execute ();

7.7. Networked Multiplayer Game Loops

Free download pdf