diff --git a/client/network/Client.gd b/client/network/Client.gd index 4cbe7b4..994fa30 100644 --- a/client/network/Client.gd +++ b/client/network/Client.gd @@ -1,7 +1,7 @@ extends NetworkNode -@export var host: String -@export var port: int +@export var host := "127.0.0.1" +@export var port := 4242 signal download_changed(down: int) signal upload_changed(up: int) diff --git a/client/network/Login.gd b/client/network/Login.gd index 3bcc687..80d30ab 100644 --- a/client/network/Login.gd +++ b/client/network/Login.gd @@ -23,6 +23,7 @@ func handle_packet(data: PackedByteArray, _peer: PacketPeer): print("[%s] Auth token: %s" % [Global.username, auth_token]) DisplayServer.window_set_title("%s - %s" % [Global.username, Global.account_id]) + DisplayServer.window_set_position(Vector2((Global.instance_id % 2) * 960, (Global.instance_id / 2 % 2) * 540)) func send_login(): if is_logged_in(): diff --git a/client/project.godot b/client/project.godot index 967aa24..5213f76 100644 --- a/client/project.godot +++ b/client/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Client" -run/main_scene="res://world/Client.tscn" +run/main_scene="res://world/Main.tscn" config/features=PackedStringArray("4.2", "Forward Plus") config/icon="res://ui/icon.svg" @@ -19,6 +19,10 @@ config/icon="res://ui/icon.svg" Global="*res://Global.gd" +[debug] + +gdscript/warnings/integer_division=0 + [display] window/size/viewport_width=960 diff --git a/client/ui/UI.tscn b/client/ui/UI.tscn index f988407..80fae70 100644 --- a/client/ui/UI.tscn +++ b/client/ui/UI.tscn @@ -16,22 +16,22 @@ script = ExtResource("1_l5b6o") [node name="CanvasLayer" type="CanvasLayer" parent="."] -[node name="TopLeftMargin" type="MarginContainer" parent="CanvasLayer"] +[node name="TopLeft" type="MarginContainer" parent="CanvasLayer"] offset_right = 40.0 offset_bottom = 50.0 -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/TopLeftMargin"] +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/TopLeft"] layout_mode = 2 -[node name="FPS" parent="CanvasLayer/TopLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] +[node name="FPS" parent="CanvasLayer/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")] layout_mode = 2 script = ExtResource("2_i200p") -[node name="Ping" parent="CanvasLayer/TopLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] +[node name="Ping" parent="CanvasLayer/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")] layout_mode = 2 script = ExtResource("3_xjdws") -[node name="BottomLeftMargin" type="MarginContainer" parent="CanvasLayer"] +[node name="BottomLeft" type="MarginContainer" parent="CanvasLayer"] anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 @@ -39,21 +39,39 @@ offset_top = -10.0 offset_right = 10.0 grow_vertical = 0 -[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/BottomLeftMargin"] +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/BottomLeft"] layout_mode = 2 +alignment = 2 -[node name="Position" parent="CanvasLayer/BottomLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] -layout_mode = 2 -script = ExtResource("4_beqf6") - -[node name="Velocity" parent="CanvasLayer/BottomLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] -layout_mode = 2 -script = ExtResource("5_8lm6a") - -[node name="Send" parent="CanvasLayer/BottomLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] +[node name="Send" parent="CanvasLayer/BottomLeft/VBoxContainer" instance=ExtResource("1_7s8uu")] layout_mode = 2 script = ExtResource("7_cfnpx") -[node name="Receive" parent="CanvasLayer/BottomLeftMargin/VBoxContainer" instance=ExtResource("1_7s8uu")] +[node name="Receive" parent="CanvasLayer/BottomLeft/VBoxContainer" instance=ExtResource("1_7s8uu")] layout_mode = 2 script = ExtResource("8_ogt38") + +[node name="BottomRight" type="MarginContainer" parent="CanvasLayer"] +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -79.0 +offset_top = -102.0 +grow_horizontal = 0 +grow_vertical = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/BottomRight"] +layout_mode = 2 +alignment = 2 + +[node name="Position" parent="CanvasLayer/BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")] +layout_mode = 2 +alignment = 2 +script = ExtResource("4_beqf6") + +[node name="Velocity" parent="CanvasLayer/BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")] +layout_mode = 2 +alignment = 2 +script = ExtResource("5_8lm6a") diff --git a/client/world/Client.tscn b/client/world/Main.tscn similarity index 73% rename from client/world/Client.tscn rename to client/world/Main.tscn index 58e32c8..099769f 100644 --- a/client/world/Client.tscn +++ b/client/world/Main.tscn @@ -1,39 +1,37 @@ [gd_scene load_steps=18 format=3 uid="uid://b40y7iuskv1ar"] -[ext_resource type="Script" path="res://Game.gd" id="1_pux6q"] -[ext_resource type="Script" path="res://network/Client.gd" id="2_1ofik"] -[ext_resource type="Script" path="res://network/Ping.gd" id="3_4h5la"] -[ext_resource type="Script" path="res://network/Login.gd" id="4_k8n1i"] -[ext_resource type="Script" path="res://network/PlayerAdd.gd" id="5_1dcs7"] -[ext_resource type="PackedScene" uid="uid://2lcnu3dy54lx" path="res://player/Player.tscn" id="5_22pku"] -[ext_resource type="Script" path="res://network/PlayerMove.gd" id="7_rjgcp"] -[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="8_5uta8"] -[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://camera/CameraAttributes.tres" id="9_w4cdu"] -[ext_resource type="PackedScene" uid="uid://tgmbtt7u172g" path="res://world/Arena.blend" id="10_cje7b"] -[ext_resource type="Script" path="res://world/Sun.gd" id="10_mlmor"] -[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://world/Tree.blend" id="11_wlyv1"] -[ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="12_6yrwn"] -[ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="13_s76b0"] -[ext_resource type="Script" path="res://camera/Camera.gd" id="13_y4waa"] -[ext_resource type="Material" uid="uid://ddy5gkw0k16dq" path="res://shader/OutlineMaterial.tres" id="14_hobco"] +[ext_resource type="Script" path="res://Game.gd" id="1_uxop2"] +[ext_resource type="Script" path="res://network/Client.gd" id="2_00qe8"] +[ext_resource type="Script" path="res://network/Ping.gd" id="3_fd082"] +[ext_resource type="Script" path="res://network/Login.gd" id="4_0illd"] +[ext_resource type="Script" path="res://network/PlayerAdd.gd" id="5_sd8xh"] +[ext_resource type="PackedScene" uid="uid://2lcnu3dy54lx" path="res://player/Player.tscn" id="6_jxdko"] +[ext_resource type="Script" path="res://network/PlayerMove.gd" id="7_6xfox"] +[ext_resource type="Script" path="res://world/Sun.gd" id="8_leyo3"] +[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="9_4u3r5"] +[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://camera/CameraAttributes.tres" id="10_4uslp"] +[ext_resource type="PackedScene" uid="uid://tgmbtt7u172g" path="res://world/Arena.blend" id="11_ffpbh"] +[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://world/Tree.blend" id="12_x8kho"] +[ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="13_hdbbd"] +[ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="14_ofk4r"] +[ext_resource type="Script" path="res://camera/Camera.gd" id="15_ym3qc"] +[ext_resource type="Material" uid="uid://ddy5gkw0k16dq" path="res://shader/OutlineMaterial.tres" id="16_srvfy"] [sub_resource type="QuadMesh" id="QuadMesh_7yiqd"] -material = ExtResource("14_hobco") +material = ExtResource("16_srvfy") flip_faces = true size = Vector2(2, 2) [node name="Main" type="Node"] -script = ExtResource("1_pux6q") +script = ExtResource("1_uxop2") [node name="Client" type="Node" parent="."] unique_name_in_owner = true -script = ExtResource("2_1ofik") -host = "127.0.0.1" -port = 4242 +script = ExtResource("2_00qe8") [node name="Ping" type="Node" parent="Client"] unique_name_in_owner = true -script = ExtResource("3_4h5la") +script = ExtResource("3_fd082") packet_type = 1 [node name="Timer" type="Timer" parent="Client/Ping"] @@ -41,7 +39,7 @@ autostart = true [node name="Login" type="Node" parent="Client"] unique_name_in_owner = true -script = ExtResource("4_k8n1i") +script = ExtResource("4_0illd") packet_type = 2 [node name="Timer" type="Timer" parent="Client/Login"] @@ -49,12 +47,12 @@ wait_time = 5.0 autostart = true [node name="PlayerAdd" type="Node" parent="Client"] -script = ExtResource("5_1dcs7") -player_scene = ExtResource("5_22pku") +script = ExtResource("5_sd8xh") +player_scene = ExtResource("6_jxdko") packet_type = 10 [node name="PlayerMove" type="Node" parent="Client"] -script = ExtResource("7_rjgcp") +script = ExtResource("7_6xfox") packet_type = 12 [node name="Statistics" type="Timer" parent="Client"] @@ -66,37 +64,37 @@ autostart = true transform = Transform3D(0.984808, 0.122788, -0.122788, 0, 0.707107, 0.707107, 0.173648, -0.696364, 0.696364, 0, 10, 0) shadow_enabled = true directional_shadow_mode = 0 -script = ExtResource("10_mlmor") +script = ExtResource("8_leyo3") [node name="Environment" type="WorldEnvironment" parent="World"] -environment = ExtResource("8_5uta8") -camera_attributes = ExtResource("9_w4cdu") +environment = ExtResource("9_4u3r5") +camera_attributes = ExtResource("10_4uslp") -[node name="Arena" parent="World" instance=ExtResource("10_cje7b")] +[node name="Arena" parent="World" instance=ExtResource("11_ffpbh")] [node name="Trees" type="Node3D" parent="World"] -[node name="Tree" parent="World/Trees" instance=ExtResource("11_wlyv1")] +[node name="Tree" parent="World/Trees" instance=ExtResource("12_x8kho")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.11323, 0, -7.57074) -[node name="Tree2" parent="World/Trees" instance=ExtResource("11_wlyv1")] +[node name="Tree2" parent="World/Trees" instance=ExtResource("12_x8kho")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.11323, 0, 7.80548) [node name="Enemies" type="Node3D" parent="World"] -[node name="Slime" parent="World/Enemies" instance=ExtResource("12_6yrwn")] +[node name="Slime" parent="World/Enemies" instance=ExtResource("13_hdbbd")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.53558, 1.28057, -3.79687) -[node name="Slime2" parent="World/Enemies" instance=ExtResource("12_6yrwn")] +[node name="Slime2" parent="World/Enemies" instance=ExtResource("13_hdbbd")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.00829, 1.28057, -1.95247) -[node name="Slime3" parent="World/Enemies" instance=ExtResource("12_6yrwn")] +[node name="Slime3" parent="World/Enemies" instance=ExtResource("13_hdbbd")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.53558, 1.28057, -0.306177) [node name="Players" type="Node3D" parent="."] unique_name_in_owner = true -[node name="UI" parent="." instance=ExtResource("13_s76b0")] +[node name="UI" parent="." instance=ExtResource("14_ofk4r")] [node name="Viewport" type="SubViewportContainer" parent="."] texture_filter = 1 @@ -121,7 +119,7 @@ current = true fov = 90.0 size = 10.0 far = 100.0 -script = ExtResource("13_y4waa") +script = ExtResource("15_ym3qc") center = NodePath("..") follow_speed = 5.0