feat(multiplayer): ENet networking + player/world sync + lobby menu + chat

Add dedicated server / host / client modes via NetworkManager autoload,
PlayerSyncComponent (20 Hz unreliable RPC), WorldSyncComponent (authoritative
block break/place), ChatManager (F2), LobbyMenu scene, updated MainMenu
with Solo/Heberger/Rejoindre/Quitter buttons. Port changed to 7777
(9999 occupied by sntlkeyssrvr on this machine). Mobs disabled in multi
(spawn solo only). Solo mode untouched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Floppyrj45
2026-04-19 17:48:48 +02:00
parent 9546fcd96b
commit 5db858527e
15 changed files with 748 additions and 48 deletions

View File

@@ -36,9 +36,9 @@ anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -200.0
offset_top = -160.0
offset_top = -220.0
offset_right = 200.0
offset_bottom = 160.0
offset_bottom = 220.0
alignment = 1
[node name="Title" type="Label" parent="CenterContainer"]
@@ -53,36 +53,52 @@ theme_override_constants/shadow_offset_y = 3
[node name="Subtitle" type="Label" parent="CenterContainer"]
layout_mode = 2
text = "Un monde voxel sous l'océan"
text = "Un monde voxel sous l'ocean"
horizontal_alignment = 1
theme_override_font_sizes/font_size = 22
theme_override_colors/font_color = Color(0.5, 0.75, 0.9, 0.85)
[node name="Spacer" type="Control" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(0, 30)
custom_minimum_size = Vector2(0, 20)
[node name="DiveButton" type="Button" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(300, 56)
text = "Plonger"
theme_override_font_sizes/font_size = 26
custom_minimum_size = Vector2(300, 52)
text = "Solo"
theme_override_font_sizes/font_size = 24
theme_override_colors/font_color = Color(0.8, 0.97, 1.0, 1.0)
theme_override_styles/normal = SubResource("StyleBoxFlat_btn")
[node name="HostButton" type="Button" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(300, 52)
text = "Heberger"
theme_override_font_sizes/font_size = 24
theme_override_colors/font_color = Color(0.8, 0.97, 1.0, 1.0)
theme_override_styles/normal = SubResource("StyleBoxFlat_btn")
[node name="JoinButton" type="Button" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(300, 52)
text = "Rejoindre"
theme_override_font_sizes/font_size = 24
theme_override_colors/font_color = Color(0.8, 0.97, 1.0, 1.0)
theme_override_styles/normal = SubResource("StyleBoxFlat_btn")
[node name="OptionsButton" type="Button" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(300, 56)
custom_minimum_size = Vector2(300, 52)
text = "Options"
theme_override_font_sizes/font_size = 26
theme_override_font_sizes/font_size = 24
theme_override_colors/font_color = Color(0.8, 0.97, 1.0, 1.0)
theme_override_styles/normal = SubResource("StyleBoxFlat_btn")
[node name="QuitButton" type="Button" parent="CenterContainer"]
layout_mode = 2
custom_minimum_size = Vector2(300, 56)
custom_minimum_size = Vector2(300, 52)
text = "Quitter"
theme_override_font_sizes/font_size = 26
theme_override_font_sizes/font_size = 24
theme_override_colors/font_color = Color(0.8, 0.97, 1.0, 1.0)
theme_override_styles/normal = SubResource("StyleBoxFlat_btn")
@@ -134,8 +150,42 @@ max_value = 1.0
step = 0.01
value = 0.8
[node name="HostPortPopup" type="Window" parent="."]
title = "Heberger une partie"
size = Vector2i(360, 200)
visible = false
[node name="VBox" type="VBoxContainer" parent="HostPortPopup"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 20.0
offset_top = 20.0
offset_right = -20.0
offset_bottom = -20.0
[node name="PortLabel" type="Label" parent="HostPortPopup/VBox"]
text = "Port (defaut 9999)"
[node name="PortInput" type="LineEdit" parent="HostPortPopup/VBox"]
layout_mode = 2
text = "9999"
theme_override_font_sizes/font_size = 18
[node name="StatusLabel" type="Label" parent="HostPortPopup/VBox"]
theme_override_colors/font_color = Color(1.0, 0.4, 0.4, 1.0)
[node name="ConfirmBtn" type="Button" parent="HostPortPopup/VBox"]
layout_mode = 2
text = "Lancer le serveur"
theme_override_font_sizes/font_size = 18
[connection signal="pressed" from="CenterContainer/DiveButton" to="." method="_on_dive_pressed"]
[connection signal="pressed" from="CenterContainer/HostButton" to="." method="_on_host_pressed"]
[connection signal="pressed" from="CenterContainer/JoinButton" to="." method="_on_join_pressed"]
[connection signal="pressed" from="CenterContainer/OptionsButton" to="." method="_on_options_pressed"]
[connection signal="pressed" from="CenterContainer/QuitButton" to="." method="_on_quit_pressed"]
[connection signal="value_changed" from="OptionsPopup/VBox/MusicSlider" to="." method="_on_music_slider_value_changed"]
[connection signal="value_changed" from="OptionsPopup/VBox/SFXSlider" to="." method="_on_sfx_slider_value_changed"]
[connection signal="pressed" from="HostPortPopup/VBox/ConfirmBtn" to="." method="_on_host_confirm_pressed"]