Valheim
Install with App

Details

Latest version
1.2.1
Last Updated
First Uploaded
Downloads
1K
Likes
1
Size
71KB
Dependants
ADDatHost Valheim hosting
€1

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.1100.
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:

  1. 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 + the ConnectionStatus.ErrorVersion code); no third-party config-sync library is bundled.

  2. Server settings win. Immediately after the handshake, the server pushes its effective DayLengthMultiplier to 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:

  1. Copy Directory.Build.props.example to Directory.Build.props and set the two paths to your install's …/Managed folder and …/BepInEx/core folder. (Directory.Build.props is gitignored.) This is what the .csproj / IDE use.
  2. The game assembly referenced is assembly_valheim.dll (the full ~2 MB managed assembly). Do not reference Assembly-CSharp.dll on 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.

DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro
DatHost — Valheim server hosting, first month for one euro