forked from woofmeow/straywild
Optimize PortMaster low-memory profile
This commit is contained in:
parent
b27883d115
commit
021de5aca4
16 changed files with 327 additions and 31 deletions
31
main/main.gd
31
main/main.gd
|
|
@ -118,6 +118,10 @@ const NetworkWorldSpawnServiceType = preload(
|
|||
)
|
||||
|
||||
const TITLE_MUSIC_SILENCE_DB: float = -80.0
|
||||
const TITLE_MUSIC_PATH: String = (
|
||||
"res://audio/music/title/as_in_four_wolves.ogg"
|
||||
)
|
||||
const DUSK_MUSIC_PATH: String = "res://audio/music/world/craft.mp3"
|
||||
const TIME_CROSSING_EPSILON_HOURS: float = 0.000001
|
||||
const PLAYER_MENU_PATTERN_SCALE: float = 0.85
|
||||
const PLAYER_MENU_PATTERN_SCROLL_VELOCITY := Vector2(-7.0, -5.0)
|
||||
|
|
@ -273,6 +277,7 @@ func _ready() -> void:
|
|||
_rain_ambience.name = "RainAmbience"
|
||||
add_child(_rain_ambience)
|
||||
_rain_ambience.configure(_world_weather)
|
||||
_configure_audio_performance_profile(_performance_profile.is_light())
|
||||
_shoreline_ambience.configure(
|
||||
_player,
|
||||
_test_world.get_saltwater_shoreline_mesh(),
|
||||
|
|
@ -297,6 +302,8 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _configure_presentation_performance_profile(light_profile: bool) -> void:
|
||||
_game_ui.get_title_screen().set_minimal_presentation(light_profile)
|
||||
_game_ui.set_light_performance_profile(light_profile)
|
||||
var title_water_material := _title_background.material as ShaderMaterial
|
||||
if title_water_material != null:
|
||||
title_water_material.set_shader_parameter(
|
||||
|
|
@ -343,6 +350,25 @@ func _configure_presentation_performance_profile(light_profile: bool) -> void:
|
|||
)
|
||||
|
||||
|
||||
func _configure_audio_performance_profile(light_profile: bool) -> void:
|
||||
if light_profile:
|
||||
_title_music.stream = null
|
||||
_dusk_music.stream = null
|
||||
_shoreline_ambience.set_audio_enabled(false)
|
||||
_rain_ambience.set_audio_enabled(false)
|
||||
return
|
||||
_title_music.stream = _load_optional_audio_stream(TITLE_MUSIC_PATH)
|
||||
_dusk_music.stream = _load_optional_audio_stream(DUSK_MUSIC_PATH)
|
||||
_shoreline_ambience.set_audio_enabled(true)
|
||||
_rain_ambience.set_audio_enabled(true)
|
||||
|
||||
|
||||
func _load_optional_audio_stream(path: String) -> AudioStream:
|
||||
if not ResourceLoader.exists(path, "AudioStream"):
|
||||
return null
|
||||
return load(path) as AudioStream
|
||||
|
||||
|
||||
func _is_dedicated_server_runtime() -> bool:
|
||||
if OS.has_feature("dedicated_server"):
|
||||
return true
|
||||
|
|
@ -1488,7 +1514,8 @@ func _on_natural_time_advanced(advanced_hours: float) -> void:
|
|||
)
|
||||
):
|
||||
_dusk_music_played_for_natural_day = true
|
||||
_dusk_music.play(0.0)
|
||||
if _dusk_music.stream != null:
|
||||
_dusk_music.play(0.0)
|
||||
|
||||
|
||||
static func _natural_interval_crosses_hour(
|
||||
|
|
@ -1956,6 +1983,8 @@ func _on_quit_requested() -> void:
|
|||
func _show_title_music(restart_from_beginning: bool = false) -> void:
|
||||
_title_music_requested = true
|
||||
_replace_title_music_transition()
|
||||
if _title_music.stream == null:
|
||||
return
|
||||
if restart_from_beginning:
|
||||
_title_music.stop()
|
||||
_title_music.volume_db = title_music_volume_db
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
[ext_resource type="Script" uid="uid://dwv3nvfke5xtu" path="res://settings/player_settings_manager.gd" id="10_settings"]
|
||||
[ext_resource type="Resource" path="res://items/catalog/item_catalog.tres" id="11_items"]
|
||||
[ext_resource type="Resource" path="res://economy/buyers/main_fishing_shop.tres" id="12_main_shop"]
|
||||
[ext_resource type="AudioStream" uid="uid://bgkfluumuen4m" path="res://audio/music/title/as_in_four_wolves.ogg" id="13_title_music"]
|
||||
[ext_resource type="Script" uid="uid://bdtb05vkiicd" path="res://ui/ui_pixelation_presenter.gd" id="14_pixelation"]
|
||||
[ext_resource type="PackedScene" path="res://ui/pixelation_reset_overlay.tscn" id="15_reset"]
|
||||
[ext_resource type="PackedScene" path="res://main/world_pixelation_postprocess.tscn" id="16_world_pixelation"]
|
||||
|
|
@ -53,11 +52,9 @@
|
|||
[ext_resource type="Script" uid="uid://daqtje84gqgu0" path="res://jobs/player_job_service.gd" id="52_player_jobs"]
|
||||
[ext_resource type="Script" uid="uid://drlyytr2o3uw8" path="res://network/network_job_service.gd" id="53_network_jobs"]
|
||||
[ext_resource type="Script" uid="uid://b0c3o2vy76fg3" path="res://world/shoreline_ambience.gd" id="54_shoreline_ambience"]
|
||||
[ext_resource type="AudioStream" uid="uid://dck3tf8qkadea" path="res://audio/ambience/waves.wav" id="55_waves"]
|
||||
[ext_resource type="Script" uid="uid://c80x8jkdnx0xy" path="res://settings/controller_mapping_manager.gd" id="56_controller_mapping"]
|
||||
[ext_resource type="Script" path="res://settings/keyboard_mouse_mapping_manager.gd" id="keyboard_mouse_mapping"]
|
||||
[ext_resource type="Script" uid="uid://d0jv8n2nfqia0" path="res://network/discovery_client.gd" id="57_discovery"]
|
||||
[ext_resource type="AudioStream" uid="uid://c4y8puv0n6xk8" path="res://audio/music/world/craft.mp3" id="dusk_music"]
|
||||
[ext_resource type="Resource" path="res://gathering/catalog/gatherable_catalog.tres" id="58_gatherable_catalog"]
|
||||
[ext_resource type="Script" path="res://network/network_world_spawn_service.gd" id="59_world_spawns"]
|
||||
[ext_resource type="Script" path="res://gathering/gathering_controller.gd" id="60_gathering_controller"]
|
||||
|
|
@ -398,13 +395,11 @@ script = ExtResource("keyboard_mouse_mapping")
|
|||
|
||||
[node name="TitleMusic" type="AudioStreamPlayer" parent="." unique_id=1292939956]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("13_title_music")
|
||||
volume_db = -80.0
|
||||
bus = &"Music"
|
||||
|
||||
[node name="DuskMusic" type="AudioStreamPlayer" parent="." unique_id=992744241]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("dusk_music")
|
||||
bus = &"Music"
|
||||
|
||||
[node name="ShorelineAmbience" type="Node" parent="." unique_id=1948037177]
|
||||
|
|
@ -413,7 +408,6 @@ script = ExtResource("54_shoreline_ambience")
|
|||
|
||||
[node name="WavesAudio" type="AudioStreamPlayer" parent="ShorelineAmbience" unique_id=193530658]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("55_waves")
|
||||
bus = &"Environment"
|
||||
|
||||
[node name="WorldPixelationPostprocess" parent="." unique_id=344378000 instance=ExtResource("16_world_pixelation")]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const LEGACY_LIGHT_ENVIRONMENT_VARIABLE: String = "NETFISHING_LOW_END"
|
|||
const NORMAL_PROFILE: StringName = &"normal"
|
||||
const LIGHT_PROFILE: StringName = &"light"
|
||||
const NORMAL_WORLD_RENDER_SCALE: float = 1.0
|
||||
const LIGHT_WORLD_RENDER_SCALE: float = 0.5
|
||||
const LIGHT_WORLD_RENDER_SCALE: float = 0.375
|
||||
|
||||
var _profile_name: StringName = NORMAL_PROFILE
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue