diff --git a/dGame/dComponents/ControllablePhysicsComponent.cpp b/dGame/dComponents/ControllablePhysicsComponent.cpp index f2ee9b0b..9c1d8975 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.cpp +++ b/dGame/dComponents/ControllablePhysicsComponent.cpp @@ -24,8 +24,6 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Com m_IsOnGround = true; m_IsOnRail = false; m_DirtyPosition = true; - m_DirtyVelocity = true; - m_DirtyAngularVelocity = true; m_dpEntity = nullptr; m_Static = false; m_SpeedMultiplier = 1; @@ -134,20 +132,20 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo outBitStream->Write(m_IsOnGround); outBitStream->Write(m_IsOnRail); - outBitStream->Write(m_DirtyVelocity); - if (m_DirtyVelocity) { + bool isVelocityZero = m_Velocity != NiPoint3::ZERO; + outBitStream->Write(isVelocityZero); + if (isVelocityZero) { outBitStream->Write(m_Velocity.x); outBitStream->Write(m_Velocity.y); outBitStream->Write(m_Velocity.z); - m_DirtyVelocity = false; } - outBitStream->Write(m_DirtyAngularVelocity); - if (m_DirtyAngularVelocity) { + bool isAngularVelocityZero = m_AngularVelocity != NiPoint3::ZERO; + outBitStream->Write(isAngularVelocityZero); + if (isAngularVelocityZero) { outBitStream->Write(m_AngularVelocity.x); outBitStream->Write(m_AngularVelocity.y); outBitStream->Write(m_AngularVelocity.z); - m_DirtyAngularVelocity = false; } outBitStream->Write0(); // LocalSpaceInfo @@ -230,7 +228,6 @@ void ControllablePhysicsComponent::SetVelocity(const NiPoint3& vel) { m_Velocity = vel; m_DirtyPosition = true; - m_DirtyVelocity = true; if (m_dpEntity) m_dpEntity->SetVelocity(vel); } @@ -242,7 +239,6 @@ void ControllablePhysicsComponent::SetAngularVelocity(const NiPoint3& vel) { m_AngularVelocity = vel; m_DirtyPosition = true; - m_DirtyAngularVelocity = true; } void ControllablePhysicsComponent::SetIsOnGround(bool val) { @@ -261,14 +257,6 @@ void ControllablePhysicsComponent::SetDirtyPosition(bool val) { m_DirtyPosition = val; } -void ControllablePhysicsComponent::SetDirtyVelocity(bool val) { - m_DirtyVelocity = val; -} - -void ControllablePhysicsComponent::SetDirtyAngularVelocity(bool val) { - m_DirtyAngularVelocity = val; -} - void ControllablePhysicsComponent::AddPickupRadiusScale(float value) { m_ActivePickupRadiusScales.push_back(value); if (value > m_PickupRadius) { diff --git a/dGame/dComponents/ControllablePhysicsComponent.h b/dGame/dComponents/ControllablePhysicsComponent.h index 384dfdac..7422fbd9 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.h +++ b/dGame/dComponents/ControllablePhysicsComponent.h @@ -116,18 +116,6 @@ public: */ void SetDirtyPosition(bool val); - /** - * Mark the velocity as dirty, forcing a serializtion update next tick - * @param val whether or not the velocity is dirty - */ - void SetDirtyVelocity(bool val); - - /** - * Mark the angular velocity as dirty, forcing a serialization update next tick - * @param val whether or not the angular velocity is dirty - */ - void SetDirtyAngularVelocity(bool val); - /** * Sets whether or not the entity is currently wearing a jetpack * @param val whether or not the entity is currently wearing a jetpack @@ -337,21 +325,11 @@ private: */ NiQuaternion m_Rotation; - /** - * Whether or not the velocity is dirty, forcing a serialization of the velocity - */ - bool m_DirtyVelocity; - /** * The current velocity of the entity */ NiPoint3 m_Velocity; - /** - * Whether or not the angular velocity is dirty, forcing a serialization - */ - bool m_DirtyAngularVelocity; - /** * The current angular velocity of the entity */ diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 84bd154c..1b87abc3 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -347,7 +347,7 @@ int main(int argc, char** argv) { StartChatServer(); Game::im->GetInstance(0, false, 0); - Game::im->GetInstance(1800, false, 0); + Game::im->GetInstance(1200, false, 0); StartAuthServer(); } diff --git a/dNet/ClientPackets.cpp b/dNet/ClientPackets.cpp index 8bebda93..30a1930d 100644 --- a/dNet/ClientPackets.cpp +++ b/dNet/ClientPackets.cpp @@ -182,9 +182,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac vehiclePhysicsComponent->SetIsOnGround(onGround); vehiclePhysicsComponent->SetIsOnRail(onRail); vehiclePhysicsComponent->SetVelocity(velocity); - vehiclePhysicsComponent->SetDirtyVelocity(velocityFlag); vehiclePhysicsComponent->SetAngularVelocity(angVelocity); - vehiclePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag); vehiclePhysicsComponent->SetRemoteInputInfo(remoteInput); } else { // Need to get the mount's controllable physics @@ -195,9 +193,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac controllablePhysicsComponent->SetIsOnGround(onGround); controllablePhysicsComponent->SetIsOnRail(onRail); controllablePhysicsComponent->SetVelocity(velocity); - controllablePhysicsComponent->SetDirtyVelocity(velocityFlag); controllablePhysicsComponent->SetAngularVelocity(angVelocity); - controllablePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag); } Game::entityManager->SerializeEntity(possassableEntity); } @@ -221,9 +217,7 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac comp->SetIsOnGround(onGround); comp->SetIsOnRail(onRail); comp->SetVelocity(velocity); - comp->SetDirtyVelocity(velocityFlag); comp->SetAngularVelocity(angVelocity); - comp->SetDirtyAngularVelocity(angVelocityFlag); auto* player = static_cast(entity); player->SetGhostReferencePoint(position);