Unreal Engine SDK
모든 C++기반의 Photon SDK 는 UNREAL ENGINE 과 호환되며 바로 사용할 수 있습니다!
UNREAL ENGINE SDK 와 같이 개발 할 수 있는 멀티플레이어 SDK 는
API 레퍼런스는 각 링크를 따라서 데모와 SDK 를 다운로드 합니다.
Platform
UNREAL ENGINE, https://www.unrealengine.com/
시작하기
일반사항
UNREAL ENGINE SDK와 Photon 멀티플레이어 게임 SDK 를 통합하기 위해서 다음 단계로 진행 하시기 바랍니다.
UE4 'C++' 프로젝트만 지원 합니다.
선택한 (Windows, Android or iOS) Photon SDK 를 UE4 프로젝트의 'Source' 폴더 내부의 'Photon' 안에 압축을 해제 합니다. 헤더 파일과 사전구축된 라이브러리 파일만 필요 합니다. 다수의 다른 플랫폼을 위해서 라이브러리 추가를 원할 수 도 있습니다. 샘플 폴더 레이아웃:
\---Source +---Photon | +---Common-cpp | | \---inc | | (*.h) | +---LoadBalancing-cpp | | \---inc | | (*.h) | |---Photon-cpp | | \---inc | | (*.h) | +---lib | | +---Android | | (*.a) | | +---iOS | | (*.a) | | \---Windows | | (*.lib)
UE4 헤더들과 호환되지 않는 차선책으로 Photon 헤더들을 변경 합니다.
FLOAT
를EG_FLOAT
, 또는 프로젝트에서Source\Photon\photon.patch
를 실행 합니다:Photon/Common-cpp/inc/Enums/TypeCode.h @@ -18,7 +18,7 @@ - static const nByte FLOAT = 'f'; /**<float*/ + static const nByte EG_FLOAT = 'f'; /**<float*/ // Photon/Common-cpp/inc/Helpers/ConfirmAllowed.h @@ -76,7 +76,7 @@ - static const nByte typeName = TypeCode::FLOAT; + static const nByte typeName = TypeCode::EG_FLOAT; // Photon/Common-cpp/inc/Helpers/ConfirmAllowedKey.h @@ -43,7 +43,7 @@ - static const nByte typeName = TypeCode::FLOAT; + static const nByte typeName = TypeCode::EG_FLOAT;
UE4 로 컴파일시 나타나게 되는 RTTI 감지 이슈를 보완하기 위해 Photon 헤더를 변경 합니다:
Photon/Common-cpp/inc/Helpers/TypeName.h @@ -14,7 +14,7 @@ -#if defined _CPPRTTI || defined __GXX_RTTI || (__GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 3 || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 2)))) +#if defined _CPPRTTI || defined __GXX_RTTI
UE4 프로젝트의 *.Build.cs 파일을 변경 하여 해당 플랫폼에 대한 라이브러리를 로드하고 Photon define 을 설정합니다. 데모에서 아래에 링크 되어 있는 Source/PhotonDemoParticle/PhotonDemoParticle.Build.cs 와 UE4 문서를 보시기 바랍니다.:
private string PhotonPath { get { return Path.GetFullPath(Path.Combine(ModulePath, "..", "Photon")); } } // if ( Target.Platform == UnrealTargetPlatform.Android) { // Set _EG_WINDOWS_PLATFORM for Windows, _EG_IPHONE_PLATFORM for iOS and _EG_IMAC_PLATFORM for OS X Definitions.Add("_EG_ANDROID_PLATFORM"); // PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", "libcommon-cpp-static_debug_android_armeabi_no-rtti.a")); PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", "libphoton-cpp-static_debug_android_armeabi_no-rtti.a")); PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", "libloadbalancing-cpp-static_debug_android_armeabi_no-rtti.a")); }
프로젝트 소스에서 맞는 Photon API 헤더를 include 하고 차선책으로 변경 해줍니다; 참조 프로젝트내의 source\photon-import.h:
프로젝트의 소스 코드에서 임포트된 Photon API 를 사용 합니다.
선택한 플랫폼으로 UE4 프로젝트를 빌드 합니다.
노트
UE4 iOS 빌드에 대한 힌트들은 https://answers.unrealengine.com/questions/21222/steps-for-ios-build-with-unrealremotetool.html 에 나와 있습니다.
Ready-to-run 데모
개념을 확인 하기 위하여 ready-to-run을 여기 에서 다운로드 하세요.
- 위의 1~2 단계를 따라 합니다.
- 다운로드한 패키지를 압축 해제 합니다.
- 위의 4단계를 따라 합니다.
- ./PhotonDemoParticle.uproject의 컨텍스트 메뉴를 오픈하여 "Generate Visual Studio project files" 를 선택 합니다.
- 여러 버전의 언리얼 엔진이 설치되어 있다면 원하는 엔진 버전을 선택하고 OK 를 클릭 합니다.
- UE 는 프로젝트 파일을을 생성합니다. 몇 초 걸릴 수 있고 UE 는 "Generating" 메시지 박스가 사라지면 완료 되었다는 것을 의미 합니다.
- Visual Studio 로 PhotonDemoParticle.sln 을 오픈 합니다.
- 솔루션 플랫폼으로 "Win64" 를 선택 합니다.
- 솔루션 환경설정으로 "DebugGame_Editor"를 선택 합니다.
- 솔루션 탐색기에서 Games/PhotonDemoParticle 로 이동하고 그 프로젝트를 빌드 합니다.
- VS 프로젝트를 디버그 또는 실행 합니다 - 로드된 UE 프로젝트에서 PhotonDemoParticle이 UE 에디터에서 시작 될 것입니다.
- UE 에디터에서 "World Outliner" 탭 "PhotonLBClient" -> "Demo" -> "App ID" 으로 이동 합니다.
- 웹사이트 대시보드의 App ID 로 필드의 내용을 교체 합니다.
- Play를 누릅니다.