inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

이득우의 언리얼 프로그래밍 Part3 - 네트웍 멀티플레이 프레임웍의 이해

14강 캐릭터 아이템과 스탯의 구현

액터에 우선권을 사용자 설정할 수 있었나요?

해결된 질문

258

themoon007

작성한 질문수 98

0

다시 쭉 보다 보니 궁금한게 하나씩 계속 나오는 것 같습니다...

 

Owner 설정해서 배율을 높히는 것 말고 다른 manual적 방법이 있나요?

unreal-engine 네트워크 언리얼-c++

답변 1

1

이득우

NetPriority변수 또는 GetNetPriority 함수를 오버라이드해 구현하면 됩니다.
액터의 기본 우선권 값은 1이며, 최종 설정 값 산출 로직은 다음과 같습니다.

 

float AActor::GetNetPriority(const FVector& ViewPos, const FVector& ViewDir, AActor* Viewer, AActor* ViewTarget, UActorChannel* InChannel, float Time, bool bLowBandwidth)
{
	if (bNetUseOwnerRelevancy && Owner)
	{
		// If we should use our owner's priority, pass it through
		return Owner->GetNetPriority(ViewPos, ViewDir, Viewer, ViewTarget, InChannel, Time, bLowBandwidth);
	}

	if (ViewTarget && (this == ViewTarget || GetInstigator() == ViewTarget))
	{
		// If we're the view target or owned by the view target, use a high priority
		Time *= 4.f;
	}
	else if (!IsHidden() && GetRootComponent() != NULL)
	{
		// If this actor has a location, adjust priority based on location
		FVector Dir = GetActorLocation() - ViewPos;
		float DistSq = Dir.SizeSquared();

		// Adjust priority based on distance and whether actor is in front of viewer
		if ((ViewDir | Dir) < 0.f)
		{
			if (DistSq > NEARSIGHTTHRESHOLDSQUARED)
			{
				Time *= 0.2f;
			}
			else if (DistSq > CLOSEPROXIMITYSQUARED)
			{
				Time *= 0.4f;
			}
		}
		else if ((DistSq < FARSIGHTTHRESHOLDSQUARED) && (FMath::Square(ViewDir | Dir) > 0.5f * DistSq))
		{
			// Compute the amount of distance along the ViewDir vector. Dir is not normalized
			// Increase priority if we're being looked directly at
			Time *= 2.f;
		}
		else if (DistSq > MEDSIGHTTHRESHOLDSQUARED)
		{
			Time *= 0.4f;
		}
	}

	return NetPriority * Time;
}

5.6버전 Networking Insights 실행안됨 문제에 관하여

0

30

1

8강 중간, 분수대의 SetOwner 에 대해 궁금합니다.

0

77

2

플레이어(Actor) 로 (리슨)서버에서 생성 되나요?

0

99

2

2강) HandleBeginPlay 의 역활이 궁금합니다.

-1

72

2

3강 중간, 모드 로그로 찍을 시 스탠드얼론이 안찍힙니다.

1

76

2

CompressedFlag 질문

0

58

2

10강까지 머리 위 체력바가 표시가 안됩니다.

0

110

3

10강까지 머리 위 체력바가 표시가 안됩니다.

0

95

2

16:44 부분에서 질문이 있습니다.

0

104

2

12:50 NetMulticast RPC 커넥션 관려하여 질문이 있습니다.

0

121

2

github 3-5 파트 프로젝트에서 컴파일 에러가 발생합니다.

0

116

3

언리얼 인사이트 5.6버전 networking insights 가 뜨지 않습니다.

0

164

3

Insight 사용이 안되어서 문의 드립니다!

0

131

2

하위 레벨...?? High Level 말씀하신거죠..??

0

147

1

CompressedFlags를 이용한 InputThrottle, InputSteering 전달 방법 질문

0

191

1

조건식 프로퍼티 리플리케이션 질문

0

144

2

ArenaBattle에 Log추가하는 곳에 에러가 나타나 질문 드립니다.

0

160

2

7강에서 DORM_Initial 안됨

0

128

3

안녕하세요 강의 내용 정리에 관련해서 질문있어요

0

131

2

캐릭터 클래스의 mesh 관련

0

133

2

3파트 6강 분수대 로테이트에 문제가 생겼습니다.

0

131

3

클라이언트의 오너십 설정에 대해서 궁금합니다.

0

201

3

프로퍼티 리플리케이트 동기화 보장 개념.

0

225

2

결국엔 액터 기본함수들은 어디든 똑같이 일단 실행되는건가요?

0

93

2