Help! Can't see other players (multiplayer issue)

0 favourites
  • 8 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • When I open multiple browsers and connect to my game, I can see all instances of myself. But when I send the game to a friend and ask them to join the same room, we can't see each other. Why is that?

    My game uses peer to peer connection to facilitate communication between multiple users through a web browser. My app works by connecting the user to a signalling server which helps peers find each other and puts them into a "room". One peer is made the host, and the host acts like the server for the other users.

    Currently, my app works perfectly when I open multiple browsers on the same computer and establish connection that way. The problem arises when I try to connect with different computers. The computers "see" each other and know that there is a connection to another peer, but they can't send each other information. And after a short time, one or more of the peers will lose connection to the host.

    I'm 99% sure the issue is not in my code because when I uploaded Construct's demo code for multiplayer, it gave me the exact same problem and also starts to kick the other players. I suspect the issue lies somewhere in my server settings, but I don't know anything about how that works and would really appreciate some pointers! I currently use HostGator to host my Construct HTML5 files.

    Notice in my screenshot, I (char) have joined. It recognizes that Alvin is the host, but his name does not appear in the Player List.

  • By the way, the game is hosted here if you want to take a look: alvinhew.com/multiplayer-test

  • Most likely, the host client (first to join) has some network nat or routing issues that is causing issues for the following peers to communicate.

    Are you using the Scirra signalling server or your own?

    Have you tried having a different client join first to be the host?

    Note that generally speaking, where you host/upload the game itself has no impact on anything. The app is downloaded to each client's computer, and each client communicates directly with the host after getting matched together from the signalling server.

    If it works with some hosts and not others, a TURN server would likely solve your issues in most cases.

  • Thank you for the reply, oosyrag!

    I'm working alongside charhew on this project, so I'm going to jump into this conversation as well.

    To answer your first question, yes we're using the default Scirra signalling server. And to your second question, we've also tried with different hosts.

    I have a couple of follow-up questions:

    1. If the game is being played through the browser, is it actually being downloaded by each user?

    2. I would like to do a test with a TURN server to determine if that is the solution to this problem. I see that Construct has an "Add ICE server" action, but how do I acquire the TURN server itself?

  • If you've tried with different hosts and none of them work, it might not be a networking issue after all (unless you're all on a campus network or something similar?).

    Correct, the game is being downloaded into the browser's cache on each user's computer to run. For more details, see the "How Projects Load" section in this tutorial - construct.net/en/tutorials/loader-layouts-custom-loading-9

    An ICE server is basically the name for either a STUN or TURN server (confusing, I know). STUN is generally publicly available as a free service. TURN servers are usually not, because they have real time bandwidth usage. So when you "Add ICE server", you can add either a STUN or TURN server. See Ashley's post here for a more detailed explanation - construct.net/en/forum/construct-2/general-discussion-17/multi-player-plugin-quotadd-75795

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Very informative, thank you.

    I signed up for a free account on xirsys.com to gain access to a TURN server.

    The problem still persists, however.

    Here's my project, so you can see if perhaps my implementation of the "add ICE server" action was incorrect (I hid the username and credential information).

    dropbox.com/s/f4dphqm5mwkwmt9/multiplayer-test.c3p

  • add the ice server before connecting to signalling. also make sure to add a TURN server

  • Brilliant, it worked! Thank you so much for your help eleanorjmorel and oosyrag!

    I'm going to write down the steps I took to fix this problem so anyone who has the same problem in the future can reference it:

    1. Acquire TURN server. (I signed up for a free account on xirsys.com.)

    2. Configure TURN server. (xirsys.com provided a tutorial to walk me through the steps.)

    3. Insert the "Add ICE server" action into the event sheet. (Make sure this action goes before the "Connect to signalling server" action.)

    4. Plug in the TURN server url into the action parameters. (The url should look something like this: "turn:[SITE NAME]:[MORE CHARACTERS]".)

    5. Plug in username/credentials into the action parameters if necessary.

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