mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 12:21:19 +00:00
Determine latency with leveltime BS instead of nettics
This commit is contained in:
parent
656de08b96
commit
bc429ad4f8
3 changed files with 8 additions and 20 deletions
|
@ -4007,25 +4007,6 @@ FILESTAMP
|
|||
&netbuffer->u.client4pak.cmd4, 1);
|
||||
}
|
||||
|
||||
{ // Store the node's latency in tics on the ticcmd right as we receive it. I think this should be sync-stable
|
||||
UINT8 latency = min(maketic - nettics[node], MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
|
||||
|
||||
switch (netbuffer->packettype)
|
||||
{
|
||||
case PT_CLIENT4CMD:
|
||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].latency = latency;
|
||||
|
||||
case PT_CLIENT3CMD:
|
||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].latency = latency;
|
||||
|
||||
case PT_CLIENT2CMD:
|
||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].latency = latency;
|
||||
|
||||
default:
|
||||
netcmds[maketic%BACKUPTICS][netconsole].latency = latency;
|
||||
}
|
||||
}
|
||||
|
||||
// A delay before we check resynching
|
||||
// Used on join or just after a synch fail
|
||||
if (resynch_delay[node])
|
||||
|
|
|
@ -1567,6 +1567,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
lang += (cmd->angleturn<<16);
|
||||
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->latency = leveltime & 0xFF; // Send leveltime when this tic was generated to the server for control lag calculations
|
||||
|
||||
if (!hu_stopped)
|
||||
{
|
||||
|
@ -2142,6 +2143,9 @@ void G_Ticker(boolean run)
|
|||
players[i].kartstuff[k_throwdir] = 0;
|
||||
|
||||
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
|
||||
|
||||
// Use the leveltime sent in the player's ticcmd to determine control lag
|
||||
cmd->latency = min((leveltime & 0xFF) - cmd->latency, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6678,7 +6678,10 @@ static void P_MovePlayer(player_t *player)
|
|||
if (add_delta) {
|
||||
player->mo->angle += angle_diff<<16;
|
||||
player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
|
||||
CONS_Printf("leftover turn (%s): %d\n", player_names[player-players], (INT16) (cmd->angleturn - (player->mo->angle>>16)));
|
||||
CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
|
||||
player_names[player-players],
|
||||
(INT16) (cmd->angleturn - (player->mo->angle>>16)),
|
||||
(INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ?: 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue