multiplayer: added basic server and client functionality

This commit is contained in:
Simon Ward 2026-01-27 12:12:18 +13:00 committed by Jeremy Baxter
parent e16f87cbfa
commit f1a4ad761c
5 changed files with 138 additions and 6 deletions

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=16 format=3 uid="uid://eiaw4xbs3suk"]
[ext_resource type="Script" uid="uid://cnbm3aqyg0p2o" path="res://server.gd" id="1_5vw27"]
[ext_resource type="PackedScene" uid="uid://qb8cbljxgnub" path="res://world/killbrick.tscn" id="1_h2yge"]
[ext_resource type="PackedScene" uid="uid://cfceg80unq0pe" path="res://player/player.tscn" id="1_ig7tw"]
[ext_resource type="PackedScene" uid="uid://bcmrj6qkemrll" path="res://world/radiohead_cube.tscn" id="2_0xm2m"]
[ext_resource type="Texture2D" uid="uid://wdjmyv260he1" path="res://world/textures/grass.jpg" id="2_272bh"]
[ext_resource type="PackedScene" uid="uid://of6tq8gpjxtu" path="res://gears/gear_pickup.tscn" id="3_lquwl"]
@ -40,9 +40,7 @@ glow_hdr_luminance_cap = 0.0
[sub_resource type="Compositor" id="Compositor_5vw27"]
[node name="Main" type="Node3D"]
[node name="Player" parent="." instance=ExtResource("1_ig7tw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
script = ExtResource("1_5vw27")
[node name="Baseplate" type="StaticBody3D" parent="."]
@ -83,3 +81,45 @@ compositor = SubResource("Compositor_5vw27")
transform = Transform3D(0.70710665, 0.5, -0.5, 0, 0.7071067, 0.7071067, 0.7071069, -0.49999988, 0.49999988, -500, 200, 500)
light_color = Color(1, 0.87058824, 0.12941177, 1)
shadow_enabled = true
[node name="UI" type="CanvasLayer" parent="."]
[node name="Menu" type="Panel" parent="UI"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="UI/Menu"]
layout_mode = 0
offset_right = 1149.0
offset_bottom = 134.0
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
[node name="VBoxContainer" type="VBoxContainer" parent="UI/Menu/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="UI/Menu/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Menu
"
horizontal_alignment = 1
[node name="ServerButton2" type="Button" parent="UI/Menu/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Host
"
[node name="ClientButton" type="Button" parent="UI/Menu/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Join
"
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
_spawnable_scenes = PackedStringArray("uid://cfceg80unq0pe")
spawn_path = NodePath("..")
[connection signal="pressed" from="UI/Menu/MarginContainer/VBoxContainer/ServerButton2" to="." method="_on_server_button_pressed"]
[connection signal="pressed" from="UI/Menu/MarginContainer/VBoxContainer/ClientButton" to="." method="_on_client_button_pressed"]