From f20107d5f7a91c66adf7b075d37455adbfa02952 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 27 Feb 2026 15:47:50 -0500 Subject: [PATCH] Revert "Remove tic provision" This reverts commit 8c624cdc65fd5a48b197e24f239fe9b7225cbaba. --- src/d_clisrv.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 859313833..4c5d42ba2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -139,6 +139,7 @@ boolean receivedplayerinfo = false; tic_t servermaxping = 20; // server's max delay, in frames. Defaults to 20 static tic_t nettics[MAXNETNODES]; // what tic the client have received +static tic_t supposedtics[MAXNETNODES]; // nettics prevision for smaller packet static UINT8 nodewaiting[MAXNETNODES]; static tic_t firstticstosend; // min of the nettics static tic_t tictoclear = 0; // optimize d_clearticcmd @@ -3576,6 +3577,7 @@ static void ResetNode(INT32 node) nodewaiting[node] = 0; nettics[node] = gametic; + supposedtics[node] = gametic; nodetoplayer[node] = -1; nodetoplayer2[node] = -1; @@ -3743,6 +3745,7 @@ void D_QuitNetGame(void) static inline void SV_AddNode(INT32 node) { nettics[node] = gametic; + supposedtics[node] = gametic; // little hack because the server connects to itself and puts // nodeingame when connected not here if (node) @@ -5860,11 +5863,12 @@ static void SV_SendTics(void) // send to all client but not to me // for each node create a packet with x tics and send it - // x is computed using nettics[n], max packet size and maketic + // x is computed using supposedtics[n], max packet size and maketic for (n = 1; n < MAXNETNODES; n++) if (nodeingame[n]) { - realfirsttic = nettics[n]; + // assert supposedtics[n]>=nettics[n] + realfirsttic = max(supposedtics[n], firstticstosend); lasttictosend = min(maketic, nettics[n] + CLIENTBACKUPTICS); if (realfirsttic >= lasttictosend) @@ -5873,8 +5877,8 @@ static void SV_SendTics(void) // to resent packet that are supposed lost (this is necessary since lost // packet detection work when we have received packet with firsttic > neededtic // (getpacket servertics case) - DEBFILE(va("Nothing to send node %u mak=%u net=%u \n", - n, lasttictosend, nettics[n])); + DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n", + n, lasttictosend, supposedtics[n], nettics[n])); realfirsttic = nettics[n]; if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3) // all tic are ok @@ -5951,10 +5955,16 @@ static void SV_SendTics(void) packsize = bufpos - (UINT8 *)&(netbuffer->u); HSendPacket(n, false, 0, packsize); - } + // when tic are too large, only one tic is sent so don't go backward! + if (lasttictosend-doomcom->extratics > realfirsttic) + supposedtics[n] = lasttictosend-doomcom->extratics; + else + supposedtics[n] = lasttictosend; + supposedtics[n] = max(supposedtics[n], nettics[n]); + } // node 0 is me! - nettics[0] = maketic; + supposedtics[0] = maketic; } //