mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
Stall testing for interpolation
Uncapped framerate never triggered the stall detection code, as it never tried to process a frame to start with.
This commit is contained in:
parent
a993b0288a
commit
455145d611
2 changed files with 45 additions and 35 deletions
|
@ -1747,6 +1747,8 @@ void TryRunTics (void)
|
||||||
|
|
||||||
if (counts == 0 && !doWait)
|
if (counts == 0 && !doWait)
|
||||||
{
|
{
|
||||||
|
// Check possible stall conditions
|
||||||
|
Net_CheckLastRecieved(counts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1824,41 +1826,8 @@ void TryRunTics (void)
|
||||||
if (lowtic < gametic)
|
if (lowtic < gametic)
|
||||||
I_Error ("TryRunTics: lowtic < gametic");
|
I_Error ("TryRunTics: lowtic < gametic");
|
||||||
|
|
||||||
// [Ed850] Check to see the last time a packet was recieved.
|
// Check possible stall conditions
|
||||||
// If it's longer then 3 seconds, a node has likely stalled.
|
Net_CheckLastRecieved (counts);
|
||||||
if(I_GetTime(false) - lastglobalrecvtime >= TICRATE*3)
|
|
||||||
{
|
|
||||||
lastglobalrecvtime = I_GetTime(false); //Bump the count
|
|
||||||
|
|
||||||
if(NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
|
|
||||||
{
|
|
||||||
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
|
|
||||||
//However, we don't send a resend request for sanity reasons.
|
|
||||||
for (i = 0; i < doomcom.numnodes; i++)
|
|
||||||
{
|
|
||||||
if (nodeingame[i] && nettics[i] < gametic + counts)
|
|
||||||
{
|
|
||||||
if (debugfile)
|
|
||||||
fprintf (debugfile, "%i is slow (%i to %i)\n",
|
|
||||||
i, nettics[i], gametic+counts);
|
|
||||||
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
|
|
||||||
if(i != 0)
|
|
||||||
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
players[playerfornode[i]].waiting = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
|
|
||||||
if (debugfile)
|
|
||||||
fprintf (debugfile, "Arbitrator is slow (%i to %i)\n",
|
|
||||||
nettics[Net_Arbitrator], gametic+counts);
|
|
||||||
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
|
|
||||||
if(i != 0)
|
|
||||||
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't stay in here forever -- give the menu a chance to work
|
// don't stay in here forever -- give the menu a chance to work
|
||||||
if (I_GetTime (false) - entertic >= TICRATE/3)
|
if (I_GetTime (false) - entertic >= TICRATE/3)
|
||||||
|
@ -1901,6 +1870,44 @@ void TryRunTics (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Net_CheckLastRecieved (int counts)
|
||||||
|
{
|
||||||
|
// [Ed850] Check to see the last time a packet was recieved.
|
||||||
|
// If it's longer then 3 seconds, a node has likely stalled.
|
||||||
|
if (I_GetTime(false) - lastglobalrecvtime >= TICRATE * 3)
|
||||||
|
{
|
||||||
|
lastglobalrecvtime = I_GetTime(false); //Bump the count
|
||||||
|
|
||||||
|
if (NetMode == NET_PeerToPeer || consoleplayer == Net_Arbitrator)
|
||||||
|
{
|
||||||
|
//Keep the local node in the for loop so we can still log any cases where the local node is /somehow/ late.
|
||||||
|
//However, we don't send a resend request for sanity reasons.
|
||||||
|
for (int i = 0; i < doomcom.numnodes; i++)
|
||||||
|
{
|
||||||
|
if (nodeingame[i] && nettics[i] <= gametic + counts)
|
||||||
|
{
|
||||||
|
if (debugfile && !players[playerfornode[i]].waiting)
|
||||||
|
fprintf(debugfile, "%i is slow (%i to %i)\n",
|
||||||
|
i, nettics[i], gametic + counts);
|
||||||
|
//Send resend request to the late node. Also mark the node as waiting to display it in the hud.
|
||||||
|
if (i != 0)
|
||||||
|
remoteresend[i] = players[playerfornode[i]].waiting = hadlate = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
players[playerfornode[i]].waiting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ //Send a resend request to the Arbitrator, as it's obvious we are stuck here.
|
||||||
|
if (debugfile && !players[playerfornode[Net_Arbitrator]].waiting)
|
||||||
|
fprintf(debugfile, "Arbitrator is slow (%i to %i)\n",
|
||||||
|
nettics[Net_Arbitrator], gametic + counts);
|
||||||
|
//Send resend request to the Arbitrator. Also mark the Arbitrator as waiting to display it in the hud.
|
||||||
|
remoteresend[Net_Arbitrator] = players[playerfornode[Net_Arbitrator]].waiting = hadlate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Net_NewMakeTic (void)
|
void Net_NewMakeTic (void)
|
||||||
{
|
{
|
||||||
specials.NewMakeTic ();
|
specials.NewMakeTic ();
|
||||||
|
|
|
@ -115,6 +115,9 @@ void D_QuitNetGame (void);
|
||||||
//? how many ticks to run?
|
//? how many ticks to run?
|
||||||
void TryRunTics (void);
|
void TryRunTics (void);
|
||||||
|
|
||||||
|
//Use for checking to see if the netgame has stalled
|
||||||
|
void Net_CheckLastRecieved(int);
|
||||||
|
|
||||||
// [RH] Functions for making and using special "ticcmds"
|
// [RH] Functions for making and using special "ticcmds"
|
||||||
void Net_NewMakeTic ();
|
void Net_NewMakeTic ();
|
||||||
void Net_WriteByte (BYTE);
|
void Net_WriteByte (BYTE);
|
||||||
|
|
Loading…
Reference in a new issue