From 2a676a519c834582533dea308a2b2111c82ed5ca Mon Sep 17 00:00:00 2001 From: anyreso Date: Sat, 27 Apr 2024 14:52:11 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20env=20settings=20and=20maps=20/=20e?= =?UTF-8?q?nv=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interfaces/menus/boot/boot.tscn | 1041 ++++++++++------- main.tscn | 24 +- maps/desert/desert.tscn | 15 +- .../desert/resources/env.tres | 0 maps/genesis/genesis.tscn | 28 +- .../genesis/resources/env.tres | 0 maps/map.gd | 15 - modes/demo.tscn | 1 + modes/{ => multiplayer}/multiplayer.gd | 15 +- modes/{ => multiplayer}/multiplayer.tscn | 4 +- modes/team.gd | 3 - project.godot | 1 + systems/maps_manager.gd | 55 + systems/settings.gd | 16 +- systems/teams.gd | 17 + 15 files changed, 761 insertions(+), 474 deletions(-) rename environments/desert.tres => maps/desert/resources/env.tres (100%) rename environments/default.tres => maps/genesis/resources/env.tres (100%) delete mode 100644 maps/map.gd rename modes/{ => multiplayer}/multiplayer.gd (93%) rename modes/{ => multiplayer}/multiplayer.tscn (91%) delete mode 100644 modes/team.gd create mode 100644 systems/maps_manager.gd create mode 100644 systems/teams.gd diff --git a/interfaces/menus/boot/boot.tscn b/interfaces/menus/boot/boot.tscn index 2705332..f2a45f4 100644 --- a/interfaces/menus/boot/boot.tscn +++ b/interfaces/menus/boot/boot.tscn @@ -1,10 +1,24 @@ -[gd_scene load_steps=8 format=3 uid="uid://bjctlqvs33nqy"] +[gd_scene load_steps=28 format=3 uid="uid://bjctlqvs33nqy"] [ext_resource type="Texture2D" uid="uid://c1tjamjm8qjog" path="res://interfaces/menus/boot/background.webp" id="1_ph586"] [sub_resource type="GDScript" id="GDScript_jd8xf"] resource_name = "MainMenu" -script/source = "class_name BootMenu extends CanvasLayer +script/source = "# This file is part of open-fpsz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +class_name BootMenu extends CanvasLayer signal start_demo @@ -12,26 +26,26 @@ func _on_demo_pressed() -> void: start_demo.emit() func _on_multiplayer_pressed() -> void: - %MultiplayerPanelContainer.hide() - %MultiplayerPanelContainer.tab_container.current_tab = 0 - %SettingsPanelContainer.hide() - %MainPanelContainer.hide() - %MultiplayerPanelContainer.show() + $MultiplayerPanelContainer.hide() + $MultiplayerPanelContainer.tab_container.current_tab = 0 + $SettingsPanelContainer.hide() + $MainPanelContainer.hide() + $MultiplayerPanelContainer.show() func _on_settings_pressed() -> void: - %MultiplayerPanelContainer.hide() - %MultiplayerPanelContainer.tab_container.current_tab = 0 - %SettingsPanelContainer.show() - %MainPanelContainer.hide() + $MultiplayerPanelContainer.hide() + $MultiplayerPanelContainer.tab_container.current_tab = 0 + $SettingsPanelContainer.show() + $MainPanelContainer.hide() func _on_quit_pressed() -> void: get_tree().quit() func _on_main_menu_pressed() -> void: - %MultiplayerPanelContainer.hide() - %MultiplayerPanelContainer.tab_container.current_tab = 0 - %SettingsPanelContainer.hide() - %MainPanelContainer.show() + $MultiplayerPanelContainer.hide() + $MultiplayerPanelContainer.tab_container.current_tab = 0 + $SettingsPanelContainer.hide() + $MainPanelContainer.show() " [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_krqeq"] @@ -126,343 +140,6 @@ func _on_connection_failed() -> void: resource_name = "Settings" script/source = "extends PanelContainer -const WINDOW_MODE_OPTIONS = [DisplayServer.WINDOW_MODE_WINDOWED, DisplayServer.WINDOW_MODE_FULLSCREEN] - -func _ready() -> void: - print(Settings) - # video settings - %UIScaleOptionButton.selected = Settings.get_value(\"ui\", \"scale\") - %QualitySlider.value = Settings.get_value(\"video\", \"quality\") - %FilterOptionButton.selected = Settings.get_value(\"video\", \"filter\") - %FSRSharpnessSlider.value = Settings.get_value(\"video\", \"fsr_sharpness\") - %WindowModeOptionButton.selected = Settings.get_value(\"video\", \"window_mode\") - %VsyncOptionButton.selected = Settings.get_value(\"video\", \"vsync\") - %TAAOptionButton.selected = Settings.get_value(\"video\", \"taa\") - %MSAAOptionButton.selected = Settings.get_value(\"video\", \"msaa\") - %FXAAOptionButton.selected = Settings.get_value(\"video\", \"fxaa\") - %FOVSlider.value = Settings.get_value(\"video\", \"fov\") - - # quality settings - %ShadowSizeOptionButton.selected = Settings.get_value(\"quality\", \"shadow_size\") - %ShadowFilterOptionButton.selected = Settings.get_value(\"quality\", \"shadow_filter\") - %MeshLODOptionButton.selected = Settings.get_value(\"quality\", \"mesh_lod\") - - # environment settings - # @NOTE: disabled for now as not adapted to our env management - #%SDFGIOptionButton.selected = Settings.get_value(\"environment\", \"sdfgi\") - #%GlowOptionButton.selected = Settings.get_value(\"environment\", \"glow\") - #%SSAOOptionButton.selected = Settings.get_value(\"environment\", \"saoo\") - #%SSReflectionsOptionButton.selected = Settings.get_value(\"environment\", \"ssr\") - #%SSILOptionButton.selected = Settings.get_value(\"environment\", \"ssil\") - #%VolumetricFogOptionButton.selected = Settings.get_value(\"environment\", \"volumetric_fog\") - - # adjustments settings - %SensitivitySpinBox.value = Settings.get_value(\"controls\", \"mouse_sensitivity\") - %InvertedYCheckbox.button_pressed = Settings.get_value(\"controls\", \"inverted_y_axis\") - - -func _on_ui_scale_option_button_item_selected(index: int) -> void: - Settings.set_value(\"ui\", \"scale\", clamp(index, 0, 2)) - # When the screen changes size, we need to update the 3D - # viewport quality setting. If we don't do this, the viewport will take - # the size from the main viewport. - var new_size := Vector2( - ProjectSettings.get_setting(&\"display/window/size/viewport_width\"), - ProjectSettings.get_setting(&\"display/window/size/viewport_height\") - ) - # compute new size - if index == 0: # Smaller (66%) - new_size *= 1.5 - elif index == 1: # Small (80%) - new_size *= 1.25 - elif index == 2: # Medium (100%) (default) - new_size *= 1. - elif index == 3: # Large (133%) - new_size *= .75 - elif index == 4: # Larger (200%) - new_size *= .5 - # update scale - get_tree().root.set_content_scale_size(new_size) - - -func _on_quality_slider_value_changed(value: float) -> void: - Settings.set_value(\"video\", \"quality\", value) - get_viewport().scaling_3d_scale = value - - -func _on_filter_option_button_item_selected(index: int) -> void: - Settings.set_value(\"video\", \"filter\", index) - # Viewport scale mode setting. - if index == 0: # Bilinear (Fastest) - get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR - # FSR Sharpness is only effective when the scaling mode is FSR 1.0. - %FSRSharpnessLabel.visible = false - %FSRSharpnessSlider.visible = false - elif index == 1: # FSR 1.0 (Fast) - get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR - # FSR Sharpness is only effective when the scaling mode is FSR 1.0. - %FSRSharpnessLabel.visible = true - %FSRSharpnessSlider.visible = true - - -func _on_window_mode_option_button_item_selected(index : int) -> void: - Settings.set_value(\"video\", \"window_mode\", clamp(index, 0, 2)) - if index == 0: # Windowed (default) - get_tree().root.set_mode(Window.MODE_WINDOWED) - elif index == 1: # Fullscreen - get_tree().root.set_mode(Window.MODE_FULLSCREEN) - elif index == 2: # Exclusive Fullscreen - get_tree().root.set_mode(Window.MODE_EXCLUSIVE_FULLSCREEN) - - -func _on_fsr_sharpness_slider_value_changed(value: float) -> void: - Settings.set_value(\"video\", \"fsr_sharpness\", value) - # Lower FSR sharpness values result in a sharper image. - # Invert the slider so that higher values result in a sharper image, - # which is generally expected from users. - get_viewport().fsr_sharpness = 2.0 - value - - -func _on_vsync_option_button_item_selected(index: int) -> void: - Settings.set_value(\"video\", \"vsync\", index) - # Vsync is enabled by default. - # Vertical synchronization locks framerate and makes screen tearing not visible at the cost of - # higher input latency and stuttering when the framerate target is not met. - # Adaptive V-Sync automatically disables V-Sync when the framerate target is not met, and enables - # V-Sync otherwise. This prevents suttering and reduces input latency when the framerate target - # is not met, at the cost of visible tearing. - if index == 0: # Disabled (default) - DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED) - elif index == 1: # Adaptive - DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ADAPTIVE) - elif index == 2: # Enabled - DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED) - - -func _on_taa_option_button_item_selected(index: int) -> void: - Settings.set_value(\"video\", \"taa\", index) - # Temporal antialiasing. Smooths out everything including specular aliasing, but can introduce - # ghosting artifacts and blurring in motion. Moderate performance cost. - get_viewport().use_taa = index == 1 - -func _on_msaa_option_button_item_selected(index: int) -> void: - Settings.set_value(\"video\", \"msaa\", index) - # Multi-sample anti-aliasing. High quality, but slow. It also does not smooth out the edges of - # transparent (alpha scissor) textures. - if index == 0: # Disabled (default) - get_viewport().msaa_3d = Viewport.MSAA_DISABLED - elif index == 1: # 2× - get_viewport().msaa_3d = Viewport.MSAA_2X - elif index == 2: # 4× - get_viewport().msaa_3d = Viewport.MSAA_4X - elif index == 3: # 8× - get_viewport().msaa_3d = Viewport.MSAA_8X - - -func _on_fxaa_option_button_item_selected(index: int) -> void: - Settings.set_value(\"video\", \"fxaa\", index) - # Fast approximate anti-aliasing. Much faster than MSAA (and works on alpha scissor edges), - # but blurs the whole scene rendering slightly. - get_viewport().screen_space_aa = int(index == 1) as Viewport.ScreenSpaceAA - -func _on_fov_slider_value_changed(value: float) -> void: - Settings.set_value(\"video\", \"fov\", value) - -# Quality settings. - -func _on_shadow_size_option_button_item_selected(index : int) -> void: - Settings.set_value(\"quality\", \"shadow_size\", index) - if index == 0: # Minimum - RenderingServer.directional_shadow_atlas_set_size(512, true) - # Adjust shadow bias according to shadow resolution. - # Higher resultions can use a lower bias without suffering from shadow acne. - Settings.set_value(\"quality\", \"shadow_bias\", 0.06) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - - # Disable positional (omni/spot) light shadows entirely to further improve performance. - # These often don't contribute as much to a scene compared to directional light shadows. - get_viewport().positional_shadow_atlas_size = 0 - if index == 1: # Very Low - RenderingServer.directional_shadow_atlas_set_size(1024, true) - Settings.set_value(\"quality\", \"shadow_bias\", 0.04) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - get_viewport().positional_shadow_atlas_size = 1024 - if index == 2: # Low - RenderingServer.directional_shadow_atlas_set_size(2048, true) - Settings.set_value(\"quality\", \"shadow_bias\", 0.03) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - get_viewport().positional_shadow_atlas_size = 2048 - if index == 3: # Medium (default) - RenderingServer.directional_shadow_atlas_set_size(4096, true) - Settings.set_value(\"quality\", \"shadow_bias\", 0.02) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - get_viewport().positional_shadow_atlas_size = 4096 - if index == 4: # High - RenderingServer.directional_shadow_atlas_set_size(8192, true) - Settings.set_value(\"quality\", \"shadow_bias\", 0.01) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - get_viewport().positional_shadow_atlas_size = 8192 - if index == 5: # Ultra - RenderingServer.directional_shadow_atlas_set_size(16384, true) - Settings.set_value(\"quality\", \"shadow_bias\", 0.005) - #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") - get_viewport().positional_shadow_atlas_size = 16384 - -func _on_shadow_filter_option_button_item_selected(index : int) -> void: - Settings.set_value(\"quality\", \"shadow_filter\", index) - if index == 0: # Very Low - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_HARD) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_HARD) - if index == 1: # Low - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_VERY_LOW) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_VERY_LOW) - if index == 2: # Medium (default) - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_LOW) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_LOW) - if index == 3: # High - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_MEDIUM) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_MEDIUM) - if index == 4: # Very High - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH) - if index == 5: # Ultra - RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_ULTRA) - RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_ULTRA) - -func _on_mesh_lod_option_button_item_selected(index : int) -> void: - Settings.set_value(\"quality\", \"mesh_lod\", index) - if index == 0: # Very Low - get_viewport().mesh_lod_threshold = 8.0 - if index == 0: # Low - get_viewport().mesh_lod_threshold = 4.0 - if index == 1: # Medium - get_viewport().mesh_lod_threshold = 2.0 - if index == 2: # High (default) - get_viewport().mesh_lod_threshold = 1.0 - if index == 3: # Ultra - # Always use highest LODs to avoid any form of pop-in. - get_viewport().mesh_lod_threshold = 0.0 - -# Effect settings. - -#func _on_ss_reflections_option_button_item_selected(index: int) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - #if index == 0: # Disabled (default) - #world_environment.environment.set_ssr_enabled(false) - #elif index == 1: # Low - #world_environment.environment.set_ssr_enabled(true) - #world_environment.environment.set_ssr_max_steps(8) - #elif index == 2: # Medium - #world_environment.environment.set_ssr_enabled(true) - #world_environment.environment.set_ssr_max_steps(32) - #elif index == 3: # High - #world_environment.environment.set_ssr_enabled(true) - #world_environment.environment.set_ssr_max_steps(56) - - -#func _on_ssao_option_button_item_selected(index: int) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - #if index == 0: # Disabled (default) - #world_environment.environment.ssao_enabled = false - #if index == 1: # Very Low - #world_environment.environment.ssao_enabled = true - #RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300) - #if index == 2: # Low - #world_environment.environment.ssao_enabled = true - #RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300) - #if index == 3: # Medium - #world_environment.environment.ssao_enabled = true - #RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_MEDIUM, true, 0.5, 2, 50, 300) - #if index == 4: # High - #world_environment.environment.ssao_enabled = true - #RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_HIGH, true, 0.5, 2, 50, 300) -# - -#func _on_ssil_option_button_item_selected(index: int) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - #if index == 0: # Disabled (default) - #world_environment.environment.ssil_enabled = false - #if index == 1: # Very Low - #world_environment.environment.ssil_enabled = true - #RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_VERY_LOW, true, 0.5, 4, 50, 300) - #if index == 2: # Low - #world_environment.environment.ssil_enabled = true - #RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_LOW, true, 0.5, 4, 50, 300) - #if index == 3: # Medium - #world_environment.environment.ssil_enabled = true - #RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_MEDIUM, true, 0.5, 4, 50, 300) - #if index == 4: # High - #world_environment.environment.ssil_enabled = true - #RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_HIGH, true, 0.5, 4, 50, 300) - - -#func _on_sdfgi_option_button_item_selected(index: int) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - #if index == 0: # Disabled (default) - #world_environment.environment.sdfgi_enabled = false - #if index == 1: # Low - #world_environment.environment.sdfgi_enabled = true - #RenderingServer.gi_set_use_half_resolution(true) - #if index == 2: # High - #world_environment.environment.sdfgi_enabled = true - #RenderingServer.gi_set_use_half_resolution(false) - -# -#func _on_glow_option_button_item_selected(index: int) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - #if index == 0: # Disabled (default) - #world_environment.environment.glow_enabled = false - #if index == 1: # Low - #world_environment.environment.glow_enabled = true - #if index == 2: # High - #world_environment.environment.glow_enabled = true -# -# -#func _on_volumetric_fog_option_button_item_selected(index: int) -> void: - #if index == 0: # Disabled (default) - #world_environment.environment.volumetric_fog_enabled = false - #if index == 1: # Low - #world_environment.environment.volumetric_fog_enabled = true - #RenderingServer.environment_set_volumetric_fog_filter_active(false) - #if index == 2: # High - #world_environment.environment.volumetric_fog_enabled = true - #RenderingServer.environment_set_volumetric_fog_filter_active(true) - -# Adjustment settings. - -#func _on_brightness_slider_value_changed(value: float) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - ## The slider value is clamped between 0.5 and 4. - #world_environment.environment.set_adjustment_brightness(value) -# -# -#func _on_contrast_slider_value_changed(value: float) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - ## The slider value is clamped between 0.5 and 4. - #world_environment.environment.set_adjustment_contrast(value) -# -# -#func _on_saturation_slider_value_changed(value: float) -> void: - ## This is a setting that is attached to the environment. - ## If your game requires you to change the environment, - ## then be sure to run this function again to make the setting effective. - ## The slider value is clamped between 0.5 and 10. - #world_environment.environment.set_adjustment_saturation(value) - # Quality presets. func _on_very_low_preset_pressed() -> void: @@ -559,18 +236,504 @@ func update_preset() -> void: %SSILOptionButton.item_selected.emit(%SSILOptionButton.selected) %VolumetricFogOptionButton.item_selected.emit(%VolumetricFogOptionButton.selected) - func _on_apply_pressed() -> void: Settings.apply() - func _on_reset_pressed() -> void: Settings.reset() - func _on_close_pressed() -> void: self.hide() %MainPanelContainer.show() + +# Adjustment settings. + +#func _on_brightness_slider_value_changed(value: float) -> void: + ## This is a setting that is attached to the environment. + ## If your game requires you to change the environment, + ## then be sure to run this function again to make the setting effective. + ## The slider value is clamped between 0.5 and 4. + #world_environment.environment.set_adjustment_brightness(value) + +#func _on_contrast_slider_value_changed(value: float) -> void: + ## This is a setting that is attached to the environment. + ## If your game requires you to change the environment, + ## then be sure to run this function again to make the setting effective. + ## The slider value is clamped between 0.5 and 4. + #world_environment.environment.set_adjustment_contrast(value) + +#func _on_saturation_slider_value_changed(value: float) -> void: + ## This is a setting that is attached to the environment. + ## If your game requires you to change the environment, + ## then be sure to run this function again to make the setting effective. + ## The slider value is clamped between 0.5 and 10. + #world_environment.environment.set_adjustment_saturation(value) +" + +[sub_resource type="GDScript" id="GDScript_7votw"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"ui\", \"scale\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + print(\"here\") + Settings.set_value(\"ui\", \"scale\", clamp(index, 0, 2)) + # When the screen changes size, we need to update the 3D + # viewport quality setting. If we don't do this, the viewport will take + # the size from the main viewport. + var new_size := Vector2( + ProjectSettings.get_setting(&\"display/window/size/viewport_width\"), + ProjectSettings.get_setting(&\"display/window/size/viewport_height\") + ) + # compute new size + if index == 0: # Smaller (66%) + new_size *= 1.5 + elif index == 1: # Small (80%) + new_size *= 1.25 + elif index == 2: # Medium (100%) (default) + new_size *= 1. + elif index == 3: # Large (133%) + new_size *= .75 + elif index == 4: # Larger (200%) + new_size *= .5 + # update scale + get_tree().root.set_content_scale_size(new_size) +" + +[sub_resource type="GDScript" id="GDScript_ux54k"] +script/source = "extends HBoxContainer + +@export var min_value : float = 0. +@export var max_value : float = 1. +@export var step : float = .01 + +func _ready() -> void: + var value : float = Settings.get_value(\"controls\", \"mouse_sensitivity\") + for control : Range in [$SpinBox, $Slider]: + control.min_value = min_value + control.max_value = max_value + control.step = step + control.value = value + _on_value_changed(value) + +func _on_value_changed(new_value : float) -> void: + Settings.set_value(\"controls\", \"mouse_sensitivity\", new_value) + +func _on_spin_box_value_changed(new_value : float) -> void: + _on_value_changed(new_value) + $Slider.value = new_value + +func _on_slider_value_changed(new_value : float) -> void: + _on_value_changed(new_value) + $SpinBox.value = new_value +" + +[sub_resource type="GDScript" id="GDScript_v5ux6"] +script/source = "extends HBoxContainer + +@export var min_value : int = 70 +@export var max_value : int = 150 +@export var step : int = 1 + +func _ready() -> void: + var value : int = Settings.get_value(\"video\", \"fov\") + for control : Range in [$SpinBox, $Slider]: + control.min_value = min_value + control.max_value = max_value + control.step = step + control.value = value + _on_value_changed(value) + +func _on_value_changed(new_value : int) -> void: + Settings.set_value(\"video\", \"fov\", new_value) + +func _on_spin_box_value_changed(new_value : int) -> void: + _on_value_changed(new_value) + $Slider.value = new_value + +func _on_slider_value_changed(new_value : int) -> void: + _on_value_changed(new_value) + $SpinBox.value = new_value +" + +[sub_resource type="GDScript" id="GDScript_viqb1"] +script/source = "extends HSlider + +func _ready() -> void: + self.value = Settings.get_value(\"video\", \"quality\") + self.value_changed.emit(self.value) + +func _on_value_changed(new_value : float) -> void: + Settings.set_value(\"video\", \"quality\", new_value) + get_viewport().scaling_3d_scale = new_value +" + +[sub_resource type="GDScript" id="GDScript_mnbe0"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"filter\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"video\", \"filter\", index) + # Viewport scale mode setting. + if index == 0: # Bilinear (Fastest) + get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR + # FSR Sharpness is only effective when the scaling mode is FSR 1.0. + %FSRSharpnessLabel.visible = false + %FSRSharpnessSlider.visible = false + elif index == 1: # FSR 1.0 (Fast) + get_viewport().scaling_3d_mode = Viewport.SCALING_3D_MODE_FSR + # FSR Sharpness is only effective when the scaling mode is FSR 1.0. + %FSRSharpnessLabel.visible = true + %FSRSharpnessSlider.visible = true +" + +[sub_resource type="GDScript" id="GDScript_c3ngv"] +script/source = "extends HSlider + +func _ready() -> void: + self.value = Settings.get_value(\"video\", \"fsr_sharpness\") + self.value_changed.emit(self.value) + +func _on_value_changed(new_value : float) -> void: + Settings.set_value(\"video\", \"fsr_sharpness\", new_value) + # Lower FSR sharpness values result in a sharper image. + # Invert the slider so that higher values result in a sharper image, + # which is generally expected from users. + get_viewport().fsr_sharpness = 2.0 - new_value +" + +[sub_resource type="GDScript" id="GDScript_xa5kp"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"window_mode\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index : int) -> void: + Settings.set_value(\"video\", \"window_mode\", clamp(index, 0, 2)) + if index == 0: # Windowed (default) + get_tree().root.set_mode(Window.MODE_WINDOWED) + elif index == 1: # Fullscreen + get_tree().root.set_mode(Window.MODE_FULLSCREEN) + elif index == 2: # Exclusive Fullscreen + get_tree().root.set_mode(Window.MODE_EXCLUSIVE_FULLSCREEN) +" + +[sub_resource type="GDScript" id="GDScript_jl1uk"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"vsync\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index : int) -> void: + Settings.set_value(\"video\", \"vsync\", index) + # Vsync is enabled by default. + # Vertical synchronization locks framerate and makes screen tearing not visible at the cost of + # higher input latency and stuttering when the framerate target is not met. + # Adaptive V-Sync automatically disables V-Sync when the framerate target is not met, and enables + # V-Sync otherwise. This prevents suttering and reduces input latency when the framerate target + # is not met, at the cost of visible tearing. + if index == 0: # Disabled (default) + DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED) + elif index == 1: # Adaptive + DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ADAPTIVE) + elif index == 2: # Enabled + DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED) +" + +[sub_resource type="GDScript" id="GDScript_6qqbt"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"taa\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"video\", \"taa\", index) + # Temporal antialiasing. Smooths out everything including specular aliasing, but can introduce + # ghosting artifacts and blurring in motion. Moderate performance cost. + # @NOTE: https://github.com/TokisanGames/Terrain3D/issues/302 + # get_viewport().use_taa = index == 1 +" + +[sub_resource type="GDScript" id="GDScript_ulkhx"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"msaa\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"video\", \"msaa\", index) + # Multi-sample anti-aliasing. High quality, but slow. It also does not smooth out the edges of + # transparent (alpha scissor) textures. + if index == 0: # Disabled (default) + get_viewport().msaa_3d = Viewport.MSAA_DISABLED + elif index == 1: # 2× + get_viewport().msaa_3d = Viewport.MSAA_2X + elif index == 2: # 4× + get_viewport().msaa_3d = Viewport.MSAA_4X + elif index == 3: # 8× + get_viewport().msaa_3d = Viewport.MSAA_8X +" + +[sub_resource type="GDScript" id="GDScript_k6fl5"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"video\", \"fxaa\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"video\", \"fxaa\", index) + # Fast approximate anti-aliasing. Much faster than MSAA (and works on alpha scissor edges), + # but blurs the whole scene rendering slightly. + get_viewport().screen_space_aa = int(index == 1) as Viewport.ScreenSpaceAA +" + +[sub_resource type="GDScript" id="GDScript_cph1u"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"quality\", \"shadow_size\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index : int) -> void: + Settings.set_value(\"quality\", \"shadow_size\", index) + if index == 0: # Minimum + RenderingServer.directional_shadow_atlas_set_size(512, true) + # Adjust shadow bias according to shadow resolution. + # Higher resultions can use a lower bias without suffering from shadow acne. + #Settings.set_value(\"quality\", \"shadow_bias\", 0.06) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + + # Disable positional (omni/spot) light shadows entirely to further improve performance. + # These often don't contribute as much to a scene compared to directional light shadows. + get_viewport().positional_shadow_atlas_size = 0 + if index == 1: # Very Low + RenderingServer.directional_shadow_atlas_set_size(1024, true) + #Settings.set_value(\"quality\", \"shadow_bias\", 0.04) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + get_viewport().positional_shadow_atlas_size = 1024 + if index == 2: # Low + RenderingServer.directional_shadow_atlas_set_size(2048, true) + #Settings.set_value(\"quality\", \"shadow_bias\", 0.03) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + get_viewport().positional_shadow_atlas_size = 2048 + if index == 3: # Medium (default) + RenderingServer.directional_shadow_atlas_set_size(4096, true) + #Settings.set_value(\"quality\", \"shadow_bias\", 0.02) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + get_viewport().positional_shadow_atlas_size = 4096 + if index == 4: # High + RenderingServer.directional_shadow_atlas_set_size(8192, true) + #Settings.set_value(\"quality\", \"shadow_bias\", 0.01) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + get_viewport().positional_shadow_atlas_size = 8192 + if index == 5: # Ultra + RenderingServer.directional_shadow_atlas_set_size(16384, true) + #Settings.set_value(\"quality\", \"shadow_bias\", 0.005) + #directional_light.shadow_bias = Settings.get_value(\"quality\", \"shadow_bias\") + get_viewport().positional_shadow_atlas_size = 16384 +" + +[sub_resource type="GDScript" id="GDScript_uhm5l"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"quality\", \"shadow_filter\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index : int) -> void: + Settings.set_value(\"quality\", \"shadow_filter\", index) + if index == 0: # Very Low + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_HARD) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_HARD) + if index == 1: # Low + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_VERY_LOW) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_VERY_LOW) + if index == 2: # Medium (default) + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_LOW) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_LOW) + if index == 3: # High + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_MEDIUM) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_MEDIUM) + if index == 4: # Very High + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_HIGH) + if index == 5: # Ultra + RenderingServer.directional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_ULTRA) + RenderingServer.positional_soft_shadow_filter_set_quality(RenderingServer.SHADOW_QUALITY_SOFT_ULTRA) +" + +[sub_resource type="GDScript" id="GDScript_4cgn8"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"quality\", \"mesh_lod\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index : int) -> void: + Settings.set_value(\"quality\", \"mesh_lod\", index) + if index == 0: # Very Low + get_viewport().mesh_lod_threshold = 8.0 + if index == 0: # Low + get_viewport().mesh_lod_threshold = 4.0 + if index == 1: # Medium + get_viewport().mesh_lod_threshold = 2.0 + if index == 2: # High (default) + get_viewport().mesh_lod_threshold = 1.0 + if index == 3: # Ultra + # Always use highest LODs to avoid any form of pop-in. + get_viewport().mesh_lod_threshold = 0.0 +" + +[sub_resource type="GDScript" id="GDScript_xfygm"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"sdfgi\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"sdfgi\", index) + # This is a setting that is attached to the environment. + # If your game requires you to change the environment, + # then be sure to run this function again to make the setting effective. + if index == 0: # Disabled (default) + MapsManager.environment.sdfgi_enabled = false + elif index == 1: # Low + MapsManager.environment.sdfgi_enabled = true + RenderingServer.gi_set_use_half_resolution(true) + elif index == 2: # High + MapsManager.environment.sdfgi_enabled = true + RenderingServer.gi_set_use_half_resolution(false) +" + +[sub_resource type="GDScript" id="GDScript_k3pso"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"glow\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"glow\", index) + ## This is a setting that is attached to the environment. + ## If your game requires you to change the environment, + ## then be sure to run this function again to make the setting effective. + if index == 0: # Disabled (default) + MapsManager.environment.glow_enabled = false + elif index == 1: # Low + MapsManager.environment.glow_enabled = true + elif index == 2: # High + MapsManager.environment.glow_enabled = true +" + +[sub_resource type="GDScript" id="GDScript_0sqe1"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"ssao\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"ssao\", index) + # This is a setting that is attached to the environment. + # If your game requires you to change the environment, + # then be sure to run this function again to make the setting effective. + if index == 0: # Disabled (default) + MapsManager.environment.ssao_enabled = false + elif index == 1: # Very Low + MapsManager.environment.ssao_enabled = true + RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300) + elif index == 2: # Low + MapsManager.environment.ssao_enabled = true + RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_VERY_LOW, true, 0.5, 2, 50, 300) + elif index == 3: # Medium + MapsManager.environment.ssao_enabled = true + RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_MEDIUM, true, 0.5, 2, 50, 300) + elif index == 4: # High + MapsManager.environment.ssao_enabled = true + RenderingServer.environment_set_ssao_quality(RenderingServer.ENV_SSAO_QUALITY_HIGH, true, 0.5, 2, 50, 300) +" + +[sub_resource type="GDScript" id="GDScript_cb82q"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"ssr\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"ssr\", index) + # This is a setting that is attached to the environment. + # If your game requires you to change the environment, + # then be sure to run this function again to make the setting effective. + if index == 0: # Disabled (default) + MapsManager.environment.ssr_enabled = false + elif index == 1: # Low + MapsManager.environment.ssr_enabled = true + MapsManager.environment.ssr_max_steps = 8 + elif index == 2: # Medium + MapsManager.environment.ssr_enabled = true + MapsManager.environment.ssr_max_steps = 32 + elif index == 3: # High + MapsManager.environment.ssr_enabled = true + MapsManager.environment.ssr_max_steps = 56 +" + +[sub_resource type="GDScript" id="GDScript_qrf3h"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"ssil\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"ssil\", index) + ## This is a setting that is attached to the environment. + ## If your game requires you to change the environment, + ## then be sure to run this function again to make the setting effective. + if index == 0: # Disabled (default) + MapsManager.environment.ssil_enabled = false + if index == 1: # Very Low + MapsManager.environment.ssil_enabled = true + RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_VERY_LOW, true, 0.5, 4, 50, 300) + if index == 2: # Low + MapsManager.environment.ssil_enabled = true + RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_LOW, true, 0.5, 4, 50, 300) + if index == 3: # Medium + MapsManager.environment.ssil_enabled = true + RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_MEDIUM, true, 0.5, 4, 50, 300) + if index == 4: # High + MapsManager.environment.ssil_enabled = true + RenderingServer.environment_set_ssil_quality(RenderingServer.ENV_SSIL_QUALITY_HIGH, true, 0.5, 4, 50, 300) +" + +[sub_resource type="GDScript" id="GDScript_80uen"] +script/source = "extends OptionButton + +func _ready() -> void: + self.selected = Settings.get_value(\"environment\", \"volumetric_fog\") + self.item_selected.emit(self.selected) + +func _on_item_selected(index: int) -> void: + Settings.set_value(\"environment\", \"volumetric_fog\", index) + if index == 0: # Disabled (default) + MapsManager.environment.volumetric_fog_enabled = false + if index == 1: # Low + MapsManager.environment.volumetric_fog_enabled = true + RenderingServer.environment_set_volumetric_fog_filter_active(false) + if index == 2: # High + MapsManager.environment.volumetric_fog_enabled = true + RenderingServer.environment_set_volumetric_fog_filter_active(true) " [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c4ymk"] @@ -866,7 +1029,6 @@ grow_vertical = 2 text = "CONNECTING..." [node name="SettingsPanelContainer" type="PanelContainer" parent="."] -unique_name_in_owner = true visible = false anchors_preset = 15 anchor_right = 1.0 @@ -883,6 +1045,7 @@ layout_mode = 2 custom_minimum_size = Vector2(480, 0) layout_mode = 2 size_flags_vertical = 3 +scroll_vertical = 120 [node name="MarginContainer" type="MarginContainer" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer"] layout_mode = 2 @@ -954,7 +1117,6 @@ theme_override_font_sizes/font_size = 16 text = "UI Scale:" [node name="UIScaleOptionButton" type="OptionButton" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/UIGridContainer"] -unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -970,6 +1132,45 @@ popup/item_3/text = "Large (133%)" popup/item_3/id = 3 popup/item_4/text = "Larger (200%)" popup/item_4/id = 4 +script = SubResource("GDScript_7votw") + +[node name="ControlsSection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1) +text = "Controls Settings" +horizontal_alignment = 1 + +[node name="ControlsGridContainer" type="GridContainer" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +columns = 2 + +[node name="SensitivityLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Mouse sensitivity" + +[node name="SensitivityControls" type="HBoxContainer" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +script = SubResource("GDScript_ux54k") + +[node name="SpinBox" type="SpinBox" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls"] +layout_mode = 2 + +[node name="Slider" type="HSlider" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 + +[node name="InvertedYLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Inverted Y" + +[node name="InvertedYCheckbox" type="CheckBox" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 0 [node name="ViewportSection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -981,6 +1182,31 @@ horizontal_alignment = 1 layout_mode = 2 columns = 2 +[node name="FOVLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 16 +text = "Field of View:" + +[node name="FOVControls" type="HBoxContainer" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] +unique_name_in_owner = true +layout_mode = 2 +script = SubResource("GDScript_v5ux6") + +[node name="SpinBox" type="SpinBox" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls"] +layout_mode = 2 +min_value = 70.0 +max_value = 150.0 +value = 90.0 + +[node name="Slider" type="HSlider" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +min_value = 70.0 +max_value = 150.0 +value = 90.0 + [node name="QualityLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 size_flags_horizontal = 3 @@ -988,7 +1214,6 @@ theme_override_font_sizes/font_size = 16 text = "Resolution Scale:" [node name="QualitySlider" type="HSlider" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 1 @@ -996,6 +1221,7 @@ min_value = 0.25 max_value = 2.0 step = 0.05 value = 1.0 +script = SubResource("GDScript_viqb1") [node name="FilterLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 @@ -1004,7 +1230,6 @@ theme_override_font_sizes/font_size = 16 text = "Display Filter:" [node name="FilterOptionButton" type="OptionButton" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -1014,6 +1239,7 @@ popup/item_0/text = "Bilinear (Fastest)" popup/item_0/id = 0 popup/item_1/text = "FSR 1.0 (Fast)" popup/item_1/id = 1 +script = SubResource("GDScript_mnbe0") [node name="FSRSharpnessLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] unique_name_in_owner = true @@ -1029,6 +1255,7 @@ size_flags_horizontal = 3 size_flags_vertical = 1 max_value = 2.0 step = 0.2 +script = SubResource("GDScript_c3ngv") [node name="WindowModeLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 @@ -1037,7 +1264,6 @@ theme_override_font_sizes/font_size = 16 text = "Window Mode:" [node name="WindowModeOptionButton" type="OptionButton" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -1049,6 +1275,7 @@ popup/item_1/text = "Fullscreen" popup/item_1/id = 1 popup/item_2/text = "Exclusive Fullscreen" popup/item_2/id = 2 +script = SubResource("GDScript_xa5kp") [node name="VsyncLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 @@ -1057,7 +1284,6 @@ theme_override_font_sizes/font_size = 16 text = "V-Sync:" [node name="VsyncOptionButton" type="OptionButton" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -1069,8 +1295,10 @@ popup/item_1/text = "Adaptive" popup/item_1/id = 1 popup/item_2/text = "Enabled" popup/item_2/id = 2 +script = SubResource("GDScript_jl1uk") [node name="TAALabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] +visible = false layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -1078,6 +1306,7 @@ text = "Anti-Aliasing (TAA):" [node name="TAAOptionButton" type="OptionButton" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] unique_name_in_owner = true +visible = false layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 16 @@ -1087,6 +1316,7 @@ popup/item_0/text = "Disabled (Fastest)" popup/item_0/id = 0 popup/item_1/text = "Enabled (Average)" popup/item_1/id = 1 +script = SubResource("GDScript_6qqbt") [node name="MSAALabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 @@ -1109,6 +1339,7 @@ popup/item_2/text = "4× (Slow)" popup/item_2/id = 2 popup/item_3/text = "8× (Slower)" popup/item_3/id = 3 +script = SubResource("GDScript_ulkhx") [node name="FXAALabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] layout_mode = 2 @@ -1127,53 +1358,7 @@ popup/item_0/text = "Disabled (Fastest)" popup/item_0/id = 0 popup/item_1/text = "Enabled (Fast)" popup/item_1/id = 1 - -[node name="FOVLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_font_sizes/font_size = 16 -text = "Field of View:" - -[node name="FOVSlider" type="HSlider" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 1 -min_value = 50.0 -value = 50.0 - -[node name="ControlsSection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_colors/font_color = Color(0.683425, 0.916893, 1, 1) -text = "Controls Settings" -horizontal_alignment = 1 - -[node name="ControlsGridContainer" type="GridContainer" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -columns = 2 - -[node name="SensitivityLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Mouse sensitivity" - -[node name="SensitivitySpinBox" type="SpinBox" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 3 -max_value = 1.0 -step = 0.01 -value = 1.0 - -[node name="InvertedYLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -text = "Inverted Y" - -[node name="InvertedYCheckbox" type="CheckBox" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer"] -unique_name_in_owner = true -layout_mode = 2 -size_flags_horizontal = 3 +script = SubResource("GDScript_k6fl5") [node name="QualitySection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -1210,6 +1395,7 @@ popup/item_4/text = "High (Slow)" popup/item_4/id = 4 popup/item_5/text = "Ultra (Slowest)" popup/item_5/id = 5 +script = SubResource("GDScript_cph1u") [node name="ShadowFilterLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer"] layout_mode = 2 @@ -1236,6 +1422,7 @@ popup/item_4/text = "Very High (Slow)" popup/item_4/id = 4 popup/item_5/text = "Ultra (Slower)" popup/item_5/id = 5 +script = SubResource("GDScript_uhm5l") [node name="MeshLODLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer"] layout_mode = 2 @@ -1258,6 +1445,7 @@ popup/item_2/text = "High (Average)" popup/item_2/id = 2 popup/item_3/text = "Ultra (Slow)" popup/item_3/id = 3 +script = SubResource("GDScript_4cgn8") [node name="EnvironmentSection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 @@ -1288,6 +1476,7 @@ popup/item_1/text = "Low (Average)" popup/item_1/id = 1 popup/item_2/text = "High (Slow)" popup/item_2/id = 2 +script = SubResource("GDScript_xfygm") [node name="GlowLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer"] layout_mode = 2 @@ -1308,6 +1497,7 @@ popup/item_1/text = "Low (Fast)" popup/item_1/id = 1 popup/item_2/text = "High (Average)" popup/item_2/id = 2 +script = SubResource("GDScript_k3pso") [node name="SSAOLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer"] layout_mode = 2 @@ -1332,6 +1522,7 @@ popup/item_3/text = "Medium (Average)" popup/item_3/id = 3 popup/item_4/text = "High (Slow)" popup/item_4/id = 4 +script = SubResource("GDScript_0sqe1") [node name="SSReflectionsLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer"] layout_mode = 2 @@ -1354,6 +1545,7 @@ popup/item_2/text = "Medium (Slow)" popup/item_2/id = 2 popup/item_3/text = "High (Slower)" popup/item_3/id = 3 +script = SubResource("GDScript_cb82q") [node name="SSILLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer"] layout_mode = 2 @@ -1378,6 +1570,7 @@ popup/item_3/text = "Medium (Slow)" popup/item_3/id = 3 popup/item_4/text = "High (Slower)" popup/item_4/id = 4 +script = SubResource("GDScript_qrf3h") [node name="VolumetricFogLabel" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer"] layout_mode = 2 @@ -1398,6 +1591,7 @@ popup/item_1/text = "Low (Fast)" popup/item_1/id = 1 popup/item_2/text = "High (Average)" popup/item_2/id = 2 +script = SubResource("GDScript_80uen") [node name="AdjustmentSection" type="Label" parent="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"] visible = false @@ -1556,17 +1750,28 @@ mouse_filter = 1 [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/Presets/MediumPreset" to="SettingsPanelContainer" method="_on_medium_preset_pressed"] [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/Presets/HighPreset" to="SettingsPanelContainer" method="_on_high_preset_pressed"] [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/Presets/UltraPreset" to="SettingsPanelContainer" method="_on_ultra_preset_pressed"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/UIGridContainer/UIScaleOptionButton" to="SettingsPanelContainer" method="_on_ui_scale_option_button_item_selected"] -[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/QualitySlider" to="SettingsPanelContainer" method="_on_quality_slider_value_changed"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FilterOptionButton" to="SettingsPanelContainer" method="_on_filter_option_button_item_selected"] -[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FSRSharpnessSlider" to="SettingsPanelContainer" method="_on_fsr_sharpness_slider_value_changed"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/UIGridContainer/UIScaleOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/UIGridContainer/UIScaleOptionButton" method="_on_item_selected"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls/SpinBox" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls" method="_on_spin_box_value_changed"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls/Slider" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ControlsGridContainer/SensitivityControls" method="_on_slider_value_changed"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls/SpinBox" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls" method="_on_spin_box_value_changed"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls/Slider" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVControls" method="_on_slider_value_changed"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/QualitySlider" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/QualitySlider" method="_on_value_changed"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FilterOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FilterOptionButton" method="_on_item_selected"] +[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FSRSharpnessSlider" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FSRSharpnessSlider" method="_on_value_changed"] [connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/WindowModeOptionButton" to="SettingsPanelContainer" method="_on_window_mode_option_button_item_selected"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/VsyncOptionButton" to="SettingsPanelContainer" method="_on_vsync_option_button_item_selected"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/TAAOptionButton" to="SettingsPanelContainer" method="_on_taa_option_button_item_selected"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/MSAAOptionButton" to="SettingsPanelContainer" method="_on_msaa_option_button_item_selected"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FXAAOptionButton" to="SettingsPanelContainer" method="_on_fxaa_option_button_item_selected"] -[connection signal="value_changed" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FOVSlider" to="SettingsPanelContainer" method="_on_fov_slider_value_changed"] -[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/MeshLODOptionButton" to="SettingsPanelContainer" method="_on_mesh_lod_option_button_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/VsyncOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/VsyncOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/TAAOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/TAAOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/MSAAOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/MSAAOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FXAAOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/ViewportGridContainer/FXAAOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/ShadowSizeOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/ShadowSizeOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/ShadowFilterOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/ShadowFilterOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/MeshLODOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/QualityGridContainer/MeshLODOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SDFGIOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SDFGIOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/GlowOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/GlowOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSAOOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSAOOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSReflectionsOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSReflectionsOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSILOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/SSILOptionButton" method="_on_item_selected"] +[connection signal="item_selected" from="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/VolumetricFogOptionButton" to="SettingsPanelContainer/VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/EnvironmentGridContainer/VolumetricFogOptionButton" method="_on_item_selected"] [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/MarginContainer/Buttons/Apply" to="SettingsPanelContainer" method="_on_apply_pressed"] [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/MarginContainer/Buttons/Reset" to="SettingsPanelContainer" method="_on_reset_pressed"] [connection signal="pressed" from="SettingsPanelContainer/VBoxContainer/MarginContainer/Buttons/Close" to="SettingsPanelContainer" method="_on_close_pressed"] diff --git a/main.tscn b/main.tscn index 8690f7c..070b766 100644 --- a/main.tscn +++ b/main.tscn @@ -2,11 +2,25 @@ [ext_resource type="PackedScene" uid="uid://boviiugcnfyrj" path="res://modes/demo.tscn" id="1_50a80"] [ext_resource type="PackedScene" uid="uid://bjctlqvs33nqy" path="res://interfaces/menus/boot/boot.tscn" id="1_acy5o"] -[ext_resource type="PackedScene" uid="uid://bvwxfgygm2xb8" path="res://modes/multiplayer.tscn" id="2_g8xeb"] +[ext_resource type="PackedScene" uid="uid://bvwxfgygm2xb8" path="res://modes/multiplayer/multiplayer.tscn" id="2_g8xeb"] [ext_resource type="Resource" uid="uid://dut5f1sq0wfeb" path="res://maps/maps.tres" id="3_1ipir"] [sub_resource type="GDScript" id="GDScript_e61dq"] -script/source = "class_name Game extends Node3D +script/source = "# This file is part of open-fpsz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +class_name Game extends Node3D @export_category(\"Modes\") @export var SINGLEPLAYER : PackedScene @@ -32,6 +46,7 @@ var mode : Node: else: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + func _ready() -> void: $BootMenu.start_demo.connect(_start_demo) $BootMenu/MultiplayerPanelContainer.start_server.connect(_start_server) @@ -39,7 +54,8 @@ func _ready() -> void: # do not set initial window mode for debug build if not OS.is_debug_build(): DisplayServer.window_set_mode(Settings.get_value(\"video\", \"window_mode\")) - + + func _unhandled_input(event : InputEvent) -> void: if event.is_action_pressed(\"exit\"): # reset game mode @@ -73,7 +89,7 @@ func _start_server(port : int, nickname : String) -> void: mode.start_server({ \"port\": port, \"nickname\": nickname, - \"map\": maps[clamp($BootMenu/Multiplayer.map_selector.selected, 0, len(maps))] + \"map\": maps[clamp($BootMenu/MultiplayerPanelContainer.map_selector.selected, 0, len(maps))] }) $BootMenu.hide() diff --git a/maps/desert/desert.tscn b/maps/desert/desert.tscn index aab61c7..61fb9ba 100644 --- a/maps/desert/desert.tscn +++ b/maps/desert/desert.tscn @@ -1,27 +1,23 @@ -[gd_scene load_steps=6 format=3 uid="uid://btlkog4b87p4x"] +[gd_scene load_steps=5 format=3 uid="uid://btlkog4b87p4x"] [ext_resource type="Terrain3DStorage" uid="uid://wgmg245njt8e" path="res://maps/desert/resources/storage.res" id="1_7nbyj"] -[ext_resource type="Environment" uid="uid://nw62ce5cglvs" path="res://environments/desert.tres" id="1_e1o3u"] [ext_resource type="Terrain3DMaterial" uid="uid://c3isipd4wqxpk" path="res://maps/desert/resources/material.tres" id="2_psdr0"] [ext_resource type="Terrain3DTextureList" uid="uid://d1j24k8sq8qpj" path="res://maps/desert/resources/textures.tres" id="3_aowug"] -[ext_resource type="Script" path="res://maps/map.gd" id="4_cl7fm"] +[ext_resource type="Environment" uid="uid://nw62ce5cglvs" path="res://maps/desert/resources/env.tres" id="5_4l4vc"] -[node name="Desert" type="Terrain3D" node_paths=PackedStringArray("_flagstand", "_player_spawns_root")] +[node name="Desert" type="Terrain3D"] storage = ExtResource("1_7nbyj") material = ExtResource("2_psdr0") texture_list = ExtResource("3_aowug") collision_layer = 2147483648 collision_mask = 2147483648 -script = ExtResource("4_cl7fm") -_flagstand = NodePath("FlagStand") -_player_spawns_root = NodePath("PlayerSpawns") [node name="Sunlight" type="DirectionalLight3D" parent="."] transform = Transform3D(0.5, 0.55667, -0.663414, 0, 0.766044, 0.642788, 0.866025, -0.321394, 0.383022, -1613.38, 2730.74, 446.64) shadow_enabled = true [node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = ExtResource("1_e1o3u") +environment = ExtResource("5_4l4vc") [node name="PlayerSpawns" type="Node" parent="."] @@ -33,3 +29,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1161.42, 174.535, 909.901) [node name="FlagStand" type="Marker3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 878.613, 134.55, 916.185) + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 1024, 920, 1024) diff --git a/environments/desert.tres b/maps/desert/resources/env.tres similarity index 100% rename from environments/desert.tres rename to maps/desert/resources/env.tres diff --git a/maps/genesis/genesis.tscn b/maps/genesis/genesis.tscn index b79583c..31bf286 100644 --- a/maps/genesis/genesis.tscn +++ b/maps/genesis/genesis.tscn @@ -1,21 +1,24 @@ -[gd_scene load_steps=6 format=3 uid="uid://chbno00ugl6te"] +[gd_scene load_steps=5 format=3 uid="uid://chbno00ugl6te"] -[ext_resource type="Environment" uid="uid://d2ahijqqspw5f" path="res://environments/default.tres" id="1_3nr12"] -[ext_resource type="Script" path="res://maps/map.gd" id="1_6ysiv"] [ext_resource type="Terrain3DStorage" uid="uid://dyon4xda4k40d" path="res://maps/genesis/resources/storage.res" id="1_a88qe"] [ext_resource type="Terrain3DMaterial" uid="uid://bd4lr5sxu8xu" path="res://maps/genesis/resources/material.res" id="2_o2y3d"] [ext_resource type="Terrain3DTextureList" uid="uid://dnqa8kxgm3xuw" path="res://maps/genesis/resources/textures.res" id="3_1cww7"] +[ext_resource type="Environment" uid="uid://d2ahijqqspw5f" path="res://maps/genesis/resources/env.tres" id="5_3klr3"] -[node name="Genesis" type="Terrain3D" node_paths=PackedStringArray("_flagstand", "_player_spawns_root")] +[node name="Genesis" type="Terrain3D"] storage = ExtResource("1_a88qe") material = ExtResource("2_o2y3d") texture_list = ExtResource("3_1cww7") collision_layer = 2147483648 collision_mask = 2147483648 mesh_size = 24 -script = ExtResource("1_6ysiv") -_flagstand = NodePath("FlagPillar/CSGCylinder3D/FlagStand") -_player_spawns_root = NodePath("PlayerSpawns") + +[node name="Sunlight" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.866024, -0.433016, 0.25, 0, 0.499998, 0.866027, -0.500003, 0.75, -0.43301, 0, 100, 0) +shadow_enabled = true + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = ExtResource("5_3klr3") [node name="PlayerSpawns" type="Node" parent="."] @@ -39,12 +42,5 @@ size = Vector3(0.5, 6, 0.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.42967, 0) height = 5.0 -[node name="FlagStand" type="Marker3D" parent="FlagPillar/CSGCylinder3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.53822, 0) - -[node name="Sunlight" type="DirectionalLight3D" parent="."] -transform = Transform3D(-0.866024, -0.433016, 0.25, 0, 0.499998, 0.866027, -0.500003, 0.75, -0.43301, 0, 100, 0) -shadow_enabled = true - -[node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = ExtResource("1_3nr12") +[node name="FlagStand" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 108.644, 0) diff --git a/environments/default.tres b/maps/genesis/resources/env.tres similarity index 100% rename from environments/default.tres rename to maps/genesis/resources/env.tres diff --git a/maps/map.gd b/maps/map.gd deleted file mode 100644 index 62b9cf4..0000000 --- a/maps/map.gd +++ /dev/null @@ -1,15 +0,0 @@ -class_name Map extends Terrain3D - -@export var _flagstand : Node3D -@export var _player_spawns_root : Node - -var _rng : RandomNumberGenerator = RandomNumberGenerator.new() - -func get_flagstand() -> Node3D: - return _flagstand - -func get_player_spawn() -> Node3D: - var spawn_count : int = _player_spawns_root.get_child_count() - var spawn_index : int = _rng.randi_range(0, spawn_count - 1) - var spawn_selected : Node3D = _player_spawns_root.get_child(spawn_index) - return spawn_selected diff --git a/modes/demo.tscn b/modes/demo.tscn index 3fe8a59..d94a223 100644 --- a/modes/demo.tscn +++ b/modes/demo.tscn @@ -15,6 +15,7 @@ script/source = "extends Node func _ready() -> void: player_node.died.connect(respawn_player) + MapsManager.current_map = $Desert func respawn_player(player : Player, _killer_id : int) -> void: player.respawn(player_respawn_location) diff --git a/modes/multiplayer.gd b/modes/multiplayer/multiplayer.gd similarity index 93% rename from modes/multiplayer.gd rename to modes/multiplayer/multiplayer.gd index 9350cde..9270c36 100644 --- a/modes/multiplayer.gd +++ b/modes/multiplayer/multiplayer.gd @@ -25,7 +25,6 @@ class_name Multiplayer extends Node @onready var map : Node = $Map @onready var scoreboard : Scoreboard = $Scoreboard -var _map_manager : Map var _flag : Flag var _flag_carrier_scoring_timer : Timer = Timer.new() @@ -85,17 +84,17 @@ func _on_player_died(player : Player, killer_id : int) -> void: respawn_player(player) func respawn_player(player : Player) -> void: - var spawn_location : Vector3 = _map_manager.get_player_spawn().position + var spawn_location : Vector3 = MapsManager.get_player_spawn().position player.respawn.rpc(spawn_location) func add_player(peer_id : int, nickname : String) -> void: var player : Player = PLAYER.instantiate() + players.add_child(player)grep player.name = str(peer_id) player.player_id = peer_id player.team_id = team_chasers.team_id player.nickname = nickname - player.global_position = _map_manager.get_player_spawn().position - players.add_child(player) + player.global_position = MapsManager.get_player_spawn().position player.died.connect(_on_player_died) scoreboard.add_player(player) print("Peer `%s` connected" % player.name) @@ -111,17 +110,17 @@ func remove_player(peer_id : int) -> void: func _load_map(scene : PackedScene, nickname : String) -> void: var map_scene : Node = scene.instantiate() - _map_manager = map_scene - map_scene.ready.connect(_add_flag) + map.add_child(map_scene) + MapsManager.current_map = map_scene + MapsManager.current_map.ready.connect(_add_flag) if DisplayServer.get_name() != "headless": add_player(1, nickname) - map.add_child(map_scene) func _add_flag() -> void: _flag = FLAG.instantiate() _flag.grabbed.connect(_on_flag_grabbed) _flag.dropped.connect(_on_flag_dropped) - _flag.global_position = _map_manager.get_flagstand().global_position + _flag.global_position = MapsManager.flagstand.global_position objectives.add_child(_flag) @rpc("any_peer", "reliable") diff --git a/modes/multiplayer.tscn b/modes/multiplayer/multiplayer.tscn similarity index 91% rename from modes/multiplayer.tscn rename to modes/multiplayer/multiplayer.tscn index bf5c98c..bee4713 100644 --- a/modes/multiplayer.tscn +++ b/modes/multiplayer/multiplayer.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://bvwxfgygm2xb8"] -[ext_resource type="Script" path="res://modes/multiplayer.gd" id="1_r1kd6"] +[ext_resource type="Script" path="res://modes/multiplayer/multiplayer.gd" id="1_r1kd6"] [ext_resource type="PackedScene" uid="uid://cbhx1xme0sb7k" path="res://entities/player/player.tscn" id="2_og1vb"] [ext_resource type="PackedScene" uid="uid://c88l3h0ph00c7" path="res://entities/flag/flag.tscn" id="3_h0rie"] [ext_resource type="PackedScene" uid="uid://b8bosdd0o1lu7" path="res://interfaces/scoreboard/scoreboard.tscn" id="5_uj0pp"] @@ -9,6 +9,8 @@ script = ExtResource("1_r1kd6") PLAYER = ExtResource("2_og1vb") FLAG = ExtResource("3_h0rie") +MAX_CLIENTS = null +RESPAWN_TIME = null [node name="Map" type="Node" parent="."] diff --git a/modes/team.gd b/modes/team.gd deleted file mode 100644 index 2bcfc84..0000000 --- a/modes/team.gd +++ /dev/null @@ -1,3 +0,0 @@ -class_name Team extends Object - -var team_id : int diff --git a/project.godot b/project.godot index 7f9e400..f98acf7 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="res://icon.svg" [autoload] Settings="*res://systems/settings.gd" +MapsManager="*res://systems/maps_manager.gd" [debug] diff --git a/systems/maps_manager.gd b/systems/maps_manager.gd new file mode 100644 index 0000000..aa908a3 --- /dev/null +++ b/systems/maps_manager.gd @@ -0,0 +1,55 @@ +# This file is part of open-fpsz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +extends Node + +var environment := Environment.new() +var flagstand : Marker3D = null +var _rng := RandomNumberGenerator.new() + +var current_map : Terrain3D = null: + set(new_map): + if current_map != null: + current_map.queue_free() + current_map = new_map + flagstand = new_map.get_node("FlagStand") + var world : World3D = get_viewport().find_world_3d() + if world.environment: + # forward user environment settings + world.environment.sdfgi_enabled = MapsManager.environment.sdfgi_enabled + world.environment.glow_enabled = MapsManager.environment.glow_enabled + world.environment.ssao_enabled = MapsManager.environment.ssao_enabled + world.environment.ssr_enabled = MapsManager.environment.ssr_enabled + world.environment.ssr_max_steps = MapsManager.environment.ssr_max_steps + world.environment.ssil_enabled = MapsManager.environment.ssil_enabled + world.environment.volumetric_fog_enabled = MapsManager.environment.volumetric_fog_enabled + +func get_player_spawn() -> Node3D: + if current_map == null: + push_error("MapsManager.current_map is null") + return null + + if not current_map.has_node("PlayerSpawns"): + push_warning("PlayerSpawns node not found in MapsManager.current_map") + return null + + var player_spawns : Node = current_map.get_node("PlayerSpawns") + var spawn_count : int = player_spawns.get_child_count() + if spawn_count == 0: + push_error("PlayerSpawns has no children (%s)" % current_map.name) + return null + var spawn_index : int = _rng.randi_range(0, spawn_count - 1) + var random_spawn : Marker3D = player_spawns.get_child(spawn_index) + return random_spawn + diff --git a/systems/settings.gd b/systems/settings.gd index cfc68a6..0f1b0da 100644 --- a/systems/settings.gd +++ b/systems/settings.gd @@ -1,3 +1,17 @@ +# This file is part of open-fpsz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . extends Node var _file : ConfigFile = ConfigFile.new() @@ -42,7 +56,7 @@ func reset() -> void: # environment settings _file.set_value("environment", "sdfgi", 0) _file.set_value("environment", "glow", 0) - _file.set_value("environment", "saoo", 0) + _file.set_value("environment", "ssao", 0) _file.set_value("environment", "ssr", 0) _file.set_value("environment", "ssil", 0) _file.set_value("environment", "volumetric_fog", 0) diff --git a/systems/teams.gd b/systems/teams.gd new file mode 100644 index 0000000..c94d9cd --- /dev/null +++ b/systems/teams.gd @@ -0,0 +1,17 @@ +# This file is part of open-fpsz. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +class_name Team extends Object + +var team_id : int