I'm trying to build a simple multiplayer game. I have a client project and a server project. In the server project I set up an enet server like this:
extends Node
var network = NetworkedMultiplayerENet.new()
var port : int = 29995
var max_players : int = 100
func _ready():
StartServer()
func StartServer():
network.create_server(port, max_players)
get_tree().set_network_peer(network)
print("Server started")
network.connect("peer_connected", self, "_peer_connected")
network.connect("peer_disconnected", self, "_peer_disconnected")
This works fine if I try to run it on my local (windows) machine. However, when I try to run it on a virtual ubuntu server I get the following output:
Godot Engine v3.3.stable.official - https://godotengine.org
ERROR: create_server: Couldn't create an ENet multiplayer server.
At: modules/enet/networked_multiplayer_enet.cpp:108.
ERROR: set_network_peer: Supplied NetworkedMultiplayerPeer must be connecting or connected.
At: core/io/multiplayer_api.cpp:147.
The steps I used to run this:
- Exported the .pck file using Linux/X11 settings on windows
- Moved .pck file to server
- Renamed headless server binary to match the .pck file
- Executed binary
I did make sure that my port is allowing inbound and outbound connections with ufw. If the port is free, what could other reasons for this error be?