Skip to content
View source

Types & Fields

Entelechy has one resource: the typed Field. Pictures, sound, geometry, rigs and game state are all Fields — elements of one type in one shape. Any Kernel can read and write any data, and the Host stays minimal (the reasoning is in docs/TYPED-FIELD-ARCHITECTURE.md).

Shape Address size(f) domain = in a graph
Rows<T> Int Int 256
Grid<T> Vec2 Vec2 vec2(w, h)
Volume<T> Vec3 Vec3 vec3(w, h, d)

A Kernel declares any number of ports; a GPU backend refuses one whose inputs and outputs exceed what its adapter binds at once, and says the numbers.

The element is a scalar, a vector, a struct or an array; its layout is its scalars in order, integers and booleans exact.

Kind Types
Scalars Float, Int, Bool, Double, Long
Float vectors Vec2, Vec3, Vec4
Integer vectors IVec2, IVec3, IVec4
Matrices (by columns) Mat2, Mat3, Mat4
64-bit DVec2..4, LVec2, LVec3, DMat2..4
Compound struct, arrays [T; N], enum (named Ints)

Image is the built-in alias for Grid<Vec4>: a Grid<Vec4> output shows in the window and reads as pixels wherever an Image would.

type Name = Shape<Element>; declares an alias. Aliases are transparent: a Rows<Vec2> wire connects to a type Stereo = Rows<Vec2>; port, and a mismatch is reported by structure, never by name. A binding must match the port’s shape and element layout, whatever either side calls it.

A node’s output extent is its domain:

  • A node with no inputs must say domain = …;.
  • A node with an input defaults to the extent of the input its Kernel walks (over), or a map’s first input.
  • domain may be an expression of structure: size(port), count(port), value(port), graph params, numbers, vec2/vec3, + - * / <<, max, min, floor, ceil, window(), scale(). E.g. domain = size(map) * tile;, domain = 4 * count(faces);, domain = window(); (runs again at the new extent on resize).

Every domain function is in Scene syntax.

A document’s input name: Type; is a Field the caller supplies. With a source, the Host reads it relative to the document and again whenever it changes:

Form Read as
input atlas: Image = "atlas.ppm"; .png/.ppm as pixels (luminance for Grid<Float>); .pgm as Grid<Float>; .wav as rows of one or two floats; .mid as rows of notes; .ies as photometry; .field, any Field, the Host’s format
input skills: Rows<Skill> = "data/skills.csv"; a .csv or .json table, read as the element the reading Kernel lays out; a #name column is referenced from other tables as table:name
input title: Rows<Int> = text "ENTELECHY"; the characters’ codes
input level: Rows<Int> = bytes "level.bin"; a file’s bytes, 0 to 255
input clip: Image = frames "clip/" at 30; a directory’s files in name order, played by time, wrapping
input problems: Rows<Int> = checks "src/"; what the language finds wrong in the documents there (as entelechy check)
input defined: Rows<Int> = outline "src/"; what the documents there define (functions, Kernels, structs…)
input disk: Rows<Int> = files "project/"; every file’s path and bytes under a directory
input pasted: Rows<Int> = clipboard; the clipboard’s text (the Player needs --allow clipboard.read)
input work: Rows<Int> = progress; the progress of the Kernels being prepared
input saved: Rows<Tally> = "saves/tally.field" else fresh.result; fresh.result until the file exists (or while it has another layout)

A path through a package’s name ("world.entpkg/data/rules.csv") reads the file inside that package. What a scene writes lands where its path says, never into a package.

  • entelechy run --save <node.port>=<file> writes any node’s output in the format its extension names.
  • output kept <- state.result to "saves/state.field"; writes a scene output after each committed evaluation, with --allow file.write=<dir>.
  • to files "project/" carries file operations (write, remove, rename); removal and renaming also need --allow file.delete.
  • An output may go to a Host device: to sound, to pointer, to pointer_tip, to clipboard.

See Files, import & export.