NetDormancy (네트워크 휴면 여부) 이해

전지훈·2021년 8월 24일
0

Unreal

목록 보기
8/25
post-thumbnail
/** Describes if an actor can enter a low network bandwidth dormant mode */
UENUM(BlueprintType)
enum ENetDormancy
{
	/** This actor can never go network dormant. */
	DORM_Never UMETA(DisplayName = "Never"),
	/** This actor can go dormant, but is not currently dormant. Game code will tell it when it go dormant. */
	DORM_Awake UMETA(DisplayName = "Awake"),
	/** This actor wants to go fully dormant for all connections. */
	DORM_DormantAll UMETA(DisplayName = "Dormant All"),
	/** This actor may want to go dormant for some connections, GetNetDormancy() will be called to find out which. */
	DORM_DormantPartial UMETA(DisplayName = "Dormant Partial"),
	/** This actor is initially dormant for all connection if it was placed in map. */
	DORM_Initial UMETA(DisplayName = "Initial"),

	DORM_MAX UMETA(Hidden),
};

NetDormancy는 네트워크 휴면 여부를 결정하며 설정에 따라 액터의 프로퍼티 리플리케이션 여부를 조절할 수 있다. 즉, 액터가 휴면(Dormant) 상태인 경우 프로퍼티 리플리케이션이 수행되지 않는다고 이해하면 된다.

  • DORM_Never: 네트워크를 절대 휴면상태로 놓치않는다는 상태. (단, 휴면 상태 전환에 강제적인 제한은 없다)
  • DORM_Awake: 현재 휴면상태는 아니지만, 휴면 상태로 전환이 가능한 상태.
  • DORM_DormantAll: 모든 클라이언트에 대하여 휴면 상태.
  • DORM_DormantPartial: Actor의 가상 함수 GetNetDormancy()가 true인 클라이언트에 대해서만 휴면 상태.
  • DORM_Initial: 맵에 배치 될 때 한번 리플리케이션을 수행하고 DORM_DormantAll로 전환 되는 상태.

휴면 상태인 액터의 프로퍼티를 리플리케이션 하고 싶은 경우, FlushNetDormancy를 통해 휴면 상태를 유지하면서 호출 프레임에만 리플리케이션을 수행하도록 하거나, DROM_Never 혹은 DORM_Awake로 NetDormancy를 변경하여 리플리케이션이 지속적으로 수행되도록 할 수 있다.

NetDormancy는 서버에서 설정한 것만 유효하다.

Multicast RPC를 수행하는 경우, FlushNetDormancy가 강제적으로 호출된다.

왜 NetDormancy 설정을 변경하는가?

NetDormacy 설정은 네트워크 최적화 그 중에서도 엑터의 프로퍼티 리플리케이션에 대한 최적화를 위한 것이다. 액터들 중에는 시시각각 프로퍼티 리플리케이션이 필요한 경우도 있지만 특정 이벤트가 발생할 때마다 리플리케이션이 수행되어도 무관한 액터들도 존재한다. 예를들어 파괴 가능한 나무를 만든다고 할 때, 이 액터는 평소에는 휴면 상태로 있다가 공격을 받았을 때만 FlushNetDormancy를 통해 체력을 리플리케이션 받는 식으로 최적화를 수행할 수 있다.

참고 링크

https://youtu.be/18LbGKf6QQw
https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Engine/ENetDormancy/

profile
10%의 확신과 90%의 어.. 이게 왜 되지?

0개의 댓글