0 Favourites

Multiplayer connectivity problems

  • Hello there,

    @Ashley

    today I tried to test the game with two devices on mobile networks (low bandwidth) and it was not possible to establish the connection. The host registered the peer, but didn't let it in.

    I also noticed that it does not connect if the connection bandwidth is low even on wifi network, which previously worked with high bandwidth.

    Does multiplayer object use this traversal standards to overcome NAT/Firewall issues:

    Interactive Connectivity Establishment (ICE) – RFC 5245 http://tools.ietf.org/html/rfc5245

    Session Traversal Utilities for NAT (STUN) - RFC 5389 http://tools.ietf.org/html/rfc5389

    Traversal Using Relay NAT (TURN) - RFC 5766 http://tools.ietf.org/html/rfc5766

    I just tried this WebRTC demo and it worked on all networks which I used (wi-fi at home and office, mobile, lan)

    https://opentokrtc.com/

    Also this instant messaging demo works on all my networks:

    http://demo.easyrtc.com/demos/demo_inst ... aging.html

    Looks like the current implementation of Multiplayer Plugin has some issues.

  • WebRTC handles ICE, STUN and TURN internally. There is not much for us to add or change there. I've tested it and connected through with a Nexus 5 over both Wifi and HSPA+, but some network configurations (e.g. symmetric NAT) block peer-to-peer connections by their very design. This can be worked around in some cases such as with a TURN server (perhaps this is what the demo you said worked does), which you can host yourself and add to the multiplayer object using the 'Add ICE server' action. However connectivity issues largely stem from highly restrictive network configurations, or flakey workarounds to IPv4 exhaustion (IPv6 should improve the situation a lot). Without knowing more about your specific network setups it's hard to comment more, but anywhere without severe restrictions should connect through just fine.

  • Thanks for the reply, I will try to setup a TURN server - hopefully it will help.

  • Ashley

    Noob questions:

    Here https://code.google.com/p/rfc5766-turn-server/ I found an open source STUN server by google:

    https://code.google.com/p/rfc5766-turn-server/

    If I set it up and connect with "Add ICE Server", will it work together with Multiplayer Plugin?

    There's also a public STUN server provided by google: stun.l.google.com:19302

  • Adding a STUN server won't help - the Multiplayer object has a built-in list of several public STUN servers, including the one you mentioned, and they all work the same. Only TURN servers help connections happen where they might otherwise not happen, and since they act as a relay you will have to pay the bandwidth cost of all data going through them (which is also why we don't host one and why there probably aren't any free public TURN servers out there). But if you add your own TURN server using that action, it should use it if it can't otherwise connect directly.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Good, bandwidth is not a problem.

  • Ashley

    I installed the turn server and it's running, but in order to connect to it I have to specify username and password (credential). I can't find the way to do it in C2 events. There's only Add ICE server command. Can I add username and password to the "Add ICE server" string somehow?

    I tried something like this, but it doesn't work: "turn:test@<11.22.33.44>, credential:test"

    So far I found this:

    In your Javascript code where the RTCPeerConnection is created, reference the TURN server as follows:

    var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}, {"url":"turn:my_username@", "credential":"my_password"}]};

    pc_new = new webkitRTCPeerConnection(pc_config);

    Another question is, where should "Add ICE server" be useded: before On signalling connected or after

  • Ashley

    Is it right to add a TURN server in C2 like this:

    js - {"url":"turn:my_username@<turn_server_ip_address>", "credential":"my_password"}]};

    C2 - "turn:my_username@<turn_server_ip_address>,credential:my_password"

    E.g. In multiplayer example where should the TURN server be added, before on signalling connected or after, or may be somwhere else?

  • xoros - could you please let me know if you get this working? I have the same issues.

  • Tobye - sure, now I have to figure out how to properly add a TURN surver to C2 multiplayer. Currently my TURN server doesn't log anything by using this "turn:my_username@<turn_server_ip_address>,credential:my_password"

  • xoros sorry, but I have no idea how to do that stuff at the moment, I'm hoping to learn from you I only know C2 side stuff, but would very much like to get my game more stable.

  • Oh, the 'Add ICE server' action doesn't support credentials. I'll try get that in for the next build.

  • Ashley - Thank you!

  • Ashley

    So, I'm trying to add a TURN server with new credentials options, but with no success. May be I'm doing something wrong, but it's like working with a black box. I installed the TURN server according to the tutorial and it's running. I added it before "Connect to signalling server", but TURN server does not log anything. I also tried to add it after on signalling connected. Could you please provide some information how to properly use it in Construct 2?

  • Are you sure your TURN server is configured correctly? There is really nothing to it in the multiplayer object, it passes those details straight to WebRTC and that's it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
224 49,502
ThePhotons's avatar
ThePhotons
Unread hot topic
190 41,414
juantar's avatar
juantar
Unread hot topic
163 20,223
iBarin's avatar
iBarin