+1 vote
extends Node

var network = NetworkedMultiplayerENet.new()

func _ready():
    network.connect("connection_failed", self, "_on_connection_failed")
    network.connect("connection_succeeded", self, "_on_connection_succeeded")

func connect_to_server(ip : String, port : int): # Called from another script
    network.create_client(ip, port)
    get_tree().set_network_peer(network)

func _on_connection_failed(): # This function NEVER gets called
    print(":(")

func _on_connection_succeeded():
    print(":)")

When I try to connect to an offline server (which fails), the function _on_connection_failed() doen't get called.

Godot version 3.3.2
in Engine by (94 points)

Nevermind... I solved it!

This signal is infact working properly, but it delays some time until the connection fails.

Is this your own system? when not, could you post the tutorial? it sounds great, and i always have problems with multiplayer...

I'm following some tutorials but applying to the reality of my game (it's a multiplayer FPS).

I think that "Game Development Center" Youtube channel videos about multiplayer are great, also Godot documentation help A LOOOOOOT :)

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.