Skip to content
ct

Class

TimeHost

Generated GDScript class reference for CalendarTime.TimeHost.

Status
Current
Version
v2.0
Updated
Generated from GDScript addon source

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, docs/notes/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 is the deterministic / replay / lockstep seam.

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 deterministic / replay path — see `docs/notes/timescale-and-drive-modes.md`. The clocks this host drives every frame. Designer-fillable: drag `clock.tres` files into this array. Clocks must be bound explicitly; the old runtime/static-registry auto-attach path was removed. Assigning or replacing this array at runtime (after `_enter_tree`) rebuilds the internal `ClockGroup` so driving, save/load, and the group serializer stay in sync. After `_ready` it also recomposes the host-owned `DayNightCycleService` array so each clock keeps a fresh, correctly-bound day/night service
auto_attach_unbound_clocksPropertyDeprecated no-op. Auto-attach previously scanned a static registry of all GameClock instances. That registry was removed to fix static reference leaks, so clocks must now be bound explicitly via the `clocks` export array. This flag is kept only so existing scenes with the serialized property still load.
time_scalePropertyThe time scale (delta_multiplier bridge from real seconds to game seconds, multiplied into the engine delta in PROCESS / PHYSICS_PROCESS drive modes). Distinct from `GameCalendar.time_scale`, which is the calendar's unit schema (seconds_per_minute / hour / day), not the rate. See `docs/notes/timescale-and-drive-modes.md`. Reassigning `time_scale` resets the pending fractional µs carry — the carry is computed under the current multiplier, so leftover carry from the previous multiplier would be applied under the new multiplier and produce a non-deterministic first tick
drive_modePropertyDrive mode. PROCESS is the beginner default and matches prior `auto_increment_time = true` behaviour. MANUAL is deterministic. `auto_increment_time` is preserved as a backward-compatible alias — `auto_increment_time = true` ≡ `drive_mode = PROCESS`, `auto_increment_time = false` ≡ `drive_mode = MANUAL`.
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 internal 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
multiplierProperty
delta_microsecondsProperty
defaultProperty