Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Bush2Tree |
Hey all,
I’m trying to set up p2p multiplayer, similar to the way Terraria handles things. Trying to connect via 127.0.0.1 works great, but when I try to connect to my friend’s computer via his public IP, it doesn’t work. My only lead is that connection_failed
is triggered.
We suspected a firewall issue, but after configuring firewalls on both machines to allow the game through, the issue still occurs.
I’m using a NetworkedMultiplayerENet.
What could the issue be?
I asked this question previously:
https://forum.godotengine.org/65718/private-vs-public-ip-addresses
After enabling port forwarding for both tcp and udp connections, it worked for me
RedBlueCarrots | 2020-09-30 10:55
Having each player manually enable port forwarding isn’t feasible, so I’m looking into UPNP. I found this article: UPNP — Godot Engine (stable) documentation in English
If I understand correctly, a single call to add_port_mapping()
at game startup should fix this. Is it better security practice to add_port_mapping()
only when hosting game, and to delete_port_mapping()
when done? Or is it okay to simply leave the port mapping there?
EDIT: on second thought, this is beyond the scope of this question, so I’m opening a new thread.
Bush2Tree | 2020-09-30 16:31
You should just need port forwarding to host a server, not connect to it.
I don’t know much about upnp, sorry
RedBlueCarrots | 2020-10-01 00:23