Launch
Some choices have to be made before the window opens, and can’t change
once it is open: the window size, the step rate, the size of the shadow map
and of each table. Your game makes these choices in launch, which returns
a Launch.
The host calls launch once, before init, and never again. Hot reload
doesn’t call it again either, so restart the game after you change
launch.
Start from the default
Launch.default is the Launch that most games want. To
keep all of it, return it, as the entity game does:
launch : Vocabulary.Config -> Vocabulary.Launch
launch = |_config| Launch.defaultTo change a field, start a record update from the default. Pong changes only the title of its window:
launch : Vocabulary.Config -> Vocabulary.Launch
launch = |_config| { ..Launch.default, window: { ..Launch.default.window, title: "pong" } }launch gets the Config, so a Launch can follow the Args. For example, a
game can open fullscreen when its Args hold --fullscreen.
The checks at startup
The host checks the Launch before it opens the window. No number field can
be zero, and each capacity must be inside its limits. For example,
capacity.groups must be above zero and at most 1048576. If a field fails, the
host prints the name of the field and the rule, then exits with code 1. For
example:
Launch.capacity.meshes must be at least 4, for the Fallback mesh and the three Primitives, so the run endslaunch itself cannot fail. If your game wants to reject its Args, return
Quit from the first step, because a Quit from init does not stop a
windowed run yet.
Past a capacity
A capacity sets the size of a table. If a table fills up during the run, the host does not stop. It logs once and carries on:
meshes,skiesorsounds: aLoadgives the new name id 0.draws: the host draws the first Draws of the Scene, in the order of a depth-first walk ofScene.nodes, and drops the rest. It also draws at most 256 Draws of skinned meshes, ordrawsif that is lower, in the same order.groups: the host pairs the first Groups of the Scene, in the same order. Every Group still draws its children, but a Group past the capacity does not interpolate. See Groups.ui_quads: the host draws the first quads of the UI and drops the rest.voices: aPlaytakes the voice of the oldest Play that still sounds. If Speakers hold every voice, the Play plays nothing. A new Speaker waits silent for a free voice, and starts when one frees if it is still in the Scene.
The fields
The Launch, Window and Capacity types describe each field.
| Field | Default | A run mode overrides it |
|---|---|---|
window.width, window.height |
960 by 540 | Headless lays out the UI at this size and opens no window. |
window.title |
"rocco" |
Headless ignores it. |
window.fullscreen |
False |
Headless ignores it. |
window.high_dpi |
True |
Headless lays out the UI at a DPI scale of 1. |
window.samples |
X4 |
Headless ignores it. |
window.vsync |
True |
Lockstep and Headless turn vsync off. |
step_hz |
120 | No |
shadow_map |
2048 | No |
capacity.meshes |
64 | No |
capacity.skies |
16 | No |
capacity.draws |
16384 | No |
capacity.groups |
1024 | No |
capacity.ui_quads |
16384 | No |
capacity.sounds |
64 | No |
capacity.voices |
64 | No |
Running and debugging explains the run modes. A field changes only when the game starts again. No Scene field changes a field of the Launch today.