Hello,
We want to have a high number of networked AI character actors in our game (1500+). Each of these AI is composed of over 20 components, most of which have replicated state. To help with perf our strategy is going to consist of turning components “on” and “off” based on based on some LOD heuristic. When turning a component off I initially thought we could just stop replicating the component (AActorComponent::SetIsReplicated(false)) but there’s an issue with that approach:
- UFooComponent is attached to an actor and is set to replicate
- Server game logic sets replicated property UFooComponent::Bar to true and that value replicates to all clients
- UFooComponent is set to no longer replicate which results in the associated instance protocol, fragments and state buffers to getting cleaned up
- Server game logic sets replicated property UFooComponent::Bar to false
- UFooComponent is set to replicate which then creates a new instance protocol, fragments, state buffers etc
- Since the default value of UFooComponent::Bar is false, the server doesn’t replicate that value to the clients and the clients are now out of sync
…due to this issue, instead of turning replication off I’d like to essentially pause replication by making the component dormant. UObjectReplicationBridge::SetObjectWantsToBeDormant has an ensure to make sure only root objects (actors) have their dormancy change. Any advice here?
Thanks,
Nick