Time Manager
UsewithTimeManager() to add synchronized game time without adding methods to RpgMap.
The server owns the canonical time. The client receives a map snapshot and infers the displayed time locally from elapsedMinutes, scale, paused, and serverTimestamp.
Register the Module
You can use the same module object on both sides:Server API
UseTimeManager from server hooks, events, or services:
Client API
UseClientTimeManager for display logic:
Snapshot
The synchronized map field is internal and namespaced:TimeManager and ClientTimeManager instead of reading __rpgjsTime directly.
Lighting
Whenlighting.enabled is true, the server can apply map lighting from time phases:
Weather Ambiences
Whenweather.enabled is true, the server can roll weather ambiences per map. Each ambience has a weight and a game-time duration. When the duration expires, the server rolls the next ambience and applies it with the existing map weather API.
maps[mapId] overrides the default weather table for that map. A weather: null ambience clears the map weather. If weather is omitted, disabled, or no table exists for a map, the time manager does not modify that map’s weather.
Weather remains server-owned. Clients receive the regular weatherState map update and should read engine.sceneMap.weather() or engine.sceneMap.getWeather() for rendering.
Environment Hooks
Usehooks on withTimeManager() when the environment should drive gameplay rules from the plugin itself:
onBeforeWeatherChange() can return false to cancel the roll, or another { key, ambience } candidate to replace it. Initial map registration is silent: hooks run only after an actual time, lighting, or weather transition.
Transition payloads include the current map so plugin hooks can update synchronized map state or trigger map-local systems.
Events can react locally by declaring matching methods: