From 035da588f88badb1779ee869a43b195ffbcd1c18 Mon Sep 17 00:00:00 2001 From: James Darpinian Date: Fri, 21 Jun 2024 20:33:48 -0700 Subject: [PATCH] Fix framerate throttling in Emscripten builds Default com_maxfps to 0 under Emscripten. Under Emscripten the browser handles throttling the frame rate. Manual framerate throttling interacts poorly with Emscripten's browser-driven event loop. --- code/qcommon/common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/qcommon/common.c b/code/qcommon/common.c index aeab6e2e81..092a2fd4f4 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2741,7 +2741,14 @@ void Com_Init( char *commandLine ) { // init commands and vars // com_altivec = Cvar_Get ("com_altivec", "1", CVAR_ARCHIVE); +#ifdef EMSCRIPTEN + // Under Emscripten the browser handles throttling the frame rate. + // Manual framerate throttling interacts poorly with Emscripten's + // browser-driven event loop. So default throttling to off. + com_maxfps = Cvar_Get ("com_maxfps", "0", CVAR_ARCHIVE); +#else com_maxfps = Cvar_Get ("com_maxfps", "85", CVAR_ARCHIVE); +#endif com_blood = Cvar_Get ("com_blood", "1", CVAR_ARCHIVE); com_logfile = Cvar_Get ("logfile", "0", CVAR_TEMP );