engine: introduce fps_override to unlock the 200 FPS limit in multiplayer games to 1000
This commit is contained in:
parent
f88d424ecd
commit
371639f0dc
4 changed files with 22 additions and 13 deletions
|
@ -218,7 +218,7 @@ double CL_GetDemoFramerate( void )
|
|||
{
|
||||
if( cls.timedemo )
|
||||
return 0.0;
|
||||
return bound( MIN_FPS, demo.header.host_fps, MAX_FPS );
|
||||
return bound( MIN_FPS, demo.header.host_fps, MAX_FPS_HARD );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -380,9 +380,10 @@ Write demo header
|
|||
*/
|
||||
static void CL_WriteDemoHeader( const char *name )
|
||||
{
|
||||
int copysize;
|
||||
int savepos;
|
||||
int curpos;
|
||||
double maxfps;
|
||||
int copysize;
|
||||
int savepos;
|
||||
int curpos;
|
||||
|
||||
Con_Printf( "recording to %s.\n", name );
|
||||
cls.demofile = FS_Open( name, "wb", false );
|
||||
|
@ -397,12 +398,14 @@ static void CL_WriteDemoHeader( const char *name )
|
|||
cls.demorecording = true;
|
||||
cls.demowaiting = true; // don't start saving messages until a non-delta compressed message is received
|
||||
|
||||
maxfps = fps_override.value ? MAX_FPS_HARD : MAX_FPS_SOFT;
|
||||
|
||||
memset( &demo.header, 0, sizeof( demo.header ));
|
||||
|
||||
demo.header.id = IDEMOHEADER;
|
||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||
demo.header.net_protocol = CL_GetDemoNetProtocol( cls.legacymode );
|
||||
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, MAX_FPS ) : MAX_FPS;
|
||||
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, maxfps ) : maxfps;
|
||||
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
||||
|
|
|
@ -118,8 +118,9 @@ typedef enum
|
|||
#include "fscallback.h"
|
||||
|
||||
// PERFORMANCE INFO
|
||||
#define MIN_FPS 20.0f // host minimum fps value for maxfps.
|
||||
#define MAX_FPS 200.0f // upper limit for maxfps.
|
||||
#define MIN_FPS 20.0f // host minimum fps value for maxfps.
|
||||
#define MAX_FPS_SOFT 200.0f // soft limit for maxfps.
|
||||
#define MAX_FPS_HARD 1000.0f // multiplayer hard limit for maxfps.
|
||||
#define HOST_FPS 100.0f // multiplayer games typical fps
|
||||
|
||||
#define MAX_FRAMETIME 0.25f
|
||||
|
@ -164,6 +165,7 @@ extern convar_t host_allow_materials;
|
|||
extern convar_t host_developer;
|
||||
extern convar_t host_limitlocal;
|
||||
extern convar_t host_maxfps;
|
||||
extern convar_t fps_override;
|
||||
extern convar_t sys_timescale;
|
||||
extern convar_t cl_filterstuffcmd;
|
||||
extern convar_t rcon_password;
|
||||
|
|
|
@ -56,6 +56,7 @@ static CVAR_DEFINE_AUTO( host_gameloaded, "0", FCVAR_READ_ONLY, "inidcates a loa
|
|||
static CVAR_DEFINE_AUTO( host_clientloaded, "0", FCVAR_READ_ONLY, "inidcates a loaded client.dll" );
|
||||
CVAR_DEFINE_AUTO( host_limitlocal, "0", 0, "apply cl_cmdrate and rate to loopback connection" );
|
||||
CVAR_DEFINE( host_maxfps, "fps_max", "72", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "host fps upper limit" );
|
||||
CVAR_DEFINE_AUTO( fps_override, "1", FCVAR_ARCHIVE, "unlock higher framerate values" );
|
||||
static CVAR_DEFINE_AUTO( host_framerate, "0", FCVAR_FILTERABLE, "locks frame timing to this value in seconds" );
|
||||
static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
|
||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||
|
@ -594,9 +595,11 @@ static double Host_CalcFPS( void )
|
|||
{
|
||||
if( !gl_vsync.value )
|
||||
{
|
||||
double max_fps = fps_override.value ? MAX_FPS_HARD : MAX_FPS_SOFT;
|
||||
|
||||
fps = host_maxfps.value;
|
||||
if( fps == 0.0 ) fps = MAX_FPS;
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
if( fps == 0.0 ) fps = max_fps;
|
||||
fps = bound( MIN_FPS, fps, max_fps );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -615,7 +618,7 @@ static qboolean Host_Autosleep( double dt, double scale )
|
|||
return true;
|
||||
|
||||
// limit fps to withing tolerable range
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS_HARD );
|
||||
|
||||
if( Host_IsDedicated( ))
|
||||
targetframetime = ( 1.0 / ( fps + 1.0 ));
|
||||
|
@ -1041,7 +1044,7 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
|
|||
|
||||
if( Sys_GetParmFromCmdLine( "-sys_ticrate", ticrate ))
|
||||
{
|
||||
double fps = bound( MIN_FPS, atof( ticrate ), MAX_FPS );
|
||||
double fps = bound( MIN_FPS, atof( ticrate ), MAX_FPS_HARD );
|
||||
Cvar_SetValue( "sys_ticrate", fps );
|
||||
}
|
||||
|
||||
|
@ -1140,6 +1143,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||
Cvar_RegisterVariable( &host_allow_materials );
|
||||
Cvar_RegisterVariable( &host_serverstate );
|
||||
Cvar_RegisterVariable( &host_maxfps );
|
||||
Cvar_RegisterVariable( &fps_override );
|
||||
Cvar_RegisterVariable( &host_framerate );
|
||||
Cvar_RegisterVariable( &host_sleeptime );
|
||||
Cvar_RegisterVariable( &host_sleeptime_debug );
|
||||
|
|
|
@ -262,8 +262,8 @@ static void SV_CheckCmdTimes( void )
|
|||
if( sv_fps.value < MIN_FPS )
|
||||
Cvar_SetValue( "sv_fps", MIN_FPS );
|
||||
|
||||
if( sv_fps.value > MAX_FPS )
|
||||
Cvar_SetValue( "sv_fps", MAX_FPS );
|
||||
if( sv_fps.value > MAX_FPS_HARD )
|
||||
Cvar_SetValue( "sv_fps", MAX_FPS_HARD );
|
||||
}
|
||||
|
||||
if( Host_IsLocalGame( ))
|
||||
|
|
Loading…
Add table
Reference in a new issue