Photon & UE4

DinaOrla
DinaOrla
edited April 12 in Native
Dear Team,

I'm new to Photon and its community! I want to use Photon for Multiplayers in a VR project that I'm running in UE4 (4.24. - 26.). I don't consider myself a developper just a good user of UE4 (no programming experience etc.). I follow clearly the steps of this documentation (https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine) but the demo project is very out-of-date (as mentioned in the txt file: version 4.12.5) and it's not possible to build it or run it in any recent version. Is there any current demo project out there that could help me out to explore photon for UE4 (also for VR)?
Any recommendations much appreciated!

Thanks!

PS: Sorry if this isn't the category for this post and for any cross-overs

Comments

  • This is a question for the "Native" section of the forum (C / C++ clients).
    I will ping my colleague to chime in when he's available.
  • Hi @DinaOrla.
    This is a question for the "Native" section of the forum (C / C++ clients).
    I have moved it to that section now.
    but the demo project is very out-of-date (as mentioned in the txt file: version 4.12.5)
    The readme.txt is very out of date, not the project itself.
    it's not possible to build it or run it in any recent version
    In fact it is very possible.
    I have successfully run the demo project with UE 4.24, 4.25 and 4.26 myself.
    Make sure that you switch the demo UE4 version to the one that you intending to use it with via the context-menu of the .ueproject file.
    Also please make sure that you let the demo link to the correct variants of the Photon Windows libraries in the .Build.cs file: out of the box it specifies the '_vc14' variants (the ones for Visual Studio 2015), but for UE4.24 you need to change this to '_vc15' (Visual Studio 2017) and with UE4.25 and above to to '_vc16' (Visual Studio 2019).
    Afterwards generate the Visual Studio project files via the context-menu of the .ueproject file , open the VS solution and build and run the 'DevelopmentEditor' configuration.
    Assuming that you have copied the header and lib files to the correct locations inside the demo folder like instructed in the guide that you have linked in your post, the demo will build just fine for 4.24-4.26.
    Is there any current demo project out there that could help me out to explore photon for UE4 (also for VR)
    We don't have any VR-specific demos for UE4, but as far as Photon is concerned, there isn't really anything special about VR, so that the normal Photon UE4 integration demo should do just fine.

  • Hi Kaiserludi,

    Thanks for your answer!

    I tried out the steps that you mentioned above but I can't build the file for 4.24. although I specified the variables (_vc15 for VS 2017 and for 4.24.) so either I haven't copied the files to the correct locations (I'll do it again!) or I'm missing a basic info: do I need to use the source build versions of the engine or it doesn't matter? (sorry for these questions but as I said no experience there but I have to start from somewhere!)
  • Hi @DinaOrla.
    do I need to use the source build versions of the engine or it doesn't matter?
    It doesn't matter.
    so either I haven't copied the files to the correct locations (I'll do it again!)
    Inside the Windows SDK open folder Common-cpp.
    In that folder you find 2 subfolders: 'inc' and 'lib'
    The content of the Common-cpp/inc folder in the Windows SDK needs to be copied into the Common-cpp/inc folder of the UE project.
    The content of the Common-cpp/lib folder in the Windows SDK needs to be copied into the lib/Windows folder of the UE project.
    Do the same for Photon-cpp and LoadBalancing-cpp as well.

    If it still doesn't build afterwards, then please let me know the error messages that Visual Studio gives you.
  • Hi there,

    Sorry for not responding earlier but I was offline for a while.
    I followed all your instructions and unfortunately I can't build for version 4.24.
    Did following steps:
    1) Copied files to the correct folders of the project
    2) by opening the UE demo project was asked to select version and selected 4.24 (since I have VS2017)
    3) Generated Project files
    4) Tried to open the uproject and got the notification "PhotonDemoParticle module was built with a different version. Would you like to rebuild them now?" --> Pressed option "yes"
    5) Started building and in between got a log message (see below, I have marked as xxxxxx my folder specifications - couldn't copy the full ouput log message because the window vanishes immediately after) and got following message:
    "PhotonDemoParticle could not be compiled. Try rebuidling from source manually"

    Log:
    Running D:/UE_4.24/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Win64 -Project="D:/xxxxx/Multiusers/Photon/Demo_Photon/Photon-Unreal-SDK_DemoParticle-UE4/PhotonDemoParticle.uproject" -TargetType=Editor -Progress -NoHotReloadFromIDE
    Creating makefile for PhotonDemoParticleEditor (no existing makefile)
    D:\xxxxxxx\Multiusers\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\Source\PhotonDemoParticle\PhotonDemoParticle.Build.cs: warning: Modules must specify an explicit precompiled header (eg. PrivatePCHHeaderFile = "PhotonDemoParticle.h") from UE 4.21 onwards.
    WARNING: Library 'D:\xxxxxx\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\lib\Windows\Common-cpp_vc14_release_windows_md_x64.lib' was not resolvable to a file when used in Module 'PhotonDemoParticle', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
    WARNING: Library 'D:\xxxxxx\Multiusers\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\lib\Windows\Photon-cpp_vc14_release_windows_md_x64.lib' was not resolvable to a file when used in Module 'PhotonDemoParticle', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
    WARNING: Library 'D:\xxxxxx\Multiusers\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\lib\Windows\LoadBalancing-cpp_vc14_release_windows_md_x64.lib' was not resolvable to a file when used in Module 'PhotonDemoParticle', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning.
    @progress push 5%
    Parsing headers for PhotonDemoParticleEditor
    Running UnrealHeaderTool "D:\xxxxxx\Multiusers\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\PhotonDemoParticle.uproject" "D:\MovingSoundPictures\Multiusers\Photon\Demo_Photon\Photon-Unreal-SDK_DemoParticle-UE4\Intermediate\Build\Win64\PhotonDemoParticleEditor\Development\PhotonDemoParticleEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
    Reflection code generated for PhotonDemoParticleEditor in 5,6540891 seconds
    @progress pop
    Building PhotonDemoParticleEditor...
    Using Visual Studio 2017 14.16.27044 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
    [Upgrade]
    [Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
    [Upgrade] bLegacyPublicIncludePaths = false => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
    [Upgrade] ShadowVariableWarningLevel = WarningLevel.Error => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
    [Upgrade] PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
    [Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in PhotonDemoParticleEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
    [Upgrade]
    Building 11 actions with 8 processes...
    @progress 'Compiling C++ source code...' 0%
    @progress 'Compiling C++ source code...' 9%
    [1/11] PhotonDemoParticle.rc

  • Hi there,

    Sorry for not responding earlier but I was offline for a while.
    I followed all your instructions and unfortunately I can't build for version 4.24.
    Did following steps:
    1) Copied files to the correct folders of the project
    2) by opening the UE demo project was asked to select version and selected 4.24 (since I have VS2017)
    3) Generated Project files
    4) Tried to open the uproject and got the notification "PhotonDemoParticle module was built with a different version. Would you like to rebuild them now?" --> Pressed option "yes"
    5) Started building and got following message:
    "PhotonDemoParticle could not be compiled. Try rebuidling from source manually"
    6) So continued to rebuild from source and opened the sln file in VS2017
    7) Changed the _vc14 to _vc15 in the Build.cs since I use VS2017 for 4.24.
    8) Build & run in the "DevelopmentEditor" configuration
    9) Couldn't be built

    I made a screenshot with the warnings and errors I get in vs. Does that help?


    https://drive.google.com/file/d/16BVuSEI9KGCheKhT5D_m_Dz-BZ--ICJb/view?usp=sharing
  • Hi @DinaOrla.

    It looks like Unreal can't find the Photon .lib files for Windows.

    Are you 100% sure that you have indeed put them into the paths that you can see in the warning messages and error messages (Source/Photon/lib/Windows)?

    Also, you have admin access to that path, correct?
    Otherwise it might be a file permission issue.

    Moreover you could try to copy the project into a smaller path to rule out path length issues.

    PS:
    Is that a German Visual Studio installation running on a Greek Windows installation?
    Interesting combination.
  • Hi @Kaiserludi ,

    I know what the mistake was. I Just had put the lib/Windows files in the wrong folder! It seems to work now! I'll try to explore and hopefully find my way! Thanks for the help! It can be that I'll knock your door again at a point if something is not understandable!

    PS:
    That is correct! That happens when a greekie lands and works in Germany :-)
  • Hi @DinaOrla.

    Great to hear that it is solved.
    That is correct! That happens when a greekie lands and works in Germany :-)
    Our headquarters are in Hamburg.
  • DinaOrla
    DinaOrla
    edited May 18
    Wow! We're so close! I'm living in Hamburg!!
    Great city although it could be more sunny!
    :)