Added client-side Thinkers
Adds support for client-side Thinkers, Actors, and ACS scripts (ACS uses the existing CLIENTSIDE keyword). These will tick regardless of the network state allowing for localized client handling and are put in their own separate lists so they can't be accidentally accessed by server code. They currently aren't serialized since this would have no meaning for other clients in the game that would get saved. Other logic like the menu, console, HUD, and particles have also been moved to client-side ticking to prevent them from becoming locked up by poor network conditions. Additionally, screenshotting and the automap are now handled immediately instead of having to wait for any game tick to run first, making them free of net lag.
This commit is contained in:
parent
e4081df0db
commit
f7e62a8cd6
28 changed files with 507 additions and 215 deletions
|
|
@ -73,6 +73,8 @@
|
|||
#include "i_interface.h"
|
||||
#include "savegamemanager.h"
|
||||
|
||||
void P_RunClientsideLogic();
|
||||
|
||||
EXTERN_CVAR (Int, disableautosave)
|
||||
EXTERN_CVAR (Int, autosavecount)
|
||||
EXTERN_CVAR (Bool, cl_capfps)
|
||||
|
|
@ -1800,6 +1802,12 @@ static bool ShouldStabilizeTick()
|
|||
void TryRunTics()
|
||||
{
|
||||
GC::CheckGC();
|
||||
|
||||
if (ToggleFullscreen)
|
||||
{
|
||||
ToggleFullscreen = false;
|
||||
AddCommandString("toggle vid_fullscreen");
|
||||
}
|
||||
|
||||
bool doWait = (cl_capfps || pauseext || (!netgame && r_NoInterpolate && !M_IsAnimated()));
|
||||
if (vid_dontdowait && (vid_maxfps > 0 || vid_vsync))
|
||||
|
|
@ -1852,14 +1860,6 @@ void TryRunTics()
|
|||
// commands to predict.
|
||||
if (runTics <= 0)
|
||||
{
|
||||
// If we actually did have some tics available, make sure the UI
|
||||
// still has a chance to run.
|
||||
for (int i = 0; i < totalTics; ++i)
|
||||
{
|
||||
C_Ticker();
|
||||
M_Ticker();
|
||||
}
|
||||
|
||||
// If we're in between a tic, try and balance things out.
|
||||
if (totalTics <= 0)
|
||||
TicStabilityWait();
|
||||
|
|
@ -1875,6 +1875,11 @@ void TryRunTics()
|
|||
S_UpdateSounds(players[consoleplayer].camera); // Update sounds only after predicting the client's newest position.
|
||||
}
|
||||
|
||||
// If we actually did have some tics available, make sure the UI
|
||||
// still has a chance to run.
|
||||
for (int i = 0; i < totalTics; ++i)
|
||||
P_RunClientsideLogic();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1895,8 +1900,6 @@ void TryRunTics()
|
|||
if (advancedemo)
|
||||
D_DoAdvanceDemo();
|
||||
|
||||
C_Ticker();
|
||||
M_Ticker();
|
||||
G_Ticker();
|
||||
MakeConsistencies();
|
||||
++gametic;
|
||||
|
|
@ -1912,6 +1915,11 @@ void TryRunTics()
|
|||
}
|
||||
P_PredictPlayer(&players[consoleplayer]);
|
||||
S_UpdateSounds(players[consoleplayer].camera); // Update sounds only after predicting the client's newest position.
|
||||
|
||||
// These should use the actual tics since they're not actually tied to the gameplay logic.
|
||||
// Make sure it always comes after so the HUD has the correct game state when updating.
|
||||
for (int i = 0; i < totalTics; ++i)
|
||||
P_RunClientsideLogic();
|
||||
}
|
||||
|
||||
void Net_NewClientTic()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue