[Iris] Making characters fully push based

Hello,

Our game needs to network a lot of characters and we’ve finally hit a wall that requires all character actors to be fully push based. At this stage I’ve got all our characters fully push based and verified as such using their replication protocols. However there is still more work to be done since there are various spots in the engine that unnecessarily dirty replicated state every frame anyway. I’ve taken care of most of them but so far there is 1 area that I’m confused on.

AActor::PreReplication nulls out the AttachParent and AttachComponent with this comment: “// Attachment replication gets filled in by GatherCurrentMovement(), but in the case of a detached root we need to trigger remote detachment.” AActor::GatherCurrentMovement also nulls them out. I’d like to understand what that comment means and why nulling them out is required, as this is causing all actors that are attached to be dirtied every frame. (Note that I’ve already taken care of the various places within GatherCurrentMovement that unnecessarily set bWasAttachmentModified and bWasRepMovementModified even in the case that replicated state hasn’t changed.)

Thanks,

Nick

[Attachment Removed]

Hi,

Thank you for bringing this to our attention!

I believe this comment is referring to the fact that AttachmentReplication is only updated if the actor’s root component has a non-null AttachParent. In the case where an actor is detached, its AttachParent would be set back to nullptr. This would cause GatherCurrentMovement to skip filling out AttachmentReplication, leading to the client not receiving the new null value for AttachmentReplication.AttachParent. To work around this, the struct’s AttachParent pointer is set to null before GatherCurrentMovement fills out AttachmentReplication ([AttachComponent getting reset was also added [Content removed]

I unfortunately can’t speak to the reasoning behind this implementation though. The change was made quite some time ago (~10 years), and the dev who made this change is no longer at Epic.

That being said, it does seem unintended that both PreReplication and GatherCurrentMovement would reset AttachParent/AttachComponent, esspecially since this is causing the “old” and current values in GatherCurrentMovement to always differ in the case where the actor’s root component does have a non-null AttachParent. I’ve opened a new issue for this, UE-365282.

Thanks,

Alex

[Attachment Removed]

Awesome, thanks Alex.

[Attachment Removed]