Error with the Unreal Engine Photon demo

Options

Hi,

I'm trying to make the Unreal Engine demo (https://www.photonengine.com/en-US/sdks#realtime-sdkrealtimeunrealengine) work but am encountering some problems.

I downloaded the Unreal Engine demo and followed the readme-demo steps:

Before building and running the demo project, I had to insert header files and .lib files into the appropriate file directories (that I got from the Windows SDK) before I could open the project. After I was able to open the project on Unreal Engine (version 5), I created a new app on Photon and inserted the proper appId.

I can only occasionally get the client to work properly. When it doesn't, one of two following message appears:

Is there any way I can get the app to consistently work? Would it have something to do with the following blueprint errors (that I am also trying to fix)

Any help would be appreciated.

Answers

  • Kaiserludi
    Options

    Hi @jricafort40.

    That looks like your firewall or router is blocking the connection.

    Please make sure that they are permitting outgoing traffic over the ports listed at https://doc.photonengine.com/en-us/realtime/current/connection-and-authentication/tcp-and-udp-port-numbers + port 443.


    Note that you don't need to open all of those ports. Which ones you need, depends on which connection protocol you use (and in case of UDP also depending on the two flags that are mentioned below).

    With UDP, "tryUseDatagramEncryption" set to false and 'useAlternativePorts' set to false (this is the default setting of the Client and also what the demo uses on default) you only need the ports 5055, 5056 and 5058.

    With UDP, "tryUseDatagramEncryption"set to false and 'useAlternativePorts' set to true you only need the ports 27000, 27001 and 27002.

    With UDP, "tryUseDatagramEncryption"set to true and 'useAlternativePorts' set to false you only need the ports 5055, 5056 and 19093.

    With UDP, "tryUseDatagramEncryption"set to true and 'useAlternativePorts' set to true you only need the ports 27000, 27001 and 19093.

    With TCP you only need the ports 4530, 4531 and 4533.

    With WS you only need the ports 9090, 9091 and 9093.

    With WSS you only need the ports 19090, 19091, 19093 and 443.


    As the displayed error messages are coming from WebSocketWindows.cpp, your code must apparently either use WS, WSS or "tryUseDatagramEncryption", as otherwise no code from that file will run.

  • Hi,

    I tried to disable the relevant ports, both on my computer firewall and on the router side, however the problem still persists. I even tried to turn off the firewall (which is obviously not a long-term solution), and I still have the same problem.

  • Kaiserludi
    Options

    Hi @jricafort40.


    Does the problem persist when you select UDP as connection protocol and set 'tryUseDatagramEncryption' to false?

  • How do I change the connection protocol to UDP? I've tried to look throughout the code and UE blueprints and I can't find the setting anywhere.

  • Kaiserludi
    Options

    Hi @jricafort40.


    UDP is the default protocol, so if you did not change it, then it should already be set to UDP.

    The Connection protocol is the 4th parameter of the constructor of class LoadBalancing::Client. Valid values are the constants listed in Photon-cpp/inc/Enums/ConnectionProtocol.h.


    Be aware though, that if 'tryUseDatagramEncryption' is set to true (this can be set in the ConnectOptions that are passed to Client::connect()), then the name server connection will use WSS as connection protocol, when the general connection protocol is UDP, although UDP will be used for other server types.


    I have just checked and apparently the demo overrides the default value of false and sets 'tryUseDatagramEncryption' to true, so you need to modify the demo source to ensure that UDP will be used for all connections.

  • Yes, the demo now works, thanks.