The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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.

in Engine by (14 points)

It's eerie that you asked this question 30ish minutes ago. I just posted an almost identical question here: https://godotengine.org/qa/84433/how-establish-connection-network-peer-via-external-address. Also having trouble establishing a connection via an external IP address, even with port forwarding set up.

Hopefully we can both get this resolved.

o sheet that is kinda creepy.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.