mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 17:14:18 +00:00
made antiping limit have new functionality as a limit to the amount of antiping there is but backwards, higher number means less antiping. Basically the amount of time antiping doesn't predict
This commit is contained in:
parent
38324489a2
commit
6c0427d23c
|
@ -905,11 +905,11 @@ void CClient::Render()
|
||||||
GameClient()->OnRender();
|
GameClient()->OnRender();
|
||||||
DebugRender();
|
DebugRender();
|
||||||
|
|
||||||
if(State() == IClient::STATE_ONLINE && g_Config.m_ClAntiPingLimit)
|
// if(State() == IClient::STATE_ONLINE && g_Config.m_ClAntiPingLimit)
|
||||||
{
|
// {
|
||||||
int64_t Now = time_get();
|
// int64_t Now = time_get();
|
||||||
g_Config.m_ClAntiPing = (m_PredictedTime.Get(Now) - m_aGameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq() > g_Config.m_ClAntiPingLimit;
|
// g_Config.m_ClAntiPing = (m_PredictedTime.Get(Now) - m_aGameTime[g_Config.m_ClDummy].Get(Now)) * 1000 / (float)time_freq() > g_Config.m_ClAntiPingLimit;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CClient::LoadMap(const char *pName, const char *pFilename, SHA256_DIGEST *pWantedSha256, unsigned WantedCrc)
|
const char *CClient::LoadMap(const char *pName, const char *pFilename, SHA256_DIGEST *pWantedSha256, unsigned WantedCrc)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
// client
|
// client
|
||||||
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict client movements")
|
MACRO_CONFIG_INT(ClPredict, cl_predict, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict client movements")
|
||||||
MACRO_CONFIG_INT(ClPredictDummy, cl_predict_dummy, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict dummy movements")
|
MACRO_CONFIG_INT(ClPredictDummy, cl_predict_dummy, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict dummy movements")
|
||||||
MACRO_CONFIG_INT(ClAntiPingLimit, cl_antiping_limit, 0, 0, 200, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Antiping limit (0 to disable)")
|
MACRO_CONFIG_INT(ClAntiPingLimit, cl_antiping_limit, 0, 0, 200, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Adds delay to antiping (0 to disable)")
|
||||||
MACRO_CONFIG_INT(ClAntiPingMax, cl_antiping_max, 100, 0, 500, CFGFLAG_CLIENT | CFGFLAG_SAVE, "how far ahead Antiping predicts")
|
MACRO_CONFIG_INT(ClAntiPingpercent, cl_antiping_percent, 100, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "how far ahead Antiping predicts, ignored when antiping limit is used")
|
||||||
MACRO_CONFIG_INT(ClAntiPing, cl_antiping, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Enable antiping, i. e. more aggressive prediction.")
|
MACRO_CONFIG_INT(ClAntiPing, cl_antiping, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Enable antiping, i. e. more aggressive prediction.")
|
||||||
MACRO_CONFIG_INT(ClAntiPingPlayers, cl_antiping_players, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict other player's movement more aggressively (only enabled if cl_antiping is set to 1)")
|
MACRO_CONFIG_INT(ClAntiPingPlayers, cl_antiping_players, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict other player's movement more aggressively (only enabled if cl_antiping is set to 1)")
|
||||||
MACRO_CONFIG_INT(ClAntiPingGrenade, cl_antiping_grenade, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict grenades (only enabled if cl_antiping is set to 1)")
|
MACRO_CONFIG_INT(ClAntiPingGrenade, cl_antiping_grenade, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Predict grenades (only enabled if cl_antiping is set to 1)")
|
||||||
|
|
|
@ -58,9 +58,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemId)
|
||||||
|
|
||||||
bool IsOtherTeam = (pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner));
|
bool IsOtherTeam = (pCurrent->m_ExtraInfo && pCurrent->m_Owner >= 0 && m_pClient->IsOtherTeam(pCurrent->m_Owner));
|
||||||
|
|
||||||
float predictPercentage = 1 - g_Config.m_ClAntiPingMax / 100.0f;
|
int predictTick = GameClient()->GetPredictionTick();
|
||||||
int predictTick = Client()->GetPredictionTime() * Client()->GameTickSpeed() / 1000.0f;
|
|
||||||
predictTick = Client()->PredGameTick(g_Config.m_ClDummy) - std::floor(predictTick * predictPercentage);
|
|
||||||
|
|
||||||
float Ct;
|
float Ct;
|
||||||
if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !IsOtherTeam)
|
if(m_pClient->Predict() && m_pClient->AntiPingGrenade() && LocalPlayerInGame && !IsOtherTeam)
|
||||||
|
@ -308,9 +306,7 @@ void CItems::RenderLaser(const CLaserData *pCurrent, bool IsPredicted)
|
||||||
{
|
{
|
||||||
Dir = normalize_pre_length(Pos - From, Len);
|
Dir = normalize_pre_length(Pos - From, Len);
|
||||||
|
|
||||||
float predictPercentage = 1 - g_Config.m_ClAntiPingMax / 100.0f;
|
int predictTick = GameClient()->GetPredictionTick();
|
||||||
int predictTick = Client()->GetPredictionTime() * Client()->GameTickSpeed() / 1000.0f;
|
|
||||||
predictTick = Client()->PredGameTick(g_Config.m_ClDummy) - std::floor(predictTick * predictPercentage);
|
|
||||||
|
|
||||||
float Ticks;
|
float Ticks;
|
||||||
if(IsPredicted)
|
if(IsPredicted)
|
||||||
|
@ -611,9 +607,7 @@ void CItems::ReconstructSmokeTrail(const CProjectileData *pCurrent, int DestroyT
|
||||||
if(!m_pClient->AntiPingGunfire() || !LocalPlayerInGame)
|
if(!m_pClient->AntiPingGunfire() || !LocalPlayerInGame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float predictPercentage = 1 - g_Config.m_ClAntiPingMax / 100.0f;
|
int predictTick = GameClient()->GetPredictionTick();
|
||||||
int predictTick = Client()->GetPredictionTime() * Client()->GameTickSpeed() / 1000.0f;
|
|
||||||
predictTick = Client()->PredGameTick(g_Config.m_ClDummy) - std::floor(predictTick * predictPercentage);
|
|
||||||
|
|
||||||
if(predictTick == pCurrent->m_StartTick)
|
if(predictTick == pCurrent->m_StartTick)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1956,6 +1956,25 @@ void CGameClient::UpdateEditorIngameMoved()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CGameClient::GetPredictionTick()
|
||||||
|
{
|
||||||
|
int predictTick = Client()->GetPredictionTime() * Client()->GameTickSpeed() / 1000.0f;
|
||||||
|
|
||||||
|
float predictPercentage = 1 - g_Config.m_ClAntiPingpercent / 100.0f;
|
||||||
|
int predictMin = std::floor(predictTick * predictPercentage);
|
||||||
|
int predictMin2 = g_Config.m_ClAntiPingLimit * Client()->GameTickSpeed() / 1000.0f;
|
||||||
|
if (g_Config.m_ClAntiPingLimit != 0)
|
||||||
|
predictMin = predictMin2;
|
||||||
|
|
||||||
|
predictTick = Client()->PredGameTick(g_Config.m_ClDummy) - predictMin;
|
||||||
|
|
||||||
|
if(predictTick < Client()->GameTick(g_Config.m_ClDummy) + 1)
|
||||||
|
{
|
||||||
|
predictTick = Client()->GameTick(g_Config.m_ClDummy) + 1;
|
||||||
|
}
|
||||||
|
return predictTick;
|
||||||
|
}
|
||||||
|
|
||||||
void CGameClient::OnPredict()
|
void CGameClient::OnPredict()
|
||||||
{
|
{
|
||||||
// store the previous values so we can detect prediction errors
|
// store the previous values so we can detect prediction errors
|
||||||
|
@ -2013,14 +2032,7 @@ void CGameClient::OnPredict()
|
||||||
if(PredictDummy())
|
if(PredictDummy())
|
||||||
pDummyChar = m_PredictedWorld.GetCharacterById(m_PredictedDummyId);
|
pDummyChar = m_PredictedWorld.GetCharacterById(m_PredictedDummyId);
|
||||||
|
|
||||||
int predictTick = Client()->GetPredictionTime() * Client()->GameTickSpeed() / 1000.0f;
|
int predictTick = GetPredictionTick();
|
||||||
float predictPercentage = 1 - g_Config.m_ClAntiPingMax / 100.0f;
|
|
||||||
predictTick = Client()->PredGameTick(g_Config.m_ClDummy) - std::floor(predictTick * predictPercentage);
|
|
||||||
|
|
||||||
if(predictTick < Client()->GameTick(g_Config.m_ClDummy) + 1)
|
|
||||||
{
|
|
||||||
predictTick = Client()->GameTick(g_Config.m_ClDummy) + 1;
|
|
||||||
}
|
|
||||||
// predict
|
// predict
|
||||||
for(int Tick = Client()->GameTick(g_Config.m_ClDummy) + 1; Tick <= Client()->PredGameTick(g_Config.m_ClDummy); Tick++)
|
for(int Tick = Client()->GameTick(g_Config.m_ClDummy) + 1; Tick <= Client()->PredGameTick(g_Config.m_ClDummy); Tick++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -466,6 +466,7 @@ public:
|
||||||
CRenderTools m_RenderTools;
|
CRenderTools m_RenderTools;
|
||||||
|
|
||||||
void OnReset();
|
void OnReset();
|
||||||
|
int GetPredictionTick();
|
||||||
|
|
||||||
size_t ComponentCount() { return m_vpAll.size(); }
|
size_t ComponentCount() { return m_vpAll.size(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue