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.
TimeControl
Adjust the length of the Valheim day/night cycle with a simple multiplier.
| Date uploaded | a week ago |
| Version | 1.2.0 |
| Download link | DrummerCraig-TimeControl-1.2.0.zip |
| Downloads | 147 |
| Dependency string | DrummerCraig-TimeControl-1.2.0 |
README
TimeControl
A BepInEx 5 plugin for Valheim that adjusts the length of the in-game day/night cycle with a single multiplier.
By default Valheim runs one full day/night cycle in roughly 30 real minutes.
TimeControl lets you stretch (or compress) that — e.g. a 4.0 multiplier turns
a full day into about 2 real hours.
How it works
Valheim derives the time of day every physics tick from a single field,
EnvMan.m_dayLengthSec:
dayFraction = (worldClockSeconds mod m_dayLengthSec) / m_dayLengthSec
The networked world clock advances at a fixed rate of 1 real second to 1 game
second, so making a day longer is simply a matter of increasing
m_dayLengthSec. TimeControl captures Valheim's shipped value once and
multiplies it by your configured multiplier. Day and night both scale together;
their ratio is fixed by Valheim and is preserved.
The change takes effect immediately and smoothly — the sun does not jump.
On-screen clock
TimeControl shows a small clock in the top-center of the screen that displays the
current time of day as a single word — Midnight, Night, Dawn, Morning,
Midday, Afternoon, or Dusk. The word is derived from Valheim's own
day fraction, so it lines up with the real sunrise (0.25), midday (0.5) and sunset
(0.75) points of the cycle. It is display-only and per-client — it reads your local
clock and adds no network traffic and no Harmony patches.
The clock's appearance is configurable (color, custom hex color, size, style and
font); see the Clock Appearance options below. The clock's style and font are
rebuilt only when you change a setting, so it adds no measurable per-frame cost.
Configuration
Config file: BepInEx/config/drummercraig.time_control.cfg
| Section | Key | Default | Description |
|---|---|---|---|
General |
DayLengthMultiplier |
4.0 |
Multiplier on the vanilla day length. 1.0 = vanilla (~30 min/day). 2.0 = twice as long. Range 0.1–100. |
General |
ShowClock |
true |
Show the on-screen time-of-day word clock. |
Clock Appearance |
TextColor |
White |
Palette color for the clock text. Ignored when TextColorHex is set to a valid value. |
Clock Appearance |
TextColorHex |
(blank) | Optional custom color as #RRGGBB; overrides TextColor when valid. Blank uses the palette. |
Clock Appearance |
FontSize |
16 |
Font size (dropdown of preset sizes: 12, 14, 16, 18, 20, 24, 28). |
Clock Appearance |
FontStyle |
Bold |
Normal, Bold, Italic, or BoldAndItalic. |
Clock Appearance |
Font |
Default |
Font family. Default = the built-in game UI font; other entries are common cross-platform fonts, falling back to the default if not installed on your machine. |
You can edit these live from the in-game Configuration Manager (if installed); changes apply on the spot.
Multiplayer
m_dayLengthSec is a client-local field — vanilla Valheim never sends it
over the network. To keep everyone on the same clock, TimeControl:
-
Requires an exact mod-version match. When a client connects, the server and client exchange their TimeControl version over a custom RPC. If they do not match exactly — or if one side does not have the mod at all — the connection is refused with Valheim's native "Incompatible version" screen. This reuses the same mechanism vanilla itself uses to reject mismatched clients (
ZNet.RPC_PeerInfo+ theConnectionStatus.ErrorVersioncode); no third-party config-sync library is bundled. -
Server settings win. Immediately after the handshake, the server pushes its effective
DayLengthMultiplierto the client, which adopts it for the session. A connected client's own local config is ignored while connected, so all players always share the server's clock. The client's local value applies again in singleplayer or when hosting.
Install TimeControl on the server and on every client, at the same version.
Building
Requires Mono with the .NET Framework 4.8 reference assemblies. TimeControl does not commit any game/BepInEx DLLs; it references them from your live Valheim install so it always builds against the exact version you run.
First-time setup:
- Copy
Directory.Build.props.exampletoDirectory.Build.propsand set the two paths to your install's…/Managedfolder and…/BepInEx/corefolder. (Directory.Build.propsis gitignored.) This is what the.csproj/ IDE use. - The game assembly referenced is
assembly_valheim.dll(the full ~2 MB managed assembly). Do not referenceAssembly-CSharp.dllon macOS — that file is a tiny AOT stub with no game types.
Then:
./build.sh
build.sh resolves the same paths from the VALHEIM_MANAGED and BEPINEX_CORE
environment variables, falling back to the local macOS Steam "testing" install
defaults. Override them to build against a different install:
VALHEIM_MANAGED="/path/to/.../Managed" BEPINEX_CORE="/path/to/.../BepInEx/core" ./build.sh
This compiles TimeControl.dll into bin/Release/ and (when the local Steam
testing install is present) copies it into that install's BepInEx/plugins/
directory.
License
See repository.
CHANGELOG
Changelog
1.2.0
- Deep North (1.0.7) Release
1.2.0
- Added Game Clock (default Enabled)
1.0.2
- Housekeeping
1.0.0
- Initial release