Places can carry a repeating cycle of sunrise, daylight, sunset and moonlight. The cycle controls the sky gradient and disc, diffuse sky light, directional light, ambient light and mist color. Local lights and mist density retain their authored values. Removing the cycle restores the saved static atmosphere.
#Try it
Restart npm run dev:editor, open the printed private link and choose Atmosphere → Day & night → Let daylight change. Set day length, starting hour and sunrise direction, then Preview atmosphere → Save changes. The atelier shows the starting hour. Apply saved revision shares the cycle with connected travelers; a publication retains its epoch and settings. The world keeps advancing while travelers are away.
A changed configuration receives a new epoch when Preview is accepted. Reopening unchanged settings preserves the saved epoch. Cancel and Discard do not change the saved world. Saved Undo/Redo survives restart and restores the prior cycle and source format. Choosing an atmosphere mood disables the cycle in that preview, so the static mood takes effect.
#Source and time contract
World format 20, compiler day-cycle-world.20, introduces optional place.dayCycle:
dayCycle: {
profile: 'day-night.1',
periodSeconds: 1200,
startHour: 9,
epochSeconds: 1800000000,
azimuth: -35,
}Period is a whole number from 60–86400 seconds. Starting hour is from 0 to less than 24 (reader upper bound 23.999999); epoch is finite UTC seconds from 0–1e12; azimuth is −180–180 degrees. The schema owns inputs and rejects unknown fields. set-day-cycle accepts the value or null, through the ordinary authoring transaction, review, merge and saved-history paths. Captured object arrangements omit the surrounding cycle. Older world formats remain supported and cannot carry this field. Presentation format 13 carries the configuration; older presentation profiles remain supported.
sampleDayCycle is a pure versioned sampler. It computes the cycle phase modulo its period from the authored epoch, including timestamps before that epoch. It does not advance simulation ticks or mutate gameplay state. The palette interpolates cool night, warm twilight and blue daylight. The sun and opposite moon use a tilted artistic orbit; near-horizon illumination fades to avoid a bright switch. This is an artistic cycle, not an astronomical location/calendar model.
Cooperative and persistent room servers emit small environment-time packets alongside their existing presence cadence, only when the world has a cycle. Packets bind UTC seconds to the current room authority epoch. Each server anchors UTC once and advances it using its monotonic clock. Clients ignore another epoch's samples, reject regressing samples within an accepted receipt stream, and extrapolate for at most one second using monotonic receipt time. They hold the last displayed time when disconnected or during a local revision barrier. Reconnection catches up to the current room time; server downtime is included in the saved absolute cycle. Server clocks must be reasonably synchronized across hosts for seamless host replacement; this is not a clock-synchronization service.
The simulation Worker forwards the accepted time and its absolute monotonic sample/deadline timestamps through the existing acknowledged frame delivery. Main-thread and Worker graphics consume the remaining prediction budget at rendering time, without renewing the original one-second deadline when a view crosses threads. A monotonic view holds its phase on pause or expiration rather than rewinding to an older snapshot. This avoids adding frame-handoff delay to the sampled phase, without repeated environment/foliage payloads or structural scene changes. Portal destinations receive the same clock with their own cycle settings. Reduced decorative motion does not stop shared daylight. Offline play uses the local wall clock; an editor/native view without a time sample uses the authored starting hour.
#Rendering and limits
The cycle reuses the sky and geometry pipelines, uniforms and shadow resources. It adds no textures, GPU buffers or frame targets. When no static sky was present, the cycle enables the existing sky triangle. Directional shadow placement follows the sampled direction; local lights and a selected local shadow light retain their authored behavior. Accepted scene/configuration and sampled time reproduce the image after device recovery. Foliage receives the sampled broad lighting through the same uniforms.
The first profile has a fixed artistic palette and orbit. Authored rain and snow can accompany the cycle. Custom time-keyed colors, seasons, stars, moving clouds, automatic weather transitions and gameplay triggers tied to time of day remain open. This feature does not implement water, swimming, buoyancy, terrain streaming/LOD, voxels, or the final character/environment art pass. Physical-device, WAN clock-skew and long-session acceptance remain unqualified.
Acceptance evidence records schema, phase/wrap, bounded clock extrapolation, source/checkpoint/undo, cooperative and PostgreSQL restart checks, native main/Worker pixels, portal timing, responsive editor controls and shared Apply/publication. It does not close milestone 15 or the full engine program.