From 9cd08594ac4747ee0731ca416dc2977a89e3a271 Mon Sep 17 00:00:00 2001 From: Srayan Jana Date: Wed, 25 Sep 2024 13:44:25 -0700 Subject: [PATCH] add address bar for custom address + added basic README --- examples/multiplayer-lan/godot/README.md | 17 +++++++ .../multiplayer-lan/godot/export_presets.cfg | 2 +- .../godot/multiplayerScene.tscn | 46 +++++++++++++------ .../rust/src/multiplayer_controller.rs | 1 + .../multiplayer-lan/rust/src/scene_manager.rs | 24 +++++----- 5 files changed, 61 insertions(+), 29 deletions(-) create mode 100644 examples/multiplayer-lan/godot/README.md diff --git a/examples/multiplayer-lan/godot/README.md b/examples/multiplayer-lan/godot/README.md new file mode 100644 index 000000000..1ce568c67 --- /dev/null +++ b/examples/multiplayer-lan/godot/README.md @@ -0,0 +1,17 @@ +# Multiplayer Lan Example + +This is a sample multiplayer example showing off how to set up a lobby + dedicated server with godot-rust. + + + +Largely adapted from FinePointCGI's Godot multiplayer tutorial: + +[Basics Of Multiplayer In Godot 4! - YouTube](https://youtu.be/e0JLO_5UgQo?si=mHYry88uC8j4r2DM) + + + +To run as dedicated server, run the exported version of this game from the command line with the arguments ``--headless --server`` + + + + diff --git a/examples/multiplayer-lan/godot/export_presets.cfg b/examples/multiplayer-lan/godot/export_presets.cfg index a70011bfd..a5e396c96 100644 --- a/examples/multiplayer-lan/godot/export_presets.cfg +++ b/examples/multiplayer-lan/godot/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="build/multiplayer Lan Tutorial.exe" +export_path="../../../../build/multiplayer Lan Tutorial.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false diff --git a/examples/multiplayer-lan/godot/multiplayerScene.tscn b/examples/multiplayer-lan/godot/multiplayerScene.tscn index 7132fd43e..08c450843 100644 --- a/examples/multiplayer-lan/godot/multiplayerScene.tscn +++ b/examples/multiplayer-lan/godot/multiplayerScene.tscn @@ -13,49 +13,65 @@ grow_vertical = 2 [node name="HostButton" type="Button" parent="."] layout_mode = 0 offset_left = 74.0 -offset_top = 120.0 +offset_top = 163.0 offset_right = 251.0 -offset_bottom = 168.0 +offset_bottom = 211.0 text = "Host" [node name="JoinButton" type="Button" parent="."] layout_mode = 0 offset_left = 270.0 -offset_top = 120.0 +offset_top = 163.0 offset_right = 447.0 -offset_bottom = 168.0 +offset_bottom = 211.0 text = "Join" [node name="StartButton" type="Button" parent="."] layout_mode = 0 offset_left = 479.0 -offset_top = 120.0 +offset_top = 163.0 offset_right = 656.0 -offset_bottom = 168.0 +offset_bottom = 211.0 text = "Start Game" [node name="UsernameLineEdit" type="LineEdit" parent="."] layout_mode = 0 offset_left = 156.0 -offset_top = 68.0 +offset_top = 104.0 offset_right = 508.0 -offset_bottom = 99.0 +offset_bottom = 135.0 text = "Player" -[node name="Label" type="Label" parent="."] +[node name="UsernameLabel" type="Label" parent="."] layout_mode = 0 offset_left = 75.0 -offset_top = 70.0 -offset_right = 122.0 -offset_bottom = 96.0 -text = "Name" +offset_top = 106.0 +offset_right = 126.0 +offset_bottom = 132.0 +text = "Name:" + +[node name="AddressLineEdit" type="LineEdit" parent="."] +layout_mode = 0 +offset_left = 156.0 +offset_top = 55.0 +offset_right = 508.0 +offset_bottom = 86.0 +text = "127.0.0.1" + +[node name="AddressLabel" type="Label" parent="."] +layout_mode = 0 +offset_left = 75.0 +offset_top = 57.0 +offset_right = 142.0 +offset_bottom = 83.0 +text = "Address:" [node name="MultiplayerLog" type="RichTextLabel" parent="."] layout_mode = 0 offset_left = 66.0 -offset_top = 185.0 +offset_top = 228.0 offset_right = 705.0 -offset_bottom = 425.0 +offset_bottom = 468.0 [connection signal="button_down" from="HostButton" to="." method="_on_host_button_down"] [connection signal="button_down" from="JoinButton" to="." method="_on_join_button_down"] diff --git a/examples/multiplayer-lan/rust/src/multiplayer_controller.rs b/examples/multiplayer-lan/rust/src/multiplayer_controller.rs index 263187a84..f079188d3 100644 --- a/examples/multiplayer-lan/rust/src/multiplayer_controller.rs +++ b/examples/multiplayer-lan/rust/src/multiplayer_controller.rs @@ -192,6 +192,7 @@ impl MultiplayerController { .get_node_as::