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
@@ -9,6 +9,10 @@ const ItemDescription = preload("res://world/owniverse/item_description.gd")
|
||||
const WorldIndicators = preload("res://ui/indicators/world_indicators.gd")
|
||||
var world_indicators: RefCounted
|
||||
var indicator_elapsed: float = 0.0
|
||||
var indicator_revision: int = -1
|
||||
var actions_revision: int = -1
|
||||
var descriptions_revision: int = -1
|
||||
var displayed_year: Variant = null
|
||||
var description_targets: Dictionary = {}
|
||||
var description_samples: Dictionary = {}
|
||||
var description_rates: Dictionary = {}
|
||||
@@ -159,6 +163,11 @@ func _update_descriptions(delta: float) -> void:
|
||||
description_elapsed += delta
|
||||
if description_elapsed < 0.25:
|
||||
return
|
||||
if descriptions_revision == owniverse.presentation.revision:
|
||||
var has_rate: bool = false
|
||||
for rate in description_rates.values(): has_rate = has_rate or E.ne(rate, 0)
|
||||
if not has_rate: return
|
||||
descriptions_revision = owniverse.presentation.revision
|
||||
for page in description_targets:
|
||||
var id: String = description_targets[page].id
|
||||
var total = ItemDescription.quantities(owniverse, id).total
|
||||
@@ -347,6 +356,10 @@ func create_new_universe() -> void:
|
||||
g_tween.kill()
|
||||
g_active_items.clear()
|
||||
description_targets.clear()
|
||||
indicator_revision = -1
|
||||
actions_revision = -1
|
||||
descriptions_revision = -1
|
||||
displayed_year = null
|
||||
description_samples.clear()
|
||||
description_rates.clear()
|
||||
description_elapsed = 0.0
|
||||
@@ -380,12 +393,15 @@ func _process(delta: float) -> void:
|
||||
|
||||
owniverse.evolute_frame(delta, get_tree())
|
||||
indicator_elapsed += delta
|
||||
if indicator_elapsed >= 0.1:
|
||||
if indicator_elapsed >= 0.1 and indicator_revision != owniverse.presentation.revision:
|
||||
indicator_elapsed = 0.0
|
||||
world_indicators.update(owniverse)
|
||||
indicator_revision = owniverse.presentation.revision
|
||||
_update_descriptions(delta)
|
||||
set_owniverse_item_value()
|
||||
set_datetime(owniverse.state.time.year)
|
||||
if not owniverse.presentation.pending_amounts.is_empty(): set_owniverse_item_value()
|
||||
if displayed_year == null or E.ne(displayed_year, owniverse.state.time.year):
|
||||
set_datetime(owniverse.state.time.year)
|
||||
displayed_year = owniverse.state.time.year
|
||||
|
||||
#owniverse.cycle(delta)
|
||||
|
||||
@@ -397,10 +413,11 @@ func _process(delta: float) -> void:
|
||||
# them when selection changes and at a modest cadence instead of every
|
||||
# rendered frame. The simulation itself continues to run every frame.
|
||||
active_actions_elapsed += delta
|
||||
if active_actions_dirty or active_actions_elapsed >= 0.1:
|
||||
if active_actions_dirty or (active_actions_elapsed >= 0.1 and actions_revision != owniverse.presentation.revision):
|
||||
active_actions_elapsed = 0.0
|
||||
active_actions_dirty = false
|
||||
_set_active_page_actions()
|
||||
actions_revision = owniverse.presentation.revision
|
||||
|
||||
|
||||
func _change_speed(delta: int) -> void:
|
||||
|
||||
Reference in New Issue
Block a user