Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
DvergrAstrolabe
Day length, daylight and night in real minutes, with production as its own dial: vanilla pace or faster at any cycle length. Server-synced and version-locked, required on clients too; the full maths is printed to the log.
CHANGELOG
Changelog
0.4.0
A new line of the mod: it now runs on the server and on every client, and owns the whole day/night cycle instead of pacing the server's clock around a vanilla one. Settings carry over from 0.3 (see Upgrading from 0.3 in the README); clients that do not have the mod can no longer join.
Added
- Three lengths in real minutes.
[2 - Cycle]CycleMinutes(the full day, vanilla 30),DaytimeMinutes(sunrise to sunset, vanilla 21) andNightMinutes(sunset to sunrise, vanilla 9), withLengthRuledeciding which one gives way when they do not add up (FitToCyclekeeps the cycle exact and scales the other two, the default;DaytimePlusNight,CycleMinusNight,CycleMinusDaytime). - Production as its own dial.
[3 - Production]ProductionScale(1 = vanilla, 2 = twice as fast, 0.01 to 100) runs everything on the game clock - crops, smelters, fermenters, beehives, fuel, respawns, spawners, taming, regeneration, weather - at that multiple, without touching the sun.ProductionBasissays what 1 means:RealTime(vanilla per real minute whatever the cycle length) orGameDays(vanilla per game day, the 0.3 economy). - The full mathematics, in the log and in the README. The solver derives the game-day length
L, the exact clock rateRand the sunrise/sunset knees from the settings in six steps, and prints each step with your numbers in at startup, after every settings change, and on every client as the values arrive. The README has the formulas, their consequences and worked examples; theastrolabeconsole command prints the working plus the live clock of the machine you are on. - Server-synced, version-locked. ServerSync (compiled in) pushes the settings to every client and
[1 - General]LockConfiguration(default on) makes the server's values the only ones that count. Both sides must run the same version; a vanilla client is refused at the door. [4 - Clock]WaveSpeed(Vanilla, default: the water runs on real time whatever the clock rate, so waves look and hit as in vanilla;FollowClockas an unmodded game) andSleepSkipPushInterval(how many steps clients see the 12-second sleep skip in).[5 - Compatibility]PatchSelfCheck(samples the game's own sunrise/sunset function after applying and reports another mod's knees if they won; re-asserts the day length every 5 s with a warning naming the other mod) andSelfCheckSteps.- Every cfg comment explains its setting in plain words and gives worked examples ("60 = each day takes one real hour"), with the formula underneath for those who want it.
- Automatic migration of a 0.3 (or earlier) cfg:
DayMinutes+NightMinutesbecome the three lengths withProductionBasis = GameDays, keeping the 1800-second day, the per-day economy and the day counter of the existing world.
Changed
- The day/night cycle is set on every machine (
EnvMan.m_dayLengthSec,RescaleDayFraction,GetMorningStartSec,SkipToMorning) and the clock runs at one flat rateReverywhere (ZNet.UpdateNetTimeon the server and on every client). Daylight and night no longer run at two different rates: the band moves instead. A sunrise/sunset patch from another mod on the same method loses to Astrolabe's (it runs last). - Changing the day length on a running world shifts the day counter and the time of day once (the clock itself is never re-based, so every timestamp in the world stays valid); the log prints the before and after.
- A sleep taken in the pre-dawn with a late sunrise no longer risks skipping an extra day, and with an early one no
longer risks rewinding the clock:
SkipToMorninguses the configured sunrise instead of vanilla's 0.15.
Removed
[4 - Boats](PauseFor,PauseRadius,MooredRadius,UnderWaySpeed,CheckInterval),HoldSchedule,CatchUpLimit,ClockPushInterval,BandDetection,BandProbeSteps. With every machine on the same clock a push carries nothing, so there is nothing to pause for, nothing to catch up, and no other mod's band to follow. The 0.3 limits go with them: no schedule slip while someone sails, no 0.2x floor, no fast-night production.
0.3.0
Fixed
- Sunrise and sunset were hardcoded at vanilla's raw day-fractions 0.15 and 0.85. With a mod that moves them
(Gamma of Night Lights' day/night cycle sets the night as a percentage of the day) Astrolabe paced the wrong
stretch: at Gamma's
3600 / 75the real daylight band is 900 game-seconds, but Astrolabe fitted 1260 intoDayMinutes, so every rate was off by 1260/900 and the segment it treated as the long one was the short one. Found on ProximaMaxi.
Added
- The daylight band is read from the running game. Astrolabe samples
EnvMan.RescaleDayFraction(the patched version, whoever patched it) to find where the game's day begins and ends, and paces that band; the day length was already read live. Re-read every 5 seconds, at every sunrise and sunset and after a config edit, so a synced change on the other mod is picked up within seconds. Gamma sets the size and the split of the day, Astrolabe sets how long it takes in real minutes, and when both segments land on the same multiplier there is no fast-day, slow-night contrast at all: Gamma3600 / 75+ Astrolabe15 / 45runs a flat 1x with a 45-minute night,7200 / 75+15 / 45a flat 2x. See Pairing with Gamma of Night Lights in the README. Detection that fails falls back to the vanilla knees and logs an error; an unmodded game detects exactly 0.15 / 0.85 and behaves as 0.2.1 did. [5 - Compatibility]:BandDetection=Auto(default) orVanilla(force the vanilla knees, the escape hatch), andBandProbeSteps(1000) for how finely the band is sampled.- Logging. The schedule line reports the daylight band (
daylight band 900 of 3600 game-s (25%, sunrise and sunset moved by another mod)), aday cycleline is printed when the world loads and whenever the band or the day length changes, andVerboseLoggingadds the two detected fractions. A warning names the setting and the number whenever a schedule implies a nominal rate at or under 0.2x (progress drift on client-owned fires, beehives and sap collectors) or fast enough that one clock push moves the sun more than a degree (about 11x at the default 0.5 s push interval). When another mod has moved the band, one note reminds you that it must be on the clients too.
0.2.1
Fixed
- Rebuilt against Valheim 1.0.16 and re-verified (static reference check on client and dedicated server, headless 1.0.16 dedicated-server boot).
0.2.0
Fixed
- Boats took water-impact damage under sail while the schedule was active (60-150 hull damage a minute on
a Karve at a 40-minute day, with constant bobbing). Every clock push moved an unmodded client's physics
water surface in a single step, and vanilla's
Ship.UpdateWaterForcecounts a jump like that as a slam: 10 blunt per hit, up to thirty hits a minute, whenever someone is aboard. The sun and the rendered water are smoothed; the surface boats float on is not, whatever the push interval. Found on the live server through Wonderland's boat-upkeep log.
Added
[4 - Boats]. The whole server's clock runs at vanilla speed while any player is withinPauseRadius(64 m) of a boat under way orMooredRadius(24 m) of one at rest, where pushes change nothing; the switch is seamless.PauseFor=Ships(default),Water(also anyone over water) orOff;UnderWaySpeedandCheckIntervaltune the detection. A boat docked beside a base only pauses it for someone on or beside the deck. The README's Boats section explains exactly how time behaves around boats.HoldSchedule(default on) andCatchUpLimit(default 4) in[2 - Day And Night]. Every sunrise and sunset is now held to its scheduled time: after a pause near boats, a server hitch or a mid-day config edit, the rest of the segment runs faster or slower (within the limit) to land the boundary on time. A 40-minute day absorbs about 18 minutes of boating, a 5-minute night about 4. Off = fixed rates, as 0.1.0 behaved.- Self-verifying sunrise and sunset lines. With
VerboseLoggingon, each line now reports how long the segment that just ended really ran, what was scheduled, and how much of it was spent at vanilla speed near boats; every pause and resume is logged with who and which boat. - Boat guard self-test at startup ("boat guard ready: sector query OK ..."). If the lookup ever throws, the mod logs an error and keeps the clock at vanilla speed until restart rather than risk hulls.
0.1.0
Added
- Day and night length in real minutes.
DayMinutes(sunrise to sunset, vanilla 21) andNightMinutes(sunset to sunrise, vanilla 9) in[2 - Day And Night]. The server paces its authoritative world clock (ZNet.UpdateNetTime) at a different rate inside and outside the daylight band, so every connected client sees the new lengths with nothing installed. The clock itself, the day counter, sleeping and the world save are untouched: a day is still 1800 game-seconds, it just takes as long as you say in wall time. - Smoother sun at rates far from 1x.
ClockPushIntervalin[3 - Client Sync](default0.5s) pushes the clock to clients more often than vanilla's 2 s, shrinking the correction each push applies. Set2to add no extra traffic. - Live config reload. Edit the cfg on a running server; the new schedule is picked up within 5 seconds and logged.