목록Game Dev (258)
KoreanFoodie's Study
블루프린트 노드를 이용하기 ThirdPerson Template 을 활용해 간단하게 멀티플레이어 세팅을 해 보자. StarterPack 에 있는 BP_ThirdPersonCharacter 에서 다음과 같이 블루프린트 노드를 설정해주면 된다. 참고로 Lobby 는 Default 설정의 Map 을 만든 것이고, Open 13.32.244.36 은 Local IPv4 Address 이다. 그 후, 다음과 같이 패키징 프로젝트를 만들어 준다. (아래 Binary Configuration 은 Development 로 바꾸어 준다) 이제 완료된 exe 파일을 이 컴퓨터에서 열고, 1을 눌러 로비를 시작한다. 다른 컴퓨터에서 2을 눌러 로비에 접속하면, 멀티플레이를 즐길 수 있다. 새 프로젝트를 만들 때, Thrid..
멀티플레이어 서버의 유형 peer - to peer 각각의 플레이어가 세션을 가지고, 움직임이나 게임 데이터의 변경이 있을 경우 연결된 다른 세션의 사용자에게 이를 전파한다. A 에서 플레이어가 캐릭터를 움직였다고 했을 때, 움직인 좌표를 다른 컴퓨터에게 전달하기 전까지 다른 컴퓨터에서는 A의 데이터 변경이 조회되지 않는다. Client - Server Model Client - Server Model 에서는, 각 클라이언트들이 어떤 동작을 하게 되면, 데이터의 변경을 Server 로 request 한다. Server 에서는 정합성이 있는 상태를 갖고 있으며, 이를 다른 클라이언트들에게 전파하는식으로 위치나 상태 등을 업데이트 한다. Client - Server Model 은 크게 Listen-Serve..
UPoseableMeshComponent 언리얼에서 GhostTrail 등을 구현할 때, UPoseableMeshComponent 를 사용하는 것을 볼 수 있다. UPosebleMeshComponent 는 무엇일까? 먼저 정의로 넘어가보면, /** *UPoseableMeshComponent that allows bone transforms to be driven by blueprint. */ UCLASS(ClassGroup=Rendering, hidecategories=(Object,Physics), config=Engine, editinlinenew, meta=(BlueprintSpawnableComponent)) class ENGINE_API UPoseableMeshComponent : public ..
AttachedActors vs ChildActors 만약 다음과 같이 부모 액터에 부착된 액터들을 삭제하려고 하면 어떻게 해야 할까? 만약 현재 액터에 자식으로 설정된 ActorComponent 들의 경우, 다음과 같은 코드로 조회할 수 있다. TArray tempChildActors; AActor* owner = GetOwner(); // SomeChildActor->SetOwner(this); 가 어디선가 실행되었다고 가정 owner->GetAllChildActors( tempChildActors, true ); uint32 count = tempChildActors.Num(); 하지만 위와 같은 경우나, 무기를 캐릭터의 소켓에 부착 (AttachToComponent) 하는 경우..
오브젝트 생성 및 애셋 불러오기 언리얼에서 오브젝트를 생성하고 애셋을 불러올 때는 보통 CreateDefaultSubobject 로 CDO 를 만들어 준 다음, ConstructorHelpers::FObjectFinder 로 애셋을 연결시켜 준다. 이 과정을 단축시켜주는 Helper Function 을 만들어 사용해 보자. CHelpers.h #pragma once #include "CoreMinimal.h" #include "Components/SkeletalMeshComponent.h" #include "Kismet/GameplayStatics.h" #include "Particles/ParticleSystem.h" #include "NiagaraSystem.h" #include "NiagaraFun..
화면에 출력하는 로깅시스템 콘솔에 출력했던 것과 비슷하게, 이번에는 UE_LOG 가 아닌 AddOnScreenDebugMessage 함수를 활용해 화면에 값을 출력해보자. 출처는 여기! CLog.h class UE_PROJECT_NAME_API CLog { public: static void Print(int32 InValue, int32 InKey = -1, float InDuration = 10, FColor InColor = FColor::Blue); static void Print(float InValue, int32 InKey = -1, float InDuration = 10, FColor InColor = FColor::Blue); static void Print(const FString& I..
언리얼 로그 언리얼은 UE_LOG 함수를 이용하여 로그를 출력한다. 먼저, .h 파일에 카테고리를 선언하고, 그에 맞는 정의를 .cpp 파일에서 Define 해주면 된다. MyGame.h //General Log DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Log, All); //Logging during game startup DECLARE_LOG_CATEGORY_EXTERN(LogMyGameInit, Log, All); MyGame.cpp #include "MyGame.h" //General Log DEFINE_LOG_CATEGORY(LogMyGame); //Logging during game startup DEFINE_LOG_CATEGORY(LogMyGameInit); 헤더..
TArray TArray 는 std::vector 와 비슷하게 동작하지만, AddUnique, RemoveAtSwap 등의 부가적인 API 를 제공한다. TArray 는 빠르고, 메모리를 효율적으로 사용하며, 안전하다! TArray ActorArray = GetActorArrayFromSomewhere(); // Tells how many elements (AActors) are currently stored in ActorArray. int32 ArraySize = ActorArray.Num(); // TArrays are 0-based (the first element will be at index 0) int32 Index = 0; // Attempts to retrieve an element at..
언리얼 게임플레이의 4대 main class type 언리얼에는 게임플레이에 사용되는 4대 main class type 이 있다. 바로 UObject, AActor, AActorComponent, UStruct 이다. 이 외에도 사용자 정의 타입을 사용할수는 있지만, 그런 타입들은 엔진에 내장된 기능을 사용하지는 않는다. 하나씩 그 역할과 범위를 알아보자. Unreal Objects (UObject) UObject 는 언리얼 엔진의 building block 으로써, UClass 와 함께 다음과 같은 서비스들을 제공한다 : Reflection of properties and methods Serialization of properties Garbage Collection Finding a UObject ..
애니메이션 레이어 언리얼에서는 애니메이션 간의 자연스러운 전환을 위해 블렌드 스페이스를 사용한다. 그런데 만약 UpperBody 만 총을 드는 모션을 재생하고 싶다고 하자. 블렌드 스페이스를 이용해 특정 부위만 동작을 바꾸는 등의 기능도 구현할 수 있을까? 언리얼에서는 애니메이션 레이어를 활용해 위의 기능을 구현할 수 있다. 방법은 아래와 같다. 1. 먼저 블렌드할 애니메이션을 선택한다. 2. 게임 모드의 Default Pawn Class 를 우리가 사용할 애니메이션이 타깃된 스켈레톤으로 바꿔준다. 3. 애님 몽타주를 생성한다. 4. 애님 몽타주에서 돋보기 클릭 후, 우리가 원하는 슬롯으로 지정한다. 5. 슬롯이 없을 경우 새로 생성한다. 6. 원하는 슬롯을 지정한다. 7. 애님 그래프로 이동한다. 8...