KernelAPI reference
Class GameLauncher
Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Configuration and launch options
The command line every desktop game accepts, on any backend: a thin caller of the launcher model every host shares (GameHost, LaunchRequest). Supported arguments:
--script FILEplay scripted input (see [InputScript](/docs/api/microengine.core.inputscript/)); implies deterministic time unless--timesays otherwise.--captures DIRdirectory for script captures (default ./captures).--platform NAMErun on that platform of the catalog (default:MICROENGINE_PLATFORM, else the first one that can run here);--list-platformsprints them and exits.--headlessrun without a window (no captures are written); the same as--platform headless. A headless run is in deterministic time unless--timesays otherwise (the headless platform's [RunPreset](/docs/api/microengine.core.runpreset/)).--hiddenrender in a hidden window (captures still work); it implies nothing about time or sound.--time realtime|deterministichow the loop advances time ([TimeMode](/docs/api/microengine.kernel.timemode/)): with the wall clock, or one fixed step per frame; by default the game's choice, else the platform's [RunPreset](/docs/api/microengine.core.runpreset/) (headless: deterministic), else real time; a script means deterministic.--frames Nstop after N updates;--seed N;--scale N;--mute.--reportprint the platform that runs and whether it has audio before the game starts (package checks).--audio auto|device|silentwhere sound may go ([AudioOutput](/docs/api/microengine.core.audiooutput/));auto(the default) asks for no physical device when the run is in deterministic time (scripts,--time deterministic), so checks are never heard, and for one otherwise (the headless platform has none).--audio-capture FILEplay nothing aloud and write what would have been heard as a WAV ([CaptureAudioDevice](/docs/api/microengine.audio.captureaudiodevice/)).--gpu auto|high-performance|power-savingthe GPU to ask for on a machine with two ([GpuPreference](/docs/api/microengine.core.gpupreference/)).--renderer NAME[,NAME...]graphics APIs to try first ([Renderers](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_Renderers)).--graphics NAMEthe graphics device to draw with, on platforms that offer several: SDL'ssdl-rendererorsdl-gpu([Device](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_Device)).--vsync on|offwait for the display's refresh or not ([VSync](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_VSync)).--fps-limit Ndraw at most N frames per second; 0 removes the game's limit ([FrameRateLimit](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_FrameRateLimit)).--window windowed|fullscreen|exclusivethe window mode ([WindowMode](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_WindowMode)).--display Nopen on display N, counted from 0 ([Display](/docs/api/microengine.core.graphicssettings/#MicroEngine_Core_GraphicsSettings_Display)).--pacing display|measuredcount frame time in refresh periods of the display (the default) or as measured ([PaceToDisplay](/docs/api/microengine.core.runoptions/#MicroEngine_Core_RunOptions_PaceToDisplay)).--profile FILEmeasure every frame and the start phases ([FrameProfiler](/docs/api/microengine.core.frameprofiler/)), print a summary and write the results as JSON, or CSV when FILE ends in .csv.--state-trace FILEhash the simulation state after every fixed step ([StateTrace](/docs/api/microengine.core.runoptions/#MicroEngine_Core_RunOptions_StateTrace)) and write one line per step with each section's hash ([StateTrace](/docs/api/microengine.kernel.statetrace/)'s text format): two runs of the same build, script and seed write the same file, and [FirstDivergence](/docs/api/microengine.kernel.statetrace/#MicroEngine_Kernel_StateTrace_FirstDivergence_MicroEngine_Kernel_StateTrace_MicroEngine_Kernel_StateTrace_) names where two traces part.
A run in deterministic time also asks the platform, through explicit request options, not to wait for the display
(WaitForDisplay) and for no sound device (–audio auto); a run in real time
whose game shows a start screen asks it to start gamepads after the first frame
(StartGamepadsAfterFirstFrame). The platform itself never knows the time mode.
Browser pages, phone apps and tests apply the same rules through GameHost.
Returns a process exit code: 0 on success, 1 on a game or platform error, 2 on bad arguments.
public static class GameLauncherInheritance
Fields
ProfileWarmupFrames
Frames of a profiled run left out of its summary: the first second or so, while the JIT compiles and caches warm up.
public const int ProfileWarmupFrames = 60Field Value
Usage
The one-line usage text printed after an argument error.
public const string Usage = "Usage: [--script FILE] [--captures DIR] [--platform NAME] [--list-platforms] [--headless] [--hidden] [--time realtime|deterministic] [--frames N] [--seed N] [--scale N] [--mute] [--report] [--audio auto|device|silent] [--audio-capture FILE] [--gpu auto|high-performance|power-saving] [--renderer NAME[,NAME...]] [--graphics NAME] [--vsync on|off] [--fps-limit N] [--window windowed|fullscreen|exclusive] [--display N] [--pacing display|measured] [--profile FILE] [--state-trace FILE]"Field Value
Methods
Fallbacks(PlatformCatalog)
The platforms tried, in order, when nobody named one: every platform of the catalog that can run here except the headless one (a player who sees no window would not know why), or the catalog’s default when that leaves none.
public static IReadOnlyList<PlatformProfile> Fallbacks(PlatformCatalog catalog)Parameters
catalog PlatformCatalog
Returns
IReadOnlyList<PlatformProfile>
Exceptions
PlatformConfigurationException
The catalog has no platform that can run here.
Preferred(PlatformCatalog, string?)
The platforms tried when the game prefers backend (Backend) and
nobody named one: that platform first, then the Fallbacks. A preference this catalog lacks or that
cannot run here is reported on standard error and skipped.
public static IReadOnlyList<PlatformProfile> Preferred(PlatformCatalog catalog, string? backend)Parameters
catalog PlatformCatalog
backend string?
Returns
IReadOnlyList<PlatformProfile>
Exceptions
PlatformConfigurationException
The catalog has no platform that can run here.
Report(PlatformProfile, IPlatform)
What –report prints: the profile that runs, with what the platform says about itself when it overrides
ToString (SDL names its graphics API), and whether an audio device is open.
public static IReadOnlyList<string> Report(PlatformProfile profile, IPlatform platform)Parameters
profile PlatformProfile
platform IPlatform
Returns
Run(Game, string[], PlatformCatalog, Func<PlatformRequest, PlatformRequest>?)
Runs game with the command line args on the platforms of catalog.
public static int Run(Game game, string[] args, PlatformCatalog catalog, Func<PlatformRequest, PlatformRequest>? configure = null)Parameters
game Game
args string[]
catalog PlatformCatalog
configure Func<PlatformRequest, PlatformRequest>?
Changes the platform request before the platform is built: an audio device or input sources of the host’s own (see PlatformRequest).
Returns
Run(string[], Action<HostBuilder>, Action<HostBuilder>?)
Runs the game a composition chooses (a game’s Configure entry point, GameHost) with the
command line args as a desktop process. defaults (the host’s own platforms
and content) runs before configure, which may replace any of them.
public static int Run(string[] args, Action<HostBuilder> configure, Action<HostBuilder>? defaults = null)Parameters
args string[]
configure Action<HostBuilder>
defaults Action<HostBuilder>?
Returns
The process exit code: 0 on success, 1 on a game or platform error, 2 on bad arguments.