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:
parent
abfd91e8f1
commit
94be307225
45 changed files with 3119 additions and 2669 deletions
|
|
@ -95,6 +95,8 @@
|
|||
#include "s_music.h"
|
||||
#include "d_main.h"
|
||||
|
||||
extern int paused;
|
||||
|
||||
static FRandom pr_skullpop ("SkullPop");
|
||||
|
||||
// [SP] Allows respawn in single player
|
||||
|
|
@ -1236,7 +1238,7 @@ DEFINE_ACTION_FUNCTION(APlayerPawn, CheckEnvironment)
|
|||
void P_CheckUse(player_t *player)
|
||||
{
|
||||
// check for use
|
||||
if (player->cmd.ucmd.buttons & BT_USE)
|
||||
if (player->cmd.buttons & BT_USE)
|
||||
{
|
||||
if (!player->usedown)
|
||||
{
|
||||
|
|
@ -1269,7 +1271,7 @@ DEFINE_ACTION_FUNCTION(APlayerPawn, CheckUse)
|
|||
|
||||
void P_PlayerThink (player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
usercmd_t *cmd = &player->cmd;
|
||||
|
||||
if (player->mo == NULL)
|
||||
{
|
||||
|
|
@ -1309,14 +1311,14 @@ void P_PlayerThink (player_t *player)
|
|||
{
|
||||
fprintf (debugfile, "tic %d for pl %d: (%f, %f, %f, %f) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
|
||||
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
|
||||
player->mo->Angles.Yaw.Degrees(), player->cmd.ucmd.buttons,
|
||||
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
|
||||
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
|
||||
player->mo->Angles.Yaw.Degrees(), player->cmd.buttons,
|
||||
player->cmd.pitch, player->cmd.yaw, player->cmd.forwardmove,
|
||||
player->cmd.sidemove, player->cmd.upmove);
|
||||
}
|
||||
|
||||
// Make unmodified copies for ACS's GetPlayerInput.
|
||||
player->original_oldbuttons = player->original_cmd.buttons;
|
||||
player->original_cmd = cmd->ucmd;
|
||||
player->original_cmd = *cmd;
|
||||
// Don't interpolate the view for more than one tic
|
||||
player->cheats &= ~CF_INTERPVIEW;
|
||||
player->cheats &= ~CF_INTERPVIEWANGLES;
|
||||
|
|
@ -1453,8 +1455,7 @@ void P_PredictPlayer (player_t *player)
|
|||
{
|
||||
int maxtic;
|
||||
|
||||
if (singletics ||
|
||||
demoplayback ||
|
||||
if (demoplayback ||
|
||||
player->mo == NULL ||
|
||||
player != player->mo->Level->GetConsolePlayer() ||
|
||||
player->playerstate != PST_LIVE ||
|
||||
|
|
@ -1465,7 +1466,7 @@ void P_PredictPlayer (player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
maxtic = maketic;
|
||||
maxtic = ClientTic;
|
||||
|
||||
if (gametic == maxtic)
|
||||
{
|
||||
|
|
@ -1557,8 +1558,11 @@ void P_PredictPlayer (player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
player->oldbuttons = player->cmd.ucmd.buttons;
|
||||
player->cmd = localcmds[i % LOCALCMDTICS];
|
||||
player->oldbuttons = player->cmd.buttons;
|
||||
player->cmd = LocalCmds[i % LOCALCMDTICS];
|
||||
if (paused)
|
||||
continue;
|
||||
|
||||
player->mo->ClearInterpolation();
|
||||
player->mo->ClearFOVInterpolation();
|
||||
P_PlayerThink(player);
|
||||
|
|
@ -1591,6 +1595,10 @@ void P_PredictPlayer (player_t *player)
|
|||
player->viewz = snapPos.Z + zOfs;
|
||||
}
|
||||
}
|
||||
else if (paused)
|
||||
{
|
||||
r_NoInterpolate = true;
|
||||
}
|
||||
|
||||
// This is intentionally done after rubberbanding starts since it'll automatically smooth itself towards
|
||||
// the right spot until it reaches it.
|
||||
|
|
@ -1900,11 +1908,11 @@ DEFINE_FIELD_X(PlayerInfo, player_t, ConversationNPC)
|
|||
DEFINE_FIELD_X(PlayerInfo, player_t, ConversationPC)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, ConversationNPCAngle)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, ConversationFaceTalker)
|
||||
DEFINE_FIELD_NAMED_X(PlayerInfo, player_t, cmd.ucmd, cmd)
|
||||
DEFINE_FIELD_NAMED_X(PlayerInfo, player_t, cmd, cmd)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, original_cmd)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, userinfo)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, weapons)
|
||||
DEFINE_FIELD_NAMED_X(PlayerInfo, player_t, cmd.ucmd.buttons, buttons)
|
||||
DEFINE_FIELD_NAMED_X(PlayerInfo, player_t, cmd.buttons, buttons)
|
||||
DEFINE_FIELD_X(PlayerInfo, player_t, SoundClass)
|
||||
|
||||
DEFINE_FIELD_X(UserCmd, usercmd_t, buttons)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue