GameMaker Multiplayer over WAN?

I am trying to set up multiplayer for a 2d platforming party game. So far it works great over LAN connection, but when I tried to play with my friends across the internet, nobody was able to join the server. When I discovered the problem, I thought that connecting to my public external ip address, instead of my local ip address would fix the issue, but neither me nor my friends can connect to the server in that situation. I'm looking for information about what to do next but I'm not having much luck. Does anyone know what is going wrong?
 
Last edited:
Thanks for the tip on port forwarding guys! I guess this has become more of a networking topic than a programming topic. I have set up my port forward and verified that it was successful by using an open port check tool, but I still can't connect to my server. I have also disabled the firewalls on my machine running the server. Unfortunately after going through all this I'm still having the same issue as before.

Also there is one thing I'm not really clear on: For WAN networking, should the clients try to connect to the local ip address of the machine running the server, or should they connect to the WAN ip address? I've been trying both options, but it would be nice to know which is correct.
 
Last edited:

FrostyCat

Redemption Seeker
They should connect to the WAN IP address. You would not be able to notice the difference as the host, but your guests will.

And no, the open port check alone does NOT tell you that your setup is correct. If during the port forwarding you forwarded to the wrong internal IP-port combination, then the port would still be open outside but lead nowhere inside. Use ipconfig (Windows) or ifconfig (Mac) to find the internal IP address of your LAN interface card, and make sure it is the internal IP listed in your forward. Then start your server listening to the forward's internal port, and ask your guests to connect to your external IP-port combination. Once that is validated, set up DHCP Reservation so that it doesn't drift around later.

Also consider testing with other LAN-enabled games to rule out programming mistakes specific to your project.
 
What I have done is use the exact same setup which I know works for LAN connection, replaced the code network_connect(client,LANIP,port) with network_connect(client,WANIP,port) as if I expected the client could connect to my external address and that would be the same as connecting to my server.

I don't know much about networking. To be honest, I find the vocabulary confusing at times and a lot of what you said went completely over my head the first time I read it. While attempting to figure it out though, I got a potential idea of what could be happening:

When the client connects to my external address, should the data be transferred to an internal address? I thought that when I connect the client to my external address, the data should find its way to the server automatically, but now I'm starting to think there's an extra step. I think I have to connect the client to my external address, and then somehow transfer the data to my internal address. Does that sound right? Is that what I'm missing? How would I do that in game maker?
 
Last edited:

FrostyCat

Redemption Seeker
When the client connects to my external address, should the data be transferred to an internal address? I thought that when I connect the client to my external address, the data should find its way to the server automatically, but now I'm starting to think there's an extra step. I think I have to connect the client to my external address, and then somehow transfer the data to my internal address. Does that sound right? Is that what I'm missing? How would I do that in game maker?
Your assumption is false. The router does NOT automatically transfer external inbound connections to internal machines on a stock setup. You need to set up port forwarding so that the router knows exactly what external ports correspond to what ports at which internal IP address. That is done in your router, not in GM.

This is what a typical port-forwarding admin screen on a router looks like:

1622642382213.png

Assume that your game listens on TCP 4567, and you have already found your LAN card's internal IP address. Then you put this in one of the port forwarding rule fields and save:
  • Name: My Game
  • IP Address: <Your LAN card's internal IP address>
  • TCP: 4567
After you set up this correspondence, connecting to the external IP's TCP 4567 port will forward the connection to your internal machine's TCP 4567. Some routers have more detailed rule setups than the one above, but the idea is the same.

Topics like this demonstrate why you should learn basic network administration --- basic network topologies, DHCP, port forwarding, opening ports in a firewall, etc. --- BEFORE multiplayer game development. It is a prerequisite that tutorial authors and the eventual end-users of the product can reasonably demand of the developer.
 
Thanks for the answer to my question. I had set up the port forward as you have described and I have double checked the information and I believe it is correct. Unfortunately I haven't gotten the results I'm looking for. Are there any necessary steps exclusive for WAN connection besides asking the clients to connect to your external address, correctly setting up a port forward, and potentially disabling your firewall?
 
Thanks for the answer to my question. I believe I have set up the port forward as you described and made sure the information is correct, but I haven't gotten any results yet. Is there any definitive way to find out if the port forward is set up correctly?

Edit: sorry, I didn't mean to double post.
 
Last edited:

chamaeleon

Member
Use something like https://portchecker.co/ to have a computer outside your network try to connect to your internal port. It should be successful when port forwarding and firewalls are properly configured in your end, and your server program is running (otherwise there's nothing listening on the port and connections will fail).
 
I have passed the open port check. I resorted to to setting up a minecraft server to see if I will have the same issues, and it seems that I do, which makes me a little more hopeful. I have found out that some ISPs will not allow you to connect to your own public IP address. I think this might be my issue. I will find out as soon as possible.
 

curato

Member
That can be an issue if you use the ISP's modem some don't want you to run a server out of your house. You may need your own equipment to do that. I know a guy that happened to that had to return the rental and get his own modem.
 
I have contacted my ISP about my issue. They told me their team would call me within 24 hours once they have remotely solved the issue (they never actually called me or solved the issue). I have decided to use a vpn called logmein hamachi that i discovered while searching for solutions, and that works just fine. I don't want to call customer service again so I'll just leave it at that for now. Thanks for the replies everyone I really appreciate it.
 
Last edited:

woods

Member
some ISPs will not allow you to connect to your own public IP address.
if you have your port forward set up correctly and your server allowed thru your firewall..

if i remmber right, host machine shouldnt try to connect thru its out external IP(mumbles something about NAT loopback unsupported)
clients outside your network connects thru your external IP
clients on your LAN network connects thru your internal IP
host machine would connect with 127.0.0.1 or localhost

tho i am not 100% on how WAN differs from LAN networking

following thread for potential learning ;o)
 
Top