Skip to content

Commit

Permalink
Fix updates for scoresync and nodeposesync packets not properly applying
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Aug 31, 2024
1 parent ffac0ba commit e487c0d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/NodePoseSyncState/MpNodePoseSyncStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ namespace MultiplayerCore::NodePoseSyncState {
void MpNodePoseSyncStateManager::HandleNodePoseSyncUpdateReceived(MpNodePoseSyncStatePacket* data, GlobalNamespace::IConnectedPlayer* player) {
if (player->get_isConnectionOwner()) {
DEBUG("Updating node pose sync frequency to following values: delta: {}ms, full: {}ms", data->deltaUpdateFrequencyMs, data->fullStateUpdateFrequencyMs);
bool shouldForceUpdate = deltaUpdateFrequencyMs != data->deltaUpdateFrequencyMs || fullStateUpdateFrequencyMs != data->fullStateUpdateFrequencyMs;
deltaUpdateFrequencyMs = data->deltaUpdateFrequencyMs;
fullStateUpdateFrequencyMs= data->fullStateUpdateFrequencyMs;
if (shouldForceUpdate) {
DEBUG("Forcing new state buffer update");
_localState = nullptr;
}
}
}

long MpNodePoseSyncStateManager::get_deltaUpdateFrequencyMs() { return deltaUpdateFrequencyMs; }
long MpNodePoseSyncStateManager::get_fullStateUpdateFrequencyMs() { return fullStateUpdateFrequencyMs; }
long MpNodePoseSyncStateManager::get_deltaUpdateFrequencyMs() {
DEBUG("Returning delta update frequency: {}ms", deltaUpdateFrequencyMs);
return deltaUpdateFrequencyMs;
}
long MpNodePoseSyncStateManager::get_fullStateUpdateFrequencyMs() {
DEBUG("Returning full state update frequency: {}ms", fullStateUpdateFrequencyMs);
return fullStateUpdateFrequencyMs;
}
}
16 changes: 14 additions & 2 deletions src/ScoreSyncState/MpScoreSyncStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,23 @@ namespace MultiplayerCore::ScoreSyncState {

void MpScoreSyncStateManager::HandleScoreSyncUpdateReceived(MpScoreSyncStatePacket* data, GlobalNamespace::IConnectedPlayer* player) {
if (player->get_isConnectionOwner()) {
DEBUG("Updating score sync frequency to following values: delta: {}ms, full: {}ms", data->deltaUpdateFrequencyMs, data->fullStateUpdateFrequencyMs);
bool shouldForceUpdate = deltaUpdateFrequencyMs != data->deltaUpdateFrequencyMs || fullStateUpdateFrequencyMs != data->fullStateUpdateFrequencyMs;
deltaUpdateFrequencyMs = data->deltaUpdateFrequencyMs;
fullStateUpdateFrequencyMs= data->fullStateUpdateFrequencyMs;
if (shouldForceUpdate) {
DEBUG("Forcing new state buffer update");
_localState = nullptr;
}
}
}

long MpScoreSyncStateManager::get_deltaUpdateFrequencyMs() { return deltaUpdateFrequencyMs; }
long MpScoreSyncStateManager::get_fullStateUpdateFrequencyMs() { return fullStateUpdateFrequencyMs; }
long MpScoreSyncStateManager::get_deltaUpdateFrequencyMs() {
DEBUG("Returning delta update frequency: {}ms", deltaUpdateFrequencyMs);
return deltaUpdateFrequencyMs;
}
long MpScoreSyncStateManager::get_fullStateUpdateFrequencyMs() {
DEBUG("Returning full state update frequency: {}ms", fullStateUpdateFrequencyMs);
return fullStateUpdateFrequencyMs;
}
}

0 comments on commit e487c0d

Please sign in to comment.