Unreal Engine SDK

모든 C++ 기반의 Photon SDK는 UNREAL ENGINE 과 호환되며 바로 사용할 수 있습니다!

UNREAL ENGINE SDK 와 같이 개발할 수 있는 멀티플레이어 SDK는

API 레퍼런스는 각 링크를 따라서 데모와 SDK를 다운로드합니다.

Platform

언리얼 엔진, https://www.unrealengine.com/

시작하기

일반 사항

언리얼 엔진 SDK와 Photon 멀티플레이어 게임 SDK를 통합하기 위해서 다음 단계로 진행하시기 바랍니다.

  1. UNREAL ENGINE SDK를 다운로드합니다.

  2. 타겟 플랫폼에 대한 Photon SDK를 다운로드합니다.

  3. UE4 'C++' 프로젝트만 지원합니다.

  4. 선택한 (Windows, Android or iOS) Photon SDK를 UE4 프로젝트의 'Source' 폴더 내부의 'Photon' 안에 압축을 해제합니다. 헤더 파일과 사전 구축된 라이브러리 파일만 필요합니다. 다수의 다른 플랫폼을 위해서 라이브러리 추가를 원할 수도 있습니다. 샘플 폴더 레이아웃:

    text

        \---Source
            +---Photon
            |    +---Common-cpp
            |    |    \---inc
            |    |        (*.h)
            |    +---LoadBalancing-cpp
            |    |    \---inc
            |    |        (*.h)
            |    |---Photon-cpp
            |    |    \---inc
            |    |        (*.h)
            |    +---lib
            |    |    +---Android 
            |    |        (*.a)
            |    |    +---iOS
            |    |        (*.a)
            |    |    \---Windows
            |    |        (*.lib)
    
  5. UE4 헤더들과 호환되지 않는 차선책으로 Photon 헤더들을 변경합니다. FLOATEG_FLOAT, 또는 프로젝트에서 Source\Photon\photon.patch 를 실행합니다:

    C++

        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;
    
  6. UE4로 컴파일 시 나타나게 되는 RTTI 감지 이슈를 보완하기 위해 Photon 헤더를 변경합니다:

    C++

        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
    
  7. UE4 프로젝트의 *.Build.cs 파일을 변경하여 해당 플랫폼에 대한 라이브러리를 로드하고 Photon define 을 설정합니다. 데모에서 아래에 링크 되어 있는 Source/PhotonDemoParticle/PhotonDemoParticle.Build.cs 와 UE4 문서를 보시기 바랍니다.:

    C#

        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"));
        }
    
  8. 프로젝트 소스에서 맞는 Photon API 헤더를 include 하고 차선책으로 변경해줍니다; 참조 프로젝트 내의 source\photon-import.h:

    C++

        #ifdef __clang__
        #pragma clang diagnostic ignored "-Woverloaded-virtual"
        #endif
        #if _EG_WINDOWS_PLATFORM
        #include "AllowWindowsPlatformTypes.h"
        #endif
        #pragma warning (disable: 4263)
        #pragma warning (disable: 4264)
        #include "LoadBalancing-cpp/inc/Client.h"
        #pragma warning (default: 4263)
        #pragma warning (default: 4264)
        #if _EG_WINDOWS_PLATFORM
        #include "HideWindowsPlatformTypes.h"
        #endif
    
  9. 프로젝트의 소스 코드에서 임포트 된 Photon API를 사용합니다.

  10. 선택한 플랫폼으로 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를 누릅니다.
Back to top