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 <cmath>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "bone_setup.h"
|
#include "bone_setup.h"
|
||||||
|
#include "const.h"
|
||||||
#include "convar.h"
|
#include "convar.h"
|
||||||
#include "imovehelper.h"
|
#include "imovehelper.h"
|
||||||
#include "ipredictionsystem.h"
|
#include "ipredictionsystem.h"
|
||||||
|
@ -1300,6 +1301,11 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
|
||||||
m_EntityGroundContact.RemoveAll();
|
m_EntityGroundContact.RemoveAll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_EDICTS; i++)
|
||||||
|
{
|
||||||
|
cmd->simulationdata[i].m_bEntityExists = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Send interpolated simulation time for lag compensation
|
// Send interpolated simulation time for lag compensation
|
||||||
for (int i = 0; i <= ClientEntityList().GetHighestEntityIndex(); i++)
|
for (int i = 0; i <= ClientEntityList().GetHighestEntityIndex(); i++)
|
||||||
{
|
{
|
||||||
|
@ -1312,6 +1318,7 @@ 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_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
|
#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
|
// Write finally simulation data with entity index
|
||||||
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
||||||
{
|
{
|
||||||
if (from->simulationdata[i].m_flSimulationTime
|
if (to->simulationdata[i].m_bEntityExists)
|
||||||
!= to->simulationdata[i].m_flSimulationTime)
|
{
|
||||||
|
buf->WriteOneBit( 0 );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf->WriteOneBit( 1 );
|
||||||
|
|
||||||
|
if (from->simulationdata[i].m_flSimulationTime != to->simulationdata[i].m_flSimulationTime)
|
||||||
{
|
{
|
||||||
buf->WriteOneBit(1);
|
buf->WriteOneBit(1);
|
||||||
buf->WriteBitFloat(to->simulationdata[i].m_flSimulationTime);
|
buf->WriteBitFloat(to->simulationdata[i].m_flSimulationTime);
|
||||||
|
@ -359,6 +366,11 @@ void ReadUsercmd( bf_read *buf, CUserCmd *move, CUserCmd *from )
|
||||||
|
|
||||||
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
for (unsigned int i = 0; i <= highestEntityIndex; i++)
|
||||||
{
|
{
|
||||||
|
if (!buf->ReadOneBit())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (buf->ReadOneBit())
|
if (buf->ReadOneBit())
|
||||||
{
|
{
|
||||||
move->simulationdata[i].m_flSimulationTime = buf->ReadBitFloat();
|
move->simulationdata[i].m_flSimulationTime = buf->ReadBitFloat();
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct SimulationData
|
||||||
// anim time is unreliable on low fps.
|
// anim time is unreliable on low fps.
|
||||||
float m_flSimulationTime;
|
float m_flSimulationTime;
|
||||||
float m_flAnimTime;
|
float m_flAnimTime;
|
||||||
|
bool m_bEntityExists;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CEntityGroundContact
|
class CEntityGroundContact
|
||||||
|
|
Loading…
Add table
Reference in a new issue