Разделить частоту обновления часов и расчёта симуляции

Счётчик времени UI обновляется до 10 Гц по запрошенному времени, а тяжёлые циклы по-прежнему запускаются с адаптивным интервалом и обрабатывают весь накопленный промежуток. Обновить тесты и описание модели.
This commit is contained in:
Kirill
2026-10-17 23:41:18 +03:00
parent 00b6192d19
commit 273093bd9e
14 changed files with 853 additions and 10 deletions
+6 -3
View File
@@ -38,6 +38,7 @@ func run():
sliced.evolute_frame(0.2, self)
check(sliced.frame_busy, "Heavy transaction yields before publishing")
check(E.eq(sliced.state.time.year, 0), "Published clock stays at completed transaction")
check(E.eq(sliced.display_clock().year, Clock.advance({"datetime": 0, "year": 0}, 0.2, sliced.speed).year), "Display clock advances independently of the heavy transaction")
check(sliced.request_production("H", 1, true), "Production requested during a frame is queued")
check(sliced.frame_checkpoint().productions.size() == 1, "Queued production remains part of the save checkpoint")
check(E.eq(sliced.state.amount.H, initial_h), "Player action waits for transaction commit")
@@ -117,15 +118,17 @@ func run():
check(E.eq(behind.state.time.datetime, 100000) and E.eq(behind.state.time, behind.frame_clock), "Delayed start consumes all elapsed time in one cycle")
behind.evolute_frame(0.0, self)
check(behind.frame_commits == 1 and not behind.frame_busy, "Consumed interval cannot be processed twice")
behind.evolute_frame(0.23, self)
var next_interval: float = behind.frame_step_seconds + 0.03
behind.evolute_frame(next_interval, self)
var remained_busy: bool = behind.frame_busy
if remained_busy: behind.evolute_frame(0.53, self)
var pending_clock: Dictionary = behind.frame_clock.duplicate()
if remained_busy:
check(E.eq(behind.frame_active_clock.datetime, 123000), "Busy transaction reserves its original target")
var expected_active: Dictionary = Clock.advance({"datetime": 100000, "year": 100000}, next_interval, behind.speed)
check(E.eq(behind.frame_active_clock, expected_active), "Busy transaction reserves its original target")
while behind.frame_busy: await process_frame
if remained_busy:
check(E.eq(behind.state.time.datetime, 123000), "Busy transaction keeps its original target")
check(E.eq(behind.state.time, behind.frame_active_clock), "Busy transaction keeps its original target")
behind.evolute_frame(0.0, self)
while behind.frame_busy: await process_frame
check(E.eq(behind.state.time, pending_clock), "Next cycle consumes all time accumulated during computation")