Add new tests and implement frame budget management

- Introduced `civilization_benchmark.gd` and `legacy_quantity_math.gd` for benchmarking and legacy quantity calculations.
- Created `test_dynamic_math.gd`, `test_frame_evolution.gd`, and `test_sparse_batches.gd` to validate mathematical operations and frame evolution logic.
- Implemented `frame_budget.gd` to manage cooperative work on the main thread, ensuring no partially calculated state is published.
- Added UID files for all new scripts to maintain unique identifiers.
This commit is contained in:
Kirill
2026-10-01 23:43:34 +03:00
parent f51eea6c0f
commit c4e7302567
53 changed files with 1313 additions and 397 deletions
+5 -3
View File
@@ -219,7 +219,7 @@ func item_activated(item: OwniverseItem) -> void:
if item.item_id == "S" or item.item_id == "H":
var _value = owniverse.state.amount[item.item_id]
_value = E.multiply(9, _value) if E.gt(_value, 0) else 1
owniverse.production.produce_hs(item.item_id, _value)
owniverse.request_production(item.item_id, _value, true)
func _check_counters(delta: float) -> Array:
@@ -302,7 +302,7 @@ func _page_action_pressed(page_id: int, action_amount) -> void:
var item_id: String = g_active_items[page_id].item_id
if E.gt(action_amount, 0):
owniverse.production.produce(item_id, action_amount)
owniverse.request_production(item_id, action_amount)
#endregion
@@ -369,7 +369,7 @@ func _refresh_universe_ui() -> void:
func _process(delta: float) -> void:
owniverse.evolute(delta)
owniverse.evolute_frame(delta, get_tree())
indicator_elapsed += delta
if indicator_elapsed >= 0.1:
indicator_elapsed = 0.0
@@ -449,6 +449,7 @@ func load_data() -> bool:
var complete: Dictionary = owniverse.state.duplicate(true)
complete.merge(restored, true)
owniverse.state = complete
owniverse.restore_frame_checkpoint(game_data.get("simulation", {}))
owniverse.evolution.initialize_life_batches()
owniverse.presentation.refresh(owniverse.state, owniverse.catalog)
@@ -471,6 +472,7 @@ func save_data() -> void:
page = clampi(roundi(float(stage_page_scroller.scroll_horizontal) / PAGE_WIDTH), 0, PAGE_COUNT - 1)
SaveManager.request_save("owniverse", "qwerty", {
"state": owniverse.state,
"simulation": owniverse.frame_checkpoint(),
"ui": {"current_page": page},
})