Change to FL_EDICT_ALWAYS

This commit is contained in:
Kamay Xutax 2024-08-24 04:52:57 +02:00
parent 1856a9ee30
commit 7a92c3afde
5 changed files with 57 additions and 56 deletions

View file

@ -3140,38 +3140,38 @@ void _Host_RunFrame (float time)
#ifndef SWDS
const auto CalcInterpolationAmount = [&]()
{
// TODO_ENHANCED:
// Notice_Enhanced:
// This check permits to fix interpolation problems on the
// local player that valve has been (fucking finally)
// caring about on counter-strike 2.
//
// To recall the original issue, the
// problem that Valve cared about is that interpolation
// had some problems with interpolating the local
// player because the screen would never in the first
// place match the tick "screen", because interpolation
// amount could never reach 0.0 or 1.0
//
// Valve solution was to introduce bugs with lag
// compensating the local player and made the game worse,
// introducing a new way for cheaters to cheat even more
// on their games.
// I'm joking, but you can clearly see the outcome anyway.
//
// My solution is to simply set interpolation amount
// to 0.0 when a tick arrives.
//
// So when we shoot, we get the frame we shot with an
// interpolation amount at 0.0, perfectly aligned to user
// commands which is ideal for us.
//
// Now includes smoothing.
// TODO_ENHANCED:
// Notice_Enhanced:
// This check permits to fix interpolation problems on the
// local player that valve has been (fucking finally)
// caring about on counter-strike 2.
//
// To recall the original issue, the
// problem that Valve cared about is that interpolation
// had some problems with interpolating the local
// player because the screen would never in the first
// place match the tick "screen", because interpolation
// amount could never reach 0.0 or 1.0
//
// Valve solution was to introduce bugs with lag
// compensating the local player and made the game worse,
// introducing a new way for cheaters to cheat even more
// on their games.
// I'm joking, but you can clearly see the outcome anyway.
//
// My solution is to simply set interpolation amount
// to 0.0 when a tick arrives.
//
// So when we shoot, we get the frame we shot with an
// interpolation amount at 0.0, perfectly aligned to user
// commands which is ideal for us.
//
// Now includes smoothing.
static ConVar cl_interpolation_amount_fix("cl_interpolation_amount_fix", "1");
static float flLastInterpolationAmountOnTick = 0.0f;
float flInterpAmount = cl.m_tickRemainder / host_state.interval_per_tick;
static float flLastInterpolationAmountOnTick = 0.0f;
float flInterpAmount = cl.m_tickRemainder / host_state.interval_per_tick;
if (!cl_interpolation_amount_fix.GetBool())
{
@ -3179,37 +3179,37 @@ void _Host_RunFrame (float time)
return;
}
if (numticks > 0 || host_frametime >= host_state.interval_per_tick)
{
if (numticks > 0 || host_frametime >= host_state.interval_per_tick)
{
#ifdef false
printf("interpolation amount was %f, corrected to "
"fix interpolation issues.\n",
flInterpAmount);
printf("interpolation amount was %f, corrected to "
"fix interpolation issues.\n",
flInterpAmount);
#endif
g_ClientGlobalVariables.interpolation_amount = 0.0f;
flLastInterpolationAmountOnTick = flInterpAmount;
}
else
{
g_ClientGlobalVariables.interpolation_amount = 0.0f;
flLastInterpolationAmountOnTick = flInterpAmount;
}
else
{
float flEstimatedAmountToAdd = host_frametime / host_state.interval_per_tick;
g_ClientGlobalVariables.interpolation_amount += flEstimatedAmountToAdd;
// Accumulate also the one we diddn't account for.
g_ClientGlobalVariables.interpolation_amount += flEstimatedAmountToAdd;
// Accumulate also the one we didn't account for.
g_ClientGlobalVariables.interpolation_amount += flLastInterpolationAmountOnTick * flEstimatedAmountToAdd;
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount >= 0.0f,
("Interpolation amount was lower than 0 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount < 1.0f,
("Interpolation amount was higher than or equal to 1 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount >= 0.0f,
("Interpolation amount was lower than 0 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
ErrorIfNot(g_ClientGlobalVariables.interpolation_amount < 1.0f,
("Interpolation amount was higher than or equal to 1 (%f)\n", g_ClientGlobalVariables.interpolation_amount));
#ifdef false
printf("current interp: %f, old amount: %f, time: %f, frametime: %f, last remainder not interpolated: %f\n",
g_ClientGlobalVariables.interpolation_amount,
flInterpAmount,
time,
host_frametime,
flLastInterpolationAmountOnTick);
printf("current interp: %f, old amount: %f, time: %f, frametime: %f, last remainder not interpolated: %f\n",
g_ClientGlobalVariables.interpolation_amount,
flInterpAmount,
time,
host_frametime,
flLastInterpolationAmountOnTick);
#endif
}
}
};
#endif
{

View file

@ -3493,7 +3493,7 @@ void CMortarShell::Precache()
//------------------------------------------------------------------------------
int CMortarShell::UpdateTransmitState( void )
{
return SetTransmitState( FL_EDICT_PVSCHECK );
return SetTransmitState( FL_EDICT_ALWAYS );
}
//---------------------------------------------------------

View file

@ -438,6 +438,6 @@ void CGrenadeBeam::Precache( void )
//------------------------------------------------------------------------------
int CGrenadeBeam::UpdateTransmitState(void)
{
return SetTransmitState( FL_EDICT_PVSCHECK );
return SetTransmitState( FL_EDICT_ALWAYS );
}

View file

@ -8,6 +8,7 @@
//=============================================================================//
#include "cbase.h"
#include "edict.h"
#include "physics_prop_ragdoll.h"
#include "npc_barnacle.h"
#include "npcevent.h"
@ -2587,7 +2588,7 @@ void CBarnacleTongueTip::Spawn( void )
int CBarnacleTongueTip::UpdateTransmitState( void )
{
return SetTransmitState( FL_EDICT_PVSCHECK );
return SetTransmitState( FL_EDICT_ALWAYS );
}
//-----------------------------------------------------------------------------

View file

@ -275,7 +275,7 @@ bool CBoneFollower::Init( CBaseEntity *pOwner, const char *pModelName, solid_t &
int CBoneFollower::UpdateTransmitState()
{
// Send to the client for client-side collisions and visualization
return SetTransmitState( FL_EDICT_PVSCHECK );
return SetTransmitState( FL_EDICT_ALWAYS );
}
void CBoneFollower::VPhysicsUpdate( IPhysicsObject *pPhysics )