Game speed control: pause and speed presets #113
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#113
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GameClockhas carriedspeedandpausedsince #65, and nothing in the game sets either of them. There is no speed control, and the only thing that touchespausedis the main menu.This is a core control, not a debug affordance. The colony sim spends most of its time waiting: at
TICKS_PER_DAY = 1200andticks_per_second = 10, one in-game day is 120 real seconds, so a sensor tower (build_days = 3) takes 6 real minutes to raise with one pawn and an ore mine (10) takes 20. Threat cycles are measured in days and seasons. A player who cannot skip ahead is watching an idle screen for most of the run, and a player who cannot pause cannot react to a forecast.Two sources of pause
GameClock._on_main_menu_changed()assignspauseddirectly. If the player pauses deliberately and then opens and closes the menu, closing it will silently unpause them — the menu's state overwrites the player's.Pause therefore needs two independent inputs and one derived answer:
menu_paused— the menu is openplayer_paused— the player pressed pausepausedis either of them; leaving the menu restores whatever the player had chosenSpeed and determinism
speedscales how many ticks a real second produces; it does not change what a tick is. The tick sequence is identical at any speed, which is what keeps the deterministic threat timeline (and any future replay) intact.ticks_per_secondstays locked after the clock starts, per #65 —speedis the runtime knob and the two should not be confused in the UI or the code.One thing to watch:
advance()'swhile _accumulator >= 1.0loop emits every due tick within the frame, so a high speed means a burst of ticks in one frame and, once #75 lands, a burst of work loops with them. Decide whether to cap ticks-per-frame (smooth, but the clock falls behind wall time under load) or leave it uncapped (honest, but can hitch). Note the decision in the PR either way.Scope
camera_pan_left,place_building,system_debug):game_pauseon space,game_speed_up/game_speed_down, or directgame_speed_1/_2/_3on the number row.CalendarPanel, which already owns the date display and already listens toGameClock.tick.GameClockneedsspeed_changed(speed: float)andpaused_changed(paused: bool)signals so the panel reflects changes it did not make itself — the menu being one of them.AC
player_pausedandmenu_pausedare separate; closing the menu restores the player's choice rather than resuming unconditionallyproject.godot, named to match the existing onesspeed_changed/paused_changedemitted, and the panel updates from them rather than pollingGameClock.nowadvancing anddelta_for()returning anything but zeroUnblocks watching #75's work loop and #71's construction states actually happen.