State
I run a server with serverTime="SystemTime", so the in-game date is the real date. The moon in the sky has the wrong phase, and because its position follows its phase it also rises and sets at the wrong times. In December 2026 the engine's full moon is on the 18th, the real full moon is on the 24th. On the real full moon (Dec 24) the engine moon is already waning and only rises late in the evening instead of at dusk.
Measurements
On a vanilla DayZDiag server (Chernarus, clear sky) I called GetGame().GetWorld().SetDate() for every day from 2018 to 2032 at 2-hour steps and read GetWorld().GetMoonIntensity(). The value is the lit fraction of the moon (0 when it is below the horizon). It fits this model with an rms error of 0.007:
age = ((year - 2000) * 365.25 + dayOfYear - 0.88) / 30.348 (fraction of the cycle, 0 = new moon)
intensity = (1 - cos(2 * PI * age)) / 2The real synodic month is 29.53 days. With 30.35 days the engine moon falls behind by about 0.8 days every cycle, so it drifts by a full cycle about every 28 years. In practice the same date gives almost the same phase every year: the engine's December full moon moves only about one day per year (2024 and 2025: Dec 19, 2026: Dec 18, 2027: Dec 17), while the real one moves about 11 days per year (Dec 15 2024, Dec 4 2025, Dec 24 2026, Dec 13 2027).
Examples (highest engine intensity that night vs the real lit fraction):
2026-12-10 engine 0.42 (waxing, up in the evening) real 0.01 (new moon)
2026-12-17 engine 0.98 (nearly full, up all night) real 0.47 (first quarter, sets ~midnight)
2026-12-24 engine 0.77 (waning, rises late evening) real 1.00 (full moon, rises at dusk)The sun is correct: its position only depends on month, day and time (identical for 2001, 2026 and 2039 on the same date).
Likely cause (my guess, I can't see the engine code)
The phase cycle comes from the moon's orbit and the sun's yearly motion: 1 / (1/orbit - 1/365.25). With the real sidereal orbit of 27.32 days that gives the real 29.53 days. Working backwards from my fitted 30.348 days, the engine's orbit is about 28.02 days. That looks like the moon's orbit was rounded to about four weeks (28 days) somewhere in the moon model. I tested other round periods against the same data (rms error of the lit fraction):
30.348 days (fit) rms 0.007
30.325 days (orbit exactly 28 days) rms 0.095
30.44 days (average calendar month, 365.25/12) rms 0.33
29.53 days (real synodic month) rms 0.47An exact 28 is close but drifts over 15 years, so the constant is probably near 28.02 rather than 28. Using the real sidereal month (27.32 days), or the synodic month directly (29.530589 days), should fix it.
Workaround I use
My server mod picks the in-game year (2000-2039) whose engine moon matches the real moon on that date, since the year changes nothing but the moon. It works (phase within about a day, rise and set times within a few degrees of the real moon), but a server shouldn't have to show the wrong year to get the right moon.
On a server, run GetGame().GetWorld().SetDate(2026, 12, 24, 0, 0) (a real full moon) and wait a second.
Read GetGame().GetWorld().GetMoonIntensity(): 0.77 (waning), not ~1.0.
Repeat with SetDate(2026, 12, 17, 21, 0) (real first quarter): 0.98, a full moon.
Look at the sky on a client with the same dates: the moon shape and its rise and set times match the script values, not the real moon.
The moon follows the real synodic month (29.53 days), so on a server using the real date the moon has the real phase and rises and sets at the real times, as the sun already does.
Activity
You are not signed in. Please sign in to see more details and to reply.
State