OS: Linux Mint 21.3 x86_64
Godot version: 4.4.stable
I'm trying to make a multiplayer test project with ENet multiplayer, just to get the hang of it. But no matter how I try, my code doesn't seem to work. I was following this tutorial by 16BitDev:
I tried exporting the project for windows 11 on another computer and it worked perfectly fine, but when i export the project for linux and do the same thing to test as I did on windows 11, it just didn't work. I used the same testing method on both OSs as in the tutorial I mentioned earlier. I also tried doing the same thing as 16BitDev did in the video (without exporting the project), but it still wouldn't work. I tried asking chatGPT for help, but it's code didn't help. Here is my code if it helps:

#main.gd
extends Node2D

var peer = ENetMultiplayerPeer.new()
@export var player_scene: PackedScene

func on_host_pressed() -> void:
peer.create_server(631)
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(
add_player)
_add_player()

func _on_join_pressed() -> void:
peer.create_client("localhost", 631)
multiplayer.multiplayer_peer = peer

func _add_player(id = 1):
var player = player_scene.instantiate()
player.name = str(id)
call_deferred("add_child", player)
,
#player.gd
extends CharacterBody2D

var speed : int = 10000
var slow_speed : int = 200

func _enter_tree() -> void:
set_multiplayer_authority(name.to_int())

func _physics_process(delta: float) -> void:
var move = Input.get_vector("left", "right", "forward", "back")
if is_multiplayer_authority():
velocity = Input.get_vector("left", "right", "forward", "back") * move * speed * delta

velocity = velocity.clamp((Vector2.ONE * -1200), (Vector2.ONE * 1200))
if move == Vector2.ZERO:
	velocity = velocity.move_toward(Vector2.ZERO, delta * slow_speed)


move_and_slide()

