TimeControl
Adjust the length of the Valheim day/night cycle with a simple multiplier.
模組介紹 作者原文
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 + the ConnectionStatus.ErrorVersion code); no
third-party config-sync library is bundled.
- 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 agai
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。