Changes to maketic/menu/console updates
- Console and Menu will now update cleanly during stalls. - Moved net adaption so uncapped framerate will always use it.
This commit is contained in:
parent
84cb49b074
commit
f99a84b498
2 changed files with 62 additions and 56 deletions
108
src/d_net.cpp
108
src/d_net.cpp
|
|
@ -1275,6 +1275,55 @@ void NetUpdate (void)
|
|||
|
||||
// listen for other packets
|
||||
GetPackets ();
|
||||
|
||||
if (!demoplayback)
|
||||
{
|
||||
// ideally nettics[0] should be 1 - 3 tics above lowtic
|
||||
// if we are consistantly slower, speed up time
|
||||
|
||||
// [RH] I had erroneously assumed frameskip[] had 4 entries
|
||||
// because there were 4 players, but that's not the case at
|
||||
// all. The game is comparing the lag behind the master for
|
||||
// four runs of TryRunTics. If our tic count is ahead of the
|
||||
// master all 4 times, the next run of NetUpdate will not
|
||||
// process any new input. If we have less input than the
|
||||
// master, the next run of NetUpdate will process extra tics
|
||||
// (because gametime gets decremented here).
|
||||
|
||||
// the key player does not adapt
|
||||
if (consoleplayer != Net_Arbitrator)
|
||||
{
|
||||
// I'm not sure about this when using a packet server, because
|
||||
// if left unmodified from the P2P version, it can make the game
|
||||
// very jerky. The way I have it written right now basically means
|
||||
// that it won't adapt. Fortunately, player prediction helps
|
||||
// alleviate the lag somewhat.
|
||||
|
||||
if (NetMode != NET_PacketServer)
|
||||
{
|
||||
mastertics = nettics[nodeforplayer[Net_Arbitrator]];
|
||||
}
|
||||
if (nettics[0] <= mastertics)
|
||||
{
|
||||
gametime--;
|
||||
if (debugfile) fprintf(debugfile, "-");
|
||||
}
|
||||
if (NetMode != NET_PacketServer)
|
||||
{
|
||||
frameskip[(maketic / ticdup) & 3] = (oldnettics > mastertics);
|
||||
}
|
||||
else
|
||||
{
|
||||
frameskip[(maketic / ticdup) & 3] = (oldnettics - mastertics) > 3;
|
||||
}
|
||||
if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
|
||||
{
|
||||
skiptics = 1;
|
||||
if (debugfile) fprintf(debugfile, "+");
|
||||
}
|
||||
oldnettics = nettics[0];
|
||||
}
|
||||
}// !demoplayback
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1751,72 +1800,27 @@ void TryRunTics (void)
|
|||
else
|
||||
counts = availabletics;
|
||||
|
||||
// Uncapped framerate needs seprate checks
|
||||
if (counts == 0 && !doWait)
|
||||
{
|
||||
// Check possible stall conditions
|
||||
Net_CheckLastRecieved(counts);
|
||||
if (realtics >= 1)
|
||||
{
|
||||
C_Ticker();
|
||||
M_Ticker();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (counts < 1)
|
||||
counts = 1;
|
||||
|
||||
frameon++;
|
||||
|
||||
if (debugfile)
|
||||
fprintf (debugfile,
|
||||
"=======real: %i avail: %i game: %i\n",
|
||||
realtics, availabletics, counts);
|
||||
|
||||
if (!demoplayback)
|
||||
{
|
||||
// ideally nettics[0] should be 1 - 3 tics above lowtic
|
||||
// if we are consistantly slower, speed up time
|
||||
|
||||
// [RH] I had erroneously assumed frameskip[] had 4 entries
|
||||
// because there were 4 players, but that's not the case at
|
||||
// all. The game is comparing the lag behind the master for
|
||||
// four runs of TryRunTics. If our tic count is ahead of the
|
||||
// master all 4 times, the next run of NetUpdate will not
|
||||
// process any new input. If we have less input than the
|
||||
// master, the next run of NetUpdate will process extra tics
|
||||
// (because gametime gets decremented here).
|
||||
|
||||
// the key player does not adapt
|
||||
if (consoleplayer != Net_Arbitrator)
|
||||
{
|
||||
// I'm not sure about this when using a packet server, because
|
||||
// if left unmodified from the P2P version, it can make the game
|
||||
// very jerky. The way I have it written right now basically means
|
||||
// that it won't adapt. Fortunately, player prediction helps
|
||||
// alleviate the lag somewhat.
|
||||
|
||||
if (NetMode != NET_PacketServer)
|
||||
{
|
||||
mastertics = nettics[nodeforplayer[Net_Arbitrator]];
|
||||
}
|
||||
if (nettics[0] <= mastertics)
|
||||
{
|
||||
gametime--;
|
||||
if (debugfile) fprintf (debugfile, "-");
|
||||
}
|
||||
if (NetMode != NET_PacketServer)
|
||||
{
|
||||
frameskip[frameon&3] = (oldnettics > mastertics);
|
||||
}
|
||||
else
|
||||
{
|
||||
frameskip[frameon&3] = (oldnettics - mastertics) > 3;
|
||||
}
|
||||
if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
|
||||
{
|
||||
skiptics = 1;
|
||||
if (debugfile) fprintf (debugfile, "+");
|
||||
}
|
||||
oldnettics = nettics[0];
|
||||
}
|
||||
}// !demoplayback
|
||||
|
||||
// wait for new tics if needed
|
||||
while (lowtic < gametic + counts)
|
||||
{
|
||||
|
|
@ -1836,7 +1840,7 @@ void TryRunTics (void)
|
|||
Net_CheckLastRecieved (counts);
|
||||
|
||||
// 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 >= 1)
|
||||
{
|
||||
C_Ticker ();
|
||||
M_Ticker ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue