[SOLVED] How do I setup a MP Server with working NAT connect

0 favourites
  • 3 posts
From the Asset Store
Create your own wss server and ws server with ssl and without ssl.
  • So i started a new multiplayer project. Everything seems to work as intended first. I could connect locally over LAN booth as a peer and a host. Then i tested it over the Internet and it did not work.

    Here is what i tested both with the original Construct 2 Example and my own game in a combination of Windows, Linux, Android, latest chrome and firefox:

    My PC - Friends PC: Peers can not connect

    My PC - Other PC in other network: Peers can not connect

    Other PC in other network - Friends PC: Peers can not connect

    My PC - Mobile Phone (carrier connection): Did not work

    Other PC in other network - Mobile Phone (carrier connection): Did not work

    Error:

    So only thing i could get a connection is within my own lan network. I did not change anything on the example construct 2 provides. I am not behind a nat/special firewall. Originally i intended to write a html5 server done in construct 2 for my game and let it run in a browser (Chrome in a VM 24/7) but it currently doesnt seem to make any sense as IOS does not support the construct 2 WebRTC and even with Linux / Win it seems not to work properly...

    Does anyone else experience those issues? DOes anyone have any tips what i could try to get it work? Or is the multiplayer feature of construct currently broken?

    I am thankfull for any suggestions how to fix this problem.

  • So to answer my own question:

    I installed a turn Server and now everything works fine.

    Here is a quickl guide what i did to install the reTURN server on ubuntu 14.04:

    1) apt-get install resiprocate-turn-server

    2) nano /etc/reTurn/reTurnServer.config

    3) Set up IP and Port for TURN Server in config

    4) Disabled md5 PW hash

    5) Added User in nano /etc/reTurn/users.txt like username:SHA1HASHOFPW:reTurn:authorized

    6) Configured IP-Tables to open up the Port

    7) Restart server so the new configuration becomes active: service resiprocate-turn-server restart

    8) In Construct 2 before opening the connection: Multiplayer: Add ICE server "TURN:domain.my(username "username", "credential SHA1HASHOFPW"

    9) Works like a charm on all devices now.

    If anyone needs an account for testing purpose i can grant you a timly limited access to my TURN-Server, so you can test your stuff out!

    Kind regards

    Patrick

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So i should write a guide (and maybe i will in the future) but i am just needed elsewhere. regardless of this i want to post my solution for a common problem with C2MP:

    How to set up multiplayer server for up to 100 Players

    • write a Server in C2 which handles the game logig as you would normally do but without the player part
    • get a server for example from linode.com with at least 2 (better 3) cores
    • install ubuntu 14.04
    • Login as root
    • sudo apt-get update
    • sudo apt-get install xfce4
    • sudo apt-get install xrdp
    • sudo service xrdp restart
    • apt-get install firefox
    • echo xfce4-session >~/.xsession
    • connect via windows RDP to your server by entering the IP and your user credentials (after connection)
    • start firefox
    • type in about:config
    • enable webgl for WAY BETTER performance
    • navigate to your serversoftware written in c2
    • fire it up!
    • profit!

    so with this setup i successfully run a game with 50 simultaniously connections and the server was not nearly full, running the serversoftware at 60FPS at 0.6 CPU utilisation. The server synced 50 playerobjects with high precision double 8 bytes, 4 Instance variables, as well as 500 pickups with normal precision low bandwidth (mostly static)

    Maybe this will help someone in the future! Good luck with your mutiplayer project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)