mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 02:48:12 +02:00
adjust logic around timestamps used by entity-server to know if something was sent. adjust which physics variables are adjusted by a non-sim-owner packet
This commit is contained in:
parent
380fed7aee
commit
e702518041
4 changed files with 32 additions and 15 deletions
|
@ -325,8 +325,7 @@ void OctreeQueryNode::updateLastKnownViewFrustum() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// save that we know the view has been sent.
|
// save that we know the view has been sent.
|
||||||
quint64 now = usecTimestampNow();
|
setLastTimeBagEmpty();
|
||||||
setLastTimeBagEmpty(now); // is this what we want? poor names
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
bool moveShouldDump() const;
|
bool moveShouldDump() const;
|
||||||
|
|
||||||
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
quint64 getLastTimeBagEmpty() const { return _lastTimeBagEmpty; }
|
||||||
void setLastTimeBagEmpty(quint64 lastTimeBagEmpty) { _lastTimeBagEmpty = lastTimeBagEmpty; }
|
void setLastTimeBagEmpty() { _lastTimeBagEmpty = _sceneSendStartTime; }
|
||||||
|
|
||||||
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
bool getCurrentPacketIsColor() const { return _currentPacketIsColor; }
|
||||||
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
bool getCurrentPacketIsCompressed() const { return _currentPacketIsCompressed; }
|
||||||
|
@ -98,6 +98,8 @@ public:
|
||||||
void setLastRootTimestamp(quint64 timestamp) { _lastRootTimestamp = timestamp; }
|
void setLastRootTimestamp(quint64 timestamp) { _lastRootTimestamp = timestamp; }
|
||||||
unsigned int getlastOctreePacketLength() const { return _lastOctreePacketLength; }
|
unsigned int getlastOctreePacketLength() const { return _lastOctreePacketLength; }
|
||||||
int getDuplicatePacketCount() const { return _duplicatePacketCount; }
|
int getDuplicatePacketCount() const { return _duplicatePacketCount; }
|
||||||
|
|
||||||
|
void sceneStart(quint64 sceneSendStartTime) { _sceneSendStartTime = sceneSendStartTime; }
|
||||||
|
|
||||||
void nodeKilled();
|
void nodeKilled();
|
||||||
void forceNodeShutdown();
|
void forceNodeShutdown();
|
||||||
|
@ -158,6 +160,8 @@ private:
|
||||||
|
|
||||||
SentPacketHistory _sentPacketHistory;
|
SentPacketHistory _sentPacketHistory;
|
||||||
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
QQueue<OCTREE_PACKET_SEQUENCE> _nackedSequenceNumbers;
|
||||||
|
|
||||||
|
quint64 _sceneSendStartTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeQueryNode_h
|
#endif // hifi_OctreeQueryNode_h
|
||||||
|
|
|
@ -343,8 +343,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
|
|
||||||
if (!viewFrustumChanged && !nodeData->getWantDelta()) {
|
if (!viewFrustumChanged && !nodeData->getWantDelta()) {
|
||||||
// only set our last sent time if we weren't resetting due to frustum change
|
// only set our last sent time if we weren't resetting due to frustum change
|
||||||
quint64 now = usecTimestampNow();
|
nodeData->setLastTimeBagEmpty();
|
||||||
nodeData->setLastTimeBagEmpty(now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// track completed scenes and send out the stats packet accordingly
|
// track completed scenes and send out the stats packet accordingly
|
||||||
|
@ -368,9 +367,11 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
|
|
||||||
// TODO: add these to stats page
|
// TODO: add these to stats page
|
||||||
//::startSceneSleepTime = _usleepTime;
|
//::startSceneSleepTime = _usleepTime;
|
||||||
|
|
||||||
|
nodeData->sceneStart(usecTimestampNow() - CHANGE_FUDGE);
|
||||||
// start tracking our stats
|
// start tracking our stats
|
||||||
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, _myServer->getOctree()->getRoot(), _myServer->getJurisdiction());
|
nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged,
|
||||||
|
_myServer->getOctree()->getRoot(), _myServer->getJurisdiction());
|
||||||
|
|
||||||
// This is the start of "resending" the scene.
|
// This is the start of "resending" the scene.
|
||||||
bool dontRestartSceneOnMove = false; // this is experimental
|
bool dontRestartSceneOnMove = false; // this is experimental
|
||||||
|
@ -561,6 +562,13 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (somethingToSend) {
|
||||||
|
qDebug() << "Hit PPS Limit, packetsSentThisInterval =" << packetsSentThisInterval
|
||||||
|
<< " maxPacketsPerInterval = " << maxPacketsPerInterval
|
||||||
|
<< " clientMaxPacketsPerInterval = " << clientMaxPacketsPerInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Here's where we can/should allow the server to send other data...
|
// Here's where we can/should allow the server to send other data...
|
||||||
// send the environment packet
|
// send the environment packet
|
||||||
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
// TODO: should we turn this into a while loop to better handle sending multiple special packets
|
||||||
|
|
|
@ -321,10 +321,11 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
// if this bitstream indicates that this node is the simulation owner, ignore any physics-related updates.
|
// if this bitstream indicates that this node is the simulation owner, ignore any physics-related updates.
|
||||||
glm::vec3 savePosition = _position;
|
glm::vec3 savePosition = _position;
|
||||||
glm::quat saveRotation = _rotation;
|
glm::quat saveRotation = _rotation;
|
||||||
// glm::vec3 saveVelocity = _velocity;
|
glm::vec3 saveVelocity = _velocity;
|
||||||
// glm::vec3 saveAngularVelocity = _angularVelocity;
|
glm::vec3 saveAngularVelocity = _angularVelocity;
|
||||||
// glm::vec3 saveGravity = _gravity;
|
glm::vec3 saveGravity = _gravity;
|
||||||
// glm::vec3 saveAcceleration = _acceleration;
|
glm::vec3 saveAcceleration = _acceleration;
|
||||||
|
uint32_t saveFlags = _dirtyFlags;
|
||||||
|
|
||||||
|
|
||||||
// Header bytes
|
// Header bytes
|
||||||
|
@ -626,10 +627,15 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
// this node, so our version has to be newer than what the packet contained.
|
// this node, so our version has to be newer than what the packet contained.
|
||||||
_position = savePosition;
|
_position = savePosition;
|
||||||
_rotation = saveRotation;
|
_rotation = saveRotation;
|
||||||
// _velocity = saveVelocity;
|
_velocity = saveVelocity;
|
||||||
// _angularVelocity = saveAngularVelocity;
|
_angularVelocity = saveAngularVelocity;
|
||||||
// _gravity = saveGravity;
|
_gravity = saveGravity;
|
||||||
// _acceleration = saveAcceleration;
|
_acceleration = saveAcceleration;
|
||||||
|
_dirtyFlags &= ~(saveFlags & (EntityItem::DIRTY_POSITION |
|
||||||
|
EntityItem::DIRTY_ROTATION |
|
||||||
|
EntityItem::DIRTY_LINEAR_VELOCITY |
|
||||||
|
EntityItem::DIRTY_ANGULAR_VELOCITY |
|
||||||
|
EntityItem::DIRTY_PHYSICS_ACTIVATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
|
|
Loading…
Reference in a new issue