Topic was automatically imported from the old Question2Answer platform.
Asked By
kjell_leo
Hi everyone,
I was playing around with the Multiplayer Pong Demo but i did not get it to work. My friend ran it on his computer and me on mine, in the same local network. Both connected via Wifi. I tried to host the game with many different IP-addresses, found i CMD with ipconfig.
What am I doing wrong?
Do we need to be connected directly to each other via a ethernet cable? Am I using the IP correctly? Does it have something to do with the firewall? What port number should we be running?
then open the browser to your router and try to find both computers ip addresss
it should have the values
192.168.X.X
if you router ip is 192.168.8.1
then more likely your computers have an ip of
192.168.8.100 or 192.168.8.104
If you wish to run two instances on the same computer, connect
192.168.1.1
with the same port number
You can check your internal IP address by entering the following command in a terminal:
On Windows:ipconfig
On macOS:ifconfig
On Linux: ip addr or ifconfig
If several network interfaces are available, make sure to choose the “right” one (for instance, a virtual bridge’s IP address won’t be of much use here).
You can use any free ports. It is recommended to use big numbers like 35516.
If you want to play over internet: you need to open the port for your router. It is called port forwarding. Google it.
I use Nod32 internet security software. I had to add godot.exe and my application build’s exe to the trusted network list. Otherwise Nod32 blocked communication.
An alternative to 1 (because you might not want to force people into manually opening ports in their routers (mostly because it is not something everyone knows how to)) would be implementing a NAT hole punch.
Essentially, have an external server help the host and client handle a handshake, then they can do it themselves. It is a 3 step process:
Host registers its IP and port in the server
The client gets that info from the server and pings it, thus making their router accept messages from the host, after registering their IP and port on the server
The host pings all the clients it sees are connecting to it from the server, making their router accept connections from the clients
Profit → Now that both client and host routers will accept connections from each other, the server isn’t used anymore and you can handle your game