SimulationHost
namespace Griff.Simulations;
public sealed class SimulationHostWhat a balance simulation plays with: the game’s tables, its component types (scripts’ too), how it loads scenes and prefabs, its step rate and its script simulations. The editor makes one from the open project; a game makes one of itself with Of.
Properties
Section titled “Properties”Components
Section titled “Components”public ComponentRegistry Components { get; init; }The component types the arena’s scene is read with (the project’s scripts’ too).
Controls
Section titled “Controls”public IReadOnlyDictionary<string, IReadOnlyList<InputBinding>> Controls { get; init; }The game’s input actions and their bindings, as the project’s Controls say, so a script asking for an action by name finds it as in Play. Nothing is ever pressed in a run; the names are what count.
LoadPrefab
Section titled “LoadPrefab”public Func<string, Entity>? LoadPrefab { get; init; }Makes an entity from a prefab by name, for what the arena’s game spawns. Called on every thread a simulation runs its fights on at once, so it must be safe to (a PrefabLibrary is).
LoadScene
Section titled “LoadScene”public Func<string, Scene>? LoadScene { get; init; }Loads a scene by name: the arena, and any scene its game loads.
Modules
Section titled “Modules”public IReadOnlyList<GameModule>? Modules { get; init; }The modules its fights run the systems of (see Modules): every one this program has if null.
SaveVersion
Section titled “SaveVersion”public int SaveVersion { get; init; }The version of the game’s saved games, as the project says (SaveVersion).
ScriptTypes
Section titled “ScriptTypes”public IReadOnlyList<Type> ScriptTypes { get; init; }Types that can be script simulations (classes deriving from SimulationScript), besides those beside the components.
ScriptsNow
Section titled “ScriptsNow”public Func<object>? ScriptsNow { get; init; }Says which build of the project’s scripts is running now (the editor’s: its assembly), so a run that fails while they were rebuilt under it says so. Null when the scripts can’t change under a run (a game’s).
StepRate
Section titled “StepRate”public int StepRate { get; init; }Steps a second of game time, as the project says.
Tables
Section titled “Tables”public TableSet Tables { get; init; }The game’s tables, as the rows and the sweeps’ steps come from them.
Methods
Section titled “Methods”public static SimulationHost Of(Game game)A host playing as game does: its tables, components, modules, scenes, prefabs and step rate.
Scripts
Section titled “Scripts”public IReadOnlyList<Type> Scripts()The script simulation types it knows: ScriptTypes, those in the assemblies of the components it reads, and those in an exported game’s scripts (loaded once, never swapped).