Refactor civilization evolution and state management

- Enhanced the `civilization_evolution.gd` script to improve population handling and resource allocation during civilization transitions.
- Introduced new functions in `civilization_state.gd` for profile normalization and merging, ensuring consistent population representation across stages.
- Updated `evolution_coordinator.gd` to incorporate budget phases for better tracking of simulation performance.
- Improved `frame_budget.gd` to monitor maximum slice durations and phases during processing.
- Added a new benchmarking tool in `android_benchmark.gd` to measure performance metrics during simulation runs, including frame processing times and throughput.
- Created associated scene and resource files for the benchmarking tool to facilitate testing and performance evaluation.
This commit is contained in:
Kirill
2026-10-06 23:02:42 +03:00
parent e48d4bbe88
commit 6ee66a627d
23 changed files with 751 additions and 3009 deletions
+11 -3
View File
@@ -6,7 +6,7 @@ const E = preload("res://world/owniverse/math/exact.gd")
const SETTING_SECTION = "Settings"
const SAVE_PATH = "user://settings.cfg"
const FORMAT_VERSION : int = 5
const FORMAT_VERSION : int = 6
const SimulationTime = preload("res://world/owniverse/simulation_time.gd")
const WorldParameters = preload("res://world/owniverse/world_parameters.gd")
const STATE_VERSION : String = SimulationTime.STATE_VERSION
@@ -348,11 +348,19 @@ static func _validate_payload(data: Variant, speed_limit: int, stages: Array, en
if ((not (saved.ethics is Dictionary)) or (not (saved.civilization_homes is Dictionary))):
return "invalid civilization state"
for id in saved.ethics:
if (not E.contains(stages, id) or (not _number_map(saved.ethics[id], true))):
if (not E.contains(stages, id) or (not (saved.ethics[id] is Dictionary))):
return E.add("invalid state.ethics.", str(id))
if E.ne(saved.ethics[id].keys().size(), 6):
return E.add("invalid ethic profile size for ", str(id))
var share_sum: float = 0.0
for ethic in saved.ethics[id]:
if not E.contains(["m", "l", "w", "d", "c", "b"], ethic):
var share: Variant = saved.ethics[id][ethic]
var share_value: float = 0.0 + share if share is int or share is float else -1.0
if not E.contains(["m", "l", "w", "d", "c", "b"], ethic) or not is_finite(share_value) or share_value < 0.0 or share_value > 1.0:
return E.add("invalid ethic ", str(ethic))
share_sum += share_value
if absf(share_sum - 1.0) > 0.000001:
return E.add("invalid ethic profile total for ", str(id))
for id in saved.civilization_homes:
if (not _number_map(saved.civilization_homes[id], true)):
return "invalid civilization homes"