Does the Multiplayer object require port forwarding?

0 favourites
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I thought the entire idea behind the Multiplayer object was that it's supposed to go through web ports that are already open, but I'm having huge issues getting my client to send and receive messages.

    Are my events somehow wrong?

    I can connect, log in and join the room just fine, but it just won't show any messages whatsoever.

  • No, you don't need port forwarding - it uses WebRTC, which doesn't use any fixed port. Instead it uses STUN (and optionally TURN) servers for NAT punch-through. See the Multiplayer concepts tutorial for more information.

  • I thought the entire idea behind the Multiplayer object was that it's supposed to go through web ports that are already open, but I'm having huge issues getting my client to send and receive messages.

    Are my events somehow wrong?

    I can connect, log in and join the room just fine, but it just won't show any messages whatsoever.

    You only need port forwarding if you are the hosting part, for ex if your hosting a website/server on your PC.

  • So why am I having such immense issues sending/receiving basic messages?

    I feel like I've tried everything ranging from using different browsers to creating various capx examples, and the only time it works is when I've had two connected clients running on a local computer.

    How can I troubleshoot this?

  • internet connection? if im not mistaken the webrtc servers are peer-to-peer connections, which means you connect directly to the other user that is hosting (the server only connects you to the other user and updates surtain inputs other than that is all peer to peer i think), if he has a bad internet connection your ping will be high = in delays, and data package loss. That's why when u log on same localhost, connection being local, and not over internet, works faster.

  • internet connection? if im not mistaken the webrtc servers are peer-to-peer connections, which means you connect directly to the other user that is hosting (the server only connects you to the other user and updates surtain inputs other than that is all peer to peer i think), if he has a bad internet connection your ping will be high = in delays, and data package loss. That's why when u log on same localhost, connection being local, and not over internet, works faster.

    Ping and packet loss is not the issue since connecting and joining is instant, and it's not an explanation for 100% of messages being lost in 100% of the cases.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ping and packet loss is not the issue since connecting and joining is instant, and it's not an explanation for 100% of messages being lost in 100% of the cases.

    oh then is definitely ur code. is that image covering all the coding on multiplayer?

  • oh then is definitely ur code.

    Why do you think that it's definitely my code? It works when hosted in localhost, so the multiplayer code is functional.

    is that image covering all the coding on multiplayer?

    Some of it, yes.

  • sorry that was a bit presumptuous of me. it can also be ur firewall as u hinted, or the other persons firewall when u are live on internet, or it can be the webrtc is not supported on some end.

    i said that because the code looks rather weird, comparing it with how the tutorial of chat message works, and order of things. yours is using the sending message code right, but everything else is backwards.

    for one that line there, ur using, works for localhost for some reason..... i have no clue why(probably cause u are both on the same connection? if ur running from the same device on two browser tabs?), however, id change the else condition to a inversed condition of is host... else sometimes if not used properly can mean anything making the system confused, especially when is followed by another else on a bellow condition that we might not see.

    also if u change the else condition to a inverse condition, make sure the host coding is always last, as u would want that to be always checked last not the peer.

    but if its working in preview should work online ... however that is not always the case with all the construct objects, can we see the multiplayer code in a separated capx file that wouldn't make ur game public? i wanna alter it a bit. because some of the send data coding ur using.

    or u can check this file here and compare what is wrong on ur end, to connection to server and message coding.

    Edited: --- disregard the P.S--- this is meant to be read quietly... it can also be a bug.... shhhhh

    have u tried ur code on different versions on C3? what is ur current one ur using?

    there are various reasons why doesn't work once u go live.... but 90% of the cases is the code.

  • Most of the time such issues are networking issues such as NAT preventing WebRTC DataChannel packets being transmitted. What network setup are you using and which are the devices involved? Does it reproduce with different pairs of devices? For example sometimes there are issues hosting on a phone on cell data due to restrictive NAT at the carrier, but it works between PCs on a LAN.

  • Most of the time such issues are networking issues such as NAT preventing WebRTC DataChannel packets being transmitted. What network setup are you using and which are the devices involved? Does it reproduce with different pairs of devices? For example sometimes there are issues hosting on a phone on cell data due to restrictive NAT at the carrier, but it works between PCs on a LAN.

    Based on what you're saying it seems that the issue is the cell network.

    So how can I as a developer get around this? If I'm using Construct to develop a game for portable devices then the Multiplayer plugin can't arbitrarily not work based on the carrier that the player is using.

  • Typically you'd use a TURN server to relay traffic, which has on-going bandwidth costs. Even then, you can't get to a perfect 100% connectivity rate. The Internet is simply too chaotic and unpredictable - sometimes connections simply can't be made.

  • Typically you'd use a TURN server to relay traffic which has on-going bandwidth costs.

    What's a TURN server and how does it relate to enabling mobile connections with NAT restrictions to connect properly using the Multiplayer plugin?

    Even then, you can't get to a perfect 100% connectivity rate. The Internet is simply too chaotic and unpredictable - sometimes connections simply can't be made.

    Yeah sure, but Construct is marketed as a tool that enables cross-platform game creation where mobile gaming is a significant component, and since the Multiplayer plugin is a staple of the toolkit, I can't be expected to tell the users of my Construct-created games to only buy my games under the caveat that they're on a mobile connection that doesn't have whatever convoluted technical restrictions that are currently preventing me from getting the Multiplayer plugin to work.

  • What's a TURN server and how does it relate to enabling mobile connections with NAT restrictions to connect properly using the Multiplayer plugin?

    I think it would be best to do some research on Google - this is a complex area and will involve setting up other software which we don't make, so can't help you with.

    Yeah sure, but Construct is marketed as a tool that enables cross-platform game creation where mobile gaming is a significant component

    The problem is the Internet, not Construct. Any software using the same approach will have the same problems.

  • The problem is the Internet, not Construct. Any software using the same approach will have the same problems.

    How do you figure that the problem isn't Construct when you're marketing Construct as such:

    "Publish your games to just about any platform out there!"

    "Create Multiplayer Games"

    "Make multiplayer games with our tools and services"

    "The easiest and most powerful tools right at your fingertips"

    "Bring your ideas into reality. Construct's been designed to allow you to build the game you've always wanted to make."

    "Make any game"

    "Publish & Sell Everywhere"

    "In a few easy clicks, you can publish your games to Steam, iOS, Android and a host of other places."

    "Get your games in front of millions of potential players and make the next big hit!"

    "Runs in the browser. Translated into 6 languages."

    Only to have the Multiplayer plugin not actually work unconditionally on mobile devices in the case that a player's mobile carrier has certain NAT restrictions?

    If you're marketing a tool as capable of doing X, Y and Z then the tool needs to be able to do X, Y and Z unless otherwise stated?

    Neither game developers nor end-users will care what technical restrictions there are. If you're marketing X, Y and Z then you either have to deliver X, Y and Z or provide some very clear asterisks. How would you feel if you bought a game, only to have the game not work on your specific (yet common) hardware setup because of some obscure restriction, and have the developer of the game go "sorry, the engine provider's API doesn't work with [setup X] and we bought into the engine thinking that it'd work"? Because that's what I'm going to have to do with my players, and I'm not comfortable treating them like that.

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