Netcode Overhaul

Rewrote netcode to be more stable and functional. Packet-server mode has been restrategized and will now be the default netmode when playing with 3+ non-LAN players. TryRunTics has been cleaned up with older tick control behavior removed to account for the rewritten renderer. The main thread is now more consistent when playing online to prevent potential slow downs and lock ups. Load barriers are better accounted for to prevent spikes on level transition. Improvements to chat and lobby systems including a force start game button. Added a suite of new host options such as kicking and controlling who can pause the game. Max players increased from 8 to 16 since the new code can now handle it.

Note: Demo functionality is untested. This will be rewritten at a later time alongside improvements to GZDoom's playback features (e.g. freecam mode).
This commit is contained in:
Boondorl 2024-11-24 18:26:06 -05:00 committed by Rachael Alexanderson
commit 94be307225
45 changed files with 3119 additions and 2669 deletions

View file

@ -167,7 +167,7 @@ void CloseWidgetResources();
bool D_CheckNetGame ();
void D_ProcessEvents ();
void G_BuildTiccmd (ticcmd_t* cmd);
void G_BuildTiccmd (usercmd_t* cmd);
void D_DoAdvanceDemo ();
void D_LoadWadSettings ();
void ParseGLDefs();
@ -874,7 +874,6 @@ static void DrawRateStuff()
static void DrawOverlays()
{
NetUpdate ();
C_DrawConsole ();
M_Drawer ();
DrawRateStuff();
@ -904,6 +903,8 @@ void D_Display ()
int wipe_type;
sector_t *viewsec;
GC::CheckGC();
if (nodrawers || screen == NULL)
return; // for comparative timing / profiling
@ -960,7 +961,7 @@ void D_Display ()
}
// [RH] Allow temporarily disabling wipes
if (NoWipe || !CanWipe())
if (netgame || NoWipe || !CanWipe())
{
if (NoWipe > 0) NoWipe--;
wipestart = nullptr;
@ -1153,7 +1154,6 @@ void D_Display ()
}
else
{
NetUpdate(); // send out any new accumulation
PerformWipe(wipestart, screen->WipeEndScreen(), wipe_type, false, DrawOverlays);
}
cycles.Unclock();
@ -1177,7 +1177,6 @@ void D_ErrorCleanup ()
Net_ClearBuffers ();
G_NewInit ();
M_ClearMenus ();
singletics = false;
playeringame[0] = 1;
players[0].playerstate = PST_LIVE;
gameaction = ga_fullconsole;
@ -1224,28 +1223,7 @@ void D_DoomLoop ()
}
I_SetFrameTime();
// process one or more tics
if (singletics)
{
I_StartTic ();
D_ProcessEvents ();
G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
if (advancedemo)
D_DoAdvanceDemo ();
C_Ticker ();
M_Ticker ();
G_Ticker ();
// [RH] Use the consoleplayer's camera to update sounds
S_UpdateSounds (players[consoleplayer].camera); // move positional sounds
gametic++;
maketic++;
GC::CheckGC ();
Net_NewMakeTic ();
}
else
{
TryRunTics (); // will run at least one tic
}
TryRunTics (); // will run at least one tic
// Update display, next frame, with current state.
I_StartTic ();
D_ProcessEvents();
@ -3466,7 +3444,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
// [RH] Run any saved commands from the command line or autoexec.cfg now.
gamestate = GS_FULLCONSOLE;
Net_NewMakeTic ();
Net_Initialize();
C_RunDelayedCommands();
gamestate = GS_STARTUP;
@ -3558,6 +3536,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
AddCommandString(StoredWarp.GetChars());
StoredWarp = "";
}
gameaction = ga_mapwarp;
}
else
{