Skip to content
ct

Class

TimeHost

Generated GDScript class reference for CalendarTime.TimeHost.

Status
Current
Version
v2.0.4
Updated
2026-08-09

TimeHost — Node; the engine→game bridge. Drives every clock in the clocks array each frame via the chosen drive_mode. Composes the save/load facade (ClockGroupSerializer) and one DayNightCycleService per clock in _ready. No clock ownership, no primary-clock concept. Drive modes (see DriveMode enum, addons/calendar_time/guides/timescale-and-drive-modes.md):

  • PROCESS (default): _process(delta) advances every clock from engine delta × time_scale.delta_multiplier with fractional-µs carry.
  • PHYSICS_PROCESS: _physics_process(delta) does the same on the physics tick. Use for games whose game-time calibration is locked to the physics frame rate (e.g. 60 Hz physics).
  • MANUAL: no automatic advancement. The game / test calls host.drive_microseconds(int) or host.drive_seconds(float) itself. Manual mode: you advance time yourself. Useful for tests, replays, and fixed-step simulations.

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

Syntax

class TimeHost extends Node

Members

NameKindSummary
clocksPropertyDrive mode for automatic clock advancement. The default `PROCESS` is beginner-friendly and matches prior behaviour. `MANUAL` is the documented manual path — see `addons/calendar_time/guides/timescale-and-drive-modes.md`. The clocks this host advances every frame. Drag one or more `GameClock` `.tres` resources into this array. This is the only setup a new scene needs. The host reads this list, drives each clock, and keeps save/load and day/night services in sync with it. Replacing the list at runtime rebuilds the clock group automatically. Ships preassigned to the bundled Four Seasons clock in `default_time_host.tscn`; assign your own clock to replace it.
time_scalePropertyHow fast game time runs relative to real time. `delta_multiplier` is multiplied into each engine frame's delta in PROCESS and PHYSICS_PROCESS modes. For example, 1000.0 advances the calendar by 1000 game seconds per real second. This is the host-wide pacing rate. It does not change the calendar's unit schema (seconds per minute / hour / day). Leave unset to use the standard 1000.0 default. Distinct from `GameCalendar.time_scale`.
drive_modePropertyHow the clocks advance. PROCESS (default) advances every clock each frame from the engine delta — the beginner-friendly choice. PHYSICS_PROCESS does the same on the physics tick. MANUAL never auto-advances; your code calls `drive_microseconds()` / `drive_seconds()` itself (the deterministic / replay path).
auto_increment_timePropertyBackward-compatible boolean alias for `drive_mode`. `auto_increment_time = true` ≡ `drive_mode = PROCESS`, `auto_increment_time = false` ≡ `drive_mode = MANUAL`. Reads as the equivalent boolean for any pre-rename scenes / tests.
group_serializerPropertyThe save/load facade. Composes time + age per clock and namespaces under the group's `save_key`. See `ClockGroupSerializer`.
day_night_cycle_servicesPropertyDay-night cycle services — one per clock, composed by the host in `_ready`. Each DNC reads `times_of_day` from its own clock's calendar (the calendar is the schema; TODs are part of the schema).
get_clock_groupMethod
get_group_serializerMethod
load_stateMethod
drive_microsecondsMethod
drive_secondsMethod