Godot Game with High Level Multiplayer API does not connect to external IP address.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MysteryCoder456

I am making a multiplayer game with the High Level Multiplayer API. The game works fine when connecting over a local IP address, but it doesn’t connect over a public IP.

The following is my code for creating a server and joining a server:

func create_server(player_nickname):
	self_data.id = 1
	self_data.name = player_nickname
	players[1] = self_data
	var peer = NetworkedMultiplayerENet.new()
	peer.create_server(DEFAULT_PORT, MAX_PLAYERS)
	get_tree().set_network_peer(peer)


func connect_to_server(player_nickname, server_ip):
	self_data.name = player_nickname
	var peer = NetworkedMultiplayerENet.new()
	if server_ip == "":
		peer.create_client(DEFAULT_IP, DEFAULT_PORT)
	else:
		peer.create_client(server_ip, DEFAULT_PORT)
	get_tree().set_network_peer(peer)

The connect to server function is called by a button in a Menu that takes the ip and gives it to the function. It all works over local IP but doesn’t over external IP. I have also enabled port forwarding towards my server.

It’s eerie that you asked this question 30ish minutes ago. I just posted an almost identical question here: How to establish a connection to a network peer via an external IP address? - Archive - Godot Forum. Also having trouble establishing a connection via an external IP address, even with port forwarding set up.

Hopefully we can both get this resolved.

RaebaldKashban | 2020-10-03 17:35

o sheet that is kinda creepy.

MysteryCoder456 | 2020-10-03 17:38