suppress unchanged entities

This commit is contained in:
ZappoMan 2014-08-29 21:51:08 -07:00
parent d1a046e6ed
commit 1fa587b88a
3 changed files with 89 additions and 54 deletions

View file

@ -59,6 +59,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
qDebug() << "EntityTreeElement::appendElementData()";
qDebug() << " getAACube()=" << getAACube();
qDebug() << " START OF ELEMENT packetData->uncompressed size:" << packetData->getUncompressedSize();
qDebug() << " params.lastViewFrustumSent=" << params.lastViewFrustumSent;
}
OctreeElement::AppendState appendElementState = OctreeElement::COMPLETED; // assume the best...
@ -89,8 +90,24 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
EntityItem* entity = (*_entityItems)[i];
bool includeThisEntity = true;
if (wantDebug) {
qDebug() << "params.forceSendScene=" << params.forceSendScene;
qDebug() << "entity->getLastEdited()=" << entity->getLastEdited();
qDebug() << "entity->getLastEdited() > params.lastViewFrustumSent="
<< (entity->getLastEdited() > params.lastViewFrustumSent);
}
if (!params.forceSendScene && entity->getLastEdited() < params.lastViewFrustumSent) {
if (wantDebug) {
qDebug() << "NOT forceSendScene, and not changed since last sent SUPPRESSING this ENTITY"
<< entity->getEntityItemID();
}
includeThisEntity = false;
}
if (hadElementExtraData) {
includeThisEntity = entityTreeElementExtraEncodeData->includedItems.contains(entity->getEntityItemID());
includeThisEntity = includeThisEntity &&
entityTreeElementExtraEncodeData->includedItems.contains(entity->getEntityItemID());
if (wantDebug) {
qDebug() << " hadElementExtraData=" << hadElementExtraData;
qDebug() << " entity[" << i <<"].entityItemID=" << entity->getEntityItemID();

View file

@ -134,73 +134,83 @@ bool MovingEntitiesOperator::PreRecursion(OctreeElement* element) {
// check against each of our search entities
qDebug() << " --------- PROCESSING list of moving entities -----------";
if (wantDebug) {
qDebug() << " --------- PROCESSING list of moving entities -----------";
}
foreach(const EntityToMoveDetails& details, _entitiesToMove) {
qDebug() << " PROCESSING --- MOVING ENTITY";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << details.entity->getEntityItemID();
qDebug() << " oldCube=" << details.oldCube;
qDebug() << " newCube=" << details.newCube;
qDebug() << " newBox=" << details.newBox;
qDebug() << " oldContainingElement=" << details.oldContainingElement;
qDebug() << " oldFound=" << details.oldFound;
qDebug() << " newFound=" << details.newFound;
if (wantDebug) {
qDebug() << " PROCESSING --- MOVING ENTITY";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << details.entity->getEntityItemID();
qDebug() << " oldCube=" << details.oldCube;
qDebug() << " newCube=" << details.newCube;
qDebug() << " newBox=" << details.newBox;
qDebug() << " oldContainingElement=" << details.oldContainingElement;
qDebug() << " oldFound=" << details.oldFound;
qDebug() << " newFound=" << details.newFound;
if (!details.oldFound) {
qDebug() << " THIS ENTITY'S OLD LOCATION HAS NOT BEEN FOUND... ";
}
if (!details.oldFound) {
qDebug() << " THIS ENTITY'S OLD LOCATION HAS NOT BEEN FOUND... ";
}
if (entityTreeElement == details.oldContainingElement) {
qDebug() << " THIS ELEMENT IS THE ENTITY'S OLD LOCATION... ";
}
if (entityTreeElement == details.oldContainingElement) {
qDebug() << " THIS ELEMENT IS THE ENTITY'S OLD LOCATION... ";
}
// If this is one of the old elements we're looking for, then ask it to remove the old entity
if (!details.oldFound && entityTreeElement == details.oldContainingElement) {
qDebug() << " PROCESSING REMOVE ENTITY FROM OLD ELEMENT <<<<<<<<<<<<<";
if (wantDebug) {
qDebug() << " PROCESSING REMOVE ENTITY FROM OLD ELEMENT <<<<<<<<<<<<<";
}
entityTreeElement->removeEntityItem(details.entity);
qDebug() << "removing entityItem from element... ";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << details.entity->getEntityItemID();
qDebug() << " entityTreeElement=" << entityTreeElement;
qDebug() << " element=" << element;
qDebug() << " element->getAACube()=" << element->getAACube();
if (wantDebug) {
qDebug() << "removing entityItem from element... ";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << details.entity->getEntityItemID();
qDebug() << " entityTreeElement=" << entityTreeElement;
qDebug() << " element=" << element;
qDebug() << " element->getAACube()=" << element->getAACube();
}
_foundOldCount++;
//details.oldFound = true; // TODO: would be nice to add this optimization
}
// If this element is the best fit for the new bounds of this entity then add the entity to the element
bool bestFitCube = entityTreeElement->bestFitBounds(details.newCube);
bool bestFitBox = entityTreeElement->bestFitBounds(details.newBox);
qDebug() << " bestFitCube=" << bestFitCube;
qDebug() << " bestFitBox=" << bestFitBox;
if (bestFitCube != bestFitBox) {
qDebug() << " WHOA!!!! bestFitCube != bestFitBox!!!!";
if (wantDebug) {
bool bestFitCube = entityTreeElement->bestFitBounds(details.newCube);
bool bestFitBox = entityTreeElement->bestFitBounds(details.newBox);
qDebug() << " bestFitCube=" << bestFitCube;
qDebug() << " bestFitBox=" << bestFitBox;
if (bestFitCube != bestFitBox) {
qDebug() << " WHOA!!!! bestFitCube != bestFitBox!!!!";
}
if (!details.newFound) {
qDebug() << " THIS ENTITY'S NEW LOCATION HAS NOT BEEN FOUND... ";
}
if (entityTreeElement->bestFitBounds(details.newCube)) {
qDebug() << " THIS ELEMENT IS THE ENTITY'S BEST FIT NEW LOCATION... ";
}
}
if (!details.newFound) {
qDebug() << " THIS ENTITY'S NEW LOCATION HAS NOT BEEN FOUND... ";
}
if (entityTreeElement->bestFitBounds(details.newCube)) {
qDebug() << " THIS ELEMENT IS THE ENTITY'S BEST FIT NEW LOCATION... ";
}
if (!details.newFound && entityTreeElement->bestFitBounds(details.newCube)) {
qDebug() << " PROCESSING ADD ENTITY TO NEW ELEMENT <<<<<<<<<<<<<";
EntityItemID entityItemID = details.entity->getEntityItemID();
qDebug() << "adding entityItem to element...";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << entityItemID;
qDebug() << " entityTreeElement=" << entityTreeElement;
qDebug() << " element=" << element;
qDebug() << " element->getAACube()=" << element->getAACube();
if (wantDebug) {
qDebug() << " PROCESSING ADD ENTITY TO NEW ELEMENT <<<<<<<<<<<<<";
qDebug() << "adding entityItem to element...";
qDebug() << " entity=" << details.entity;
qDebug() << " entityItemID=" << entityItemID;
qDebug() << " entityTreeElement=" << entityTreeElement;
qDebug() << " element=" << element;
qDebug() << " element->getAACube()=" << element->getAACube();
}
entityTreeElement->addEntityItem(details.entity);
_tree->setContainingElement(entityItemID, entityTreeElement);
@ -208,7 +218,9 @@ bool MovingEntitiesOperator::PreRecursion(OctreeElement* element) {
//details.newFound = true; // TODO: would be nice to add this optimization
}
}
qDebug() << " --------- DONE PROCESSING list of moving entities -----------";
if (wantDebug) {
qDebug() << " --------- DONE PROCESSING list of moving entities -----------";
}
// if we haven't found all of our search for entities, then keep looking
keepSearching = (_foundOldCount < _lookingCount) || (_foundNewCount < _lookingCount);

View file

@ -3,15 +3,9 @@
2) Test file save load for case where two siblings have more than MTU amount of data. I wonder if the fact that file save
doesn't include the extra exists bits will break something.
3) Make sure LOD logic honors the LOD settings for entities in "spanners/parent" cells.
-- network - don't SEND small entities even if their spanner cell is visible
7) some jutter with moving entities
-- I think this might only happen with lots of models in an element or in view
this may be related to issue 13 below
8) Look into why non-changed octree cells are being resent when editing an entity --
this is probably because we're marking the trees as dirty -- but we probably can not send entitys that haven't changed
-- test lots of entities with the new suppress mode
10) What happens if the edit properties don't fit in a single message MTU???
@ -34,6 +28,15 @@
// NICE TO HAVE:
Z) Consider using client side "on the fly" billboard of entites to handle LOD
-- have routine to shoot views of an entity for 6 faces
-- store those images in the entity on the client
-- based on camera position pick "closest" face of model
-- as LOD drops use those images instead of rendering the model
3) Make sure LOD logic honors the LOD settings for entities in "spanners/parent" cells.
-- network - don't SEND small entities even if their spanner cell is visible
-- if animation is stopped, changing frame doesn't update the simulation
@ -231,6 +234,9 @@
// FIXED -- animations are on different frames -- the data suggest they are the same frame number from a simulation perspective
// SOLVED -- 50) Verify pruning logic...
// SOLVED -- 51) LOD for rendering - don't render small entities even if their spanner cell is visible
// SOLVED -- 52) Look into why non-changed octree cells are being resent when editing an entity --
// this is probably because we're marking the trees as dirty -- but we probably can not send entitys that haven't changed
// Solution -- suppress sending of entities that haven't been edited since the last view frustum sent