Cannot connect to server using custom_multiplayer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Thoomas
network.create_server(port, max_players)
set_custom_multiplayer(gateway_api)
custom_multiplayer.set_root_node(self)
custom_multiplayer.set_network_peer(network)
print("Gateway server started")

network.connect("peer_connected", self, "on_peer_connect")
network.connect("peer_disconnected", self, "on_peer_disconnect")

Above is the code on the server,

network = NetworkedMultiplayerENet.new()
gateway_api = MultiplayerAPI.new()

username = _username
password = _password

network.create_client(ip, port)
set_custom_multiplayer(gateway_api)
custom_multiplayer.set_root_node(self)
custom_multiplayer.set_network_peer(network)

network.connect("connection_succeeded", self, "on_connection_success")
network.connect("connection_failed", self, "on_connection_fail")

And this is the code on the client.

When I run the code on the client I get no errors, but I never receive the connection failed or connection succeeded signals. I also have the server run custom_multiplayer.poll() in _process().

Does anyone know the reason for this?

Did you follow this guide? The code seems to be slightly different High-level multiplayer — Godot Engine (stable) documentation in English

Zylann | 2021-08-23 20:51

Yes it is different because that guide doesn’t use custom_multiplayer, which I require.

I figured out what was wrong though. I forgot to tell the client to run custom_multiplayer.poll() every frame.

Thoomas | 2021-08-23 21:13