Class WorldMotion
The clock the world's own motion runs on: the sea's waves, the surf on a beach, rain and snow falling, the trees in the wind, the fog banks, the fish.
public static class WorldMotion
- Inheritance
-
WorldMotion
- Inherited Members
Remarks
One clock, shared by every player. Seconds is the world clock — the server's tick carried to world seconds by WorldClock — so two players standing side by side see the same wave at the same moment, and a rejoin or a hitch puts the sea back where everyone else has it. Every presenter used to keep a private sum of its own frame times from zero, so its phase was how long that client had been running (audit 2026-10-06).
Smoothed, never backwards. FishNet re-estimates the server's tick about once a second and sets it outright, a tick or a few either way. Read raw, the waves would hitch forward and back with it. Instead this runs at real time and leans onto the world clock by at most a quarter, and only a gap too big to lean across (a join, a scene hop, a long stall) is jumped.
Never faster than real time. A preview runs the world clock hundreds of times faster to watch a day go by, and the sky and the clouds keep up with it. The motion down here does not: stopped when the clock stops and slowed when it slows (Rate), but held to real time when it races. The sea was let follow the clock (2026-09-25) and it could not be made to look right: at the sky's hundred and eighty times a four-second wave comes forty times a second. Once a preview stops racing, the motion rejoins the clock in one step.
Fields
ShaderWrapSeconds
What a presenter wraps Seconds to before a shader's float sees it: whole seconds to a millisecond, and every decimal period up to it divides it. A shader that wants a seamless wrap snaps its own periods to whole fractions of this.
public const double ShaderWrapSeconds = 10000
Field Value
SkyWrapSeconds
The wrap for the sky's slow motions whose shaders scroll noise, which no wrap can make seamless (the aurora, the rain shafts, the vortices): long, so the one jump comes every eleven hours, and on every player's screen at once, while a float still holds it to 4 ms.
public const double SkyWrapSeconds = 40000
Field Value
SnapSeconds
A gap between the motion and the world clock wider than this is jumped, not leant across.
public const double SnapSeconds = 0.5
Field Value
Properties
Pace
Seconds of motion per real second now, 0 to 1: the preview's dial (Rate) and the world clock's own pace (an admin's or the bed's hold or slow), whichever is slower. What Seconds advances at, for whatever has to step its own state a frame at a time.
public static float Pace { get; }
Property Value
Rate
Seconds of motion per real second, 0 to 1: the sea and its surf, what falls, and the trees.
public static float Rate { get; set; }
Property Value
Seconds
Seconds of world motion now, since the calendar epoch: the shared world clock in the game, smoothed (see the remarks). One value for the whole frame, so everything that moves agrees.
public static double Seconds { get; }
Property Value
TimeManager
The tick the world clock is read at. Set by whoever owns the connection (the client's weather); without one the clock is this machine's UTC, which is all an editor has.
public static TimeManager TimeManager { get; set; }
Property Value
- TimeManager
Methods
Follow(double, double, double, double)
A displayed copy of a clock-like target (seconds) that runs at real time,
leans onto the target, holds when it stops or steps back, and jumps only a gap wider than
SnapSeconds — so a preview racing it is followed exactly. For things that are
the weather rather than its motion (where the storm cells are), which a preview may race.
public static double Follow(double shown, double lastTarget, double target, double realSeconds)
Parameters
Returns
FollowClock(double)
Follows a world clock running at this many world seconds per real second.
public static void FollowClock(double worldSecondsPerSecond)
Parameters
worldSecondsPerSeconddouble
Repeat(double, double)
seconds wrapped to [0, period), exactly.
public static double Repeat(double seconds, double period)
Parameters
Returns
Scale(float)
How many seconds of motion a stretch of real time is worth (Pace).
public static float Scale(float realSeconds)
Parameters
realSecondsfloat
Returns
Step(double, double, double, double, float)
One step of the motion clock: where motion goes when the world clock moved
from lastWorld to world over realSeconds.
Pure, for the tests.
public static double Step(double motion, double lastWorld, double world, double realSeconds, float rate)
Parameters
Returns
WholeCycles(float, double)
cyclesPerSecond snapped to a whole number of cycles in
windowSeconds (never negative), so a phase it drives meets itself at the
window's end.
public static float WholeCycles(float cyclesPerSecond, double windowSeconds)
Parameters
Returns
Window(double, out long)
Which window of windowSeconds the motion clock is in, and how far into it
(seconds, 0 to the window). Every player changes window at the same moment.
public static double Window(double windowSeconds, out long index)
Parameters
Returns
Remarks
How a motion whose speed changes is kept seamless and shared: a phase written as speed × clock jumps whenever the speed does, by the change times the whole clock. Instead the speed is held for the window (WorldMotion.HeldValue) and snapped so the window holds a whole number of the motion's cycles, and the phase is that speed times the time into the window: at each window's end it has come round to where the next one starts.
Wrapped(double)
Seconds wrapped to [0, period) in double, for a float.
public static float Wrapped(double period)
Parameters
perioddouble