04. Multiplayer and Dedicated Servers

Updated 2 hours ago

The host decides

Every setting is host-authoritative. When you join a server running MidgardPlus, your client asks the host for its settings and uses those instead of your own. Your config file is not overwritten, it is just not what the world runs on. Leave the server and your own settings apply again.

This means:

  • Nobody can turn on free building or a damage multiplier by editing their own file.
  • The host does not have to ask anyone to match their config.
  • Playing solo, you are the host, so your file is the one that counts.

Sync runs over ZRoutedRpc as a request and a response, not as a push when someone connects. A client asks, the host answers. If the host changes a setting mid-session, connected clients pick up the change.

Everyone needs the mod

MidgardPlus registers a creature, an item, a building piece and three recipes. Custom content has to exist on both sides or the network cannot agree on what a prefab is. Install it on the server and on every client.

The version should match across the server and clients. Mixed versions are not tested and are the first thing to rule out if something is behaving oddly.

Dedicated server install

  1. Install the BepInEx Valheim pack on the server, the same as on a client.
  2. Install Jotunn 2.30.0 or newer.
  3. Put MidgardPlus.dll in <server>/BepInEx/plugins/.
  4. Start the server once, then edit <server>/BepInEx/config/midgardplus.cfg.
  5. Restart.

Confirm it loaded by looking in the server's BepInEx/LogOutput.log for Registered companion creature.

If the server log says it was skipped

[Warning: BepInEx] Skipping [MidgardPlus] because of process filters (valheim.exe)

That was a real bug in 1.1.0 and 1.1.1. The plugin declared a BepInEx process filter for valheim.exe only, so a dedicated server running valheim_server.exe refused to load it, which meant the one machine that most needed the mod was the one ignoring it.

Fixed in 1.1.2. If you see that line, you are on an old build. Update.

Reported by Symoji, who saved everyone else the trouble.

Companions on a server

  • A companion belongs to the player who called it. Companions per player is per player, not per world.
  • Their name is stored in the creature's ZDO, so everyone sees the same name.
  • They stay in the world when their owner logs out.
  • Only the machine that owns the creature moves it, changes its gear or drops its bag, so loot is not duplicated across clients.

Crafting from nearby chests on a server

Materials are moved out of real chests, so this respects who can reach what. Chests currently open by another player are skipped, and a container that has not finished networking is ignored.

Note that a wide Chest search range costs more on a busy server than in a solo world, because the scan runs whenever any nearby player refreshes a recipe list.