분류 전체보기
cadion
2024. 5. 21. 00:22
2024. 5. 21. 00:22
Asset
BP 등 컨텐츠 브라우저에 노출되는 대상의 총칭
Object Path : /Game/MyFolder/BP_MyBP.BP_MyBP'
Package Path : /Game/MyFolder/
Asset Name : BP_MyBP
Actor
기본 세팅
기본 세팅
module의 build.cs파일 세팅
Blutility 추가 ( AssetActionUtility.h 및 ActorActionUtility.h가 해당 모듈에 포함되어 있음 )
PrivateIncludePaths.AddRange
System.IO.Path.GetFullPath(Target.RelativeEnginePath) + "/Source/Editor/Blutility/Private"
PublicDependencyModuleNames.AddRange
UFUNCTION(CallInEditor)
AssetActionUtility 자식 클래스로 생성
plugin폴더 / contents / 우클릭 → editor utility → editor utility blueprints 생성 → 만든 클래스 상속 → 재접속
Editor UI Name 활성화 - editor preference - Display UI Extension Points
주요 레퍼런스 헤더
주요 레퍼런스 헤더
<FAssetData>
Reflection 통해서 접근가능한 메타데이터 타입?
Paths.h
Combine(<FString> a, <FString> b) : 경로문자열과 경로문자열을 합침
UEditorUtilityLibrary.h
TArray<FAssetData> GetSelectedAssetData()
<FName> ObjectPath
<FName> PackagePath
<FName> AssetName
UEditorAssetLibrary.h
<bool> DuplicateAsset( {source path}, {target path} )
<bool> SaveAsset( {target path}, dirty조건 여부 )
<FString> FindPackageReferencersForAsset(에셋경로) : 해당 에셋에 reference가 걸린 대상들 리스트 반환
FMessageDialog
Open( <EAppMsgType> 메시지 타입, 기타등등 )
FSlateNotificationManager::Get()
AddNotification : 에디터 우측하단 메시지
ObjectTools
DeleteAssets ( TArray<FString> )
FModuleManager
<FContentBrowserModule> (static) LoadModuleChecked<FContentBrowserModule>(TEXT("name"))
FContentBrowserModule
<TArray<FContentBrowserMenuExtender_SelectedPaths>> GetAllPathViewContextMenuExtenders();
해당 어레이에 델리게이트 집어넣으면 메뉴에 추가되는 듯?
Tips
팁
블루프린트는 UBlueprint를 상속
EditorUtilityLibrary의 GetSelectedAsset은 <UObject*>를 반환 ( 언리얼 스트럭쳐 최상위 부모 )
UObject
FString
특정 메뉴에 리스트 추가하기
IModuleInterface 상속
virtual void StartupModule() override에서 delegate를 binding 하는 함수 실행
컨텐츠 브라우저 메뉴 ex
FModuleManager::LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser")) .GetAllPathViewContextMenuExtenders().Add( FContentBrowserMenuExtender_SelectedPaths::CreateRaw( this, &함수명 ));
즉, module를 통해 path view context menu array에 content browser menu 타입 델리게이트를 만들어서 추가해야 함 ( 출력되는 영역에 대한 정의 )
함수는 const TArray<FString>& 선택된 경로들을 파라미터로 받음
이 타입을 FMenuBuilder&를 parameter로 받으며, 해당 스트럭쳐에서 .AddMenuEntry함수를 통해 FExecuteAction 델리게이트를 쑤셔넣음 ( 수행에 대한 정의 )
cadion
2024. 5. 21. 00:19
2024. 5. 21. 00:19
Directional Light
Categoryproptypedesc
Light Unreal Doc
Intensity
float
빛 강도
Light Color
color
빛 색상
Source Angle
float
태양 크기
Source Soft Angle
float
작동 안하는듯
Use Temperature
bool
온도기반 색상 사용 여부
float
온도
AffectWorld
bool
빛 on/off
Cast Shadow
bool
그림자 생성 여부
Indirect Lighting Intensity
float
간접광 강도
Volumetric Scattering Intensity
float
Volumetric Fog에 의해 산란되는 강도 → Height Fog . Volumetric
Advanced
Shadow Cascade Bias Distribution
섀도우 케스케이드 트랜지션 시 섀도우 점 변화 조절
포워드 셰이딩 관련 ( 모바일 )
( 모바일 )
( 모바일 )
그림자 양. 0이면 오클루젼 계산 안함 이라는데 모르겠음..?
스페큘러 하이라이트 강도
섀도 맵 해상도라는데 작동을 안함..?
섀도 바이어스인데 작동안함..
...
enum
1, 2, 3 채널이 있으며, 동일한 채널의 오브젝트에만 라이트가 적용됨
bool
서브서피스 스캐터링 표면 투과 여부
bool
볼류매트릭 포그에 섀도우 여부
Light Shaft Unreal Doc
빛 기둥 효과 ( 스크린 스페이스 블러 오클루전 )
Occlusion
Fog(Volumetric)에 의존하는 빛기둥 ( 눈밝기 ) → Height Fog . Volumetric
Bloom
Fog와 독립적으로 생성되는 빛기둥
Lighmass
static / stationary일때만 활성화되는데 작동을 안함
Cascade Shadow Map
추가 공부 필요
Atmosphere and Cloud
Atmosphere Sun Light
bool
atmosphere에 태양이 이 디렉셔널을 참조할지 여부
Cast Shadows on Clouds
bool
구름에 그림자 생성 여부 ( 플래닛용 )
Cast Shadows on Atmosphere
bool
대기에 그림자 생성 여부 ( 플래닛용 )
Cast Cloud Shadows
bool
구름 그림자 생성 여부
Cloud Scattering Luminance Scale
color
클라우드에 비추는 빛 색상
Advanced
Atmosphere Sun Light Index
int
0번은 태양 ( 모든효과 받음 ) 1번은 기타 ( 몇개 안받음 ) 2번부터는 적용안됨. 태양은 최대 2개. 동일한 인덱스에 여러개의 태양 불가
Atmosphere Sun Disk Color Scale
color
천체 색상
float
관련 값들
Categoryproptypedesc
Planet
행성 대기를 가정하고 곡률을 줌
Atmosphere
Atmosphere Height
km
대기 높이
Rayleigh
레일리 산란 ( 미세 입자 ) 대기색 스펙트럼
Mie
미 산란 ( 거시 입자 ) 태양 주변 번짐 ( 백색 )
Art Direction
Sky Luminance Factor
color
전체 하늘색상 변조
Aerial Perspective View Distance Scale
float
대기 두께 두껍게 보임
Height Fog Contribution
float
height fog 강도
Transmittance MinLight Elevation Angle
degree
태양이 지면밑으로 내려갔을때 빛 새는 기준각인듯
Sky Light
Categoryproptypedesc
Light
기본적인 것들
Real Time Capture
bool
리얼타임캡쳐 ( false일시 sky light → recapture, runtime 가능 )
Distance Field Ambient Occlusion
Atmosphere and Cloud
체감안됨
Cloud Ambient Occlusion
멀리있는 구름 점차 안보임
Categoryproptypedesc
Exponential Height Fog Component
Fog Density
float
안개 진하기
Fog Height Falloff
float
고도상승할때 안개 진하기 감쇄율
파라미터를 높이(unit)에 대한 지수로 쓰는데
기준점이 sky atmosphere의 planet 크기기준 원점이라 엄청멀리잡히는 느낌
Second Fog Data
모르겠음
Fog Inscattering Color
color
안개로 인한 산란 색상
Fog Max Opacity
float
색상이 있을 때, 멀어질수록 산란색상이 강하게 들어가는데, 그 강하게 들어가는 최댓값
Start Distance
float
카메라로부터 fog가 적용되기 시작하는 최소거리라는데, 작동안함
Fog Cutoff Distance
float
이 값보다 먼 대상은 fog가 적용되지 않음
sky atmos처럼 이미 fog가 별도로 적용되어있는 경우 유용
0이면 비활성화 되는듯? ( 항상 포그 적용 )
Directional Inscattering
디렉셔널 라이트에서 발생하는 산란상호작용 처리
태양에서 카메라를 향해 콘을 쏘면서 생긴 스캐터링을 계산한 느낌
주로 대기색상에 영향
... Exponent
float
커질수록 태양 근처로만 산란됨 ( 음수 지수 계수 )
... Start Distance
float
카메라로부터 이 거리 이상의 대기에만 스캐터링
... Color
color
스캐터링 컬러
Volumetric Fog
Volumetric Fog
bool
볼류메트릭 포그 사용 여부
일반 헤이트 포그는 단순하게 월드위치와 카메라 뎁스값만 가지고 연산
볼류메트릭으로 전환 시 공간샘플링 혹은 스크린 샘플링 하는듯
Scattering Distribution
float
안개에 의한 산란시 빛 방향성 유지 강도
0 은 무작위 방향 산란
0.9는 빛 기존 방향으로 정렬
-0.9는 빛 반대방향으로 정렬? 이건 뭐야 ㄷ
Albedo
flaot
안개 색상 ( sub )
Emissive
float
안개 색상 ( additive )
Extinction Scale
flaot
아마 볼류메트릭이 헤이트 대비 소멸비인듯. 1.0이 default height하고 동률이고
View Distance
float
포그 적용 최대 거리
Start Distance
float
포그 적용 최소 거리
Near Fade In Distance
float
Start지점에서 fade in 시작될 거리 ( start + near fade ~ view 사이에서 lerp 하는듯 )
Static Light Scattering Intensity
float
스태틱 라이트 스캐터링 강도
Advanced
Override Light Colors with Fog Inscattering Colors
bool
흠..
Volumetric Cloud
PostProcess Volume
World Setting
Common Light
Planet Setting
Sky Atmosphere
Exponential Height Fog
VolumetricCloud
Layer
Layer Bottom Altitude
Layer Height
Color Temperature
cadion
2024. 5. 21. 00:14
2024. 5. 21. 00:14
Lighting Component
Diffuse
Direct Lighting
Dynamic Shadows
Global Illumination
( Ambient Occlusion )
( Specular )
Light map
Mobility
모빌리티
설명
Static
스태틱 - 이 모빌리티는 게임플레이 도중 어떤 식으로든 이동 또는 변할 수 없는 액터에 씁니다.
스태틱 메시 액터의 경우, 그 그림자가 미리계산된 라이트 맵에 반영된다는 뜻이며, 라이트매스 를 사용해서 생성하고 처리합니다. 이 모빌리티는 게임플레이 도중 움직일 일이 절대 없는 구조물이나 장식물 메시에 이상적입니다. 참고로 그 머티리얼은 애니메이션 가능합니다.
라이트 액터의 경우, 라이트매스 를 사용해서 미리계산된 라이트 맵에 반영된다는 뜻입니다. 씬의 스태틱 및 스테이셔너리 액터에 대해 빛을 비추며, 무버블 액터에 대해서도 (간접광 샘플 또는 볼류메트릭 라이트맵 같은) 간접광 메소드로 빛을 비출 수 있습니다.
Stationary
스테이셔너리 - 이 모빌리티는 게임플레이 도중 이동하지는 못하지만 변할 수는 있는 액터에 씁니다.
스태틱 메시 액터의 경우, 움직일 수는 없지만 변할 수는 있다는 뜻입니다. 라이트매스 를 사용하는 미리계산 라이트맵에 기여하지는 않지만, 스태틱 또는 스테이셔너리 라이트의 빛을 받는 경우 무버블 액터처럼 빛을 받습니다. 그러나 무버블 라이트의 빛을 받을 때는, 캐시에 저장된 섀도 맵 을 통해 라이트가 움직이지 않을 때 다음 프레임에 재사용하는 식으로 다이내믹 라이트를 사용하는 프로젝트의 퍼포먼스를 향상시킵니다.
라이트 액터의 경우, 색이 변한다든가 강도가 세지고 약해지거나 심지어 완전히 꺼진다든가 하는 식으로 변할 수 있다는 뜻입니다. 스테이셔너리 라이트는 여전히 라이트매스 를 사용하는 미리계산 라이트맵에 기여하지만, 움직이는 오브젝트에 동적 그림자를 드리울 수도 있습니다. 참고로 한 액터에 너무 많은 스테이셔너리 라이트가 영향을 주지 않도록 해야 합니다. 자세한 내용은 스테이셔너리 라이트 문서를 참고하세요.
Movable
무버블 - 이 모빌리티는 게임플레이 도중 추가, 제거, 이동해야 하는 액터에 씁니다.
스태틱 메시 액터의 경우, 라이트맵에 미리계산 그림자를 드리우지 않는 완전 동적 그림자를 드리운다는 뜻입니다. 모빌리티가 스태틱인 라이트의 빛을 받는 경우, (간접광 샘플 또는 볼류메트릭 라이트맵 같은) 간접광 메소드를 사용합니다. 모빌리티가 스테이셔너리 또는 무버블인 라이트의 경우, 동적 그림자만 드리웁니다. 변형이 없는 메시 요소를 씬에서 추가, 제거, 또는 이동해야 할 때 주로 씁니다.
라이트 액터의 경우, 동적 그림자만 드리울 수 있다는 뜻입니다. 게임플레이 도중 라이트 이동뿐 아니라 색과 강도도 변경할 수 있습니다. 그러나 이 라이트가 드리우는 그림자는 퍼포먼스 비용이 높으므로 주의해야 합니다. 참고로 그림자를 드리우지만 않는다면 무버블 라이트는 언리얼 엔진의 디퍼드 렌더링 시스템 덕에 계산 비용이 매우 저렴한 편입니다.
Mobility Matrix
Static Light
ObjectDirect LightIndirect LightShadow
Static
Lightmap
Lightmap
Shadowmap
Stationary
Indirect lighting cache
Indirect lighting cache
None
Movable
Indirect lighting cache
Indirect lighting cache
None
Stationary Light
ObjectDirect LightIndirect LightShadow
Static
RealTime
lightmap
Shadowmap
Stationary
RealTime
Indirect lighting cache
RealTime
Movable
RealTime
Indirect lighting cache
RealTime
Movable Light
ObjectDirect LightIndirect LightShadow
Static
RealTime
None
RealTime
Stationary
RealTime
None
RealTime
Movable
RealTime
None
RealTime
cadion
2024. 5. 21. 00:13
2024. 5. 21. 00:13
기본 플로우
add plugin : python editor script plugin
project setting : Plugins - Python - Additional Paths
실행할 py파일 넣을 곳
edittor setting - python - devmode = true
import
console창
tab = python ( ctrl + tab )
import [filename] as [별칭]
reload
from importlib import reload
reload(별칭)
run
그냥 함수 or 메서드 실행
API 리스트
문서 : https://docs.unrealengine.com/4.27/en-US/PythonAPI/
AssetToolsHelpers ( editor의 AssetTools object에 접근하기 위한 클래스 )
get_asset_tools()
return : <AssetTools> AssetToolsImpl ( editor에 implement된 객체? )
import_asset_tasks(arg)
arg1 : <class> AssetImportTask ( cpp의 setup용 struct 처럼, unreal.AssetImportTask()로 하나 만들고 set해서 사용
<class> AssetImportTask
set_editor_property(arg1, arg2)
arg1 : <str> 입력할 프로퍼티 종류
arg2 : <t> 입력할 프로퍼티 값
arg1 - arg2 리스팅
automated - bool ( 자동화 )
destination_name - string ( 저장할 신규 폴더 이름 )
destination_path - string ( 저장할 폴더 경로 /Game/...)
filename - string ( 저장할 파일 이름 )
replace_existing - bool ( 덮어쓰기 여부 )
get_editor_property(arg)
arg : <str> 출력할 프로퍼티
return : <t> 출력된 프로퍼티 값
arg1 : <class> Asset ImportTask (cpp 의 설정 용 구조 처럼, unreal.assetImportTask() 로 하나 만들고 세트 해서 사용
cadion
2024. 5. 21. 00:07
2024. 5. 21. 00:07
Noise
material -> texture 베이크 하기
Mat
shading model : unlit
input = float3 ( uv coord, 0 )
BP
Draw Material to Render Target
Render Target Create Static Texture Editor Only
펄린
보로노이
클라우드
마블
마블(distortion)
scale
8
4
8
8
4
quality
4
4
4
function
gradient
voronoi
voronoi
voronoi
gradient
turbulence
x
x
x
x
x
level
5
1
3
2
6
min/max output
0 ~ 1
level scale
2
2
2
2
2
tiling
o
o
o
o
o
repeat size
8
4
8
8
4
additional
one minus, squared
Slerp
LocationA * ( sin(theta*alpha) / sin(theta) ) + LocationB * ( sin(theta*(1-alpha) / sin(theta) )
Ease pattern
Quad
Sine
Cubic
Quart
Quint
Expo
Logic
Elo Rating
레이팅 컨트롤에 편한 형태로 param이 빠진 로지스틱함수
Quaternion
쿼터니안
ijk = -1;
ij = k, ji = -k;
xi + yj + zk + w = (x, y, z, w) = (v, w)
p = (px, py, pz, pw) ( = pxi + pyj + pzk + pw )
q = (qx, qy, qz, qw)
pq =
(pxqw + pyqz - pzqy + pwqx)i
+ (-pxqz + pyqw + pzqx + pwqy)j
+ (pxqy - pyqx + pzqw + pwqz)k
+ (-pxqx - pyqy - pzqz + pwqw)
(pq)* = q*p* ( 켤레복소수 )
||magnitude|| = x^2 + y^2 + z^2 + w^2
p ( 기존 rot vector )
theta ( 기준축 u에 대한 회전각 )
u ( 회전기준축의 단위벡터 )
q = (sin ( u*theta/2 ), cos ( theta/2 ) )
회전 후 벡터 = qpq*
quaternion 2 matrix ( 변환을 위해 )
cadion
2024. 5. 21. 00:05
2024. 5. 21. 00:05
Server - Client Model
Server ( authority )
check request
replicate to client
Client ( clone )
function ( input, logic, etc.. ) → request for server
Init
bReplicates
SetIsReplicated(bool)
Request Function to Server ( RPCs remote procedure calls )
header
header
UFUNCTION ( server, reliable, validation )
type funcName(var);
cpp
cpp
.AddBind( param, object, funcName );
type funcName_Implementation(var)
{ 실행문 ( 서버에서 ) }
bool funcName_Validation(var)
{ return 유효성 } // false일 경우, cheating 규칙 적용
Unreal network model에서 권한의 단위는 Actor
Simulated Proxy Actor ( in client )
서버로 부터 받는 정보에 전적으로 의존
정보들을 종합하여 지역적(시간축) 상태에 대해 시뮬레이션 → 적용
이후 리플리케이트를 적용할 때, 시뮬레이션된 값과 서버로부터 새로 받은 정보를 기반으로 비교, 검정, 보간
Autonomous Proxy
Simulated Proxy에 더해, 유저의 입력을 포함하고 있으며, 역으로 server에게의 request를 포함
Role / RemoteRole
체크하는 당사자 ( server or client 등 ) 입장에서, 자신의 정보 - Role / 비교대상의 정보 - Remote Role
Actor.Role property를 통해 접근가능
Autonomous Proxy는, 자기자신에 대한 결정권은 자신이 지니므로
Local에서 수행 후
Server 에서 UFUNCTION(server)로 할당된 로직을 수행하는 형태로 구현되어야 함
동기화를 고려하면, local 수행용 함수와, server 수행용 implementation 함수는 동일한 로직이어야 함
Replicate Property
Object 단위
bReplicates = true; ( Object ) ( constructor )
UPROPERTY(Replicated) [property]
void AActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const // header에서 선언할 필요 없음 ( property의 속성에 replicated를 통해 선언 )
{ DOREPLIFETIME(AActor, [property]); }
( ReplicatedUsing = [함수명] )
해당 함수를 통해 replicate 진행
같은 class 내의 UFUNCTION 항목?
[함수명](OnRep_Func)은 property 값이 변경될마다, client ( has authority = false )에서만 이루어짐
header
UPROPERTY(ReplicatedUsing = OnRep_ReplicatedTransform)
FTransform ReplicatedTransform;
cpp
void AMyKart::OnRep_ReplicatedTransform()
{
SetActorTransform(ReplicatedTransform);
}
Actor::NetUpdateFrequency ( sec, beginPlay )
owner player controller와 현재 접속한 instance에게 할당된 player controller를 비교해서 IsLocallyControlled 체크하는듯?
hasAuthority는 "해당 액터"의 속성에 관한 것 ( 호출자하고는 별개인듯? )
HasAuthority() 체크시, 함수를 포함하는 actor instance가 아니라 함수를 호출하는 actor instance의 authority를 체크하는듯?
IsLocallyControlled() 체크시, 함수를 포함하는 actor instance == 함수를 호출하는 actor instance 체크하는듯?
canonical state ( 표준 상태 ) - 프로토콜 -> 서버-클라 유효성검정을 위한 데이터들의 모듈화된 군집 ( serialize? or structure? )APawn::IsLocallyControlled() { return APawn::Controller(allocated) && Controller->IsLocalController() } Actor::Role
AActor::HasAuthority() { return GetLocalRole }
보간 패턴
보간 패턴
Location - Linear interp.
Revolutionary - Location Slerp ( spherical linrea interpolation )
Velocity
exponential 합성하여 사용
sigmoid interp.
bezier ( hermite ) interp. - FMath::CubicInterp ( p0, t0, p1, t1, a ) - position, tangent(velocity or pos.derivation), alpha
Acceleration
Editor에서 소켓 접속 방법
서버
"${언리얼 엔진 경로}\Engine\Binaries\Win64\UnrealEditor.exe" "${프로젝트 경로}\${프로젝트이름}.uproject" /Game/{맵 경로}?listen -server -log
로그 확인 필요사항
포트번호 확인 ( listening on port로 검색 )
created socket for bind adress : 0.0.0.0 이라면, 모든 ip의 접근에 대해 허가된 상태
클라이언트
"${언리얼 엔진 경로}\Engine\Binaries\Win64\UnrealEditor.exe" "${프로젝트 경로}\${프로젝트이름}.uproject" 서버ip:포트번호 -game -log
cadion
2024. 5. 21. 00:02
2024. 5. 21. 00:02
Krazy Kart Sample
UGoKartMovementComponent : UActorComponent
Tick → !HasAuthority? LastMove = CreateMove() → SimulateMove(LastMove) :
Create Move(DeltaTime) ( → 현재 값을 FGoKartMove instance에 넣음 )
SimulateMove(FGoKartMove&)
Throttle, MaxDrivingForce, ActorForwardVector, AirResistance, RollingResistance, Mass, DeltaTime으로 → ApplyRotation, UpdateLocationFromVelocity // 실제 로컬에 적용하는 물리값
GetAirResistance() // 속도기반 공기저항 계산
GetRollingResistance() // 속도/중량기반 구르기 마찰저항 계산
ApplyRotation() ( ← 서버가 아닐떄 ) ( → Velocity 및 Rotation actor에 적용 )
UpdateLocationFromVelocity(DeltaTime) ( ← 서버가 아닐때 ) ( → Velocity로 Translation 적용 )
AGokart : APawn
SetupPlayerInputComponent(arg) ( → bind 앞,옆 이동 )
MoveForward(value) ( ← 키바인딩 ) ( → Throttle 값 변경 )
MoveRight(value) ( ← 키바인딩 ) ( → SteeringThrow값 변경 )
UGoKartMovementReplicator : UActorComponent
Constructor ( → bCanEverTick = true, SetIsReplicated(true) )
Tick
자율프록시
MovementComponent로부터 LastMove를 얻어서, UnacknowledgedMoves에 추가
LastMove를 서버로 보냄
remote role = 시뮬프록시 ( → UpdateServerState() )
시뮬프록시 ( → ClientTick() )
UpdateServerState(FGoKartMove) ( ← remote role이 시뮬프록시일떄 ) ( → FServerState instance를 받은 move와 // 현재 actor state값 복사 )
ClientTick(DeltaTime) ( ← 시뮬프록시 ) ( → 시작Loc(클라위치), 타겟Loc(서버위치), 시작속도(클라속도), 타겟속도(서버속도), 속도Derivative 5개param으로 HermiteCubicSpline 써서 보간 )
FMath::CubicInterp ( loc )
FMath::CubicInterpDerivative ( vel )
GetLifetimeReplicatedProps ( ← 프로퍼티 복제 ) ( → FServerState )
OnRep_ServeState() ( → 복제 받을시 호출 RPC )
자율프록시() ( → serverstate의 트랜스폼, 벨로시티적용 / acknowledgeMove 갱신 ( ClearAcknowledgeMoves )
ClearAcknowledgeMoves = 각 FMove의 적용시간 비교해서, last무브 이후것만 남김
MoveComponent.Simulate ( 남은 FMove 적용, 시뮬레이션 해서 위치 덮어쓰기 )
Puzzle Platform Sample
MenuSystem
UMenuWidget : UUserWidget // 메뉴리스트 프레임
Setup() ( → 기본변수 셋업, SetInputMode(FInputModeUIOnly), bShowMouseCursor = true )
Teardown() ( → remove from viewport || remove from parent, SetInputMode, bShowMouseCursor ) // 자가붕괴
SetMenuInterface() ( → 참조변수_MenuInterface 지정 )
UInGameMenu : UMenuWidget // level에서 esc 메뉴
Init() ( → 버튼에 함수 바인딩 )
QuitPressed() ( → teardown 및 LoadMainMenu() ( main menu level로 이동 ) )
Inherit
Teardown() // 자가붕괴
LodaMainMenu()
UMainMenu : UMenuWidget // 로비 메뉴
Constructor ( → BP클래스객체 = ConstructorHelpers::FClassFind<UUserWidget> BPClass(TEXT).Class )
Init ( → 버튼 바인딩 )
OpenMainMenu() ( → menuswitcher(U위젯스위처).SetActiveWidget(타겟자식위젯 or 인덱스)
HostServer() ( → MenuInterface ( UEditableTextBlock위젯.Text.Tostring )
SelectIndex ( int ) ( → int 번호 var에 저장 후, UpdateChildren() )
UpdateChildren() ( → var에 저장된 int번호기준, 선택된거 "선택상태", 나머지 "비선택상태"로 변경 bool UServerRow.Selected)
OpenJoinMenu() ( → 위젯스위처에서 join메뉴 활성, RefreshServerList() )
OpenMainMenu() (→ 위젯스위처에서 MainMenu 활성 )
QuitPressed() ( → ConsoleCommand("quit") )
Inherit (MenuWidget)
IMenuInterface : UInterface
Host(FString)
Join(uint)
LoadMainMenu()
RefreshServerList()
UServerRow : UUserWidget // 메뉴리스트 컴포넌트
Setup ( 부모ref, 자기 번호(부모안에서) ) ( ← 부모에서 생성 후 호출 ) ( → ref들 내부변수로 할당 및 Rowbutton 바인딩 )
OnClciekd() ( → 부모의 선택됨인덱스에 자기한테 부여된 번호 주입 )
LobbyGameMode :: AGameModeBase
StartGame() ( → GameInstance.StartSession // World.ServerTravel )
inherit ( game mode )
PostLogin ( APlayerController ) ( → 인원수 체크 / 다모이면 StartGame() )
Logout ( APlayerController ) ( → 인원수 감소 )
PP.GameInstance : UGameInstance, IMenuInterface
Function
Init()
LoadMenuWidget() ( Menu ← MenuClass // Menu.Setup // Menu.SetMenuInterface(this) ) // 인터페이스를 통함
InGameLoadMenu() ( InGameLoadMenu ← InGameLoadMenuClass // InGameLoadMenu.Setup // InGameLoadMenu.SetMenuInterface(this) ) // 인터페이스를 통함
StartSession() ( → SessionInterface.StartSession(세션이름) )
CreateSession() ( → SessionInterface.CreateSession( 호스팅플레이어num, 원하는세션이름, FOnlineSessionSettings )
OnCreateSessionComplete(FName SessionName, bool Success) ( ← SessionInterface.OncreateSessionCompleteDelegates.Add ) when Init ( → Menu.Teardown() // World.ServerTravel(레벨파일경로?listen) )
OnDestroySessionComplete(FName SessionName, bool Success) ( ← SessionInterface.OnDestoySessionCompleteDelegates.Add ) when Init
OnFindSessionsComplete(bool Success) ( ← SessionInterface.OnFindSessionsCompleteDelegates.Add ) when Init
OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result) ( ← OnJoinSessionCompleteDelegates ) when Init ( → GetFirstLocalPlayerController로 자기 PC 얻고 // PC.ClientTravel(ip주소, ETravelType )
OnNetworkFailure ( UWorld* World, UNetDriver* NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString ) ( ← GEngine.OnNetworkFailure().Add )
Inherit ( Interface )
Host(FString) ( → 원하는 세션이름 받고(arg) // 세션있으면 기존세션 제거 // 없으면 CreateSession() )
Join(uint) ( → Menu 끄고 // SessionInterface.JoinSession(유저번호, 세션이름, FOnlineSessionSearchResult ( session search시 참조로 받아올 수 있는 structure )
LoadMainMenu() ( → PC.ClientTravel() )
RefreshServerList() ( → SessionInterface.FindSession(탐색플레이어num, TSharedRef<FOnlineSessionSearch>)
Property
TSubclassOf<UUserWidget> MenuClass ( ← ContructorHelpers::FClassFinde<UUserWidget> MenuBPClass(TEXT(경로)) + MenuBPClass.class ) when Construct
TSubclassOf<UUserWidget> InGameMenuClass ( ← ContructorHelpers::FClassFinde<UUserWidget> InGameMenuBPClass(TEXT(경로)) + InGameMenuBPClass.class ) when Construct
MainMenu* Menu
IOnlinSessionPtr SessionInterface
TSharedPtr<FOnlineSessionSearch> SessionSearch
FString DesiredServerName
PP.GameMode
DefaultEngine.ini
[/Script/EngineSettings.GameMapsSettings]
TransitionMap =/Game/PuzzlePlatforms/Maps/Transiton.Transiton ( seamless travel을 위한 map 설정 )
[/Script/Engine.GameEngine]
+ NetDriverDefinitions =( DefName = " GameNetDriver" , DriverClassName = " OnlineSubsystemSteam.SteamNetDriver" , DriverClassNameFallback = " OnlineSubsystemUtils.IpNetDriver" )
[OnlineSubsystem]
DefaultPlatformService =Steam
[OnlineSubsystemSteam]
bEnabled =true
SteamDevAppId =480
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName = " OnlineSubsystemSteam.SteamNetConnection"
Projectname.uproject
"Plugins": [ { "Name": "OnlineSubsystemSteam", "Enabled": true } ]
Projectname.Build.cs
PublicDependencyModuleNames.AddRange( "OnlineSubsystemStea" )
cadion
2024. 5. 21. 00:00
2024. 5. 21. 00:00