Add comprehensive tests and optimizations for simulation and UI performance
- Introduced a new benchmark save script to create a stress test scenario with extreme values for simulation performance. - Added a full UI benchmark script to measure frame rates and performance metrics during UI interactions. - Implemented tests for coarse generations to ensure population transitions are handled correctly. - Created tests for extra parameters to validate the loading and application of configuration settings. - Developed simulation optimization tests to verify the efficiency of population drift and rounding mechanisms. - Added split optimization tests to ensure accurate allocation and rounding behavior in population management. - Included startup parameter tests to confirm the correct initialization of global parameters before scene readiness. - Enhanced the audit rounding ledger to compare selective and full rounding results for consistency.
This commit is contained in:
+21
-4
@@ -2,6 +2,7 @@ extends Node
|
||||
const E = preload("res://world/owniverse/math/exact.gd")
|
||||
|
||||
const SPEED_LIMIT: int = 6
|
||||
const SUPPORTED_LOCALES: PackedStringArray = ["en", "ru"]
|
||||
|
||||
# Write a readable diagnostic copy next to the encrypted save. Never used for loading.
|
||||
var save_plaintext_copy: bool = true
|
||||
@@ -15,16 +16,20 @@ var Settings: Dictionary = {
|
||||
"language": "en",
|
||||
}
|
||||
|
||||
# TODO getter setter for locale
|
||||
|
||||
#var Locales: Dictionary = {}
|
||||
var Locale = "en"
|
||||
var _locale: String = "en"
|
||||
var Locale: String:
|
||||
get:
|
||||
return _locale
|
||||
set(value):
|
||||
set_locale(value)
|
||||
|
||||
var OwniverseEntities: Dictionary = {}
|
||||
var OwniverseItems: Dictionary = {}
|
||||
var Templates: Dictionary = {}
|
||||
var LifeRules: Dictionary = {}
|
||||
var CivilizationRules: Dictionary = {}
|
||||
var ExtraParams: Dictionary = {}
|
||||
|
||||
var Music: Dictionary = {}
|
||||
var Effects: Dictionary = {}
|
||||
@@ -32,6 +37,12 @@ var Effects: Dictionary = {}
|
||||
var batch_count: float = 40.0 # must be even not odd
|
||||
|
||||
|
||||
func set_locale(locale: String) -> void:
|
||||
_locale = locale if SUPPORTED_LOCALES.has(locale) else "en"
|
||||
Settings.language = _locale
|
||||
TranslationServer.set_locale(_locale)
|
||||
|
||||
|
||||
#func get_localized_item_description(item_id: String, item: String) -> String:
|
||||
#if Locales[Locale].has(item_id):
|
||||
#return Locales[Locale][item_id][item]
|
||||
@@ -68,8 +79,14 @@ func format_number(value, digits: int = 0) -> String:
|
||||
return E.grouped(value, digits)
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
# Stage constructs its world before autoload _ready callbacks run.
|
||||
ExtraParams = preload("res://data/owniverse_extra_param_loader.gd").get_data()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
set_locale(str(Settings.language))
|
||||
|
||||
LifeRules = OwniverseLifeRuleLoader.get_data()
|
||||
OwniverseEntities = OwniverseEntityLoader.get_data()
|
||||
OwniverseItems = OwniverseItemLoader.get_data()
|
||||
|
||||
@@ -374,8 +374,10 @@ func load_settings():
|
||||
var config = ConfigFile.new()
|
||||
var err = config.load(SAVE_PATH)
|
||||
if E.ne(err, OK):
|
||||
Global.set_locale(str(Global.Settings.language))
|
||||
return false
|
||||
for item in Global.Settings:
|
||||
Global.Settings[item] = config.get_value(SETTING_SECTION, item, Global.Settings[item])
|
||||
Global.set_locale(str(Global.Settings.language))
|
||||
return true
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user