SharedDiscovery

版本 v0.1.0·更新於 2026-09-16

Shares item and material discoveries between players in the same Valheim world with multiplayer synchronization and per-world persistence.

模組介紹 作者原文

SharedDiscovery

SharedDiscovery is a Valheim multiplayer mod for shared item/material discoveries per world.

When one player discovers an item or material, the discovery is sent to the server, stored as world progress, and synchronized to the other players. Each client applies the discovery through Valheim's native Player.AddKnownItem flow, so Valheim itself decides which recipes become available and displays the original vanilla discovery notifications.

Features

  • Shared item discoveries
  • Server-authoritative progression
  • Offline player sync through snapshots on join/spawn
  • Per-world persistence using ZNet.GetWorldUID()
  • Vanilla recipe logic
  • Vanilla discovery notifications
  • Multiplayer host and dedicated-server-oriented architecture
  • r2modman and package structure

Important

SharedDiscovery does not force recipes, crafting stations, boss progression, costs, or recipe visibility. It shares stable item prefab IDs and lets Valheim process recipe unlocks normally.

The mod does not import every known item from an old character when joining a new world. Only new discoveries made while connected with SharedDiscovery active, plus discoveries already saved by SharedDiscovery for that world, become shared world progress.

Requirements

The server and every client should install the same SharedDiscovery version.

Build references required locally:

  • Valheim managed assemblies
  • BepInEx
  • Harmony from BepInEx

SharedDiscovery uses Valheim's native ZRoutedRpc API.

The plugin target framework is net462, matching the common Valheim/BepInEx mod target. The core library also targets net8.0 for local tests.

Installation

For r2modman development:

  • Copy Environment.props.example to Environment.props.
  • Set VALHEIM_INSTALL to the Steam Valheim install folder.
  • Set BEPINEX_PATH to the r2modman profile's BepInEx folder.
  • Set MOD_DEPLOYPATH to the target plugin folder.
  • Run:.\build.ps1 -Configuration Release -CopyToProfile

Manual install:

BepInEx/plugins/SharedDiscovery/

SharedDiscovery.dll

SharedDiscovery.Core.dll

Build.\build.ps1

or:

dotnet build.\SharedDiscovery.sln

The build script validates required local assemblies before compiling.

Package.\package.ps1

The package ZIP is written to dist/SharedDiscovery-0.1.0.zip.

Inspected Valheim APIs

The local Valheim installation inspected for this project stores the main game types in:

Valheim/valheim_Data/Managed/assembly_valheim.dll

Relevant real APIs found:

  • Player.AddKnownItem(ItemDrop.ItemData)
  • Player.IsMaterialKnown(string)
  • Player.OnSpawned(bool)
  • ObjectDB.GetItemPrefab(string)
  • ObjectDB.GetItemPrefab(ItemDrop.ItemData.SharedData)
  • ZNet.GetWorldUID()
  • ZNet.GetWorldName()
  • ZNet.IsServer()
  • ZNet.OnWorldSaveLoaded()
  • ZNet.OnNewConnection(ZNetPeer)
  • ZRoutedRpc.Register(string, Action)
  • ZRoutedRpc.Register(string, Action)
  • ZRoutedRpc.InvokeRoutedRPC(...)
  • ZPackage.ReadInt/ReadString/Write(int)/Write(string)

Persistence

Server-side world state is stored under:

BepInEx/config/SharedDiscovery/worlds.json

The loader tolerates missing files, empty files, duplicate entries, invalid entries, and parse/read failures without crashing the server.

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

denikson-BepInExPack_Valheim

檔案與校驗

檔案名稱
SharedDiscovery-0.1.0.zip
檔案大小
26.3 KiB