WebGL Round Trip Time is 5 times slower than the desktop version

Options

Hi everyone,

I have a game built using Photon Fusion, everything is working perfectly fine on the desktop version, the round trip time is around 30ms which is perfect. But with the same settings, when I connect to the server with the WebGL build, it's 5 to 7 times slower. In a competitive game, 200ms is not acceptable, so I am trying to solve this problem. Both WebGL and desktop clients are connecting to a dedicated server on a remote linux machine. Is there a setting that I should have on the server such as opening websocket ports? If so, how could I do that?


I am attaching both the webgl and the desktop version screenshots for comparison.


Cheers!



Best Answer

  • HumzaKhalid
    Answer ✓
    Options

    Just writing as I didn't find the solution but was able to find the reason, so if anyone else comes across this thread would know.

    The reason RTT is high on webgl is because webgl(websocket) cannot NAT punch through directly, it needs relay server (STUN server) for NAT (network access translations), so whats happening on webgl with dedicated server build is below:

    client <=> relay (photon cloud) <=> server/host

    and on other platforms (windows/android):

    client <=> server/host

    so an extra layer is added between client and server which causes high round trips,

    this is by far webgl limitation, either switch to shared mode architecture where relay IS SERVER (if your game design could be handled by this approach) or use other platforms like desktop,android,ios etc

    P.S:

    • I chose the solution of changing the platform to windows, and getting a good 15-20 RTT.
    • Also one could look into quantum as well which uses detereminism as state autherity (if its goes well with game design) and inherently use photon cloud as the server peer.

    Big shout out to emotitron#3805 on discord, for helping me out.

Answers

  • HumzaKhalid
    edited April 2023
    Options

    bump!!

    Facing same issue, does nobody at photon ever replies??

    @bekirdag were you able to solve the issue, please let me know im banging my head for days :(

  • HumzaKhalid
    Answer ✓
    Options

    Just writing as I didn't find the solution but was able to find the reason, so if anyone else comes across this thread would know.

    The reason RTT is high on webgl is because webgl(websocket) cannot NAT punch through directly, it needs relay server (STUN server) for NAT (network access translations), so whats happening on webgl with dedicated server build is below:

    client <=> relay (photon cloud) <=> server/host

    and on other platforms (windows/android):

    client <=> server/host

    so an extra layer is added between client and server which causes high round trips,

    this is by far webgl limitation, either switch to shared mode architecture where relay IS SERVER (if your game design could be handled by this approach) or use other platforms like desktop,android,ios etc

    P.S:

    • I chose the solution of changing the platform to windows, and getting a good 15-20 RTT.
    • Also one could look into quantum as well which uses detereminism as state autherity (if its goes well with game design) and inherently use photon cloud as the server peer.

    Big shout out to emotitron#3805 on discord, for helping me out.

  • bekirdag
    Options

    Thank you Humza