Skip to content

Worlds, neighborhoods and inputs

Every project declares its world in main.hyle:

world {
dimensions = 3;
neighborhood = VonNeumann;
}

World settings use name = value;, like property initializers. dimensions is required; neighborhood is optional and defaults to VonNeumann. The setting names define their types, so they do not need annotations such as : Int.

Studio currently presents a three-dimensional Cube lattice. Z is vertical. The world declaration describes the lattice; it does not fill it with cells. Paint cells, build a world recipe, or open a published simulation.

The default VonNeumann neighborhood supplies axial neighbors. Custom neighborhoods list integer offsets explicitly:

neighborhood Rise {
offset [0, 0, 1];
}

Select a neighborhood with neighbors[Heat using Rise] or expand with Cell using Rise. The compiler resolves the reference directly; no needs declaration is required. Omitting using selects the world’s default. Directions such as +X, -Y and +Z are spatial operators; offsets determine which positions are reachable. Hidden cells in a Studio slice continue participating in neighborhood calculations.

Inputs are global values that the host can change between simulation steps. They can use scalar types, structs, fixed-size arrays, enums, and type aliases:

input wind_speed: Float [0.0, 1.0] = 0.12;
input wind: [Float; 3] = [0.0, 0.0, 0.12];

An omitted input initializer defaults to zero/false recursively, or the first enum variant. Unlike inputs, model property fields require an explicit initial value from their property, a preset, or the model. See value types.

Bounds apply to scalar inputs, including scalar aliases, rather than entire structs or arrays. The compiler preserves input bounds in .sole. Both runtime backends check the default when loading the module and check every input change before storing it. Bounds are inclusive and require a comma between endpoints. Rejected changes leave the previous value intact. Non-finite floating-point inputs (NaN and infinities) are rejected. Integer comparisons retain their full precision, and floating-point endpoints use the input’s selected storage precision.

Recompile older .sole files to recover declared input bounds. Legacy files with bounds: null still load, but only scalar type and finite-value checks are possible.

Studio displays controls when the compiled simulation declares inputs. Controls can change values between steps; timeline playback keeps recorded values read-only. Inputs may be declared in any .hyle file, including beside the behaviors that need them.

4D worlds, multiple resolutions and alternative lattice geometries are design topics, not features enabled by the examples on this page.

Hyle Astro