Hi, I am setting up a server/client environment in which the server can also be a player.
I set up the server like this:
var peer := NetworkedMultiplayerENet.new()
var result := peer.create_server(int(host_port), host_connections)
tree.set_network_peer(peer)
Later, when setting up the players I need to send some data from the client to the server, or, if on the server, from the server to the server (players are configurable/saveable by the client, like in terraria).
I am using "send_bytes" for this. On the server I get an error when I try this:
ERROR: Invalid target peer: 1
At: modules/enet/networked_multiplayer_enet.cpp:578
If I call "gettree().multiplayer.getnetworkconnectedpeers()" I get an empty list, which explains the above error.
So how do I go about sending data from the server to the server? I want to avoid having to put extra code in all over the place to do something different if the player is on the server.
Any ideas?