Dynamic ticrate calculation (related to framerate)

This commit is contained in:
Simon 2020-12-10 21:00:15 +00:00
parent 64b001537c
commit d680b76bba
10 changed files with 25 additions and 24 deletions

3
.gitignore vendored
View file

@ -28,13 +28,14 @@ $RECYCLE.BIN/
projects/Android/build/* projects/Android/build/*
assets/oculussig* assets/oculussig*
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/android_gradle_build.json Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/android_gradle_build.json
Projects/Android/.cxx/ndkBuild/*
*.json *.json
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_command.txt Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_output.txt Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_output.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_command.txt Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_command.txt
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_output.txt Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_output.txt
*.bin *.bin
Projects/Android/.gradle/4.4/fileHashes/fileHashes.lock Projects/Android/.gradle/*
*.ser *.ser
Projects/Android/.idea/codeStyles/Project.xml Projects/Android/.idea/codeStyles/Project.xml
*.xml *.xml

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.quakequest" package="com.drbeef.quakequest"
android:versionCode="15" android:versionCode="16"
android:versionName="1.4.7" android:installLocation="auto" > android:versionName="1.4.8" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/> <uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -1,6 +1,6 @@
#Sat Jul 27 06:47:04 BST 2019 #Tue Dec 08 08:47:00 GMT 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View file

@ -519,7 +519,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 0\n" "sv_gameplayfix_q1bsptracelinereportstexture 0\n"
"sv_gameplayfix_swiminbmodels 0\n" "sv_gameplayfix_swiminbmodels 0\n"
"sv_gameplayfix_downtracesupportsongroundflag 0\n" "sv_gameplayfix_downtracesupportsongroundflag 0\n"
"sys_ticrate 0.0138889\n"
"r_shadow_gloss 1\n" "r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n" "r_shadow_bumpscale_basetexture 0\n"
); );
@ -543,7 +542,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 0\n" "sv_gameplayfix_q1bsptracelinereportstexture 0\n"
"sv_gameplayfix_swiminbmodels 0\n" "sv_gameplayfix_swiminbmodels 0\n"
"sv_gameplayfix_downtracesupportsongroundflag 0\n" "sv_gameplayfix_downtracesupportsongroundflag 0\n"
"sys_ticrate 0.0138889\n"
"r_shadow_gloss 1\n" "r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n" "r_shadow_bumpscale_basetexture 0\n"
); );
@ -571,7 +569,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 0\n" "sv_gameplayfix_q1bsptracelinereportstexture 0\n"
"sv_gameplayfix_swiminbmodels 0\n" "sv_gameplayfix_swiminbmodels 0\n"
"sv_gameplayfix_downtracesupportsongroundflag 0\n" "sv_gameplayfix_downtracesupportsongroundflag 0\n"
"sys_ticrate 0.0138889\n"
"r_shadow_gloss 1\n" "r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n" "r_shadow_bumpscale_basetexture 0\n"
); );
@ -596,7 +593,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 0\n" "sv_gameplayfix_q1bsptracelinereportstexture 0\n"
"sv_gameplayfix_swiminbmodels 0\n" "sv_gameplayfix_swiminbmodels 0\n"
"sv_gameplayfix_downtracesupportsongroundflag 0\n" "sv_gameplayfix_downtracesupportsongroundflag 0\n"
"sys_ticrate 0.0138889\n"
"r_shadow_gloss 1\n" "r_shadow_gloss 1\n"
"r_shadow_bumpscale_basetexture 0\n" "r_shadow_bumpscale_basetexture 0\n"
); );
@ -620,7 +616,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 0\n" "sv_gameplayfix_q1bsptracelinereportstexture 0\n"
"sv_gameplayfix_swiminbmodels 0\n" "sv_gameplayfix_swiminbmodels 0\n"
"sv_gameplayfix_downtracesupportsongroundflag 0\n" "sv_gameplayfix_downtracesupportsongroundflag 0\n"
"sys_ticrate 0.0138889\n"
"r_shadow_gloss 2\n" "r_shadow_gloss 2\n"
"r_shadow_bumpscale_basetexture 4\n" "r_shadow_bumpscale_basetexture 4\n"
); );
@ -644,7 +639,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 1\n" "sv_gameplayfix_q1bsptracelinereportstexture 1\n"
"sv_gameplayfix_swiminbmodels 1\n" "sv_gameplayfix_swiminbmodels 1\n"
"sv_gameplayfix_downtracesupportsongroundflag 1\n" "sv_gameplayfix_downtracesupportsongroundflag 1\n"
"sys_ticrate 0.0138889\n"
"sv_gameplayfix_q2airaccelerate 1\n" "sv_gameplayfix_q2airaccelerate 1\n"
"sv_gameplayfix_stepmultipletimes 1\n" "sv_gameplayfix_stepmultipletimes 1\n"
); );
@ -669,7 +663,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 1\n" "sv_gameplayfix_q1bsptracelinereportstexture 1\n"
"sv_gameplayfix_swiminbmodels 1\n" "sv_gameplayfix_swiminbmodels 1\n"
"sv_gameplayfix_downtracesupportsongroundflag 1\n" "sv_gameplayfix_downtracesupportsongroundflag 1\n"
"sys_ticrate 0.0138889\n"
"cl_csqc_generatemousemoveevents 0\n" "cl_csqc_generatemousemoveevents 0\n"
); );
break; break;
@ -692,7 +685,6 @@ static void Cmd_Exec(const char *filename)
"sv_gameplayfix_q1bsptracelinereportstexture 1\n" "sv_gameplayfix_q1bsptracelinereportstexture 1\n"
"sv_gameplayfix_swiminbmodels 1\n" "sv_gameplayfix_swiminbmodels 1\n"
"sv_gameplayfix_downtracesupportsongroundflag 1\n" "sv_gameplayfix_downtracesupportsongroundflag 1\n"
"sys_ticrate 0.0138889\n"
); );
break; break;
} }

View file

@ -662,6 +662,8 @@ Runs all active servers
*/ */
static void Host_Init(void); static void Host_Init(void);
float GetSysTicrate();
double time1 = 0; double time1 = 0;
double time2 = 0; double time2 = 0;
double time3 = 0; double time3 = 0;
@ -842,7 +844,7 @@ void Host_BeginFrame(bool stopTime)
// don't allow simulation to run too fast or too slow or logic glitches can occur // don't allow simulation to run too fast or too slow or logic glitches can occur
// stop running server frames if the wall time reaches this value // stop running server frames if the wall time reaches this value
if (sys_ticrate.value <= 0) if (GetSysTicrate() <= 0)
advancetime = sv_timer; advancetime = sv_timer;
else if (cl.islocalgame && !sv_fixedframeratesingleplayer.integer) else if (cl.islocalgame && !sv_fixedframeratesingleplayer.integer)
{ {
@ -851,7 +853,7 @@ void Host_BeginFrame(bool stopTime)
} }
else else
{ {
advancetime = sys_ticrate.value; advancetime = GetSysTicrate();
// listen servers can run multiple server frames per client frame // listen servers can run multiple server frames per client frame
framelimit = cl_maxphysicsframesperserverframe.integer; framelimit = cl_maxphysicsframesperserverframe.integer;
aborttime = Sys_DirtyTime() + 0.1; aborttime = Sys_DirtyTime() + 0.1;

View file

@ -3611,7 +3611,7 @@ static void M_Credits_Draw (void)
" QQQQQQQQ QQQQQQQQ ", " QQQQQQQQ QQQQQQQQ ",
" QQQ QQQ ", " QQQ QQQ ",
" Q Q ", " Q Q ",
" Q Q v1.4.7 "); " Q Q v1.4.8 ");
int i, l, linelength, firstline, lastline, lines; int i, l, linelength, firstline, lastline, lines;
for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_credits_message[i];i++) for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_credits_message[i];i++)

