PhValheimCompanion

v1.0.6·Updated 2024-05-06

Connects client and server events to PhValheim's backend (phvalheim-server)

About this mod Author’s original text

PhValheim Server Side Companion

phvalheim-companion is a custom mod for Valheim servers backed by PhValheim (phvalheim-server). This is a server-side mod that is automatically added to all deployed PhValheim worlds >=phvalheim-server 2.4.

Summary

  • This mod is intended to connect in-game telemetry with PhValheim's backend. The idea is to capture events and other statistics about the running world, e.g., server start, server stop, player join, player disocnnect, player death, etc...
  • The codebase for this mod was forked from Aaron Scherer valheim-discord-notifier. All external functionality of this forked mod has been disabled until it's needed futher. Internal event handlers were used to tie into PhValheim's backend. I learned alot about HTTP POST within C# from this code base. Thank you, @aequasi!

Current capability: output from game console

  • On server start

PhValheim Companion: [Sent] {"action":"start","world":"mytestworld22"}

PhValheim Companion: [Received] Backend response:OK

  • On player join

PhValheim Companion: [Sent] {"action":"join","world":"mytestworld22","citizen":"Boogeyman"}

PhValheim Companion: [Received] Backend response:OK

The Backend response: OK is PhValheim's backend returning a result back to game.

This mod and the new changes to phvalheim-server >=2.4 lay the foundation for advanced bi-directional interaction between a running world and PhValheim.

Next steps:

  • Capture all players that join a world and store them in PhValheim's database. These players will be listed (mouse hover) on the public interface so folks will be able to identify which character they used in the world.
  • Capture player statistics. E.g., builds and deaths
  • Capture progression of the world. E.g., No hung heads at the shrines = copper/tin age, A hung Eikthyr head = bronze age and so forth. DONE!

See for more information regarding the main project.

Changelog

  • 1.0.5 removed all unused code
  • 1.0.4 Update readme
  • 1.0.3 Updated to support 0.216.9
  • 1.0.2 Corrected a URI issue with unused (as of now) server-side code.
  • 1.0.1 A significant and new capability was added to phvalheim-client, phvalheim-server and phvalheim-companion, allowing in-game client notifications to be sent back to the originating PhValheim server. The first feature that uses this new method detects world progression. E.g., When a boss head is hung at the spawn shrines, PhValheim Server will now display icons on the public interface indicating progression.
  • 1.0.0 Initial release sends world start and player join to the backend.

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.

Dependencies

Install these first, or the mod will not work:

denikson-BepInExPack_Valheim

File & checksum

Filename
PhValheimCompanion-1.0.6.zip
File size
318.7 KiB