extends Node func _ready() -> void: print("=== Full Join Simulation ===\n") # Load the full game scene var GameScene = load("res://examples/multiplayer-fps/multiplayer-fps.tscn") if GameScene == null: print("FAIL: Cannot load multiplayer-fps.tscn") get_tree().quit(1) return print("Loaded multiplayer-fps.tscn") var game = GameScene.instantiate() add_child(game) # Wait for scene to settle await get_tree().process_frame await get_tree().process_frame # Get the Network Popup tab container var ui = game.get_node_or_null("UI") var popup = game.get_node_or_null("UI/Network Popup") var bootstrapper = game.get_node_or_null("UI/Network Popup/LAN Bootstrapper") if ui: print("UI node: %s" % str(ui)) if popup: print("Network Popup: %s" % str(popup)) if bootstrapper: print("Bootstrapper: %s" % str(bootstrapper)) if bootstrapper.has_method("join"): print("Bootstrapper has join() method") if bootstrapper.has_method("host"): print("Bootstrapper has host() method") else: print("WARNING: No bootstrapper found!") # Check address/port inputs var addr_input = game.get_node_or_null("UI/Network Popup/LAN/Address Row/Address LineEdit") var port_input = game.get_node_or_null("UI/Network Popup/LAN/Address Row/Port LineEdit") if addr_input: print("Address input: '%s'" % str(addr_input.text)) if port_input: print("Port input: '%s'" % str(port_input.text)) # Simulate join: set address/port and call join() if addr_input and port_input and bootstrapper: addr_input.text = "127.0.0.1" port_input.text = "34201" print("\nCalling join()...") var peer = ENetMultiplayerPeer.new() var err = peer.create_client("127.0.0.1", 34201) if err != OK: print("FAIL: create_client error: %s" % error_string(err)) get_tree().quit(1) return get_tree().get_multiplayer().multiplayer_peer = peer print("Peer set, waiting for connection...") # Wait up to 8 seconds for connection var start = Time.get_ticks_msec() while Time.get_ticks_msec() - start < 8000: var status = peer.get_connection_status() if status != MultiplayerPeer.CONNECTION_CONNECTING: break await get_tree().process_frame var final_status = peer.get_connection_status() print("Connection status: %d (2=CONNECTED)" % final_status) if final_status == MultiplayerPeer.CONNECTION_CONNECTED: print("SUCCESS: Connected!") print("Unique ID: %d" % multiplayer.get_unique_id()) # Simulate connect_ui.hide() popup.hide() print("Popup hidden") # Now check NetworkEvents if Engine.has_singleton("NetworkEvents"): var ne = Engine.get_singleton("NetworkEvents") print("NetworkEvents enabled: %s" % str(ne.enabled)) # Wait a few frames to see if anything happens await get_tree().process_frame await get_tree().process_frame await get_tree().process_frame # Check if there are any player nodes var players = game.get_node_or_null("Players") if players: print("Players node children: %d" % players.get_child_count()) for child in players.get_children(): print(" - %s" % str(child.name)) print("\n=== Test Complete ===") else: print("FAIL: Could not connect") get_tree().quit(0)