grounders-slowjam-2024/server/lobby.gd

17 lines
419 B
GDScript

extends Node
var port: int
var MAX_CLIENTS := 32
func _ready():
var m = SceneMultiplayer.new()
get_tree().set_multiplayer(m, get_path())
var peer := ENetMultiplayerPeer.new()
peer.create_server(port, MAX_CLIENTS)
m.multiplayer_peer = peer
m.peer_connected.connect(peer_connected)
func peer_connected(id: int):
print("Client " + str(id) + "connected to lobby " + str(get_path()))
$level.server_add_player(id)