Optimized network
This commit is contained in:
parent
f46d09bab1
commit
60c8599e4c
3 changed files with 26 additions and 6 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include "bone_setup.h"
|
||||
#include "const.h"
|
||||
#include "convar.h"
|
||||
#include "imovehelper.h"
|
||||
#include "ipredictionsystem.h"
|
||||
|
@ -1300,6 +1301,11 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
|
|||
m_EntityGroundContact.RemoveAll();
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < MAX_EDICTS; i++)
|
||||
{
|
||||
cmd->simulationdata[i].m_bEntityExists = false;
|
||||
}
|
||||
|
||||
// Send interpolated simulation time for lag compensation
|
||||
for (int i = 0; i <= ClientEntityList().GetHighestEntityIndex(); i++)
|
||||
{
|
||||
|
@ -1311,7 +1317,8 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
|
|||
}
|
||||
|
||||
cmd->simulationdata[pEntity->index].m_flSimulationTime = pEntity->m_flInterpolatedSimulationTime;
|
||||
cmd->simulationdata[pEntity->index].m_flAnimTime = pEntity->m_flSimulationTime;
|
||||
cmd->simulationdata[pEntity->index].m_flAnimTime = pEntity->m_flSimulationTime;
|
||||
cmd->simulationdata[pEntity->index].m_bEntityExists = true;
|
||||
}
|
||||
|
||||
#ifdef CSTRIKE_DLL
|
||||
|
|
|
@ -194,8 +194,15 @@ void WriteUsercmd( bf_write *buf, const CUserCmd *to, const CUserCmd *from )
|
|||
// Write finally simulation data with entity index
|
||||
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
||||
{
|
||||
if (from->simulationdata[i].m_flSimulationTime
|
||||
!= to->simulationdata[i].m_flSimulationTime)
|
||||
if (to->simulationdata[i].m_bEntityExists)
|
||||
{
|
||||
buf->WriteOneBit( 0 );
|
||||
continue;
|
||||
}
|
||||
|
||||
buf->WriteOneBit( 1 );
|
||||
|
||||
if (from->simulationdata[i].m_flSimulationTime != to->simulationdata[i].m_flSimulationTime)
|
||||
{
|
||||
buf->WriteOneBit(1);
|
||||
buf->WriteBitFloat(to->simulationdata[i].m_flSimulationTime);
|
||||
|
@ -357,8 +364,13 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from )
|
|||
|
||||
const auto highestEntityIndex = buf->ReadUBitLong(11);
|
||||
|
||||
for (unsigned int i = 0; i <= highestEntityIndex;i++)
|
||||
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
||||
{
|
||||
if (!buf->ReadOneBit())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buf->ReadOneBit())
|
||||
{
|
||||
move->simulationdata[i].m_flSimulationTime = buf->ReadBitFloat();
|
||||
|
|
|
@ -57,8 +57,9 @@ struct SimulationData
|
|||
// TODO_ENHANCED:
|
||||
// For now we send the last received update for animations.
|
||||
// anim time is unreliable on low fps.
|
||||
float m_flSimulationTime;
|
||||
float m_flAnimTime;
|
||||
float m_flSimulationTime;
|
||||
float m_flAnimTime;
|
||||
bool m_bEntityExists;
|
||||
};
|
||||
|
||||
class CEntityGroundContact
|
||||
|
|
Loading…
Reference in a new issue