PlatformAPI reference
Class HostEnvironment
Namespace: MicroEngine.Hosting
Assembly: MicroEngine.Hosting.dll
Guide: Composing a game for every platform
What a host knows about the process it runs in, handed to the composition instead of being read from process-wide state: its kind, its developer variables (environment variables on desktop; the page’s or the launch’s variables elsewhere), where it reports and where its files are. Tests build one with their own variables and writers.
public sealed class HostEnvironmentInheritance
Constructors
HostEnvironment(HostKind)
An environment of kind over this process: its environment variables, the console and its base directory.
public HostEnvironment(HostKind kind)Parameters
kind HostKind
Properties
BaseDirectory
The folder the host’s program runs from (BaseDirectory by default).
public string BaseDirectory { get; init; }Property Value
ClockSeed
A seed for runs that ask for none, from the clock by default (ResolveSeed).
public Func<int> ClockSeed { get; init; }Property Value
CrashDirectory
Where the desktop launcher writes the crash report of a run that fails (Core.CrashReport), or null for
the game’s save folder (SaveStore.DefaultDirectory).
public string? CrashDirectory { get; init; }Property Value
Error
Where the host prints errors (the console’s standard error by default, as it was when this was created).
public TextWriter Error { get; init; }Property Value
Kind
The kind of host.
public HostKind Kind { get; }Property Value
Out
Where the host prints results (the console’s standard output by default, as it was when this was created).
public TextWriter Out { get; init; }Property Value
Variables
Reads a developer variable by name, or null; the process’s environment variables by default.
public Func<string, string?> Variables { get; init; }Property Value
Methods
Variable(string)
The developer variable name, or null when it is unset or blank.
public string? Variable(string name)Parameters
name string