mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:17:58 +02:00
Add more user activity tracking data
This commit is contained in:
parent
3ec1681a4e
commit
211da3c428
3 changed files with 47 additions and 0 deletions
|
@ -1145,10 +1145,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
static int SEND_STATS_INTERVAL_MS = 10000;
|
static int SEND_STATS_INTERVAL_MS = 10000;
|
||||||
static int NEARBY_AVATAR_RADIUS_METERS = 10;
|
static int NEARBY_AVATAR_RADIUS_METERS = 10;
|
||||||
|
|
||||||
|
static glm::vec3 lastAvatarPosition = getMyAvatar()->getPosition();
|
||||||
|
static glm::mat4 lastHMDHeadPose = getHMDSensorPose();
|
||||||
|
|
||||||
// Periodically send fps as a user activity event
|
// Periodically send fps as a user activity event
|
||||||
QTimer* sendStatsTimer = new QTimer(this);
|
QTimer* sendStatsTimer = new QTimer(this);
|
||||||
sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS);
|
sendStatsTimer->setInterval(SEND_STATS_INTERVAL_MS);
|
||||||
connect(sendStatsTimer, &QTimer::timeout, this, [this]() {
|
connect(sendStatsTimer, &QTimer::timeout, this, [this]() {
|
||||||
|
|
||||||
QJsonObject properties = {};
|
QJsonObject properties = {};
|
||||||
MemoryInfo memInfo;
|
MemoryInfo memInfo;
|
||||||
if (getMemoryInfo(memInfo)) {
|
if (getMemoryInfo(memInfo)) {
|
||||||
|
@ -1190,6 +1194,23 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
|
|
||||||
properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
|
properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
|
||||||
|
|
||||||
|
glm::vec3 avatarPosition = getMyAvatar()->getPosition();
|
||||||
|
properties["avatar_has_moved"] = lastAvatarPosition != avatarPosition;
|
||||||
|
lastAvatarPosition = avatarPosition;
|
||||||
|
|
||||||
|
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
|
||||||
|
auto entityActivityTracking = entityScriptingInterface->getActivityTracking();
|
||||||
|
entityScriptingInterface->resetActivityTracking();
|
||||||
|
properties["added_entity"] = entityActivityTracking.hasAddedEntity;
|
||||||
|
properties["deleted_entity"] = entityActivityTracking.hasDeletedEntity;
|
||||||
|
properties["edited_entity"] = entityActivityTracking.hasEditedEntity;
|
||||||
|
|
||||||
|
auto hmdHeadPose = getHMDSensorPose();
|
||||||
|
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);
|
||||||
|
lastHMDHeadPose = hmdHeadPose;
|
||||||
|
|
||||||
|
properties["hand_pose_changed"] = false;
|
||||||
|
|
||||||
UserActivityLogger::getInstance().logAction("stats", properties);
|
UserActivityLogger::getInstance().logAction("stats", properties);
|
||||||
});
|
});
|
||||||
sendStatsTimer->start();
|
sendStatsTimer->start();
|
||||||
|
|
|
@ -40,6 +40,12 @@ void EntityScriptingInterface::queueEntityMessage(PacketType packetType,
|
||||||
getEntityPacketSender()->queueEditEntityMessage(packetType, _entityTree, entityID, properties);
|
getEntityPacketSender()->queueEditEntityMessage(packetType, _entityTree, entityID, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityScriptingInterface::resetActivityTracking() {
|
||||||
|
_activityTracking.hasAddedEntity = false;
|
||||||
|
_activityTracking.hasDeletedEntity = false;
|
||||||
|
_activityTracking.hasEditedEntity = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool EntityScriptingInterface::canAdjustLocks() {
|
bool EntityScriptingInterface::canAdjustLocks() {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
return nodeList->isAllowedEditor();
|
return nodeList->isAllowedEditor();
|
||||||
|
@ -130,6 +136,8 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti
|
||||||
|
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) {
|
QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) {
|
||||||
|
_activityTracking.hasAddedEntity = true;
|
||||||
|
|
||||||
EntityItemProperties propertiesWithSimID = convertLocationFromScriptSemantics(properties);
|
EntityItemProperties propertiesWithSimID = convertLocationFromScriptSemantics(properties);
|
||||||
propertiesWithSimID.setDimensionsInitialized(properties.dimensionsChanged());
|
propertiesWithSimID.setDimensionsInitialized(properties.dimensionsChanged());
|
||||||
|
|
||||||
|
@ -200,6 +208,8 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QString& modelUrl, const QString& shapeType,
|
QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QString& modelUrl, const QString& shapeType,
|
||||||
bool dynamic, const glm::vec3& position, const glm::vec3& gravity) {
|
bool dynamic, const glm::vec3& position, const glm::vec3& gravity) {
|
||||||
|
_activityTracking.hasAddedEntity = true;
|
||||||
|
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setType(EntityTypes::Model);
|
properties.setType(EntityTypes::Model);
|
||||||
properties.setName(name);
|
properties.setName(name);
|
||||||
|
@ -263,6 +273,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
||||||
|
_activityTracking.hasEditedEntity = true;
|
||||||
|
|
||||||
EntityItemProperties properties = scriptSideProperties;
|
EntityItemProperties properties = scriptSideProperties;
|
||||||
|
|
||||||
auto dimensions = properties.getDimensions();
|
auto dimensions = properties.getDimensions();
|
||||||
|
@ -406,6 +418,8 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityScriptingInterface::deleteEntity(QUuid id) {
|
void EntityScriptingInterface::deleteEntity(QUuid id) {
|
||||||
|
_activityTracking.hasDeletedEntity = true;
|
||||||
|
|
||||||
EntityItemID entityID(id);
|
EntityItemID entityID(id);
|
||||||
bool shouldDelete = true;
|
bool shouldDelete = true;
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,13 @@ class EntityScriptingInterface : public OctreeScriptingInterface, public Depende
|
||||||
public:
|
public:
|
||||||
EntityScriptingInterface(bool bidOnSimulationOwnership);
|
EntityScriptingInterface(bool bidOnSimulationOwnership);
|
||||||
|
|
||||||
|
class ActivityTracking {
|
||||||
|
public:
|
||||||
|
bool hasAddedEntity { false };
|
||||||
|
bool hasDeletedEntity { false };
|
||||||
|
bool hasEditedEntity { false };
|
||||||
|
};
|
||||||
|
|
||||||
EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); }
|
EntityEditPacketSender* getEntityPacketSender() const { return (EntityEditPacketSender*)getPacketSender(); }
|
||||||
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
virtual NodeType_t getServerNodeType() const { return NodeType::EntityServer; }
|
||||||
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
virtual OctreeEditPacketSender* createPacketSender() { return new EntityEditPacketSender(); }
|
||||||
|
@ -73,6 +80,9 @@ public:
|
||||||
EntityTreePointer getEntityTree() { return _entityTree; }
|
EntityTreePointer getEntityTree() { return _entityTree; }
|
||||||
void setEntitiesScriptEngine(EntitiesScriptEngineProvider* engine);
|
void setEntitiesScriptEngine(EntitiesScriptEngineProvider* engine);
|
||||||
float calculateCost(float mass, float oldVelocity, float newVelocity);
|
float calculateCost(float mass, float oldVelocity, float newVelocity);
|
||||||
|
|
||||||
|
void resetActivityTracking();
|
||||||
|
ActivityTracking getActivityTracking() const { return _activityTracking; }
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// returns true if the DomainServer will allow this Node/Avatar to make changes
|
// returns true if the DomainServer will allow this Node/Avatar to make changes
|
||||||
|
@ -226,6 +236,8 @@ private:
|
||||||
float _currentAvatarEnergy = { FLT_MAX };
|
float _currentAvatarEnergy = { FLT_MAX };
|
||||||
float getCurrentAvatarEnergy() { return _currentAvatarEnergy; }
|
float getCurrentAvatarEnergy() { return _currentAvatarEnergy; }
|
||||||
void setCurrentAvatarEnergy(float energy);
|
void setCurrentAvatarEnergy(float energy);
|
||||||
|
|
||||||
|
ActivityTracking _activityTracking;
|
||||||
|
|
||||||
float costMultiplier = { 0.01f };
|
float costMultiplier = { 0.01f };
|
||||||
float getCostMultiplier();
|
float getCostMultiplier();
|
||||||
|
|
Loading…
Reference in a new issue