View file

@ -493,7 +493,6 @@ extern cvar_t sv_wallfriction;
extern cvar_t sv_wateraccelerate; extern cvar_t sv_wateraccelerate;
extern cvar_t sv_waterfriction; extern cvar_t sv_waterfriction;
extern cvar_t sv_areadebug; extern cvar_t sv_areadebug;
extern cvar_t sys_ticrate;
extern cvar_t teamplay; extern cvar_t teamplay;
extern cvar_t temp1; extern cvar_t temp1;
extern cvar_t timelimit; extern cvar_t timelimit;

View file

@ -151,7 +151,6 @@ cvar_t sv_warsowbunny_turnaccel = {0, "sv_warsowbunny_turnaccel", "0", "max shar
cvar_t sv_warsowbunny_backtosideratio = {0, "sv_warsowbunny_backtosideratio", "0.8", "lower values make it easier to change direction without losing speed; the drawback is \"understeering\" in sharp turns"}; cvar_t sv_warsowbunny_backtosideratio = {0, "sv_warsowbunny_backtosideratio", "0.8", "lower values make it easier to change direction without losing speed; the drawback is \"understeering\" in sharp turns"};
cvar_t sv_onlycsqcnetworking = {0, "sv_onlycsqcnetworking", "0", "disables legacy entity networking code for higher performance (except on clients, which can still be legacy)"}; cvar_t sv_onlycsqcnetworking = {0, "sv_onlycsqcnetworking", "0", "disables legacy entity networking code for higher performance (except on clients, which can still be legacy)"};
cvar_t sv_areadebug = {0, "sv_areadebug", "0", "disables physics culling for debugging purposes (only for development)"}; cvar_t sv_areadebug = {0, "sv_areadebug", "0", "disables physics culling for debugging purposes (only for development)"};
cvar_t sys_ticrate = {CVAR_SAVE, "sys_ticrate","0.0138889", "how long a server frame is in seconds, 0.05 is 20fps server rate, 0.1 is 10fps (can not be set higher than 0.1), 0 runs as many server frames as possible (makes games against bots a little smoother, overwhelms network players), 0.0138889 matches QuakeWorld physics"};
cvar_t teamplay = {CVAR_NOTIFY, "teamplay","0", "teamplay mode, values depend on mod but typically 0 = no teams, 1 = no team damage no self damage, 2 = team damage and self damage, some mods support 3 = no team damage but can damage self"}; cvar_t teamplay = {CVAR_NOTIFY, "teamplay","0", "teamplay mode, values depend on mod but typically 0 = no teams, 1 = no team damage no self damage, 2 = team damage and self damage, some mods support 3 = no team damage but can damage self"};
cvar_t timelimit = {CVAR_NOTIFY, "timelimit","0", "ends level at this time (in minutes)"}; cvar_t timelimit = {CVAR_NOTIFY, "timelimit","0", "ends level at this time (in minutes)"};
cvar_t sv_threaded = {0, "sv_threaded", "0", "enables a separate thread for server code, improving performance, especially when hosting a game while playing, EXPERIMENTAL, may be crashy"}; cvar_t sv_threaded = {0, "sv_threaded", "0", "enables a separate thread for server code, improving performance, especially when hosting a game while playing, EXPERIMENTAL, may be crashy"};
@ -561,7 +560,6 @@ void SV_Init (void)
Cvar_RegisterVariable (&sv_warsowbunny_backtosideratio); Cvar_RegisterVariable (&sv_warsowbunny_backtosideratio);
Cvar_RegisterVariable (&sv_onlycsqcnetworking); Cvar_RegisterVariable (&sv_onlycsqcnetworking);
Cvar_RegisterVariable (&sv_areadebug); Cvar_RegisterVariable (&sv_areadebug);
Cvar_RegisterVariable (&sys_ticrate);
Cvar_RegisterVariable (&teamplay); Cvar_RegisterVariable (&teamplay);
Cvar_RegisterVariable (&timelimit); Cvar_RegisterVariable (&timelimit);
Cvar_RegisterVariable (&sv_threaded); Cvar_RegisterVariable (&sv_threaded);
@ -1958,6 +1956,8 @@ SV_WriteClientdataToMessage
================== ==================
*/ */
float GetSysTicrate();
void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats) void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats)
{ {
prvm_prog_t *prog = SVVM_prog; prvm_prog_t *prog = SVVM_prog;
@ -2082,7 +2082,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
| (sv_gameplayfix_nogravityonground.integer ? MOVEFLAG_NOGRAVITYONGROUND : 0) | (sv_gameplayfix_nogravityonground.integer ? MOVEFLAG_NOGRAVITYONGROUND : 0)
| (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0) | (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0)
; ;
statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value; statsf[STAT_MOVEVARS_TICRATE] = GetSysTicrate();
statsf[STAT_MOVEVARS_TIMESCALE] = slowmo.value; statsf[STAT_MOVEVARS_TIMESCALE] = slowmo.value;
statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value; statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value;
statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value; statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value;
@ -2340,7 +2340,7 @@ static void SV_SendClientDatagram (client_t *client)
// //
// at very low rates (or very small sys_ticrate) the packet size is // at very low rates (or very small sys_ticrate) the packet size is
// not reduced below 128, but packets may be sent less often // not reduced below 128, but packets may be sent less often
maxsize = (int)(clientrate * sys_ticrate.value); maxsize = (int)(clientrate * GetSysTicrate());
maxsize = bound(128, maxsize, 1400); maxsize = bound(128, maxsize, 1400);
maxsize2 = 1400; maxsize2 = 1400;
// csqc entities can easily exceed 128 bytes, so disable throttling in // csqc entities can easily exceed 128 bytes, so disable throttling in
@ -3957,10 +3957,10 @@ static int SV_ThreadFunc(void *voiddata)
double advancetime; double advancetime;
float offset; float offset;
if (sys_ticrate.value <= 0) if (GetSysTicrate() <= 0)
advancetime = min(sv_timer, 0.1); // don't step more than 100ms advancetime = min(sv_timer, 0.1); // don't step more than 100ms
else else
advancetime = sys_ticrate.value; advancetime = GetSysTicrate();
if(advancetime > 0) if(advancetime > 0)
{ {

View file

@ -3010,6 +3010,8 @@ static void nearCallback (void *data, dGeomID o1, dGeomID o2)
} }
#endif #endif
float GetSysTicrate();
void World_Physics_Frame(world_t *world, double frametime, double gravity) void World_Physics_Frame(world_t *world, double frametime, double gravity)
{ {
prvm_prog_t *prog = world->prog; prvm_prog_t *prog = world->prog;
@ -3034,7 +3036,7 @@ void World_Physics_Frame(world_t *world, double frametime, double gravity)
if (physics_ode_constantstep.value > 0 && physics_ode_constantstep.value < 1) if (physics_ode_constantstep.value > 0 && physics_ode_constantstep.value < 1)
world->physics.ode_step = physics_ode_constantstep.value; world->physics.ode_step = physics_ode_constantstep.value;
else else
world->physics.ode_step = sys_ticrate.value; world->physics.ode_step = GetSysTicrate();
if (world->physics.ode_time > 0.2f) if (world->physics.ode_time > 0.2f)
world->physics.ode_time = world->physics.ode_step; world->physics.ode_time = world->physics.ode_step;
// set number of iterations to process // set number of iterations to process

View file

@ -2275,6 +2275,11 @@ float GetFOV()
return vrapi_GetSystemPropertyFloat( &java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y ); return vrapi_GetSystemPropertyFloat( &java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y );
} }
float GetSysTicrate()
{
return 1.0F / (float)(vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE));
}
void * AppThreadFunction( void * parm ) void * AppThreadFunction( void * parm )
{ {
ovrAppThread * appThread = (ovrAppThread *)parm; ovrAppThread * appThread = (ovrAppThread *)parm;