working online multiplayer tutorials on one Windows 10? [apparently a config problem: solved]

Roldy

Member
I tried several LAN multiplayer demos, like
Easy GMS Networking - Reference Build
YoYo Games LAN Platformer
Those works in an acceptible way or better.

I tried also multiple online multiplayer demos, by replacing the local IP by the one for internet.
But the host fails to set that up or the client fails to find it. Am I missing something for online multiplayer? My goal is that I can host with GM2 and that my friend can connect to it as a client with GM2.
Usually in these cases you will need to setup port forwarding on your router. Your 'server' is listening on a port. And you router has the 'internet' side IP. Your router needs to know that connections incoming on your server port need to be routed to your servers local ip address.

It is basically the NAT your router is always doing except it is initiated on an incoming connection for a fixed port.

Look up port forwarding.
 

rogonow

Member
You talk about the router, which is different than the firewall.
UPDATE: I failed to set up the server-client connection: I configured my router, even with DMZ-address but it doesn't work.
UPDATE 2: after a lot of research, I figured out that next code creates a local server at 0.0.0.0 with port 6409:
network_create_server(network_socket_udp, 6409,100);
For my port forwarding, the IP needs to start at least with 192.168.0..
Only 2 functions are there to create a network: network_create_server and network_create_server_raw, and none of them allows me to give an IP with.
Now I need to try with:
GML:
//code found at network_create_socket
if os_browser == browser_not_a_browser
    {
    client = network_create_socket(network_socket_tcp);
    network_connect( client, "192.134.0.1", 6510 );
    }
else
    {
    client = network_create_socket(network_socket_ws);
    network_connect( client, "192.134.0.1", 6520 );
    }
 
Last edited:

rogonow

Member
UPDATE3: next code hosted at 127.0.0.4 at my device with port 6409:
GML:
var a = network_create_socket(network_socket_udp);
    global.broadcast_server=network_connect( a, my_ip_to_rooter, 6409 );//my_ip_to_rooter starts with 192.168.0.
I think I'll get it by forwarding the port locally at my Windows 10:
 
Last edited:

rogonow

Member
I've once read that online networking is easily, but I experience the opposit and it would be too basic to put it in the advanced forum section. :s
 

Roldy

Member
This should probably belong in the Tech Support forum at this point. This doesn't have much to do with programming or GMS. Did you setup port forwarding on your router?

You can test it here. https://www.yougetsignal.com/tools/open-ports/

e.g. Use an unmodified YoYo Games LAN Platformer

On your router setup port forwarding.
You will need to check you router config and documentation, but you typically will:
  • Activate portforwarding
  • Choose an internet side PORT
  • Choose a LAN IP
  • Choose a LAN port
This will setup that incoming connections to your router are internet side port will be routed to your LAN IP: LAN PORT. The LAN IP is the ip the server is running on (192.168.x.x). Find this by running ipconfig through command line.

For the YoYo LAN demo the server port is 6510. This is the LAN PORT. For the internet side port you can choose any unused port but might as well also use 6510.

Once you have it configured, before you start the LAN server, test it at https://www.yougetsignal.com/tools/open-ports/

It should say the port is closed (because you havn't started the server).

Then start the server and test again.

If you have setup port forwarding on your router correctly it should say the port is open.

I just did the same in about 5 minutes and was able to connect with the YoYo LAN demo over the internet.

Good Luck.
 
Last edited:
Top