Improved performance
This commit is contained in:
parent
cb066f409a
commit
2bc4200f5b
@ -1,11 +1,13 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
func _ready():
|
@export var ui: UIManager
|
||||||
|
|
||||||
|
func _enter_tree():
|
||||||
|
connect_main()
|
||||||
|
connect_ui()
|
||||||
pause(true)
|
pause(true)
|
||||||
|
|
||||||
%Login.success.connect(on_login)
|
func _ready():
|
||||||
%Logout.success.connect(on_logout)
|
|
||||||
|
|
||||||
var args := OS.get_cmdline_args()
|
var args := OS.get_cmdline_args()
|
||||||
var offline := args.has("--offline")
|
var offline := args.has("--offline")
|
||||||
|
|
||||||
@ -24,16 +26,16 @@ func _input(event):
|
|||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
func on_login():
|
func on_login():
|
||||||
print("[%s] Login succeeded." % Global.account.name)
|
%Client.log("Login succeeded.")
|
||||||
print("[%s] ID: %s" % [Global.account.name, Global.account.id])
|
%Client.log("ID: %s" % Global.account.id)
|
||||||
print("[%s] Auth token: %s" % [Global.account.name, Global.account.auth_token])
|
%Client.log("Auth token: %s" % Global.account.auth_token)
|
||||||
|
|
||||||
DisplayServer.window_set_title("%s - %s" % [Global.account.name, Global.account.id])
|
DisplayServer.window_set_title("%s - %s" % [Global.account.name, Global.account.id])
|
||||||
DisplayServer.window_set_position(Vector2((Global.instance_id % 2) * 960, (Global.instance_id / 2 % 2) * 540))
|
DisplayServer.window_set_position(Vector2((Global.instance_id % 2) * 960, (Global.instance_id / 2 % 2) * 540))
|
||||||
pause(false)
|
pause(false)
|
||||||
|
|
||||||
func on_logout():
|
func on_logout():
|
||||||
print("[%s] Logout." % Global.account.name)
|
%Client.log("[%s] Logout." % Global.account.name)
|
||||||
pause(true)
|
pause(true)
|
||||||
|
|
||||||
func pause(enabled: bool):
|
func pause(enabled: bool):
|
||||||
@ -44,6 +46,18 @@ func mute_audio(enabled: bool):
|
|||||||
var master_sound = AudioServer.get_bus_index("Master")
|
var master_sound = AudioServer.get_bus_index("Master")
|
||||||
AudioServer.set_bus_mute(master_sound, enabled)
|
AudioServer.set_bus_mute(master_sound, enabled)
|
||||||
|
|
||||||
|
func connect_main():
|
||||||
|
%Login.success.connect(on_login)
|
||||||
|
%Logout.success.connect(on_logout)
|
||||||
|
|
||||||
|
func connect_ui():
|
||||||
|
ui.login = %Login.success
|
||||||
|
ui.logout = %Logout.success
|
||||||
|
ui.ping_changed = %Ping.changed
|
||||||
|
ui.download_changed = %Client.download_changed
|
||||||
|
ui.upload_changed = %Client.upload_changed
|
||||||
|
ui.message_received = %Chat.message_received
|
||||||
|
|
||||||
func toggle_fullscreen():
|
func toggle_fullscreen():
|
||||||
var mode = DisplayServer.window_get_mode()
|
var mode = DisplayServer.window_get_mode()
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=29 format=3 uid="uid://b40y7iuskv1ar"]
|
[gd_scene load_steps=30 format=3 uid="uid://b40y7iuskv1ar"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Main.gd" id="1_cw3ws"]
|
[ext_resource type="Script" path="res://Main.gd" id="1_cw3ws"]
|
||||||
[ext_resource type="Script" path="res://network/Client.gd" id="2_8hxcx"]
|
[ext_resource type="Script" path="res://network/Client.gd" id="2_8hxcx"]
|
||||||
@ -14,23 +14,16 @@
|
|||||||
[ext_resource type="Script" path="res://world/Sun.gd" id="11_4jb08"]
|
[ext_resource type="Script" path="res://world/Sun.gd" id="11_4jb08"]
|
||||||
[ext_resource type="Script" path="res://network/PlayerUseSkill.gd" id="11_gyiep"]
|
[ext_resource type="Script" path="res://network/PlayerUseSkill.gd" id="11_gyiep"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cpdoq0oh84mfw" path="res://camera/Camera.tscn" id="12_aljdh"]
|
[ext_resource type="PackedScene" uid="uid://cpdoq0oh84mfw" path="res://camera/Camera.tscn" id="12_aljdh"]
|
||||||
[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="12_cscto"]
|
[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="14_kuej8"]
|
||||||
[ext_resource type="Script" path="res://world/Generate.gd" id="15_25nmg"]
|
[ext_resource type="Script" path="res://world/Generate.gd" id="15_25nmg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="15_hgl78"]
|
[ext_resource type="PackedScene" uid="uid://cb2t7bvvf3gwh" path="res://enemy/slime/Slime.tscn" id="15_hgl78"]
|
||||||
[ext_resource type="Script" path="res://world/PlayerManager.gd" id="16_dp6bj"]
|
[ext_resource type="Script" path="res://world/PlayerManager.gd" id="16_dp6bj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="17_43qhq"]
|
[ext_resource type="PackedScene" uid="uid://dagn5bf7ou3sd" path="res://ui/UI.tscn" id="17_43qhq"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://assets/tree/Tree.blend" id="18_6ab5t"]
|
||||||
[ext_resource type="Material" uid="uid://bdsblfaxbipaa" path="res://world/grass/GrassMaterial.tres" id="18_tja64"]
|
[ext_resource type="Material" uid="uid://bdsblfaxbipaa" path="res://world/grass/GrassMaterial.tres" id="18_tja64"]
|
||||||
[ext_resource type="MultiMesh" uid="uid://dog5aq5n2q025" path="res://assets/grass/grass.multimesh" id="19_ae26a"]
|
[ext_resource type="MultiMesh" uid="uid://dog5aq5n2q025" path="res://assets/grass/grass.multimesh" id="19_ae26a"]
|
||||||
|
[ext_resource type="FastNoiseLite" uid="uid://d3f4lk8q04haa" path="res://world/trees/TreeNoise.tres" id="19_ctwmw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://djilgnhedvmtm" path="res://world/house/House.tscn" id="20_xjraj"]
|
[ext_resource type="PackedScene" uid="uid://djilgnhedvmtm" path="res://world/house/House.tscn" id="20_xjraj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cuuwwdce1u8n8" path="res://world/trees/Sapling.tscn" id="22_5yt7w"]
|
|
||||||
|
|
||||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_ql20k"]
|
|
||||||
seed = 1337
|
|
||||||
frequency = 0.05
|
|
||||||
|
|
||||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_yp2fx"]
|
|
||||||
seed = 100
|
|
||||||
frequency = 0.1
|
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_he5c5"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_he5c5"]
|
||||||
diffuse_mode = 3
|
diffuse_mode = 3
|
||||||
@ -43,8 +36,16 @@ size = Vector2(1, 1)
|
|||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_yg2lt"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_yg2lt"]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_xy4ll"]
|
||||||
|
seed = 300
|
||||||
|
|
||||||
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_yp2fx"]
|
||||||
|
seed = 100
|
||||||
|
frequency = 0.1
|
||||||
|
|
||||||
|
[node name="Main" type="Node" node_paths=PackedStringArray("ui")]
|
||||||
script = ExtResource("1_cw3ws")
|
script = ExtResource("1_cw3ws")
|
||||||
|
ui = NodePath("UI")
|
||||||
|
|
||||||
[node name="Client" type="Node" parent="."]
|
[node name="Client" type="Node" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -105,10 +106,8 @@ autostart = true
|
|||||||
|
|
||||||
[node name="World" type="Node3D" parent="."]
|
[node name="World" type="Node3D" parent="."]
|
||||||
|
|
||||||
[node name="Follow" parent="World" instance=ExtResource("12_aljdh")]
|
|
||||||
|
|
||||||
[node name="Environment" type="WorldEnvironment" parent="World"]
|
[node name="Environment" type="WorldEnvironment" parent="World"]
|
||||||
environment = ExtResource("12_cscto")
|
environment = ExtResource("14_kuej8")
|
||||||
|
|
||||||
[node name="Sun" type="DirectionalLight3D" parent="World/Environment"]
|
[node name="Sun" type="DirectionalLight3D" parent="World/Environment"]
|
||||||
transform = Transform3D(-0.350207, 0.827032, -0.439741, 0, 0.469472, 0.882948, 0.936672, 0.309215, -0.164412, 0, 3, 0)
|
transform = Transform3D(-0.350207, 0.827032, -0.439741, 0, 0.469472, 0.882948, 0.936672, 0.309215, -0.164412, 0, 3, 0)
|
||||||
@ -116,30 +115,6 @@ light_energy = 1.8
|
|||||||
shadow_enabled = true
|
shadow_enabled = true
|
||||||
script = ExtResource("11_4jb08")
|
script = ExtResource("11_4jb08")
|
||||||
|
|
||||||
[node name="Trees" type="Node3D" parent="World"]
|
|
||||||
script = ExtResource("15_25nmg")
|
|
||||||
scene = ExtResource("22_5yt7w")
|
|
||||||
noise = SubResource("FastNoiseLite_ql20k")
|
|
||||||
size_x = 100.0
|
|
||||||
size_z = 100.0
|
|
||||||
step = 5.0
|
|
||||||
density = 0.3
|
|
||||||
|
|
||||||
[node name="Enemies" type="Node3D" parent="World"]
|
|
||||||
script = ExtResource("15_25nmg")
|
|
||||||
scene = ExtResource("15_hgl78")
|
|
||||||
noise = SubResource("FastNoiseLite_yp2fx")
|
|
||||||
size_x = 100.0
|
|
||||||
size_z = 100.0
|
|
||||||
step = 2.0
|
|
||||||
density = 0.3
|
|
||||||
|
|
||||||
[node name="Grass" type="MultiMeshInstance3D" parent="World"]
|
|
||||||
layers = 2
|
|
||||||
material_override = ExtResource("18_tja64")
|
|
||||||
cast_shadow = 0
|
|
||||||
multimesh = ExtResource("19_ae26a")
|
|
||||||
|
|
||||||
[node name="Floor" type="MeshInstance3D" parent="World"]
|
[node name="Floor" type="MeshInstance3D" parent="World"]
|
||||||
transform = Transform3D(1000, 0, 0, 0, 1000, 0, 0, 0, 1000, 0, 0, 0)
|
transform = Transform3D(1000, 0, 0, 0, 1000, 0, 0, 0, 1000, 0, 0, 0)
|
||||||
mesh = SubResource("PlaneMesh_lb6xk")
|
mesh = SubResource("PlaneMesh_lb6xk")
|
||||||
@ -150,8 +125,41 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
|
|||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Floor/StaticBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="World/Floor/StaticBody3D"]
|
||||||
shape = SubResource("BoxShape3D_yg2lt")
|
shape = SubResource("BoxShape3D_yg2lt")
|
||||||
|
|
||||||
[node name="House" parent="World" instance=ExtResource("20_xjraj")]
|
[node name="Grass" type="MultiMeshInstance3D" parent="World"]
|
||||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, -6, 0, -6)
|
layers = 2
|
||||||
|
material_override = ExtResource("18_tja64")
|
||||||
|
cast_shadow = 0
|
||||||
|
multimesh = ExtResource("19_ae26a")
|
||||||
|
|
||||||
|
[node name="Houses" type="Node3D" parent="World"]
|
||||||
|
script = ExtResource("15_25nmg")
|
||||||
|
scene = ExtResource("20_xjraj")
|
||||||
|
noise = SubResource("FastNoiseLite_xy4ll")
|
||||||
|
size_x = 100.0
|
||||||
|
size_z = 100.0
|
||||||
|
step = 10.0
|
||||||
|
density = 0.3
|
||||||
|
position_randomness = 0.0
|
||||||
|
|
||||||
|
[node name="Trees" type="Node3D" parent="World"]
|
||||||
|
script = ExtResource("15_25nmg")
|
||||||
|
scene = ExtResource("18_6ab5t")
|
||||||
|
noise = ExtResource("19_ctwmw")
|
||||||
|
size_x = 100.0
|
||||||
|
size_z = 100.0
|
||||||
|
step = 5.0
|
||||||
|
density = 0.4
|
||||||
|
|
||||||
|
[node name="Enemies" type="Node3D" parent="World"]
|
||||||
|
script = ExtResource("15_25nmg")
|
||||||
|
scene = ExtResource("15_hgl78")
|
||||||
|
noise = SubResource("FastNoiseLite_yp2fx")
|
||||||
|
size_x = 100.0
|
||||||
|
size_z = 100.0
|
||||||
|
step = 2.0
|
||||||
|
density = 0.25
|
||||||
|
|
||||||
|
[node name="Follow" parent="World" instance=ExtResource("12_aljdh")]
|
||||||
|
|
||||||
[node name="Players" type="Node3D" parent="."]
|
[node name="Players" type="Node3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -163,4 +171,3 @@ process_mode = 3
|
|||||||
[connection signal="timeout" from="Client/Ping/Timer" to="Client/Ping" method="send_ping"]
|
[connection signal="timeout" from="Client/Ping/Timer" to="Client/Ping" method="send_ping"]
|
||||||
[connection signal="timeout" from="Client/Login/Timer" to="Client/Login" method="send_login"]
|
[connection signal="timeout" from="Client/Login/Timer" to="Client/Login" method="send_login"]
|
||||||
[connection signal="timeout" from="Client/Statistics" to="Client" method="update_statistics"]
|
[connection signal="timeout" from="Client/Statistics" to="Client" method="update_statistics"]
|
||||||
[connection signal="chat_message_submitted" from="UI" to="Client/Chat" method="send_message"]
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
[ext_resource type="Script" path="res://Start.gd" id="1_8y1vx"]
|
[ext_resource type="Script" path="res://Start.gd" id="1_8y1vx"]
|
||||||
|
|
||||||
[node name="Start" type="CanvasLayer" node_paths=PackedStringArray("progress_bar", "modulate")]
|
[node name="Start" type="CanvasLayer" node_paths=PackedStringArray("progress_bar", "modulate")]
|
||||||
|
layer = 128
|
||||||
script = ExtResource("1_8y1vx")
|
script = ExtResource("1_8y1vx")
|
||||||
scene_path = "Main.tscn"
|
scene_path = "Main.tscn"
|
||||||
progress_bar = NodePath("MarginContainer/Progress")
|
progress_bar = NodePath("MarginContainer/Progress")
|
||||||
|
@ -70,30 +70,34 @@ script = ExtResource("1_8gebs")
|
|||||||
[node name="Armature" parent="Model/Female" index="0"]
|
[node name="Armature" parent="Model/Female" index="0"]
|
||||||
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.000305099, -0.000408816)
|
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.000305099, -0.000408816)
|
||||||
|
|
||||||
|
[node name="Body" parent="Model/Female/Armature/GeneralSkeleton" index="0"]
|
||||||
|
|
||||||
[node name="Chest" parent="Model/Female/Armature/GeneralSkeleton" index="1"]
|
[node name="Chest" parent="Model/Female/Armature/GeneralSkeleton" index="1"]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="2"]
|
[node name="Face" parent="Model/Female/Armature/GeneralSkeleton" index="2"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.57651e-10, 1.37156, -0.0247111)
|
|
||||||
bone_name = "Head"
|
|
||||||
bone_idx = 12
|
|
||||||
|
|
||||||
[node name="PonyTail" parent="Model/Female/Armature/GeneralSkeleton/BoneAttachment3D" instance=ExtResource("3_umw6q")]
|
[node name="Hips" parent="Model/Female/Armature/GeneralSkeleton" index="3"]
|
||||||
|
|
||||||
[node name="Hips" parent="Model/Female/Armature/GeneralSkeleton" index="4"]
|
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="Hoodie" type="MeshInstance3D" parent="Model/Female/Armature/GeneralSkeleton" index="5"]
|
[node name="Hoodie" type="MeshInstance3D" parent="Model/Female/Armature/GeneralSkeleton" index="4"]
|
||||||
layers = 512
|
layers = 512
|
||||||
mesh = ExtResource("5_mkrgn")
|
mesh = ExtResource("5_mkrgn")
|
||||||
skin = ExtResource("4_b1tg1")
|
skin = ExtResource("4_b1tg1")
|
||||||
|
|
||||||
[node name="BoneAttachment3D2" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="6"]
|
[node name="Hair" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="5"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.57651e-10, 1.37156, -0.0247111)
|
||||||
|
bone_name = "Head"
|
||||||
|
bone_idx = 12
|
||||||
|
|
||||||
|
[node name="PonyTail" parent="Model/Female/Armature/GeneralSkeleton/Hair" instance=ExtResource("3_umw6q")]
|
||||||
|
|
||||||
|
[node name="Weapon" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="6"]
|
||||||
transform = Transform3D(0, -1, 0, 0, 0, -1, 1, 0, 0, -0.609469, 1.26691, -0.0234125)
|
transform = Transform3D(0, -1, 0, 0, 0, -1, 1, 0, 0, -0.609469, 1.26691, -0.0234125)
|
||||||
bone_name = "RightMiddleProximal"
|
bone_name = "RightMiddleProximal"
|
||||||
bone_idx = 44
|
bone_idx = 44
|
||||||
|
|
||||||
[node name="Heirloom" parent="Model/Female/Armature/GeneralSkeleton/BoneAttachment3D2" instance=ExtResource("7_u8433")]
|
[node name="Heirloom" parent="Model/Female/Armature/GeneralSkeleton/Weapon" instance=ExtResource("7_u8433")]
|
||||||
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0.197644, 0, 0)
|
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0.197644, 0, 0)
|
||||||
|
|
||||||
[node name="Collision" type="CollisionShape3D" parent="."]
|
[node name="Collision" type="CollisionShape3D" parent="."]
|
||||||
|
@ -31,12 +31,17 @@ gdscript/warnings/integer_division=0
|
|||||||
|
|
||||||
window/size/viewport_width=1920
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=1080
|
||||||
|
window/size/mode=3
|
||||||
window/size/window_width_override=960
|
window/size/window_width_override=960
|
||||||
window/size/window_height_override=540
|
window/size/window_height_override=540
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
window/vsync/vsync_mode=0
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
|
[editor]
|
||||||
|
|
||||||
|
run/main_run_args="--offline"
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
|
|
||||||
theme/custom="res://ui/theme/theme.tres"
|
theme/custom="res://ui/theme/theme.tres"
|
||||||
|
83
client/test/multimeshgrid/Generate.gd
Normal file
83
client/test/multimeshgrid/Generate.gd
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
@export var tree: Mesh
|
||||||
|
@export var leaves: Mesh
|
||||||
|
@export var noise: Noise
|
||||||
|
@export var size_x: float
|
||||||
|
@export var size_z: float
|
||||||
|
@export var step: float = 1
|
||||||
|
@export var density: float
|
||||||
|
@export var position_randomness := 1.0
|
||||||
|
|
||||||
|
const TILE_SIZE := 10
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if !visible:
|
||||||
|
return
|
||||||
|
|
||||||
|
var total_count := 0
|
||||||
|
var tile_count := 0
|
||||||
|
|
||||||
|
var old_tile_x := NAN
|
||||||
|
var old_tile_z := NAN
|
||||||
|
|
||||||
|
var offsets: Array[Vector3] = []
|
||||||
|
|
||||||
|
for x in range(-size_x, size_x, step):
|
||||||
|
for z in range(-size_z, size_z, step):
|
||||||
|
if noise.get_noise_2d(x, z) < 1 - density * 2:
|
||||||
|
continue
|
||||||
|
|
||||||
|
var tile_x := x / TILE_SIZE
|
||||||
|
var tile_z := z / TILE_SIZE
|
||||||
|
|
||||||
|
if tile_x != old_tile_x || tile_z != old_tile_z:
|
||||||
|
if tile_count > 0:
|
||||||
|
var tile := make_tile(old_tile_x, old_tile_z)
|
||||||
|
tile.multimesh.instance_count = tile_count
|
||||||
|
tile.multimesh.visible_instance_count = tile_count
|
||||||
|
|
||||||
|
for i in range(tile_count):
|
||||||
|
tile.multimesh.set_instance_transform(i, Transform3D(Basis(), offsets[i] - tile.position))
|
||||||
|
|
||||||
|
add_child(tile)
|
||||||
|
|
||||||
|
var tile2 := make_tile(old_tile_x, old_tile_z)
|
||||||
|
tile2.multimesh.mesh = leaves
|
||||||
|
tile2.multimesh.instance_count = tile_count
|
||||||
|
tile2.multimesh.visible_instance_count = tile_count
|
||||||
|
|
||||||
|
for i in range(tile_count):
|
||||||
|
tile2.multimesh.set_instance_transform(i, Transform3D(Basis(), offsets[i] - tile.position))
|
||||||
|
|
||||||
|
add_child(tile2)
|
||||||
|
|
||||||
|
tile_count = 0
|
||||||
|
offsets.resize(0)
|
||||||
|
|
||||||
|
old_tile_x = tile_x
|
||||||
|
old_tile_z = tile_z
|
||||||
|
|
||||||
|
var offset := Vector3.ZERO
|
||||||
|
offset.x = x + (randf() - 0.5) * position_randomness
|
||||||
|
offset.z = z + (randf() - 0.5) * position_randomness
|
||||||
|
offsets.append(offset)
|
||||||
|
|
||||||
|
tile_count += 1
|
||||||
|
total_count += 1
|
||||||
|
|
||||||
|
print("Generated %d trees" % total_count)
|
||||||
|
|
||||||
|
func make_tile(x, z) -> MultiMeshInstance3D:
|
||||||
|
prints("Tile:", x * TILE_SIZE, z * TILE_SIZE)
|
||||||
|
|
||||||
|
var instance := MultiMeshInstance3D.new()
|
||||||
|
instance.multimesh = MultiMesh.new()
|
||||||
|
instance.multimesh.mesh = tree
|
||||||
|
instance.multimesh.transform_format = MultiMesh.TRANSFORM_3D
|
||||||
|
|
||||||
|
var safe_area := Vector3(0, 0, 0)
|
||||||
|
instance.position = Vector3(x * TILE_SIZE, 0, z * TILE_SIZE)
|
||||||
|
instance.custom_aabb.position = -safe_area
|
||||||
|
instance.custom_aabb.size = Vector3(TILE_SIZE, 30, TILE_SIZE) + safe_area * 2
|
||||||
|
return instance
|
@ -1,5 +1,5 @@
|
|||||||
class_name UIManager
|
class_name UIManager
|
||||||
extends Control
|
extends Node
|
||||||
|
|
||||||
signal chat_message_submitted(message: String)
|
signal chat_message_submitted(message: String)
|
||||||
|
|
||||||
@ -11,19 +11,9 @@ signal chat_message_submitted(message: String)
|
|||||||
@export var message_received: Signal
|
@export var message_received: Signal
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
if get_node_or_null("/root/Main"):
|
if !get_node_or_null("/root/Main"):
|
||||||
connect_main_scene()
|
|
||||||
else:
|
|
||||||
connect_fake()
|
connect_fake()
|
||||||
|
|
||||||
func connect_main_scene():
|
|
||||||
login = %Login.success
|
|
||||||
logout = %Logout.success
|
|
||||||
ping_changed = %Ping.changed
|
|
||||||
download_changed = %Client.download_changed
|
|
||||||
upload_changed = %Client.upload_changed
|
|
||||||
message_received = %Chat.message_received
|
|
||||||
|
|
||||||
func connect_fake():
|
func connect_fake():
|
||||||
for property in get_property_list():
|
for property in get_property_list():
|
||||||
if property.type != TYPE_SIGNAL:
|
if property.type != TYPE_SIGNAL:
|
||||||
|
@ -16,25 +16,21 @@
|
|||||||
[ext_resource type="Script" path="res://ui/debug/StateLabel.gd" id="12_rr0mv"]
|
[ext_resource type="Script" path="res://ui/debug/StateLabel.gd" id="12_rr0mv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://y6kdpmp5glv0" path="res://ui/inventory/Inventory.tscn" id="13_1fc2b"]
|
[ext_resource type="PackedScene" uid="uid://y6kdpmp5glv0" path="res://ui/inventory/Inventory.tscn" id="13_1fc2b"]
|
||||||
|
|
||||||
[node name="UI" type="Control"]
|
[node name="UI" type="CanvasLayer"]
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 0
|
|
||||||
script = ExtResource("1_l5b6o")
|
script = ExtResource("1_l5b6o")
|
||||||
|
|
||||||
[node name="Canvas" type="CanvasLayer" parent="."]
|
[node name="TopLeft" type="MarginContainer" parent="."]
|
||||||
|
|
||||||
[node name="TopLeft" type="MarginContainer" parent="Canvas"]
|
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 50.0
|
offset_bottom = 50.0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Canvas/TopLeft"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="TopLeft"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="FPS" parent="Canvas/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="FPS" parent="TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("2_i200p")
|
script = ExtResource("2_i200p")
|
||||||
|
|
||||||
[node name="Process" parent="Canvas/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Process" parent="TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("5_ab7ln")
|
script = ExtResource("5_ab7ln")
|
||||||
monitor = 1
|
monitor = 1
|
||||||
@ -42,7 +38,7 @@ multiply = 1000.0
|
|||||||
precision = 0.1
|
precision = 0.1
|
||||||
suffix = " ms"
|
suffix = " ms"
|
||||||
|
|
||||||
[node name="Physics" parent="Canvas/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Physics" parent="TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("5_ab7ln")
|
script = ExtResource("5_ab7ln")
|
||||||
monitor = 2
|
monitor = 2
|
||||||
@ -50,7 +46,7 @@ multiply = 1000.0
|
|||||||
precision = 0.1
|
precision = 0.1
|
||||||
suffix = " ms"
|
suffix = " ms"
|
||||||
|
|
||||||
[node name="Draw calls" parent="Canvas/TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Draw calls" parent="TopLeft/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("5_ab7ln")
|
script = ExtResource("5_ab7ln")
|
||||||
monitor = 13
|
monitor = 13
|
||||||
@ -58,7 +54,7 @@ multiply = 1.0
|
|||||||
precision = 1.0
|
precision = 1.0
|
||||||
suffix = ""
|
suffix = ""
|
||||||
|
|
||||||
[node name="BottomLeft" type="MarginContainer" parent="Canvas"]
|
[node name="BottomLeft" type="MarginContainer" parent="."]
|
||||||
anchors_preset = 2
|
anchors_preset = 2
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
@ -66,22 +62,22 @@ offset_top = -134.0
|
|||||||
offset_right = 263.0
|
offset_right = 263.0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="Chat" type="VBoxContainer" parent="Canvas/BottomLeft"]
|
[node name="Chat" type="VBoxContainer" parent="BottomLeft"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
|
|
||||||
[node name="ChatBox" type="RichTextLabel" parent="Canvas/BottomLeft/Chat"]
|
[node name="ChatBox" type="RichTextLabel" parent="BottomLeft/Chat"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
scroll_following = true
|
scroll_following = true
|
||||||
script = ExtResource("5_43juw")
|
script = ExtResource("5_43juw")
|
||||||
|
|
||||||
[node name="ChatInput" type="LineEdit" parent="Canvas/BottomLeft/Chat"]
|
[node name="ChatInput" type="LineEdit" parent="BottomLeft/Chat"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("6_cg2h5")
|
script = ExtResource("6_cg2h5")
|
||||||
|
|
||||||
[node name="BottomRight" type="MarginContainer" parent="Canvas"]
|
[node name="BottomRight" type="MarginContainer" parent="."]
|
||||||
anchors_preset = 3
|
anchors_preset = 3
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
@ -92,26 +88,26 @@ offset_top = -54.0
|
|||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Canvas/BottomRight"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="BottomRight"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
|
|
||||||
[node name="Ping" parent="Canvas/BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Ping" parent="BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("3_xjdws")
|
script = ExtResource("3_xjdws")
|
||||||
|
|
||||||
[node name="Send" parent="Canvas/BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Send" parent="BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("7_cfnpx")
|
script = ExtResource("7_cfnpx")
|
||||||
|
|
||||||
[node name="Receive" parent="Canvas/BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Receive" parent="BottomRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("8_ogt38")
|
script = ExtResource("8_ogt38")
|
||||||
|
|
||||||
[node name="TopRight" type="MarginContainer" parent="Canvas"]
|
[node name="TopRight" type="MarginContainer" parent="."]
|
||||||
anchors_preset = 1
|
anchors_preset = 1
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -119,25 +115,25 @@ offset_left = -79.0
|
|||||||
offset_bottom = 102.0
|
offset_bottom = 102.0
|
||||||
grow_horizontal = 0
|
grow_horizontal = 0
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Canvas/TopRight"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="TopRight"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="State" parent="Canvas/TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="State" parent="TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("12_rr0mv")
|
script = ExtResource("12_rr0mv")
|
||||||
|
|
||||||
[node name="Position" parent="Canvas/TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Position" parent="TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("4_beqf6")
|
script = ExtResource("4_beqf6")
|
||||||
|
|
||||||
[node name="Velocity" parent="Canvas/TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
[node name="Velocity" parent="TopRight/VBoxContainer" instance=ExtResource("1_7s8uu")]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 2
|
alignment = 2
|
||||||
script = ExtResource("5_8lm6a")
|
script = ExtResource("5_8lm6a")
|
||||||
|
|
||||||
[node name="ConnectPanel" type="Panel" parent="Canvas"]
|
[node name="ConnectPanel" type="Panel" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -146,7 +142,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("11_cwl0t")
|
script = ExtResource("11_cwl0t")
|
||||||
|
|
||||||
[node name="ConnectLabel" type="Label" parent="Canvas/ConnectPanel"]
|
[node name="ConnectLabel" type="Label" parent="ConnectPanel"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
@ -161,12 +157,12 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
text = "Connecting..."
|
text = "Connecting..."
|
||||||
|
|
||||||
[node name="Settings" parent="Canvas" instance=ExtResource("11_rt7sl")]
|
[node name="Settings" parent="." instance=ExtResource("11_rt7sl")]
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 0.3
|
anchor_left = 0.3
|
||||||
anchor_right = 0.7
|
anchor_right = 0.7
|
||||||
|
|
||||||
[node name="Inventory" parent="Canvas" instance=ExtResource("13_1fc2b")]
|
[node name="Inventory" parent="." instance=ExtResource("13_1fc2b")]
|
||||||
visible = false
|
visible = false
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
anchor_left = 0.25
|
anchor_left = 0.25
|
||||||
@ -174,6 +170,11 @@ anchor_top = 0.25
|
|||||||
anchor_right = 0.75
|
anchor_right = 0.75
|
||||||
anchor_bottom = 0.75
|
anchor_bottom = 0.75
|
||||||
|
|
||||||
[connection signal="focus_entered" from="Canvas/BottomLeft/Chat/ChatInput" to="Canvas/BottomLeft/Chat/ChatInput" method="_on_focus_entered"]
|
[node name="UI" type="Control" parent="."]
|
||||||
[connection signal="focus_exited" from="Canvas/BottomLeft/Chat/ChatInput" to="Canvas/BottomLeft/Chat/ChatInput" method="_on_focus_exited"]
|
layout_mode = 3
|
||||||
[connection signal="text_submitted" from="Canvas/BottomLeft/Chat/ChatInput" to="Canvas/BottomLeft/Chat/ChatInput" method="_on_text_submitted"]
|
anchors_preset = 0
|
||||||
|
script = ExtResource("1_l5b6o")
|
||||||
|
|
||||||
|
[connection signal="focus_entered" from="BottomLeft/Chat/ChatInput" to="BottomLeft/Chat/ChatInput" method="_on_focus_entered"]
|
||||||
|
[connection signal="focus_exited" from="BottomLeft/Chat/ChatInput" to="BottomLeft/Chat/ChatInput" method="_on_focus_exited"]
|
||||||
|
[connection signal="text_submitted" from="BottomLeft/Chat/ChatInput" to="BottomLeft/Chat/ChatInput" method="_on_text_submitted"]
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://dixa0yso2s1u3"]
|
[gd_resource type="Environment" load_steps=2 format=3 uid="uid://dixa0yso2s1u3"]
|
||||||
|
|
||||||
[ext_resource type="Material" uid="uid://chtgn5pdoof5e" path="res://world/sky/PanoramaSkyMaterial.tres" id="1_vb3or"]
|
[ext_resource type="Sky" uid="uid://chqkkvnsudiww" path="res://world/Sky.tres" id="1_akiwh"]
|
||||||
|
|
||||||
[sub_resource type="Sky" id="Sky_2vfia"]
|
|
||||||
sky_material = ExtResource("1_vb3or")
|
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
background_mode = 2
|
background_mode = 2
|
||||||
background_color = Color(0.317647, 0.541176, 0.713726, 1)
|
background_color = Color(0.317647, 0.541176, 0.713726, 1)
|
||||||
sky = SubResource("Sky_2vfia")
|
sky = ExtResource("1_akiwh")
|
||||||
ambient_light_source = 3
|
ambient_light_source = 3
|
||||||
ambient_light_color = Color(0.5, 0.5, 0.5, 1)
|
ambient_light_color = Color(0.5, 0.5, 0.5, 1)
|
||||||
ambient_light_sky_contribution = 0.3
|
ambient_light_sky_contribution = 0.3
|
||||||
@ -16,16 +13,12 @@ ambient_light_energy = 3.0
|
|||||||
reflected_light_source = 2
|
reflected_light_source = 2
|
||||||
tonemap_mode = 2
|
tonemap_mode = 2
|
||||||
tonemap_white = 6.0
|
tonemap_white = 6.0
|
||||||
ssao_enabled = true
|
|
||||||
ssil_enabled = true
|
|
||||||
sdfgi_use_occlusion = true
|
sdfgi_use_occlusion = true
|
||||||
glow_enabled = true
|
|
||||||
glow_intensity = 0.1
|
glow_intensity = 0.1
|
||||||
glow_strength = 1.07
|
glow_strength = 1.07
|
||||||
glow_bloom = 0.2
|
glow_bloom = 0.2
|
||||||
glow_blend_mode = 1
|
glow_blend_mode = 1
|
||||||
glow_hdr_threshold = 0.7
|
glow_hdr_threshold = 0.7
|
||||||
volumetric_fog_enabled = true
|
|
||||||
volumetric_fog_density = 0.005
|
volumetric_fog_density = 0.005
|
||||||
volumetric_fog_emission = Color(0.45098, 0.690196, 1, 1)
|
volumetric_fog_emission = Color(0.45098, 0.690196, 1, 1)
|
||||||
adjustment_enabled = true
|
adjustment_enabled = true
|
||||||
|
@ -9,6 +9,9 @@ extends Node3D
|
|||||||
@export var position_randomness := 1.0
|
@export var position_randomness := 1.0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
if !visible:
|
||||||
|
return
|
||||||
|
|
||||||
for x in range(-size_x, size_x, step):
|
for x in range(-size_x, size_x, step):
|
||||||
for z in range(-size_z, size_z, step):
|
for z in range(-size_z, size_z, step):
|
||||||
if noise.get_noise_2d(x, z) < 1 - density * 2:
|
if noise.get_noise_2d(x, z) < 1 - density * 2:
|
||||||
|
6
client/world/Sky.tres
Normal file
6
client/world/Sky.tres
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[gd_resource type="Sky" load_steps=2 format=3 uid="uid://chqkkvnsudiww"]
|
||||||
|
|
||||||
|
[ext_resource type="Material" uid="uid://chtgn5pdoof5e" path="res://world/sky/PanoramaSkyMaterial.tres" id="1_e3kjt"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
sky_material = ExtResource("1_e3kjt")
|
5
client/world/trees/TreeNoise.tres
Normal file
5
client/world/trees/TreeNoise.tres
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[gd_resource type="FastNoiseLite" format=3 uid="uid://d3f4lk8q04haa"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
seed = 1337
|
||||||
|
frequency = 0.05
|
Loading…
Reference in New Issue
Block a user