feat: Add lobby and multiplayer room management with Nakama and ENet LAN support.

This commit is contained in:
Yogi Wiguna
2026-03-17 12:45:16 +08:00
parent 6eb6dfa20d
commit 1b8e411657
5 changed files with 23 additions and 38 deletions
+4 -6
View File
@@ -726,12 +726,8 @@ func _on_ready_state_changed(_player_id: int, _is_ready: bool) -> void:
func _on_all_players_ready() -> void:
if LobbyManager.is_host:
if LobbyManager.is_lan_mode and LobbyManager.players_in_room.size() == 1:
# Auto-start for solo LAN testing
LobbyManager.start_game()
else:
start_game_btn.disabled = false
status_label.text = "All ready! Start the match!"
start_game_btn.disabled = false
status_label.text = "All ready! Start the match!"
else:
status_label.text = "All ready! Waiting for host..."
@@ -876,6 +872,8 @@ func _update_player_slots() -> void:
if ready_label:
ready_label.text = "WAITING..."
ready_label.add_theme_color_override("font_color", Color(0.5, 0.5, 0.7))
_update_status()
func _update_status() -> void:
var players = LobbyManager.get_players()
+14 -14
View File
@@ -1,24 +1,24 @@
[gd_scene format=3 uid="uid://b8yqx5v3n8u1p"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_block"]
albedo_color = Color(0.46, 0.46, 0.46, 1)
metallic = 0.5
roughness = 0.8
uv1_scale = Vector3(3, 2, 1)
[sub_resource type="BoxMesh" id="BoxMesh_wall"]
material = SubResource("StandardMaterial3D_block")
size = Vector3(1, 2, 0.1)
[sub_resource type="BoxShape3D" id="BoxShape3D_wall"]
size = Vector3(1, 2, 0.1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wall"]
albedo_color = Color(0.8, 0.2, 0.2, 0.8)
emission_enabled = true
emission = Color(1, 0, 0, 1)
emission_energy_multiplier = 0.5
[sub_resource type="BoxMesh" id="BoxMesh_wall"]
material = SubResource("StandardMaterial3D_wall")
size = Vector3(1, 2, 0.1)
[node name="SafeZoneWall" type="StaticBody3D"]
collision_layer = 1
[node name="SafeZoneWall" type="StaticBody3D" unique_id=393858776]
collision_mask = 0
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=110057234]
visible = false
mesh = SubResource("BoxMesh_wall")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1293049960]
shape = SubResource("BoxShape3D_wall")
+1 -4
View File
@@ -1,4 +1,4 @@
[gd_scene format=3 uid="uid://cggmcgvdj6wxt"]
[gd_scene format=3 uid="uid://sb04b5pkw2g6"]
[sub_resource type="BoxShape3D" id="BoxShape3D_wall"]
size = Vector3(1.68, 1.5, 0.05)
@@ -6,9 +6,6 @@ size = Vector3(1.68, 1.5, 0.05)
[node name="Wall3D" type="StaticBody3D" unique_id=992511920]
collision_mask = 0
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=1405008923]
transform = Transform3D(1.68, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1446599023]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.35764623, 0)
shape = SubResource("BoxShape3D_wall")