ScenicScript / YAMLStacks
(Working Title)
Behind Schéma is a frame based visual language with a very simple tree structure.
This kind of structure lends itself very well to formats like JSON or YAML to achieve human readability, editing, easy transport, LLM (eg. ChatGPT) editing and generation and other benefits.
Defining the language separately outside of the context of Schéma and its automatic .NET XML based serialization also prepares ground for runtime implementation on other platforms.
Latest syntax spec and examples
The reference ScenicScript format is YAML-embedded and focuses on brevity, leading to implicit semantics via the location of attributes. YAML also naturally converts to JSON, but the discussion and examples below focuses on YAML.
It is up for discussion whether some elements should be more explicit, for instance to make the difference between Block declarations and fields clearer.
With each level, stack definitions alternate between behavior name (eg. Create.Color.Constant) and properties and inputs for that behavior, this should become clear with the examples below.
The behavior names are defined as a map key. At each such level, only a single key is allowed.
Valid top level fields
The YAML stack file contains a few defined top-level fields, functioning as metadata and content.
name
Stack name
stack
The stack itself, a map with behavior name key at the top level. This defines the root block.
Block fields
Each Block, whose behavior is defined by the map key, can contain Property values (or drivers) and a list of input Blocks.
<Property name>
Literal property value (depending on the property type derived from the parent Block behavior) or a driver map, declaring another Block which feeds the value of the property.
in
An array of input Blocks
Examples
Example 1: Simple Color Constant
This represents a simple stack that generates a constant color output.
Example 2: Flickering Color
This example adds a flicker effect to a constant green color.
Example 3: Alternating Colors with Smooth Transition
This block stack creates a smooth transition between blue and magenta, using an LFO (Low-Frequency Oscillator) to adjust the crossfade dynamically.
Motivation and design discussion
This is how a a ScenicScript program in JSON might look like:
Or even less verbose in YAML, which might work better for editing but is less widely supported as a transport format. Easy conversion between the two is possible however.
Or even more succinct with behaviors as object keys
In YAML
Properties
name
A descriptive name of the Block, optional
comment
An informative comment, optional
behavior
The Block behavior to be used inside of the block. This identifier should be consistent across runtimes.
parameters
Parameters for the behavior. Parameters missing or failing to parse will revert to implementation specific defaults.
inputs
Array of Blocks feeding into this Block.
drivers
Drivers that control parameters, containing from, to and possibly other settings along with the root Block of the Driver.
reference
Some way to reference other stacks. Needs more thought.
Data types
Primitives
Primitive data types are limited by the format of choice, in the case of JSON this would be string, number arrays and objects.
All higher level datatypes can therefore be represented via the object primitive.
Parsing
The runtime should try to parse the data into the concrete datatype of the concrete parameter, reverting to default on failure.
Convention driven datatypes
For some commonly used types it would be beneficial to use an ordered array driven by convention . This may reduce readability for the uninitiated but at the same time decrease boilerplate and data transferred.
One of these datatypes may be for instance color, which can be represented as a 3 or 4 element array of normalized RGB values. Other options of course exist as well as HEX string representation, but this would result in lost resolution which might be important for devices supporting more than 8bit (256 values) dimming.
A possibly useful alternative would be to support writing down colors in multiple formats (eg. RGB, HSL, L, ...), this would also work well with the UI where this is selectable. This might either use CSS style function syntax or pure JSON like:
Namestorming
The Hyperspace Language
Inspiration wall
Babylon JS visual editor output
Note the embedded texture
Last updated
Was this helpful?