Maybe I'm just dumb and the "issue" isn't real but I've been trying to get peer-to-peer multiplayer working for a little while now and I will appreciate any help whatsoever

    nelandaFirst first of all, are you the karl rock refugee under mint?

    Secondly, what didnt work? Linux 2 windows connection? Or Linux to Linux connection?

    If it works on windows then it should work on linux, as the functions are OS agnostic and if they provide an export to various OSes then the compiler should compile for the OS the system calls to deal with that.

    Maybe linux has more firewall rules set up "hardened" than windows ..

    Maybe explain what exactly not working... the linux pc cant connect to windows pc (game connection)?
    What does the fail says? Can you debug that part and use print() statement to throw the errored out conenction data to see what it say?

    I have an example i made year ago on 4.2 or 4.3, ill test it today to see if.. wait, i remember i did tests.. and it was working... hmm.. ill redo my test to make sure, but it shouldnt be the godot fault.. most likely its the firewall rules or port forwards that are not working or something...

    oh i see you use "localhost".. maybe thats the problem.. try putting your actual local IP in that and see if it work.. i guess windows dont get too fussy about using localhost while on linux i remember it gets fussy in some cases where you need to use IP instead of hostname..

    The Linux to Linux connection didn't work, but I'm testing both from the same computer (one for Linux to Linux, and another one for Windows to Windows). When I press join on Linux to Linux, I get these two errors:

    main.gd:7 @ _on_host_pressed(): Couldn't create an ENet host.
    main.gd:8 @ _on_host_pressed(): Supplied MultiplayerPeer must be connecting or connected.

    And lastly, how do I get the local IP on Linux? Just type netstat -aon and pick the first one under the "Local Address" column? I tried that and got a whole bunch of errors. If I didn't specify enough or something like that, just let me know I'm new to Godot so I don't really know what I need to say in these kinds of forums.

      nelandaFirst

      nelandaFirst And lastly, how do I get the local IP on Linux?

      ip -a
      ifconfig
      EDIT:
      on mint its: ip address

      maybe some other distros have different commands, its very simple and easy to google LOL.

      And besides you could go to the networking tab on your linux and i thing in GUI you can see the IP that your machine currently has.

      also youcould try using this:

      It worked on windows..

      	var ip_adress :String
      
      	if OS.has_feature("windows"):
      		if OS.has_environment("COMPUTERNAME"):
      			ip_adress =  IP.resolve_hostname(str(OS.get_environment("COMPUTERNAME")),1)
      	elif OS.has_feature("x11"):
      		if OS.has_environment("HOSTNAME"):
      			ip_adress =  IP.resolve_hostname(str(OS.get_environment("HOSTNAME")),1)
      	elif OS.has_feature("OSX"):
      		if OS.has_environment("HOSTNAME"):
      			ip_adress =  IP.resolve_hostname(str(OS.get_environment("HOSTNAME")),1)

        kuligs2

        So playing around with VM and having other issues, ive concluded on linux its really tricky to get "local" ip..

        First of all if the hostname environment is not set then you wont be able to get hostname with str(OS.get_environment("HOSTNAME"))
        Secondly even if you do manage to get hostname, it wont resolve the ip for some reason using IP.resolve_hostname_addresses(host_name_var,1) or IP.resolve_hostname(host_name_var,1)

        One thig that works is that is:

        	var ip
        	for address in IP.get_local_addresses():
        		if (address.split('.').size() == 4):
        			ip=address
        			print("my ip: ", ip)

        But.. as people get more advanced in life, they dont settle with just one network interface.. some might run virtual machines and other things like containers and dockers.. these things will create virtual network interfaces that will have their own local IP.. so you will not know for sure whic one is the "computer" and not some virtual thing..

        As for the hostname, mintVM, gives me the hostname when i use:

        var output = []
        var exit_code = OS.execute("cat",["/proc/sys/kernel/hostname"],output)

        kuligs2 var ip_adress :String

        if OS.has_feature("windows"):
        	if OS.has_environment("COMPUTERNAME"):
        		ip_adress =  IP.resolve_hostname(str(OS.get_environment("COMPUTERNAME")),1)
        elif OS.has_feature("x11"):
        	if OS.has_environment("HOSTNAME"):
        		ip_adress =  IP.resolve_hostname(str(OS.get_environment("HOSTNAME")),1)
        elif OS.has_feature("OSX"):
        	if OS.has_environment("HOSTNAME"):
        		ip_adress =  IP.resolve_hostname(str(OS.get_environment("HOSTNAME")),1)

        and as for this, this was taken from a forum, and does not work (in 4.2) on linux. Instead of "x11" use "linux"

        but it still wont find your hostname, because for me i have not set the hostname environment varriable in the linux.

        Also, i just read the doc, https://docs.godotengine.org/en/stable/classes/class_enetmultiplayerpeer.html#class-enetmultiplayerpeer-method-create-client

        Error create_client(address: String, port: int, channel_count: int = 0, 
        in_bandwidth: int = 0, out_bandwidth: int = 0, local_port: int = 0)
        
        Create client that connects to a server at address using specified port. 
        The given address needs to be either a fully qualified domain name (e.g. "www.example.com")
         or an IP address in IPv4 or IPv6 format (e.g. "192.168.1.1")

        So the localhost in your case should/would not work.. maybe try 127.0.0.1?? this loopback is always the same across all OSes. Im too lazy to recreate the whole enet multiplayer simple project.. and test it out

        Maybe your problem is something else?
        Maybe when you try to create server, the port is already taken that is why it cant create the peer?

        Need more info on how you do.. step by step..

        ok i did create a test, a very very basic one, and i could connect.

        I used the docs example:

        https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html#example-lobby-implementation

        Just added print() statements to all the functions to see how it goes.. on windows in _ready() function i set create_game() on linux -> join_game().. and i got function calls back from both machines.. i just on linux entered the windows local IP like 192.168... and it worked..

        So idk what is your problem.. maybe your code is not what you say it is.

        So the "multiplayer bomber" demo from here: https://github.com/godotengine/godot-demo-projects works on Linux to Linux. It is way more complicated and I am trying to figure out what I would need to add into the existing project to make it work as I'm trying to get better at Godot, but I will not be able to work on this a lot right now so don't expect me to answer for the next few days

          nelandaFirst either way multiplayer works, you just need to read the docs as i previously stated.