Actor Relevancy : Unreal은 각 Actor가 Client와의 관련 여부를 판단하고, 관련된 Actor만 Replicate
NetCullDistanceSquared
: 설정한 값 이내의 플레이어들에게만 해당 Actor를 ReplicationAlwaysRelevant
: 거리에 상관없이 모든 플레이어에게 ReplicationDormancy(휴면) : 네트워크 관점에서 Actor를 "휴면"시키는 기능
DormantAll
, DormantPartial
로 휴면SetNetDormancy()
, FlushNetDormancy()
Net Dormancy Flush
휴면 상태의 액터에서
AActor::FlushNetDormancy
를 호출하여 휴면 상태 액터의 변경사항을 리플리케이트할 수도 있습니다.
이렇게 하면 실제로 액터의 휴면 상태 스테이트를 변경하지 않고도 액터가 관련된 모든 연결에 대해 하나 이상의 업데이트를 강제로 리플리케이트합니다.
한 가지 예외가 있는데,AActor::NetDormancy
가ENetDormancy::DORM_Initial
로 설정된 액터에서AActor::FlushNetDormancy
를 호출하면,AActor::FlushNetDormancy
호출에 따라 해당 액터의 휴면 상태가ENetDormancy::DORM_DormantAll
로 변경됩니다.
⚠️ 주의
Blueprint Actor 휴면 상태(Dormant)일 때, Replicated된 프로퍼티를 업데이트하면 Actor가 자동으로 AActor::FlushNetDormancy를 호출하며 다시 Awake 상태가 됩니다.
- 테스트 해볼려고 Blueprint Actor 만들어서 해봤는데 안바뀜
- 이게 1초마다 print string 하도록 해서 그런가? 리플리케이션하는 순간 Awake 상태가 되었다가 다시 DormantAll로 되는건가
- 그러면 왜 주의하라는 건지 모르겠네;; 그냥 C++ 액터는 그 순간에도 Awake로 안바껴서 그런건가
▶️ Relevancy와 Dormancy를 조합해서 잘 사용하면, 네트워크 트래픽을 줄이는데 도움이 됨
앞에서 리플리케이션을 할 때, FastArray를 쓰거나, Condition을 달고, 큰 데이터는 쪼개고 등을 해서 리플리케이션을 효율적으로 하도록하였음.
이뿐 아니라 특정 데이터나 Actor의 Replication 주기를 조절할 수도 있음
NetUpdatedFrequency
: 초당 최대 Replication 횟수MinNetUpdateFrequency
: 최소로 이정도는 보장해라고 정한 횟수NetPriority
: 네트워크 Bandwidth가 부족할 때, 어떤 Actor를 우선 보낼지 결정하는 가중치// DefaultEngine.ini
[SystemSettings]
net.UseAdaptiveNetUpdateFrequency=1
에디터 커맨드 창에 stat net
명령어를 사용하면, 포괄적인 네트워크 상황을 볼 수 있음
좀 더 상세한 내용을 보고 싶으면 툴 사용(Network Insights)
Throttling : Replication 양이 너무 많아졌을 때, 실제 네트워크 상황에 맞게 그 양을 줄이는 것
ForceNetUpdate()
▶️ Update Rate를 조절하는 것은 게임의 부드러움과 네트워크 Bandwidth 절약의 TradeOff
참조 사이트
1. https://dev.epicgames.com/documentation/en-us/unreal-engine/actor-relevancy-in-unreal-engine
2. https://dev.epicgames.com/documentation/ko-kr/unreal-engine/actor-network-dormancy-in-unreal-engine
3. https://dev.epicgames.com/community/learning/tutorials/K8vY/unreal-engine-optimizing-server-performance-with-net-dormancy
4. https://dev.epicgames.com/documentation/en-us/unreal-engine/actor-relevancy-and-priority?application_version=4.27