Table of Contents

Class HostedWorld

Namespace
Valheim.Testing.Game
Assembly
Valheim.Testing.Game.dll

A fixture world placed in a hosting client's local worlds for one hosted run. Its one placement owner is the hosting layer's journalled site (HostedWorldOnHost in Valheim.Testing.GameSessions), on a campaign client's host or on this machine: it refuses when anything named for the world (Valheim.Testing.Game.HostedWorld.IsNamedFor(string, string)) is already in worlds_local (a user's world is never overwritten or used, and a refused run copies nothing), copies and verifies the fixture into the output directory (that copy stays as the input evidence), journals the placement and places the fixture in worlds_local. Collect() (also Dispose()) moves the world, with whatever the game wrote for it (saves, .old files, backups), out of the client's worlds into the run's folder on its host, and fetches it into host-world in the output directory. Collect only once the client no longer hosts it: after an owned client stopped, or after the host left to its menu.

public sealed class HostedWorld
Inheritance
object
HostedWorld

Properties

CollectedTo

Where Collect() moved the world, or null before it has.

public string? CollectedTo { get; }

Property Value

string

CurrentPlatform

This machine's platform, for an attached client (whose install the runner does not read).

public static ClientPlatform CurrentPlatform { get; }

Property Value

ClientPlatform

FixtureCopy

The verified copy of the fixture in the output directory.

public string FixtureCopy { get; }

Property Value

string

Host

The host the journalled site placed the world on: a campaign client's, or this machine.

public string Host { get; }

Property Value

string

Name

The world's name, the stem of the fixture's .fwl: what cli_start_host_world starts.

public string Name { get; }

Property Value

string

WorldUid

public string WorldUid { get; }

Property Value

string

WorldsDirectory

The client's worlds_local directory, a path on the client's host (Host).

public string WorldsDirectory { get; }

Property Value

string

Methods

Collect()

Moves every entry named for the world out of the client's worlds into the run's folder on its host (handed over, as a server's world copy is) and fetches it into host-world (then host-world-2 and so on) in the output directory. Runs once; a failure leaves the rest in place and is rethrown.

public void Collect()

DefaultSaveDirectory(ClientPlatform)

Where Unity keeps a game client's data on platform (company IronGate, product Valheim), which holds worlds_local. The only way to change it is a FakeClientDataDirectory scope, for no-game tests.

public static string DefaultSaveDirectory(ClientPlatform platform)

Parameters

platform ClientPlatform

Returns

string

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

NameOf(IEnumerable<string>)

The world's name from a fixture's relative paths, in either layout the game loads: a chunked save (exactly one directory <name>/ at the root with a _main.<n>.fwl2 in it, as Valheim 1.0 writes worlds) or the older pair (exactly one <name>.fwl at the root). The name is at least 3 characters and a valid file name, and every other entry is inside <name>/ or named for it (Valheim.Testing.Game.HostedWorld.IsNamedFor(string, string)), so the placement's move-out takes back everything it placed.

public static string NameOf(IEnumerable<string> relativePaths)

Parameters

relativePaths IEnumerable<string>

Returns

string