I'm trying to create a game where one player starts a server and others enter his IP address and connect to him. I managed to get it working for localhost and also for 2 computers at the same Wifi.
The problem is when I try to do it with my friend (who is connected to a different network) he can't connect to my server. This is part of my autoload script:
func host_game(new_player_name):
player_name = new_player_name
var host = NetworkedMultiplayerENet.new()
host.create_server(DEFAULT_PORT, MAX_PEERS)
get_tree().set_network_peer(host)
func join_game(ip, new_player_name):
player_name = new_player_name
var client = NetworkedMultiplayerENet.new()
client.create_client(ip, DEFAULT_PORT)
get_tree().set_network_peer(client)
Is something wrong with the code, router or am I just entering the wrong IP? I tried to enter IP from websites like whatsmyip and also ipv4 from command ipconfig.
Edit: I found a good answer here: https://godotengine.org/qa/65718/private-vs-public-ip-addresses but couldn't set up my router so I looked further. Found free hosting site for Godot games ( https://gotm.io/ ). Easy to upload but still can't figure out how to enable multiplayer. Any ideas?