Godot Version
4.2.1
Question
I am trying to make a system where someone creates a server, and others can enter a code to join the server (the code being randomly generated). Is there a not extremely complicated way to do this? (without using the open sockets as the code)
Current code:
extends Node
var rng = RandomNumberGenerator.new()
var peer = ENetMultiplayerPeer.new()
@export var player_scene: PackedScene
func _ready():
rng.randomize()
if Global.hostorclient == "host":
peer.create_server(SOCKET)
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(_add_player)
_add_player()
_host_gen_code()
if Global.hostorclient == "client":
peer.create_client("localhost", SOCKET)
multiplayer.multiplayer_peer = peer
(sry I am new to godot)