kill SATURNSYNCH and can_receive_gamestate, change the detection of synch method
before we unconditionally sent PT_WILLRESENDGAMESTATE to every connected node that didnt desynch before, in a big lobby this could mean having to send out alot of reliable packets to potentially clients that couldnt use it anyways, like this we just check if a client is saturn, which gets set the moment a saturn client v7.1 and onwards joins (it sends a special packet to the server during connect) this makes sure we only even attempt the new resynch system with clients WE KNOW can use it anyways this is backwards compatible until v7.1, v7 when this was introduced did not send the special packet on join and relied on the willreceivegamestate packet, so they wont benefit from the better resynching anymore
This commit is contained in:
1 parent
6a97341835
commit
ba7d3324e6
8 files changed
+35
-71
No files matched your search
@@ -195,8 +195,6 @@ endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef NOSATURNSYNCH
|
||||
DOSATURNSYNCH=1
|
||||
ifndef NOSATURNJOIN
|
||||
DOSATURNJOIN=1
|
||||
endif
|
||||
@@ -391,8 +389,6 @@ endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef NOSATURNSYNCH
|
||||
OPTS+=-DDOSATURNSYNCH
|
||||
ifndef NOSATURNJOIN
|
||||
OPTS+=-DDOSATURNJOIN
|
||||
endif
|
||||
@@ -400,7 +396,6 @@ ifndef NOSATURNPAK
|
||||
OPTS+=-DDOSATURNPAK
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_MINIUPNPC
|
||||
ifdef NONET
|
||||
|
||||
+23
-47
@@ -94,7 +94,7 @@ UINT8 playernode[MAXPLAYERS];
|
||||
// The actual timeout will be longer depending on the savegame length
|
||||
tic_t jointimeout = (3*TICRATE);
|
||||
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static boolean resendingsavegame[MAXNETNODES]; // Are we resending the savegame?
|
||||
static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can resend again?
|
||||
#endif
|
||||
@@ -153,9 +153,8 @@ static UINT8 resynch_inprogress[MAXNETNODES];
|
||||
static UINT8 resynch_local_inprogress = false; // WE are desynched and getting packets to fix it.
|
||||
UINT8 hu_resynching = 0;
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
UINT8 hu_redownloadinggamestate = 0;
|
||||
static boolean can_receive_gamestate[MAXNETNODES];
|
||||
static UINT8 gamestate_resend_counter[MAXNETNODES];
|
||||
#endif
|
||||
|
||||
@@ -168,11 +167,8 @@ static boolean cl_packetmissed;
|
||||
// here it is for the secondary local player (splitscreen)
|
||||
static UINT8 mynode; // my address pointofview server
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
static boolean cl_redownloadinggamestate = false;
|
||||
#endif
|
||||
|
||||
#ifdef SATURNPAK
|
||||
static boolean cl_redownloadinggamestate = false;
|
||||
boolean is_client_saturn[MAXNETNODES];
|
||||
#endif
|
||||
|
||||
@@ -1836,7 +1832,7 @@ static boolean SV_SendServerConfig(INT32 node)
|
||||
#ifdef JOININGAME
|
||||
#define SAVEGAMESIZE (768*1024)
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static boolean SV_ResendingSavegameToAnyone(void)
|
||||
{
|
||||
INT32 i;
|
||||
@@ -2023,7 +2019,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
|
||||
consistancy[gametic%TICQUEUE] = Consistancy();
|
||||
CON_ToggleOff();
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
// Tell the server we have received and reloaded the gamestate
|
||||
// so they know they can resume the game
|
||||
if (reloading)
|
||||
@@ -2034,7 +2030,7 @@ static void CL_LoadReceivedSavegame(boolean reloading)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static void CL_ReloadReceivedSavegame(void)
|
||||
{
|
||||
INT32 i;
|
||||
@@ -4097,7 +4093,7 @@ static void Command_list_http_logins (void)
|
||||
}
|
||||
#endif/*HAVE_CURL*/
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static void Command_ResendGamestate(void)
|
||||
{
|
||||
SINT8 playernum;
|
||||
@@ -4154,7 +4150,7 @@ consvar_t cv_discordinvites = {"discordinvites", "Everyone", CV_SAVE|CV_CALL, di
|
||||
static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_resynchattempts = {"resynchattempts", "2", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static CV_PossibleValue_t gamestateattempts_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_gamestateattempts = {"gamestateresendattempts", "10", CV_SAVE, gamestateattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -4218,7 +4214,7 @@ void D_ClientServerInit(void)
|
||||
COM_AddCommand("reloadbans", Command_ReloadBan);
|
||||
COM_AddCommand("connect", Command_connect);
|
||||
COM_AddCommand("nodes", Command_Nodes);
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
COM_AddCommand("resendgamestate", Command_ResendGamestate);
|
||||
#endif
|
||||
COM_AddCommand("listplayers", Command_Listplayers);
|
||||
@@ -4278,11 +4274,7 @@ static void ResetNode(INT32 node)
|
||||
// SATURN
|
||||
#ifdef SATURNPAK
|
||||
is_client_saturn[node] = false;
|
||||
#endif
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
resendingsavegame[node] = false;
|
||||
can_receive_gamestate[node] = false;
|
||||
savegameresendcooldown[node] = 0;
|
||||
gamestate_resend_counter[node] = 0;
|
||||
#endif
|
||||
@@ -4328,7 +4320,7 @@ void SV_ResetServer(void)
|
||||
|
||||
mynode = 0;
|
||||
cl_packetmissed = false;
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
cl_redownloadinggamestate = false;
|
||||
#endif
|
||||
|
||||
@@ -4946,7 +4938,7 @@ static void HandleServerInfo(SINT8 node)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
static void PT_WillResendGamestate(void)
|
||||
{
|
||||
char tmpsave[264];
|
||||
@@ -5413,7 +5405,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
// this decreases by one point at twice the cooldown time (ex cooldown of 2 seconds means, this counter decreases by one every 4 seconds), pretty much there to prevent a resynch loop
|
||||
if ((gamestate_resend_counter[node] != 0) && (I_GetTime() % ((max(cv_resynchcooldown.value, 1) * TICRATE) *2) == 0))
|
||||
{
|
||||
@@ -5425,27 +5417,16 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
if (gamestate == GS_LEVEL
|
||||
&& (realstart > gametic - TICQUEUE+1 && realstart <= gametic)
|
||||
&& consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy)
|
||||
&& (!can_receive_gamestate[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
&& (!is_client_saturn[node] || (!resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone())))
|
||||
{
|
||||
//#ifndef SATURNPAK // lug: keep this behaviour for v7.1 atleast
|
||||
// we need to send this so the client can tell us if it can receive the savegame
|
||||
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
|
||||
HSendPacket(node, true, 0, 0);
|
||||
|
||||
if (can_receive_gamestate[node])
|
||||
resendingsavegame[node] = true;
|
||||
else
|
||||
{
|
||||
SV_RequireResynch(node);
|
||||
resendingsavegame[node] = false;
|
||||
}
|
||||
/*#else
|
||||
if (can_receive_gamestate[node])
|
||||
// Check if a client is saturn before sending ANYTHING!
|
||||
// this way we only send stuff to clients we know can use the gamestate resend
|
||||
// and dont have to wait for a response from clients that never would send a response back
|
||||
if (is_client_saturn[node])
|
||||
{
|
||||
// Tell the client we are about to resend them the gamestate
|
||||
netbuffer->packettype = PT_WILLRESENDGAMESTATE;
|
||||
HSendPacket(node, true, 0, 0);
|
||||
|
||||
resendingsavegame[node] = true;
|
||||
}
|
||||
else
|
||||
@@ -5453,11 +5434,10 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
SV_RequireResynch(node);
|
||||
resendingsavegame[node] = false;
|
||||
}
|
||||
#endif*/
|
||||
|
||||
if ((!can_receive_gamestate[node] && (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)) || (can_receive_gamestate[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value)))
|
||||
if ((!is_client_saturn[node] && (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)) || (is_client_saturn[node] && (gamestate_resend_counter[node] < cv_gamestateattempts.value)))
|
||||
{
|
||||
if (can_receive_gamestate[node] && resendingsavegame[node])
|
||||
if (is_client_saturn[node] && resendingsavegame[node])
|
||||
{
|
||||
gamestate_resend_counter[node]++;
|
||||
DEBFILE(va("gamestate counter %d for node %d\n", gamestate_resend_counter[node], netconsole));
|
||||
@@ -5769,9 +5749,8 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
if (client)
|
||||
Got_Filetxpak();
|
||||
break;
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
case PT_CANRECEIVEGAMESTATE:
|
||||
can_receive_gamestate[node] = true;
|
||||
PT_CanReceiveGamestate(node);
|
||||
break;
|
||||
case PT_RECEIVEDGAMESTATE:
|
||||
@@ -5782,12 +5761,9 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||
case PT_WILLRESENDGAMESTATE:
|
||||
PT_WillResendGamestate();
|
||||
break;
|
||||
#endif
|
||||
#ifdef SATURNPAK
|
||||
case PT_ISSATURN:
|
||||
DEBFILE(va("hi im on saturn! node = %d\n", node));
|
||||
is_client_saturn[node] = true;
|
||||
can_receive_gamestate[node] = true;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -6854,7 +6830,7 @@ void NetUpdate(void)
|
||||
|
||||
if (client)
|
||||
{
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
// If the client just finished redownloading the game state, load it
|
||||
if (cl_redownloadinggamestate && fileneeded[0].status == FS_FOUND)
|
||||
CL_ReloadReceivedSavegame();
|
||||
@@ -6863,7 +6839,7 @@ void NetUpdate(void)
|
||||
CL_SendClientCmd(); // Send tic cmd
|
||||
|
||||
hu_resynching = resynch_local_inprogress;
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
hu_redownloadinggamestate = cl_redownloadinggamestate;
|
||||
#endif
|
||||
}
|
||||
@@ -6874,7 +6850,7 @@ void NetUpdate(void)
|
||||
INT32 counts;
|
||||
|
||||
hu_resynching = false;
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
hu_redownloadinggamestate = false;
|
||||
#endif
|
||||
// Don't erase tics not acknowledged
|
||||
|
||||
+3
-4
@@ -108,12 +108,11 @@ typedef enum
|
||||
|
||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
PT_WILLRESENDGAMESTATE, // Hey Client, I am about to resend you the gamestate!
|
||||
PT_CANRECEIVEGAMESTATE, // Okay Server, I'm ready to receive it, you can go ahead.
|
||||
PT_RECEIVEDGAMESTATE, // Thank you Server, I am ready to play again!
|
||||
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
PT_ISSATURN, // Saturn specific identifier packet
|
||||
#endif
|
||||
|
||||
@@ -599,7 +598,7 @@ extern consvar_t
|
||||
cv_allownewsaturnplayer,
|
||||
#endif
|
||||
cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts,
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
cv_resynchcooldown, cv_gamestateattempts,
|
||||
#endif
|
||||
cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
@@ -668,7 +667,7 @@ tic_t GetLag(INT32 node);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
extern UINT8 hu_redownloadinggamestate;
|
||||
#endif
|
||||
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
|
||||
+2
-3
@@ -792,15 +792,14 @@ const char *packettypename[NUMPACKETTYPE] =
|
||||
"MOREFILESNEEDED",
|
||||
|
||||
"PING"
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
,
|
||||
|
||||
"WILLRESENDGAMESTATE",
|
||||
"CANRECEIVEGAMESTATE",
|
||||
"RECEIVEDGAMESTATE",
|
||||
|
||||
// we will reserve this for now even if unused, so order wont get mangled
|
||||
"ISSATURN"
|
||||
"ISSATURN" // special packet to identify saturn clients
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -754,7 +754,7 @@ void D_RegisterServerCommands(void)
|
||||
// d_clisrv
|
||||
CV_RegisterVar(&cv_maxplayers);
|
||||
CV_RegisterVar(&cv_resynchattempts);
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
CV_RegisterVar(&cv_gamestateattempts);
|
||||
CV_RegisterVar(&cv_resynchcooldown);
|
||||
#endif
|
||||
|
||||
+2
-7
@@ -571,12 +571,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
#ifndef NONET
|
||||
//-- SATURN __
|
||||
/// Enable gamestate resynching between Saturn servers and clients
|
||||
/// Like SRB2 and RR does
|
||||
/// Still highly experimental
|
||||
#ifdef DOSATURNSYNCH
|
||||
#define SATURNSYNCH
|
||||
|
||||
/// Detect if a client is on Saturn in the clientconfig.
|
||||
/// To seperately allow them to join or block joining from vanilla clients.
|
||||
#ifdef DOSATURNJOIN
|
||||
@@ -585,7 +579,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
#endif
|
||||
|
||||
/// Server detection for if a connecting client is on Saturn.
|
||||
/// For stuff like extra synching, etc.
|
||||
/// This also enables gamestate resynching between Saturn servers and clients
|
||||
/// Like SRB2 and RR does
|
||||
#ifdef DOSATURNPAK
|
||||
#define SATURNPAK
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -1143,7 +1143,7 @@ void HU_Ticker(void)
|
||||
|
||||
// Animate the desynch dots
|
||||
if (hu_resynching
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
|| hu_redownloadinggamestate
|
||||
#endif
|
||||
)
|
||||
@@ -2244,7 +2244,7 @@ void HU_Drawer(void)
|
||||
|
||||
// draw desynch text
|
||||
if (hu_resynching
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
|| hu_redownloadinggamestate
|
||||
#endif
|
||||
)
|
||||
|
||||
+2
-2
@@ -2162,7 +2162,7 @@ static menuitem_t OP_AdvServerOptionsMenu[] =
|
||||
NULL, "Server Browser Address", &cv_masterserver, 10},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 25},
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
{IT_STRING | IT_CVAR, NULL, "Resend Gamestate Cooldown", &cv_resynchcooldown, 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Resend Gamestate Attempts", &cv_gamestateattempts, 40},
|
||||
|
||||
@@ -2196,7 +2196,7 @@ static const char* OP_AdvServerOptionsTooltips[] =
|
||||
{
|
||||
"Server used for master server.",
|
||||
"Attempts to resynchronise player to server.",
|
||||
#ifdef SATURNSYNCH
|
||||
#ifdef SATURNPAK
|
||||
"Cooldown in seconds before the Server attempts\nto resend the gamestate to a Saturn Client\nbetween resending attempts.",
|
||||
"Attempts to resend the Gamestate to player\nThis increments a Counter everytime a gamestate resend occurs\nThis Counter decrements at double the time of the Cooldown\nonce the Counter reaches the threshold, the client gets kicked.",
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user