Connection works when launching from Godot Editor, but not exported version
Asked Answered
N

5

0

My game has previously connected using UPNP with my friends, using my public IP, but I cant connect when the exported version of the game is hosting (P2P), I've checked the ports using "netstat -ab" on cmd (i'm on windows) and the ports are opening correctly, but why the only in the exported version the connection cant host but still connect?

UPNP code

if discover_result == UPNP.UPNP_RESULT_SUCCESS:
			if upnp.get_gateway() and upnp.get_gateway().is_valid_gateway():
				var map_result_udp = upnp.add_port_mapping(PORT,PORT,"godot_udp","UDP",0)
				print("map udp:",map_result_udp)
				var map_result_tcp = upnp.add_port_mapping(PORT,PORT,"godot_tcp","TCP",0)
				print("map tcp:",map_result_tcp)
				
				if not map_result_udp == UPNP.UPNP_RESULT_SUCCESS:
					upnp.add_port_mapping(PORT,PORT,"","UDP")
					print("UPD created")
				if not map_result_tcp == UPNP.UPNP_RESULT_SUCCESS:
					print("TCP created")
					upnp.add_port_mapping(PORT,PORT,"","TCP")

(The prints are from early debugging)

ENet server

       peer = NetworkedMultiplayerENet.new()
	var result = peer.create_server(PORT)
	if result == OK:
		get_tree().set_network_peer(peer)

ENet Client

client = NetworkedMultiplayerENet.new()
	client.create_client(ip_address, DEFAULT_PORT)
	get_tree().set_network_peer(client)

When hosting from the editor, the game plays normally, its just when I try to host from an exported version. Thank you for your time.

Notable answered 13/1, 2023 at 16:43 Comment(0)
N
0

Well, couldnt find the answer, but I am now using Gotm.io for my project, so it might help someone wanting to host an online game

Notable answered 19/1, 2023 at 18:26 Comment(0)
F
0

Is the exported game running on the same platform as the editor?

Fungicide answered 14/1, 2023 at 14:34 Comment(0)
N
0

Fungicide Both on windows, havent tried Mac or Linux yet, even if I am the one to use the exported version to host, it doesnt

Notable answered 14/1, 2023 at 17:33 Comment(0)
N
0

Well if anyone has any suppositions on what might be so I can look it up, i'd appreciate it. I really do not know a thing about actual networking.

Notable answered 14/1, 2023 at 20:14 Comment(0)
F
0

suppositions

The closest I've come to that kind of problem involves the same-origin policy, but it involved HTTP, not UPNP, so it may be unrelated to your issue. The symptom in my case was that HTTP get/put requests were not being handled in an HTML5 export, while it worked in the Godot editor.
https://github.com/godotengine/godot/issues/25668

Fungicide answered 14/1, 2023 at 21:20 Comment(0)
N
0

Well, couldnt find the answer, but I am now using Gotm.io for my project, so it might help someone wanting to host an online game

Notable answered 19/1, 2023 at 18:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.