Skip to content

Class

GameClock

Generated GDScript class reference for CalendarTime.GameClock.

Status
Current
Version
v2.1.1
Source updated
2026-08-09
Generated on
2026-09-26

The runtime clock consumers reference: a Resource holding the canonical microsecond count, calendar, signal bus, serializer, and age service. date_time() is derived from the count via the calendar, never stored.

Source: addons/calendar_time/game_time/state/game_clock.gd

Syntax

class GameClock extends Resource

Members

NameKindSummary
ProjectionRangeField
current_microsecondsPropertyCanonical elapsed game-microseconds, source of truth for all derived time. Not @export; runtime state saved via TimeSnapshot.
speed_multiplierPropertyPer-clock rate: final advance is engine delta × host time scale × this multiplier. Values <= 0 pause this clock and stop boundary events (direct `date_time()` reads are unaffected); it never touches `Engine.time_scale`. Watch `clock_speed_changed` to pause tweens/animations.
calendarPropertyGives this clock its shape of time: months, days, event days, and the unit schema. Duplicate the bundled Four Seasons calendar to customize.
time_scalePropertyAdvanced: pacing read by animation consumers (flipper, emote bob, etc.), not by advancement. The host propagates its own time scale; leave unset.
epochPropertyOptional start date; `date_time()` counts forward from here, making it the in-game "day one". Defaults to the calendar's epoch.
persistent_idPropertyStable UUID identifying this clock in save files; empty derives one automatically. Keep it stable: changing it breaks existing saves. Duplicating a `.tres` copies the UUID, so use "Regenerate Persistent ID" on the duplicate; "Assign Persistent ID" sets one only when missing.
clock_id_overridePropertyAdvanced: fixed, readable id for save files, e.g. cross-project references. Empty derives automatically; prefer the editor's persistent-ID actions.
signal_busPropertyClock event bus, created eagerly so consumers can subscribe before the host's `_ready`. All boundary events emit here from `advance_microseconds`.
age_servicePropertyAge service bound to this clock's time. Optional. Not @export: Godot cannot resolve a custom Resource @export here. Assign from the `.tres` or at runtime; the setter wires `age_service.clock = self`.
time_snapshot_serializerPropertyTime serializer constructed in `_init` and wired to self.
age_registryPropertyPer-clock `AgeStateRegistry`: age state is hermetic to this clock, with no process singleton, so two clocks never see each other's states. Constructed in `_init`; lifetime matches the clock resource.
clock_idPropertyStable id used by ClockGroupSerializer for save/load identity. Cached after first resolution; reassigning `persistent_id` or `clock_id_override` clears the cache. Priority (issue #424): `clock_id_override` (durable across sessions) → `persistent_id` (durable across renames, restarts, machines) → `resource_path` hash (same `.tres` shipped) → runtime counter (session-local).
assign_persistent_idMethod
regenerate_persistent_idMethod
advance_microsecondsMethod
advance_through_microsecondsMethod
advance_scaled_microsecondsMethod
progress_timeMethod
advance_to_next_dayMethod
publish_current_stateMethod
publish_state_loadedMethod
get_time_snapshot_serializerMethod
to_dictMethod
from_dictMethod
date_timeMethod
game_secondsMethod