Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

[UNR-2887] Fix: Dynamic subobjects attached near actor creation would not be able to replicate their properties #1806

Merged

Conversation

mironec
Copy link
Contributor

@mironec mironec commented Feb 14, 2020

Description

Previously, if trying to create and attach a dynamic subobject to an actor near its creation point, the fields of the dynamic component would not replicate properly after initial creation.
The reason for this was that we were not setting component write ACLs properly for these subobjects. This was due to the change made earlier, to resolve dynamic components earlier, which caused the code trying to check if the subobject is dynamically attached to think it was not dynamically attached, since it has already been resolved. This is fixed by decoupling the writing of ACLs from the resolution of the dynamic object in SpatialSender::CreateEntity.

Also a drive-by fix for $lld spam in logs.
Also a drive-by fix for authority queuing not checking which component we got authority over and potentially firing component updates for objects we did not have authority over.

Release note

This actually worked prior to the previous fix to dynamic subobjects (also in this RC), so I think no release note is necessary.

Tests

Augmented dynamic component tests: https://github.com/improbable/UnrealGDKEngineNetTest/pull/8.

Documentation

N/A

Primary reviewers

@improbable-valentyn @Vatyx

@mironec mironec self-assigned this Feb 14, 2020
@improbable-prow-robot
Copy link

Corresponding JIRA ticket: https://improbableio.atlassian.net/browse/UNR-2887

@improbable-prow-robot improbable-prow-robot added jira/UNR size/S Denotes a PR that changes 15-39 lines, ignoring generated files. labels Feb 14, 2020
@@ -538,7 +538,7 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId)
if (AActor* EntityActor = Cast<AActor>(PackageMap->GetObjectFromEntityId(EntityId)))
{
UE_LOG(LogSpatialReceiver, Log, TEXT("Entity for actor %s has been checked out on the worker which spawned it or is a singleton linked on this worker. "
"Entity id: $lld"), *EntityActor->GetName(), EntityId);
"Entity id: %lld"), *EntityActor->GetName(), EntityId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by fix

if (ComponentId == It->component_id)
{
Connection->SendComponentUpdate(EntityId, &(*It));
It.RemoveCurrent();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No memory corruption?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveCurrentSwap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have had to replace the entire code section, now it's kind of less readable. Suggestions welcome

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced back to using an iterator, because we want to preserve order.

@mironec
Copy link
Contributor Author

mironec commented Feb 14, 2020

By the way, I am pretty sure my previous early-resolving of dynamic subobjects breaks dynamic subobjects for which you turn replication on and off :(

@mironec mironec merged commit e826a6e into 0.8.1-preview-rc Feb 19, 2020
@mironec mironec deleted the bugfix/UNR-2887-dynamic-subobject-replication branch February 19, 2020 13:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jira/UNR size/S Denotes a PR that changes 15-39 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants