Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofmodule proc.module·originates fromworld 07158574-5…

registry

The operation registry: register/lookup/schema/search/help for procedural ops.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 4mo ago
What it does

proc.registry

The operation registry: register/lookup/schema/search/help for procedural ops.

Part of @builtin::systems.procgen.proc.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

proc.registry — the operation registry. A per-VM singleton table of op definitions. Each op declares input sockets (typed), params, output sockets (typed), an `eval` implementation, and a `version` (bumped on behavior change; folded into the evaluator's cache key). Re-registration overwrites (hot-reload friendly). Two op namespaces coexist: * `OPS`, keyed by the string op id a PACK names it with. Every family arrives here through `registerPack` — the ones this package ships, the terrain ops, and any `.procPack` authored in a world alike — plus any op a test or tool registers by name for the life of one VM. * The content op registry (`ASSET_OPS`), keyed by asset GUID — custom `.procNode` assets. What a node takes and gives is read from its source without running it (`asset.interface`) for every node the asset index holds; its code is loaded the first time a build runs it, and loaded again on every edit after that. A graph reaches one by a typed GUID ref, or by the name the node declares: a composite an author cannot NAME is one they will not write, so a declared name joins the namespace an op id lives in and `ASSET_NAME_TO_GUID` maps it back to the durable guid. `resolveOp` maps a node's `op` field (a string id OR a typed asset ref) to its live def.

moved(contentAddressed: boolean?) → void

argtypedescription
contentAddressedboolean?

setRegistrationScope(scope: ((() → void

Set the function the registration of the content ops runs inside: `scope(fn)` runs `fn` with a graph-building state of its own and gives the caller's back when `fn` returns or raises.

argtypedescription
scope(((The function, or nil to run the registration as it is called.

examples

registry.setRegistrationScope(builder.isolated)

registerContentOps(again: boolean) → boolean

Fire the hooks of the packs and graphs this VM has not fired: on a worker, every instance the index holds; on the engine thread, the library's own. A library pack registers here whenever its family does not stand registered, however its registration hook was reached before: a registration still under way elsewhere (one waiting on its entry script's bytes) leaves its family out until it completes, and the read asking now registers it now. Answers whether every library pack's registration completed or ran to its end here.

argtypedescription
againboolean

inRegistrationScope(fn: () → void

Run `fn` inside the registration scope the builder set, so a registration reached from the middle of a build loads its sources in a state of its own.

argtypedescription
fn(

fireContentOps(again: boolean) → boolean

argtypedescription
againboolean

ensureContentOps( ) → void

A worker's VM: fire the packs and graphs the index holds once per index revision. The engine thread's VM fires them as they appear, so this is nothing there.

ensureLibraryOps( ) → void

Every pack and graph this VM can name has registered: on a worker, through `ensureContentOps`; on the engine thread, the library's own whose family does not stand registered register now. Called where a read finds nothing, and before a listing of every op; once every library pack stands registered at an asset index revision, a read at that revision asks nothing more.

nodeIndex( ) → void

nodeInterface(guid: string) → any

What the node `guid` declares it takes and gives, read from its source without running it (`asset.interface`): `{ form, id?, description?, inputs, outputs, problems }`. Nil when the asset index holds no such node, or its source declares no interface.

argtypedescription
guidstringThe node's guid.

examples

local iface = proc.registry.nodeInterface(guid)

nodes( ) →

Every `.procNode` the asset index holds, with what it declares it takes and gives, read from its source without running it: `{ guid, path, name, interface }` per node, `interface` nil for a node whose source declares none.

examples

for _, n in ipairs(proc.registry.nodes()) do print(n.name, #n.interface.inputs) end

nodeLoader( ) → void

The `.procNode` type's `load`: the one function that registers a node's op from its entry source, running that source.

loadNode(guid: string) → any

Load the node `guid`'s code from its entry source when it has neither loaded nor failed to: its def, or nil when the index holds no such node or its load failed (`assetFailure` says why). A build reaches this the first time it runs the node.

argtypedescription
guidstring

loadAhead(budgetMs: number) → number

Load, for at most `budgetMs`, the `.procNode`s the asset index holds that no build has run yet, so the first build that runs one finds it loaded. A load leaves the revision where it was, and a node that fails to load is recorded as a failure as it is when a build reaches it.

argtypedescription
budgetMsnumberThe most milliseconds of loading this call spends (at least one node loads).

examples

while registry.loadAhead(2) > 0 do task.wait() end

nodeChanged(ref: any, load: (any) → void

A `.procNode` appeared or changed: the `.procNode` type's registration hooks call this. What it takes and gives is read from its source wherever the index lists it, so nothing runs here for a node no build has run. A node whose code a build loaded, or failed to load, loads again from its source as it stands now, so every graph reaching it cooks the edit.

argtypedescription
refanyThe node's asset ref.
load(anyThe type's loader, which registers the node's op from its entry source.

examples

registry.nodeChanged(ref, M.load)

inRecordedVersionFolder(path: any) → boolean

Whether `path` lies in a recorded version's folder, where an install places one version of another world's asset. What stands there claims no name: the reference that records its version reaches it by guid.

argtypedescription
pathany

namesIndex( ) → void

add(name: string, guid: string) → void

argtypedescription
namestring
guidstring

nodeNamed(id: string) → string

The guid of the node answering to the name `id`: one whose code has loaded under it, or else the last node the index lists that answers to it.

argtypedescription
idstring

nodeGuid(id: string) → string

The guid of the `.procNode` answering to the name `id` (its asset name, or the id its source builds its graph under), found without loading any node.

argtypedescription
idstringThe name.

examples

local guid = proc.registry.nodeGuid("points.grid")

sortedKeys(t: { [string]: any }) → void

Sorted keys of a table, for an accepted-set error message.

argtypedescription
t{ [string]: any }

optionValues(options: any) → void

The values a param's `options` accepts, sorted. `options` comes in two shapes: a MAP of accepted value → the number a kernel reads it as (what a terrain kernel param carries), and a LIST of accepted values for a param whose choice names a branch rather than a number. Both say the same thing — "these are the values this param takes" — so both answer here.

argtypedescription
optionsany

optionsAccept(options: any, value: any) → boolean

True when `options` accepts `value`.

argtypedescription
optionsany
valueany

describeExample(v: any) → string

One example value, rendered the way an author would write it: a vector as its braces rather than as "table", so the line can be copied.

argtypedescription
vany

describeValue(v: any) → string

Human-readable description of a literal value, for a type-mismatch error.

argtypedescription
vany

validateInputSpec(name: string, spec: any) → string

Validate an input socket spec.

argtypedescription
namestringSocket name (for the error message).
specanyThe socket spec.

validateParamSpec(name: string, spec: any) → string

Validate a param spec.

argtypedescription
namestringParam name (for the error message).
specanyThe param spec.

validateInputOrder(def: any) → string

Validate an op's declared positional input order.

argtypedescription
defanyThe op def (already defaulted `inputs`).

validateSockets(id: string, label: string, def: any) → void

Validate every entry of `def.inputs` and `def.params`, raising (at the caller's caller, level 3, so the error points at the `register` call site) naming the op id, the socket, and what is wrong with it.

argtypedescription
idstring
labelstring
defany

validateCachePolicy(id: string, label: string, def: any) → void

Validate (and normalize the defaults for) `def.cache`, `def.cost`, `def.deviceColumns` and `def.mutatesInput`, raising at the `register`/`registerAsset` call site (level 3) naming the op id and what is wrong.

argtypedescription
idstring
labelstring
defany

contextOfType(spec: string?) → string

The context a type spec belongs to: its first alternative, an array read as its element, a parametric type as its base.

argtypedescription
specstring?

validateContext(id: string, label: string, def: any) → void

Validate what a def says about where it operates, and settle it: `context` names one of the registered contexts, or `contextFrom` names the input (or the asset param) whose context it takes; a def saying neither operates where the type of its default output belongs, and `contextDeclared` records which. `pulls` and `pushes` name what the node reads and writes beside its sockets.

argtypedescription
idstring
labelstring
defany

fail(message: string) → void

argtypedescription
messagestring

wrapGraphRef(guid: string) → any

Resolve a graph node's `.procGraph` reference to its op def: find the captured ref for its guid in `asset.list`, then wrap it via the type's `asOp`. Shared by both a `procGraph` node ref and a subgraph `.procNode`.

argtypedescription
guidstring

validateSolver(id: string, label: string, def: any) → void

Validate a solver def (`kind = "solver"`) and give it what every solver has: the wall's params, and an `eval` that refuses a direct call. A solver steps over a graph's timeline, which only a cook has.

argtypedescription
idstring
labelstring
defany

eval( ) → void

markPrepared(params: any, def: any) → any

Note that `params` is a table `prepareParams` made for `def` (or a copy of one), which the op the table is handed to takes as it is.

argtypedescription
paramsanyThe prepared params.
defanyThe op's def.

examples

registry.markPrepared(table.clone(prepared), def)

guardParams(id: string, def: any) → void

argtypedescription
idstring
defany

eval(ctx: any, inputs: any, params: any) → void

argtypedescription
ctxany
inputsany
paramsany

validateRuns(id: string, label: string, def: any) → void

Validate what a def says about where it runs (`runs`), whether it moves a value to the CPU for the plan to use (`readback`), and whether it is a construct of the evaluator rather than an op authors call (`internal`).

argtypedescription
idstring
labelstring
defany

register(id: string, def: any) → boolean

Register a procedural operation.

argtypedescription
idstringOp id (e.g. "instances.on_points").
defany`{ description?, inputs?, params?, outputs, eval, version? }`.

examples

proc.register_op("mesh.box", { outputs = { geometry = { type = "Geometry", default = true } }, eval = fn })

addContainerKind(kind: string) → void

The folders whose own folder is a root a graph's `~` names reach: a folder asset of one of these kinds (`.package` and the world's `/source` among them) holds what is inside it together. A system that packages graphs in a folder asset of its own states its kind here.

argtypedescription
kindstringThe asset kind's extension without its dot, e.g. "package".

examples

proc.registry.addContainerKind("package")

isContainerRoot(path: string) → boolean

Whether `path` names a folder that is a root of its contents: a folder asset of a stated container kind, or the world's `/source`.

argtypedescription
pathstringA folder path.

revision( ) → number

How many times what the registry answers has changed — an op, alias or asset op registered or removed. A library node registering the first time a lookup needs it is no change. Something derived from the registry is current while this still reads what it read then.

examples

local at = proc.registry.revision()

definitionRevision( ) → number

How many times what the registry defines has changed: the revision, without the ops registered under the address of their content (`contentAddressed`, as a step solver of a plan is), which change the meaning of nothing registered before them. Something derived from definitions is current while this still reads what it read then.

examples

local at = proc.registry.definitionRevision()

unregister(id: string) → void

Unregister a builtin/in-memory op by id (test teardown, hot-reload). An id that was an alias stops answering too.

argtypedescription
idstring

registerAlias(from: string, to: string) → boolean

Register `from` as an alias of the op registered under `to` — the way a renamed op keeps answering to its former id. Lookups through `get`, `has` and `resolveOp` follow the alias; `list` and per-pack listings carry only current ids, and `search` surfaces an alias as its current op.

argtypedescription
fromstringThe former id.
tostringThe current id, already registered.

examples

proc.registry.registerAlias("template.empty", "prefab.empty")

canonical(id: string) → string

The current id behind `id` — itself when registered directly, the aliased-to id when `id` is a former name, nil when neither.

argtypedescription
idstringAn op id, current or former.

examples

proc.registry.canonicalId("template.empty") -- "prefab.empty"

canonicalId(id: string) → string

argtypedescription
idstring

namedOp(id: string) → any

The def of the op `id` names: itself, `op.<id>`, or a former id.

argtypedescription
idstring

get(id: string) → any

Get an op definition (or nil). A former id follows its alias, and a name a `.procNode` declares answers with that node's def.

argtypedescription
idstring

has(id: string) → boolean

Whether an op is registered, under this id or a former one.

argtypedescription
idstring

nodeIdentity(guid: string) → string

argtypedescription
guidstring

providerOf(id: string) →

The asset that provides op `id`: the `.procPack` whose family registers it (under this id or a former one), or the `.procNode` that declares the name. A graph depends on that asset, by the identity a reference resolves. provides it.

argtypedescription
idstringAn op id or a name a `.procNode` declares.

examples

local provider = proc.registry.providerOf("points.grid")

registerAsset(guid: string, def: any, assetPath: string?) → boolean

Register a content op from a `.procNode` asset, keyed by its GUID. `def` is either op-style (`{ kind = "op", inputs?, params?, outputs, eval, version? }`) or subgraph-style (`{ kind = "graph", graph = <.procGraph assetRef> }`). `kind` defaults to `"op"` (the common case), so an absent kind is op-style, matching how the evaluator resolves it. Re-registration overwrites (hot-reload). Pass `assetPath` so the delete hook can find this guid by the removed folder path.

argtypedescription
guidstringThe asset's stable GUID.
defanyThe op or subgraph def table.
assetPathstring?The asset folder's VFS path (indexed for delete).

recordAssetFailure(guid: string, assetPath: string?, name: string?, reason: string) → void

Record why the procNode `guid` did not register: it stays unregistered, and resolving it raises naming the node, its folder and the reason.

argtypedescription
guidstringThe asset's stable GUID.
assetPathstring?The asset folder's VFS path.
namestring?The node's name.
reasonstringWhy it did not register (its compile or load error).

setAssetRetry(retry: ((string, string) → void

Give the registry the function that loads a procNode again: `retry(guid, path)` registers the node from its entry source as it stands, or records why it cannot. A node whose load failed is loaded again, when something resolves it, if its entry source has changed since the failure.

argtypedescription
retry((string, stringThe function.

examples

registry.setAssetRetry(function(guid, path) registerNodeAt(guid, path) end)

assetFailure(guid: string) →

Why the procNode `guid` did not register, or nil when it did or was never seen.

argtypedescription
guidstring

unregisterAsset(guid: string) → void

Unregister a content op by GUID (the procNode assetType's delete hook).

argtypedescription
guidstring

unregisterAssetByPath(assetPath: string) → string

Unregister the content op registered from `assetPath`. The delete hook uses this because a removed folder's ref carries no guid; the path->guid index resolves it. A moved asset keeps its guid and registers at the path it moved to, and the removal of the folder it left can arrive after that: the op then stands at its new path and only the old path is forgotten. Returns the unregistered guid, or nil when the path holds no registered content op.

argtypedescription
assetPathstringThe removed asset folder's VFS path.

assetPath(guid: string) → string

The folder the content op `guid` was registered from, or nil when it is not registered from one.

argtypedescription
guidstringThe asset's stable GUID.

examples

local path = registry.assetPath(ref.guid)

assetAt(assetPath: string) → string

The GUID of the content op registered from the folder `assetPath`, or nil when none is.

argtypedescription
assetPathstringThe asset folder's VFS path.

examples

local guid = registry.assetAt(ref.path)

getAsset(guid: string) → any

Get a content op def by GUID (or nil when not registered).

argtypedescription
guidstring

listAssets( ) → void

Sorted list of registered content-op GUIDs.

refGuid(op: any) → string

Extract the GUID from an asset-ref envelope (the `__ref` guid, or `guid`).

argtypedescription
opany

resolveOp(op: any) → any

Resolve a node's `op` field to its live def. `op` is either a string op id (builtin/in-memory `OPS`) or a typed asset-ref envelope (`{ __ref = guid, type = "procNode" | "procGraph" }`). An asset ref never triggers a name lookup. A `.procNode` the asset index holds that has not registered yet registers from its entry source here; an asset ref whose target the index does not hold, or whose source does not load, raises loudly, naming the missing GUID or why it does not load.

argtypedescription
opanyA string op id or a typed asset-ref envelope.

defaultOutputFor(def: any) → string

The default-flagged output name for a def (the one with `default = true`, else the sole output, else nil). Used by the evaluator to resolve `:out()` for any resolved def — builtin or content.

argtypedescription
defanyAn op def (from `get` / `resolveOp`).

sortedNames(t: any) → void

argtypedescription
tany

inputOrder(def: any) →

The order an op's inputs are passed positionally, and the order `checkInputs` reports them in. A def declares `inputOrder` — an array naming each of its inputs once — when the order it reads them in is not the sorted one; without it sockets are taken in sorted order, which is stable because Luau table order is not.

argtypedescription
defanyAn op def.

examples

local order = registry.inputOrder(registry.get("instances.on_points"))

inputWiringForms(def: any, callable: string) → void

The two forms an op's inputs are wired in, both in `inputOrder`: the positional call and the table naming each socket. `callable` is the name the op is reached by.

argtypedescription
defany
callablestring

paramTypeMessage(def: any, name: string, declaredType: string, value: any, label: string) → string

The error text for a param whose supplied value is not of the type the param declares. When the op declares the same name as an input the value DOES satisfy, the message names both declarations and the two forms that wire the value as an input, because a name living in both namespaces is what led the caller to the param.

argtypedescription
defany
namestring
declaredTypestring
valueany
labelstring

isCurve(v: any, def: ?, params: ?, label: ?, level: ?) → boolean

An op's params with its declared defaults filled in, checked against what the op accepts. A param the op does not declare is an error naming the ones it does, so a misspelling is refused rather than silently ignored, and a supplied value that is not of the type its param declares is an error naming both — the same rule, through the same `proc.types.valueSatisfies`, that `checkInputs` holds a wired input to. Values are checked in sorted name order, so the same call reports the same param every time. Defaults land after the check, so a param the caller left out arrives at its declared default. that supplied the params rather than at this function. Defaults to 3.

argtypedescription
vany
def?An op def.
params?The params a caller supplied, or nil.
label?How to name the op in an error.
level?Stack level the error is reported at, so it points at the caller

examples

local p = registry.prepareParams(def, { radius = 4 }, "points.disc")

prepareParams(def: any, params: any?, label: string, level: number?) → void

argtypedescription
defany
paramsany?
labelstring
levelnumber?

refusedOption(def: any, name: string, value: any, inputs: ?, label: ?, level: ?) →

Errors when a socket the op requires was not supplied, naming it; when a supplied value is not of the type the socket declares, naming both; and when a supplied value is missing a named layer the op declared it needs. A socket marked `optional` may be absent. Sockets are checked in `inputOrder`, so the same wiring mistake reports the same socket every time. A layered value — a `Raster` and anything else carrying named layers — is one type whatever it holds, so an op that reads `height` says so with `requiresLayers = { <socket> = { "height" } }` rather than inventing a type per layer set. The check reports the layer that is missing and the ones the value does carry. The values a param of `def` accepts when `value` is not one of them, or nil when it is, or when the param declares no `options`.

argtypedescription
defanyAn op definition.
namestringThe param's name.
valueanyThe value given to it.
inputs?The resolved inputs.
label?How to name the op in an error.
level?Stack level the error is reported at. Defaults to 3.

examples

registry.checkInputs(def, { points = pc }, "instances.on_points")
local accepted = registry.refusedOption(def, "op", "multiply")

checkInputs(def: any, inputs: any, label: string, level: number?) → void

argtypedescription
defany
inputsany
labelstring
levelnumber?

list( ) → void

Sorted list of registered op ids.

defaultOutput(id: string) → string

The default-flagged output name for an op (the one with `default = true`, else the sole output, else nil). Used by the evaluator to resolve `:out()`.

argtypedescription
idstring

solverTerms(d: any) → any

What a schema says of a solver beyond an op's sockets: its state type, the step it advances by, how many steps a frame may take, and its live inputs.

argtypedescription
dany

namedAsset(id: string) → void

The def and guid of the `.procNode` answering to `id`, as a name or a guid.

argtypedescription
idstring

resolvedOutputs(def: any, id: ?) →

Op schema (the def minus its eval function), or nil. Checks the builtin/in-memory registry first, then falls back to a content op registered by guid — the documented discovery surface (`proc.schema`) describes a `.procNode` exactly as it describes a pack's op.

argtypedescription
defany
id?A pack op's string id, or a content op's guid.

schema(id: string) → any

argtypedescription
idstring

calledNode(name: string) → string

argtypedescription
namestring

producerOf(from: any) → void

What makes a value an interface names (`from`): a pack's op (`"op"`, its def) or a node (`"node"`, its guid).

argtypedescription
fromany

op(id: string) → any

argtypedescription
idstring

outputsContext(iface: any, known: { [string]: string | boolean }) → string

The context an interface's outputs are made in: the one every op and node they come from operates in, or nil when they differ or one cannot be known.

argtypedescription
ifaceany
known{ [string]: string | boolean }

staticContext(guid: string, known: { [string]: string | boolean }) → void

The context the node `guid` operates in, read from its interface. `known` holds each node's answer once reached (`false` for none, and while it is being worked out, so a node reaching itself reads as none).

argtypedescription
guidstring
known{ [string]: string | boolean }

staticOutputType(guid: string, name: string?, seen: { [string]: boolean }) → void

The type of the output `name` of the node `guid` (its one output when nil), read from its interface: the type of the input it gives back, or of the output of the op or node that makes it.

argtypedescription
guidstring
namestring?
seen{ [string]: boolean }

nodeInterfaceContext(guid: string) → string

The context the node `guid` operates in, read from what it declares without running it: the one every op and node its outputs come from operates in, or nil when they differ or one cannot be known.

argtypedescription
guidstringThe node's guid.

examples

proc.registry.nodeInterfaceContext(guid) -- "sim"

nodeInterfaceOutputType(guid: string, name: string) → string

The type of the node `guid`'s output `name`, read from what it declares without running it: the type of the input it gives back, or of the output of the op or node that makes it. Nil when that cannot be known.

argtypedescription
guidstringThe node's guid.
namestringThe output's name.

examples

proc.registry.nodeInterfaceOutputType(guid, "points") -- "Points"

search(query: string) →

Case-insensitive substring search over both op namespaces: a builtin's id/description, and a content op's guid/description/asset path. A `.procNode` answers from what its source declares, read without running it, so a search loads no node. Every hit carries what it takes to use the match — `id` is what `resolveOp`/`get`/`schema`/`help` accept, `kind` says which registry it came from, and `path` is the human-readable asset path for a content op (a bare guid alone is not something a person searching by name can recognise).

argtypedescription
querystringSearch text ("" matches all).

examples

for _, hit in ipairs(proc.search_ops("chamfer")) do print(hit.id, hit.kind, hit.path) end

matches(...: string?) → boolean

argtypedescription
...string?

registerPack(name: string, families: { [string]: any }, pack: any?) → boolean

Register a family of ops as one pack. Every family in the registry arrives here — procgen's own and any content's alike — because a `.procPack` asset's registration calls this with what its `init.luau` returned. Each entry in `families` (op id -> def) registers via `M.register`, so it is validated the same way, and tagged with `pack = name` so `search` / `schema` report where it came from. `M.pack(name)` hands it back, so anything a pack publishes ALONGSIDE its ops — the dispatch-number assembly a test verifies the maths through, a family's own constants — is reachable without requiring into the asset, whose files are private to it.

argtypedescription
namestringThe pack's name (e.g. "terrain").
families{ [string]: any }A table mapping op id -> op def.
packany?The whole table the pack's `init.luau` returned, when there is one.

examples

proc.registerPack("terrain", { ["terrain.fbm"] = fbmDef, ["terrain.erode"] = erodeDef })

pack(name: string) → any

The table a pack's `init.luau` returned — `name`, `description`, `ops`, and whatever else that pack publishes. A pack asset's own files are private to it, so this is how anything outside reaches what it exports.

argtypedescription
namestringThe pack's name (e.g. "terrain").

examples

local packers = proc.registry.pack("terrain").packers

unregisterPack(name: string, pack: any?) → void

Drop the pack registered under `name`: `pack(name)` answers nil and `packs()` leaves it out. A `.procPack` whose folder is removed, or whose entry renames its pack, drops the name it registered; the ops it registered are unregistered by id (`unregister`). it: the name is dropped only while it still stands for that table, so a pack another asset registered under the same name since stays.

argtypedescription
namestringThe pack's name (e.g. "terrain").
packany?The table the pack registered under `name`, when the caller holds

examples

proc.registry.unregisterPack("terrain")

packs( ) →

Every registered pack's name, sorted.

examples

for _, name in ipairs(proc.registry.packs()) do print(name) end

registerContext(name: string, def: { description: string, like: string?, enclosed: boolean? }) → boolean

Register a context nodes may operate in: a new kind of node is a new context. `enclosed` holds the context's values in, so what its nodes make is read only by nodes of the context and by inputs that open it. on, the Houdini network it answers to, and whether it holds its values in.

argtypedescription
namestringThe context's name, which a node's `context` names.
def{ description: string, like: string?, enclosed: boolean? }`{ description, like?, enclosed? }` — what the context's nodes work

examples

proc.registry.registerContext("audio", { description = "Sample buffers: sound as a value." })

unregisterContext(name: string) → boolean

Remove a context `registerContext` added. The contexts procgen ships stay, and so does one a registered node still operates in.

argtypedescription
namestringThe context's name.

examples

proc.registry.unregisterContext("audio")

context(name: string) → Context

The context registered under `name`, or nil.

argtypedescription
namestringA context name.

examples

proc.registry.context("sim").enclosed -- true

contexts( ) →

Every registered context, sorted by name.

examples

for _, c in ipairs(proc.registry.contexts()) do print(c.name, c.like) end

contextOfType(spec: string) → string

The context a value type belongs to: where a node making one operates.

argtypedescription
specstringA type tag or spec ("Surface", "Field<Vec3>", "Record[]").

examples

proc.registry.contextOfType("Surface") -- "geometry"

opKey(op: any) → string

argtypedescription
opany

nodeDef(node: any) → any

argtypedescription
nodeany

assetContext(value: any) → string

The context of the value an asset reference enters a graph as: the type its asset type's `graph` states the value is.

argtypedescription
valueany

nodeContextIn(graph: any, id: string, seen: { [string]: boolean }) → string

The context node `id` of `graph` operates in (see `M.nodeContext`).

argtypedescription
graphany
idstring
seen{ [string]: boolean }

refContext(graph: any, ref: any, seen: { [string]: boolean }) → void

argtypedescription
graphany
refany
seen{ [string]: boolean }

graphContext(child: any) → string

The context a graph used as a node operates in: the one every node its outputs come from operates in, or nil when they differ or cannot be known.

argtypedescription
childanyThe graph.

examples

proc.registry.graphContext(g) -- "sim"

defContext(def: any) → string

The context a def operates in: the one it names, or — for a graph used as a node — the one its outputs are made in, settled the first time it can be known (the nodes it is built from may register after it).

argtypedescription
defanyAn op def.

examples

proc.registry.defContext(proc.registry.resolveOp("group.by_normal"))

refTypeIn(graph: any, ref: any, depth: number) → void

The type `ref` yields inside `graph`: a graph input's declared type, or the type the node it names makes — following an output that gives back one of its inputs to what that input was handed.

argtypedescription
graphany
refany
depthnumber

outputType(def: any, name: string) → string

argtypedescription
defany
namestring

nodeContext(graph: any, id: string) → string

The context node `id` of `graph` operates in: its op's context, or — for a node taking its context from an input or an asset param — the context of what is wired there or of the value the asset enters as.

argtypedescription
graphanyA Graph.
idstringA node id in it.

examples

proc.registry.nodeContext(g, "emit") -- "sim"

openers(context: string) → void

Every input that opens `context`, as "op.socket", sorted.

argtypedescription
contextstring

contextRefusal(graph: any, id: string, socket: string, ref: any) → string

Why input `socket` of node `id` in `graph` may not read `ref`, or nil when it may. What a node of an enclosed context makes is read only by a node of that context, or by an input that opens it.

argtypedescription
graphanyA Graph.
idstringThe reading node's id.
socketstringThe input (or param) the ref is wired into.
refanyWhat is wired there: a node output, or a list of producers.

examples

local why = proc.registry.contextRefusal(g, "move", "geometry", ref)

help(id: string) → string

Human-readable op help (id, description, typed sockets).

argtypedescription
idstring

section(title: string, tbl: any) → void

argtypedescription
titlestring
tblany
⌬ Types
Context = {SearchHit = {

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing the 199 items nearest this part. It holds more than this page lists.

199+items
·
assettype · born here
❒asset
# Module (asset type) A module is a reusable, stateless (or globally-stateful) Luau library that other code pulls in with `require()`. Modules are the unit of factored-out logic in a world: helpers, math libraries, format parsers, registries, shared algorithms. ## When to use one - You have logic you want to share across multiple components, services, scenes, or tools. - You have a registry, lookup table, or shared cache that callers all read from / write to. - You want a stable API surface (`M.fn`) other code can depend on. If the logic is bound to one entity, use a `.component`. If you want a named UI of fields rather than functions, use a `.preset`. ## Where it lives - Source: `/zero/source/.../<name>.module/` - Identity: the source path with `/` written as `.` and each segment's type suffix dropped — `/zero/source/demo/beats.module` is `demo.beats`, and `/zero/source/kit.package/beats.module` is `kit.beats`, the container's name kept and its `.package` suffix gone. `asset.create` returns this string, `asset.resolve(...).identity` reads it back, and the `require` forms below write it as `<identity>`. - Folder shape: - `init.luau` (or `init.lua`) — module body. **Required.** Returns a table (conventionally named `M`). - `README.md` — instance-level documentation. **Required.** - `.metadata` — agent-editable tags + free-form fields. **Required.** ## How to create one ```luau asset.create("module", "<name>") -- Creates: /zero/source/<name>.module/ -- init.luau (canonical `local M = {} … return M`) -- README.md (instance README template) -- `folder` places it in a subfolder of /source, and that subfolder -- leads the identity: `{ folder = "lib" }` produces `lib.<name>`. -- `into` authors it inside a resolved container (a package, a toolbox), -- whose own identity leads the same way: asset.create("module", "<name>", { folder = "lib" }) asset.create("module", "<name>", { into = asset.resolve("myPkg.package") }) ``` ## How it operates 1. **Registration.** Writing `init.luau` into a `.module/` folder indexes the asset and registers the module path with the resolver. 2. **Loading.** The first `require("<identity>")` runs the file's body and caches the returned table. Subsequent requires from anywhere return the **same table** — this is the shared-state lever for "module-local" registries. The body runs in an environment of the module's own: a name it declares without `local` is readable by the module's own functions and by no other script, so an export reaches its callers through the returned table and nothing else. Requiring a component's folder runs its chunk the same way, once, and its `update`, `start` and `public` stay in that environment; a component runs on an entity through `entity(id).component.add(name)`. 3. **Hot reload.** Editing the file re-runs the module body and folds what it returns into the table already loaded, so that table keeps its identity: a caller that captured it with `require` reads the new source's functions and values through the reference it already holds, and a later `require` returns that same table. A key the new source drops goes away; a key something set at runtime stays. The body's own `local`s start again from their initial values, so state that must outlive an edit lives in `modules.state()` (`guides { path: "core/scripting-and-tasks" }`). 4. **Identity resolution.** A module is reached by its `<identity>`, and where the caller lives decides which spelling of it resolves. For a module in a **world**, from a caller in that same world — another module, a component, a scene entrypoint, or an `execute` chunk: - `require("<identity>")` — the identity on its own, resolved against the caller's own root. It carries every folder segment, so a module created with `{ folder = "demo" }` is `require("demo.beats")`. - `require("@root::<identity>")` — the same root-relative resolution, written out. - `require(".sibling")` — a module in the same folder, by its bare name; `..name` steps up one folder, `...name` two. Logs, stack traces and hot-reload notices name that same module `@local.source.<identity>` — its key under the world source root. The `<identity>` tail of that key is the form above, so a trace reading `@local.source.demo.beats` is `require("demo.beats")`. For a module in a **library** — content under `/zero/source/libs/@<lib>/` — `@<lib>::` addresses that library's root from anywhere: `require("@builtin::modules.transform")`. Mounting a world as a library moves its files under such a root and flips the caller root to `@<lib>::`, which is what keeps the root-relative forms above resolving across the move. ## Discovery - `asset.list("module")` — every registered module. - `asset.inspect("<name>")` — public functions, source path, this type README. - `ls /zero/source/<name>.module` lists the files the folder holds. ## Authoring conventions - Return a single `M` table from `init.luau`. Top-level statements with side effects run on first require — useful for one-time initialization, dangerous if they touch the engine before it's ready. - Write exported functions as `typed function`, not `function`: the argument types are enforced at the call and the checker knows the signature, so a caller's mistake is reported where they made it. - Annotate exported functions with `--!desc` / `--!arg` / `--!return` / `--!example` so the LSP, `tools.list`, and `asset.inspect` surface them. A function with no `--!desc` is reachable only by someone already reading this file. - Declare a VALUE with `Field.<kind>(default, mode, description)`, and a table whose members are reached through a metatable with `--!members <TypeName>` — the latter gives the surface its accepted member set, its type, and its documentation from one table. See `guides { path: "core/authoring" }` for all four rules and `modules/api/engine/entity.module/members.module` for a worked member table. - Keep module state in module-local upvalues or in `modules.state()`. A name the body declares without `local` lives in the module's environment, which every run of the module shares: a function the previous run left in place reads what the reload assigned. Module-locals start again from their initial values with each hot reload; the table `modules.state()` returns is the same table on both sides of every reload. - Prefer focused modules over kitchen-sink modules. If two halves of a module have no shared state, split them. ## Common pitfalls - **Cyclic requires.** A `require` chain that loops will return the partial table (the half built before the cycle was detected). Design for one-way dependencies. - **Engine-time side effects.** Don't `entity.spawn` at module top-level — the engine may not be ready. Expose an `M.init` and call it from a scene entrypoint. - **Hot-reload + module-local cache.** A module that caches expensive computation in upvalues loses that cache on reload — fine for dev, but be aware in performance work. - **`init.lua` vs `init.luau`.** Either works, `.luau` is canonical. - **Writing one while play runs.** A `/source` write made while play is running lands on the play shadow, and a guarded play-exit discards it unless it is kept. One `.module` write shadows `init.luau`, the `README.md` and the `.metadata` together. `vfs.write(path, bytes, { durable = true })` skips the shadow, and `vfs.promotePlayShadow` keeps what is already on it — the `core/vfs` guide has the model and what each route costs. ## Related types - `.component` — for entity-bound state + lifecycle hooks. - `.service` — generates content you don't have yet (a mesh, sound, texture, …) via a metered provider. - `.tool` — for a single agent-callable function with a YAML schema. - `.package` — to group several modules + components + scenes into one shippable folder. ## In the Inspector Exports: what the module exports (name, kind, signature), parsed from its source without running it, with **Check** (the LSP's diagnostics for its entry file) and **Open**.
▲ 0↑ born
·
nodebox · born here
❒asset
# prefab (nodebox) Prefabs: the entity records a spawned hierarchy is made of, as record and list values. prefab.empty makes a root, prefab.entity, prefab.parent, prefab.add_component and prefab.link shape the hierarchy (each calls prefab.edit, which holds the record-list edits and the name lookup that prefab.find answers), and prefab.from_geometry, prefab.from_geometries, prefab.from_instances, prefab.from_population and prefab.from_asset make prefabs from what a graph built. The output node shows a prefab and the export node saves it as a bundle. prefab.record and prefab.find are the parts the others are built from: one entity record, and a lookup of an entity by name.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# field.distance (procNode) How far each element's position is from a target, as a Float field. It makes the target the wired `b` field or, when `b` is left unwired, the fixed `point` as a constant field (`value.fallback`, `field.constant`), then measures with `field.vector_math` in `distance` mode from `a` to that target. The result compiles to the device with the rest of the field chain. ## Inputs - `a` (`Field<Vec3> | Vec3`): the positions being measured, one per element. - `b` (`Field<Vec3> | Vec3`): what each element is measured to, per element, so the target can move with the element. Wired, it stands in for `point`. - `point` (`Vec3`, default `{ 0, 0, 0 }`): one fixed position every element is measured to when `b` is unwired. It is how a radial falloff around a place is built. ## Outputs - `field`: the distance, a Float field.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
# instances (nodebox) Instances: pack a geometry into a piece (instances.pack), place a piece set on target points (instances.to_points) and take a population or piece set apart (instances.unpack). A piece is one point whose `Mesh` holds a geometry whole, as the node that made it left it: a geometry whose elements are counted on the device (what `geometry.triangulate` makes) keeps its counts there, and draining the piece set (`Geometry.drain`) drains the geometries its records hold with it, so a CPU reader reads each piece's elements; `geometry.merge` with `pack` puts several together into a piece set. The copies `instances.to_points` makes are a population, which the output node draws as instanced draws, one per piece and material, and export saves as a population asset; any other points stand as one entity each. instances.pack, instances.to_points and instances.unpack are the nodes of that chain, with `points.pose` composing the instance attributes (`P`, `orient`, `scale`, `N`, `v`, `up`, `pscale`, `rot`, `trans`, `pivot`) the copies stand at. Earlier nodes of the nodebox stand a source on points (instances.on_points), deal one of several sources to each point (instances.pick_random, instances.pick_by_attribute), vary and move the copies (instances.randomize_transform, instances.transform, instances.set_material) and merge them into one geometry (instances.realize). The points they make carry a `Mesh` and stand as entities through the output node. instances.place, instances.variants, instances.turn and instances.sources are the parts the others are built from: a transform written onto points, a variant index written onto points, the product of two rotations, and the geometries a population stands (the ones given, else the ones its points carry).
▲ 0↑ born
▣
module · born here
❒asset
# asset_on_register Drives the optional `onRegister(self)` assetType lifecycle hook — the surface that lets an asset instance run code exactly once when it first registers, operating on the per-instance ref (`self`). This is what makes "write an asset into the world → it takes effect live, no restart" work for content that registers into a runtime registry (editor panels, and anything else that opts in). A type opts in by exporting `onRegister` from its `behavior.luau`. The hook fires exactly once per instance: - On `engine.onWorldLoaded` — a batched sweep over every world instance of every type that implements `onRegister`, yielding every 32 instances so a large instance count never stalls a frame. The @builtin library (`/zero/source/libs/`) is excluded. - On live `asset.create` — the create path calls `M.fireFor(ref)` on the freshly-created instance. A per-VM once-guard keyed by the instance's VFS path ensures the two triggers can't double-register the same instance. ## Exports - `M.fireFor(ref, onRegisterFn?) -> boolean` — fire one instance's `onRegister(self)` hook exactly once. Resolves the type's hook from `ref.type` when `onRegisterFn` isn't supplied. Idempotent: a second call on the same instance is a no-op. Returns true if the hook fired this call. - `M.sweep()` — batched sweep: fire `onRegister` once for every world instance of every registered type that implements it. Yields, so it must run inside a task. Safe to call repeatedly. - `M.install()` — install the world-loaded sweep. Idempotent. Runs the sweep on a system task so it ticks through pause and never blocks the caller.
▲ 0↑ born
·
nodebox · born here
❒asset
# value (nodebox) Single values in a graph: value.math and value.compare do arithmetic and comparison with the operation picked by a parameter, value.expr follows a Luau expression over the graph's clock, value.get reads one field of a record by a dotted path, and value.switch picks one of two values by a Bool. value.present and value.fallback are how a graph used as a node handles an input its caller may leave unwired: present answers whether anything is wired, fallback takes the wired value or a fallback.
▲ 0↑ born
·
nodebox · born here
❒asset
# part (nodebox) part.merge packs several values into one part, each piece keeping what it is; part.unpack gives one piece back by its name.
▲ 0↑ born
·
nodebox · born here
❒asset
# math One node per operator and per function of Luau's `math` table that is a function of its numbers alone: add, sub, mul, div, mod, pow, neg, abs, min, max, floor, ceil, round, sqrt, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, exp, log, log10, fmod, ldexp, frexp, modf, noise, map, sign, deg, rad, clamp, lerp, smoothstep, isnan, isinf, isfinite, length, normalize, dot, cross, vec2, vec3, vec4, the comparisons (lt, le, gt, ge, eq, ne, and `compare` over them), `where`, the integer functions (to_int, to_float, bor, bxor, shl, floordiv), and `concat` for text. `math.random` and `math.randomseed` have no node: they draw from state outside the graph, a graph that called one would cook differently each time, and a call of either in a graph is refused, naming `field.rand`, `field.random` and `rand.unit`, which draw from a seed. Operators and `math.*` over sockets resolve to these nodes, and `vector.create` over sockets resolves to `math.vec2`, `math.vec3` or `math.vec4` by its component count; with plain numbers only, `math.*` and `vector.create` are Luau's own, and `vector.create` holds three components. Each node but `compare` (built from the comparisons) and `concat` (text) calls an operation of `proc.fieldc.operators`: over plain numbers and vectors it answers the plain result, over a Column or a Field it answers a Field (a fieldc template), so a chain of math nodes is one expression that the node consuming it evaluates in a single dispatch (`fieldc.evaluate`). `math.min` and `math.max` over sockets take any number of operands, folded two at a time; `math.log(x, base)` is the `log` node with its `base`. Operands of different widths widen to the widest: a number applies to every component, and a shorter vector reads 0 for the components it lacks. Division, `floordiv`, `mod` and `fmod` by 0 answer 0, `sqrt`, `log` and `log10` of a value at or below 0 answer 0, `asin` and `acos` of a value past -1 or 1 read the nearest of the two, and `map` over an input range of no width answers its output minimum, so a chain keeps producing numbers. The orderings (`lt`, `le`, `gt`, `ge`) compare first components; `eq` and `ne` compare every component.
▲ 0↑ born
·
nodebox · born here
❒asset
# core The parts the other procgen nodes are built from: connectivity (edges, boundary, adjacency, islands, owner, corners), normals, weld, select, stitch, curve measure and resample, sampling, neighbours, realize, the raster set (`raster.new`, `raster.read`, `raster.stencil`, `raster.sample`, `raster.add_layer`, `raster.remove_layer`, `raster.reduce`, `raster.column`, `raster.resolve`, `raster.blend`, and `raster.cells` under them), `column`, and `entity.read`, which brings scene entities in (assets come in through `io.import`). Each is a graph of the four ops, the kernels of `kernels/` and other core nodes. `join` holds the module that places the parts of a join, called by `concat` and `realize`. A graph calls them as `g.core.<name>`, for instance `g.core.edges`. A node with several outputs answers a record: `local faces = g.core.normals.face(...)` then `faces.geometry`, `faces.scaled`. Every node's README states its inputs and outputs.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# Scatter (node) A scattering node: its `init.luau` holds the graph that does the work, so the declared inputs are this node's inputs and the declared output is this node's output. The node is its pipeline, in one self-contained asset. It makes points on the surface (`points.on_surface`, area-weighted), gives every point its own random yaw, lean and scale (`instances.randomize_transform`), and places the source on those points (`instances.on_points`). The transform is read from the same point cloud the instances sit on, so each copy takes the pose of its own point. A node is findable by what it does: the `procgen` toolbox's `ops` with the query `scatter` lists it beside `points.on_surface` and `instances.on_points`. Editing this node's `init.luau` cooks again every graph that calls it. ## Inputs - `surface` (Geometry): what the copies land on. - `source` (Geometry): the shape being copied. - `count` (Int, default 200): how many. - `seed` (Int, default 1): changes the arrangement. - `scaleMin` / `scaleMax` (Float, defaults 0.8 and 1.4): per-copy size range. - `tilt` (Float, default 0.15): radians of random lean. ## Output - `instances`: a population, the points each carrying the source as its `Mesh`. ## Authoring a node A node is a graph returned from a `.procNode`'s `init.luau` (`proc.define`). `asset.create("procNode", name)` scaffolds that shape, and `procNode.assetType/README.md` describes what a node states and how graphs call it.
▲ 0↑ born
·
procnode · born here
❒asset
# field.ramp (procNode) A ramp read at every element by a value it carries: a particle's colour, size or opacity following its age. It takes the value each element reads by (the wired `t`, else the element's own `by` attribute, through `value.fallback` and `field.attribute`), maps it from `range` onto 0..1 (`field.map_range`, the ends read off `range` by `value.get`), and reads the ramp there with `ramp.sample`, compiled into the element's dispatch. A value past either end of `range` reads that end of the ramp. ## Inputs - `ramp` (`Ramp`): the ramp to read. - `t` (`Field<Float> | Float`): where along the ramp each element reads. Unwired, it is the element's own `by` attribute. - `by` (`String`, default `"life"`): the Float attribute each element reads the ramp by when `t` is unwired. A particle solver's particles carry `life`, 0 at birth to 1 at death. - `range` (`Vec2`, default `{ 0, 1 }`): the values of `t` that land at 0 and at 1 on the ramp, so a speed from 0 to 20 or a temperature from 300 to 3000 reads the whole ramp. ## Outputs - `field`: the ramp's value at each element.
▲ 0↑ born
❒
package · born here
❒asset
# quickGeometry Model a scene in Luau with three.js-shaped code. A `build.luau` or a `.sceneModule` builds `Group`s and `Mesh`es from geometry constructors and materials; at the end of the build the tree is stored in the scene as data, drawn by one `Generator`, and nothing runs per frame. A bare box reads as a placeholder. Every geometry takes **modifiers** that turn it into a modelled shape: round its edges, taper it, bend it, drill it, smooth it, or build it from a profile or cross-sections. A build whose parts are mostly bare boxes and planes logs a warning that names them. ## Using it The nouns are globals in a scene's `build.luau` and a `.sceneModule`'s entry script: `sceneNouns` and `quickLighting` join both scripts' contexts, so the engine binds their exports when it loads the script, and the language server knows the same names. ```luau function content() local paint = MeshStandardMaterial({ color = "#b0332f", metalness = 0.45, roughness = 0.28 }) local steel = MeshStandardMaterial({ color = "#aab2ba", metalness = 1, roughness = 0.25 }) local body = Mesh(BoxGeometry(1, 1, 1):round(0.14), paint, "rounded_box") body.position:set(0, 0.8, 0) local block = Mesh(BoxGeometry(1.1, 1.1, 1.1):subtract(CylinderGeometry(0.3, 0.3, 2, 24)), steel, "drilled_block") block.position:set(1.5, 0.8, 0) local hull = Mesh(LoftGeometry({ { shape = EllipseShape(0.45, 0.28), z = -1.2, scale = 0.25 }, { shape = EllipseShape(0.45, 0.28), z = -0.55, scale = 0.95 }, { shape = EllipseShape(0.45, 0.28), z = 0.4, scale = 1.0 }, { shape = EllipseShape(0.45, 0.28), z = 1.2, scale = 0.3, offset = { y = -0.06 } }, }), paint, "hull") hull.position:set(3.2, 0.8, 0) end ``` The same code works in a `.sceneModule`'s builder, where `inputs` declare what a placement may set. A module joins those contexts with `--!context sceneBuild sceneModule` in its leading comment block, the way these two do. A world's own module joins the same way, and its exports become globals in every build script beside the nouns. A name that starts with `_` stays inside its module. A module that exports `_beginRun` and `_finish` has them called around every run of a build. The `script_context` module's README covers contexts in full. ## Parts - `Group(name)` holds other objects. `Mesh(geometry, material, name)` draws a geometry. - `object.position`, `object.rotation` (Euler angles in radians, XYZ) and `object.scale` take `.x`, `.y`, `.z` and the vector methods `set`, `setScalar`, `copy`, `add`, `sub`, `multiplyScalar`, `clone` and `toArray`; calls chain. - `parent:add(a, b, ...)` nests objects under another, and their poses are then in the parent's frame; an object added elsewhere moves. `parent:remove(a, ...)` takes them out, and a removed object is not drawn until it is added again. `object.parent` and `object.children` hold the tree. - `object.visible = false` leaves the object and everything under it out of the scene. `object.userData` is a table for your own values. - `object:lookAt(x, y, z)` or `object:lookAt(Vector3)` turns the object so its +Z axis points at a point in its parent's frame; the object's position and the point are numbers. - `object:clone(recursive)` copies the object, its pose, components and (unless `recursive` is false) what is under it; the copy shares the geometry and material and is placed like a new `Mesh`. `object:traverse(fn)` calls `fn` on the object and everything under it, and `object:getObjectByName(name)` finds one. - `object:addComponent(type, data)` puts an engine component on the entity a part becomes (`Physics`, a collider, a `Joint`). A part whose pose follows a formula is drawn as an instance and takes none. - An object that never moves and carries a component becomes an entity named for it, with its parent and local pose; one that never moves and carries none is folded into the object above it. A moving object's leaves are drawn as instances. ## Geometry | Constructor | Shape | |-------------|-------| | `BoxGeometry(width, height, depth)` | box | | `CylinderGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded)` | cylinder; a cone when one radius is 0 | | `ConeGeometry(radius, height, radialSegments, heightSegments, openEnded)` | cone with its apex up | | `SphereGeometry(radius, widthSegments, heightSegments)` | UV sphere | | `TorusGeometry(radius, tube, radialSegments, tubularSegments, arc)` | torus | | `TorusKnotGeometry(radius, tube, tubularSegments, radialSegments, p, q)` | torus knot | | `CapsuleGeometry(radius, length, capSegments, radialSegments)` | capsule | | `PlaneGeometry(width, height, widthSegments, heightSegments)` | flat rectangle | | `CircleGeometry(radius, segments)` | flat disc | | `RingGeometry(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength)` | flat annulus | | `TetrahedronGeometry`, `OctahedronGeometry`, `IcosahedronGeometry`, `DodecahedronGeometry` `(radius, detail)` | regular polyhedra; `detail` above 0 rounds them toward a sphere | | `LatheGeometry(points, segments)` | a profile of `{ x = radius, y }` points revolved around Y | | `ExtrudeGeometry(shape, { depth, curveSegments })` | an outline extruded along +Z | | `ShapeGeometry(shape, curveSegments)` | a flat, filled outline | | `TubeGeometry(path, tubularSegments, radius, radialSegments, closed)` | a circle swept along a curve | | `LoftGeometry(sections, { caps })` | a surface through cross-sections along Z | | `BufferGeometry()` | a mesh from your own arrays | | `mergeGeometries(list)` | several geometries as one | Every geometry also takes `translate(x, y, z)`, `rotateX/Y/Z(angle)` and `scale(x, y, z)`, which move it. ### Outlines and curves `Shape()` records an outline with `moveTo`, `lineTo`, `quadraticCurveTo`, `bezierCurveTo` and `absarc`. `EllipseShape(rx, ry, segments)` and `RoundedRectShape(width, height, radius, segments)` return ready outlines. `CatmullRomCurve3(points, closed)` and `HelixCurve(radius, turns, height)` return curves for `TubeGeometry`. ### Loft `LoftGeometry` takes sections in order, each `{ shape, z, scale?, offset? }`: an outline, where along Z it stands, a scale (a number or `{ x, y }`) and a move (`{ x, y }`). `caps = false` leaves the ends open. A body, a hull, a fuselage or a bottle is a loft. ### Custom arrays ```luau local triangle = BufferGeometry() triangle:setAttribute("position", Float32BufferAttribute({ 0, 0, 0, 1, 0, 0, 0, 1, 0 }, 3)) ``` `setAttribute` takes `position`, `normal` and `uv`; `setIndex(list)` gives triangle indices; without normals they are computed and shared across triangles (`computeVertexNormals()`). ## Modifiers A modifier changes the shape in its own frame, before `translate`/`rotate`/`scale` move it, and modifiers stack in the order called. | Modifier | Effect | |----------|--------| | `:round(radius, segments)` | round every edge with that radius | | `:bevel(width, segments, angle)` | round only edges sharper than `angle` degrees; `width` is how far it reaches onto each face | | `:subdivide(levels, mode)` | split every triangle into four, `levels` 1 to 3 times; `"loop"` (default) also smooths, `"linear"` only adds points | | `:smooth()` | one round of Loop smoothing | | `:taper(amount, axis)` | scale the cross-section by `1 - amount * d` at distance `d` along `axis` (`"y"` by default) | | `:twist(angle, axis)` | turn the shape about `axis` by `angle` radians per metre along it | | `:bend(curvature, axis)` | curve it along `axis`; `curvature` is 1 over the bend's radius in metres | | `:subtract(other)`, `:union(other)`, `:intersect(other)` | combine with another closed solid, which stands where it was moved to | `subtract`, `union` and `intersect` take one shape and one shape; merge parts after combining. Both must be closed solids (a box, cylinder, sphere, torus, capsule or polyhedron, or a bevelled or smoothed one). ## Materials `MeshStandardMaterial({ color, roughness, metalness, emissive, emissiveIntensity, opacity, side })` and `MeshBasicMaterial({ color, opacity, side })`. A colour is a `Color`, a hex string (`"#a3141b"`), a number (`0xa3141b`), a name (`"red"`) or `{ r, g, b }`; hex colours are sRGB. `side = "double"` draws both faces; an `opacity` below 1 blends. ## Math `Vector3`, `Color` and `MathUtils` come from the same module as the other nouns and are described in the [math](math.module/README.md) module's README: vector methods and operators, colours from hex, names and HSL, and clamp, lerp, smoothstep and a seeded random. ```luau MathUtils.setSeed(3) for i = 1, 12 do local post = Mesh(CylinderGeometry(0.05, 0.05, 1):round(0.01), MeshStandardMaterial({ color = Color():setHSL(i / 12, 0.5, 0.5) }), "post" .. i) post.position:set(i * 0.5, 0.5, MathUtils.randFloatSpread(0.2)) end ``` ## Motion Write a pose as a formula of `Time` (seconds) and the `Expr` functions `sin`, `cos`, `sqrt`, `atan2`, `abs`, `min`, `max`, `mod` and `floor`, with `+ - * / ^`: ```luau local angle = Time * 6.28 piston.position.y = 1.74 * Expr.cos(angle) + Expr.sqrt(32 - 3 * Expr.sin(angle) ^ 2) crank.rotation.z = -angle ``` The formula is stored with the scene and runs on the device each frame; children follow their parent's motion. ## Lighting ```luau Lighting({ background = "#0c0f12", environment = 1, sun = { color = "#fff1dc", intensity = 1.6, position = { 18, 30, 22 } } }) PostProcessing({ exposure = 0.9, toneMapping = "aces", bloom = { threshold = 1.05, intensity = 0.55 } }) ``` A scene setup places a whole lighting composition as one asset. The V8Dyno scene places `studioLighting`, a studio backdrop, a warm key light and a sky light that lights the model from the backdrop: ```luau asset.resolve("@builtin::systems.quickGeometry.studioLighting", "sceneSetup"):instantiate(nil, { name = "lighting" }) ``` ## Where it lives Each build ends by spawning one entity named `model` with a `Generator` on the `ModelGraph` graph in this package. The tree is the Generator's `objects` and `channels` inputs, stored in `scene.json`; the shapes are made by the nodes of the `shape` nodebox and the modifiers by procgen's `geometry.*` nodes. Names that two parts share get a numeric suffix.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
❒
package · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
# debug (nodebox) debug.dump summarizes any graph value into a record; debug.validate checks a Geometry's structure and reports every issue it finds.
▲ 0↑ born
·❒asset
# geometry.recalculate_normals (procNode) Every vertex's normal averaged, by area, over the faces meeting it. The node is `geometry.smooth_normals` with a crease angle of 180 degrees and area weighting, so no vertex splits: a vertex shared by two faces is smooth across them, and one already split between two copies stays a hard edge. ## Inputs - `geometry` (`Geometry`): whose surface the normals are read off. Attributes and material carry to the result. ## Outputs - `geometry`: the geometry with recomputed per-vertex normals.
▲ 0↑ born
·
nodebox · born here
❒asset
# material (nodebox) Materials as records: material.pbrMat is the standard metallic-roughness material made from its PBR maps (base colour, metallic-roughness, normal, occlusion, emissive) and their factors, and material.shader a material of any surface shader, holding every property and slot to what the shader declares. Each answers one element holding the record of the material kind (`records/material.procRecord`), which geometry.set_material, instances.set_material and the other inputs that take a material put on what draws; the output node shows it and the export node saves it as a `.material`.
▲ 0↑ born
·
procnode · born here
❒asset
# instances.cull (procNode) Keeps the instances a test says to. An instance survives when the value it is judged by is strictly above `threshold`; `invert` keeps the rest instead. The value is the `mask` field when it is wired, else the named point `attribute` (`field.attribute`). `elements.keep` on the points carries every attribute onto the instances that stay, so a culled set realizes as the whole one would have. With nothing to judge by, every instance stays, and inverted, none does. ## Inputs - `instances` (`Points`): the set to thin out, points carrying a Mesh. - `mask` (`Field`): the value each instance is judged by. Wired, it outranks `attribute`. - `threshold` (`Float`, default 0.5): an instance survives when its value reads strictly above this. Raising it thins the set, lowering it fills it back in. - `attribute` (`String`): a point attribute on the set to judge by, read while `mask` is unwired. A name the points do not carry is refused. - `invert` (`Bool`, default false): true keeps the complement, every instance the test dropped. ## Outputs - `instances`: the surviving instances.
▲ 0↑ born
·
procnode · born here
❒asset
# points.box (procNode) A 3D lattice of points filling a box centred on the origin. Each count is at least 1, and the extent the lattice spans is the counts times `spacing` (`value.math`). `grid.box` lays out the cells, x fastest, then y, then z, on the device, and each cell's centre is one point. `attribute.remove` takes the cell layout off the detail so the lattice reads as Points, and each point carries its own number as `id`. ## Inputs - `countX` (`Int`, default 3): how many points along X. The lattice holds countX x countY x countZ points and stays centred on the origin on every axis. Below 1 reads as 1. - `countY` (`Int`, default 3): how many points along Y, the layers the lattice is stacked in. 1 collapses it to a single flat sheet at y = 0. Below 1 reads as 1. - `countZ` (`Int`, default 3): how many points along Z. Below 1 reads as 1. - `spacing` (`Float`, default 1.0): distance between neighbouring points, the same on all three axes. The lattice spans (count - 1) x spacing per axis. ## Outputs - `points`: the lattice, with `id` numbering each point.
▲ 0↑ born
·
nodebox · born here
❒asset
# component (nodebox) component.set gives every element of a class a component with the fields given.
▲ 0↑ born
·
nodebox · born here
❒asset
# texture (nodebox) Textures: images drawn on the device as Texture values, a width, a height and one colour per texel. texture.noise and texture.gradient draw from a formula, texture.from_shader from an author's compute shader and texture.from_raster from the layers of a raster. A material takes a Texture in a slot, and the output node shows one. texture.cells is the part the first two are built from: one point per texel carrying its column and row.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
# geometry Nodes that move, join, cut, round, thicken and sample meshes. A graph transforms a geometry (`geometry.transform`, `geometry.set_position`, `geometry.merge`), welds and shades it (`geometry.weld`, `geometry.smooth_normals`), models it (`geometry.extrude`, `geometry.solidify`, `geometry.bevel`, `geometry.subdivide`, `geometry.decimate`), builds surfaces from outlines (`geometry.sweep`, `geometry.revolve`, `geometry.loft`, `geometry.ribbon`) and reads it into volumes (`geometry.voxelize`, `geometry.to_sdf`). Each is built from the core nodes and the kernels of the library. ## Nodes - `geometry.transform`, `geometry.set_position`, `geometry.set_material`, `geometry.merge`, `geometry.triangulate`, `geometry.measure`: the basic edits and the measurement of a geometry. `geometry.merge` also joins pieces into a piece set for `instances.to_points`; a part that lacks an attribute another part carries takes the value an element without it has: an instance attribute's identity, else zero (its README says exactly how). - `geometry.weld` (with `match = "position+normal"` it keeps hard edges), `geometry.smooth_normals`: merging points and shading normals. - `geometry.extrude`, `geometry.solidify`, `geometry.bevel`, `geometry.subdivide`, `geometry.decimate`: modelling. - `geometry.sweep`, `geometry.revolve`, `geometry.loft`, `geometry.ribbon`: surfaces from outlines and paths. - `geometry.voxelize`, `geometry.to_sdf`: a mesh as cells and as a distance field. - `geometry.boolean`: union, subtract or intersect of two closed meshes, over the `intersect` kernels. - `geometry.delete`, `geometry.separate`: the triangles a mask field or primitive attribute selects, taken away or split into two geometries (`elements.keep` on the primitives); `geometry.recalculate_normals`: `geometry.smooth_normals` at 180 degrees, area-weighted. - `geometry.selected`, `geometry.flip`, `geometry.profile`, `geometry.tangents`, `geometry.sides`, `geometry.shared`, `geometry.bvh`, `geometry.rings`, `geometry.first`: the parts the nodes above are built from, each usable on its own. - `geometry.unit`, `geometry.perpendicular`, `geometry.rotate`, `geometry.transport`, `geometry.split`: vector arithmetic over sockets that the nodes which orient points and normals share. - `geometry.offsets`, `geometry.kept`, `geometry.following`, `geometry.trim`, `geometry.blank`: column arithmetic the nodes above share (a prefix sum of counts, the places a mask keeps, a ring read one place on, the primitives of no area dropped, a one-word column to bind). ## Conventions - Each node's folder name is its call name inside the box: `geometry.<folder>`. - Inputs and outputs carry the names of the op each node replaces. - A node that answers a Data table from numbers read back off the device holds the Luau for it in a `readings.module` inside its own folder. - A node with one output answers that output's value; a node with several answers a record by output name. - A fold's index runs from 1: the first pass is 1, so a pass that works on level, chunk or step `n` reads `index - 1` when it counts from 0 (`geometry.bvh`, `geometry.to_sdf`, `geometry.sweep`, `geometry.loft`). - A field bound to a kernel takes the length of that dispatch, so a node writes a value out as a column (a gather with an explicit `count`) before it binds one whose length differs from the dispatch's.
▲ 0↑ born
▣
module · born here
❒asset
# assetType.shared.ref Builds the metatable every `AssetRef` (the `{ __ref, type, name, guid, identity, path }` envelope returned by `asset.resolve` / `asset.ref`) carries. Replaces the per-call C metatable that used to live in `crates/zero_scripting/src/ffi/bindings/asset.rs::attach_asset_ref_metatable`. ## Public API ```lua local assetRef = require("@builtin::assetTypes.assetType.shared.ref") -- Called by the Rust factory (push_asset_ref_handle) via -- _G.__build_asset_ref_proxy after the envelope fields are set. assetRef.build(envelope) -- attaches AssetRefMT, returns the table ``` The module exposes no invalidation surface — discovery is registry-driven and hot-reload is transparent (see "Discovery and hot-reload" below). ## Method dispatch order `ref.foo` is resolved in this order: 1. **Default methods** — `getSource` / `getBytes` / `getText` / `exists` / `inspect` and the lazy `meta` property. Per-type definitions cannot override these (engine contract from gh#1889). 2. **Per-type `ref` table** — discovered through `asset.resolve(<typename>, "assetType")` + `require(<identity>.behavior)`. The lookup resolves to whichever `<typename>.assetType/` folder is currently registered for the typename (built-in, user, or library-vendored) and pulls its `ref` methods. 3. **Nil** — unknown key, same shape as the original C metatable. ## Adding methods for a new asset type Drop a `behavior.luau` into the type folder: ``` src/lua/lib/assetTypes/<typename>.assetType/ ├── type.yaml -- structural spec (existing) ├── behavior.luau -- ref + global behaviour (new) └── template/ -- placeholder body (existing) ``` `behavior.luau` returns: ```lua return { ref = { --!desc Per-instance method on every `<typename>` AssetRef. myMethod = function(self, ...) ... end, }, global = { -- Reserved for the asset.<typename>.* surface — not consumed -- yet; included so the contract from gh#1889 lands cleanly. }, } ``` Within `ref` methods, `self` is the AssetRef envelope: `self.path`, `self.identity`, `self.guid`, `self.type`, `self.name` are available. Engine-required fields (`guid`, `path`, `identity`, `type`) must not be redefined. ## Discovery and hot-reload Type discovery uses the asset registry, so it doesn't matter where a `<typename>.assetType/` folder lives — engine built-ins under `@builtin::assetTypes.<X>`, user types dropped under `/zero/source/<X>.assetType/`, or types vendored inside an imported library all resolve identically. The dispatcher walks `asset.resolve(<typename>, "assetType")` → canonical identity → `require <identity>.behavior` on every miss; the asset registry is the cache for the resolve half and Luau's `_LOADED` is the cache for the require half. Hot-reload is transparent. When a `<typename>.assetType/behavior.luau` is rewritten through VFS, the engine's `invalidate_require_cache_for_state` re-runs the module and mutates the cached `_LOADED[<identity>.behavior]` table in place. Dispatch reads `mod.ref` on every access (rather than caching a sub-pointer), so existing AssetRefs see the new methods on the very next access — no Rust-side hook into this module is needed, and no invalidation API is exposed for callers to call. The same registry-driven path also handles type **registration** correctness: dropping a new `<typename>.assetType/behavior.luau` updates the asset registry, the next `asset.resolve(<typename>, "assetType")` returns the new ref, and AssetRefs of that type immediately gain the new methods. ## Why Luau, not Rust The asset surface needed per-category behaviour (`material:getProperties()`, `bundle:instantiate(entityId)`, `tool:run(args)`) and the old shape couldn't grow without an FFI change per method. Owning the proxy in Luau means: - Type-specific methods ship as content (the `<typename>.assetType/` folder), not engine code. - Adding a new asset type drops in a new folder; no Rust rebuild. - Methods can call any other Luau global (`vfs`, `asset`, `Material`, `entity`, etc.) directly, instead of going through narrow FFI primitives. ## Consumers - `crates/zero_scripting/src/ffi/bindings/asset.rs::attach_asset_ref_metatable` — the Rust factory that pushes envelopes invokes `_G.__build_asset_ref_proxy` once per push. - Every Luau call site of `asset.resolve` / `asset.ref` / `entity(id).component.X.material` / any binding declared `AssetRef<...>` — they all receive envelopes built through this module.
▲ 0↑ born
▣
module · born here
❒asset
# proc.types The procgen type system: core type tags + socket assignability for graph validation. Part of `@builtin::systems.procgen.proc`.
▲ 0↑ born
·
nodebox · born here
❒asset
# sdf (nodebox) Signed distance field nodes: shapes, smooth combines, round and shell, space warps (transform, twist, bend, taper, elongate, mirror, repeat), displacement, grids and fields in and out, and sdf.mesh, which contours a shape into a closed mesh.
▲ 0↑ born
·
procgraph · born here
❒asset
# Scatter Strews copies of one shape over the surface of another, each with its own turn, lean and size. Both the surface and the thing scattered are inputs, so this covers rocks on a hillside, crates on a deck, bushes along a bank or rubble across a floor: wire it a different `source` and it is a different field. It makes points on the surface (`points.on_surface`, area-weighted), gives every point its own random yaw, lean and scale (`instances.randomize_transform`), and places the source on those points (`instances.on_points`). The transform is read from the same point cloud the instances sit on, so each copy takes the pose of its own point. ## Inputs | Input | Type | Default | What it does | |-------|------|---------|--------------| | `surface` | Geometry | none | What the copies land on. Points are area-weighted, so a bigger face gets proportionally more. | | `source` | Geometry | none | The shape being copied. | | `count` | Int | 200 | How many copies. | | `seed` | Int | 1 | Changes the arrangement. The same seed always gives the same field. | | `scaleMin` | Float | 0.8 | Smallest per-copy size multiplier. | | `scaleMax` | Float | 1.4 | Largest per-copy size multiplier. Equal to `scaleMin` means uniform. | | `tilt` | Float | 0.15 | Radians of random lean off vertical. `0` stands every copy upright. | ## Output `instances`: a population, the points each carrying the source as its `Mesh`. A Generator draws it as one hardware-instanced draw call per source; `instances.realize` merges it into a single Geometry. ## Calling it Another graph calls a `.procGraph` as it calls a node, by its path or identity, naming the inputs in a table; the call answers what the graph outputs (`instances`). Its declared inputs are the call's inputs.
▲ 0↑ born
·
procnode · born here
❒asset
# points.grid (procNode) A flat lattice of points in the XZ plane, centred on the origin. Each count is at least 1, and the extent the lattice spans is the counts times `spacing` (`value.math`). `grid.box`, one cell thick at height `y`, lays out the cells, x fastest, then z, on the device, and each cell's centre is one point. `attribute.remove` takes the cell layout off the detail so the lattice reads as Points, and each point carries its own number as `id`. ## Inputs - `countX` (`Int`, default 4): how many points along X. The grid holds countX x countZ points and stays centred on the origin, so each one added widens it by `spacing`, half of that to either side. Below 1 reads as 1. - `countZ` (`Int`, default 4): how many points along Z. A count of 1 leaves a single row running along X. Below 1 reads as 1. - `spacing` (`Float`, default 1.0): distance between neighbouring points, the same on both axes. The grid spans (countX - 1) x spacing by (countZ - 1) x spacing. - `y` (`Float`, default 0.0): the height the whole lattice sits at. Every point takes this as its y. ## Outputs - `points`: the lattice, with `id` numbering each point.
▲ 0↑ born
·
procnode · born here
❒asset
# points.filter (procNode) Keeps the points a test says to. The value each point is tested by is the `mask` field when it is wired, else the named `attribute`'s values (`attribute.labels`). The test is a comparison (`field.compare`): above `threshold`, or, when `equals` is given, equal to the index that value or label names. `elements.keep` on the points carries every attribute and the detail onto the points that stay, counted on the device. Given neither a mask nor an attribute, the points come back as they are. ## Inputs - `points` (`Geometry`): the cloud to thin. Every point attribute and every detail value is carried onto the survivors, so a colour or an index still belongs to the point it started on. - `mask` (`Field`): the per-point value tested; a point stays when it is above `threshold`. Wired, it decides, and `attribute` is read only when this is empty. - `threshold` (`Float`, default 0.5): a point stays when its value is strictly above this. Raising it keeps fewer points. - `attribute` (`String`): a point attribute to test instead of wiring `mask`. A name the points do not carry is refused, naming the ones they do. - `equals` (`String | Float`): keeps the points whose `attribute` equals this instead of testing it against `threshold`. It is a number, or a label: one of the texts a text attribute holds, or one of the names the points' detail `labels` gives a numeric one (how one solver's particles are split back by the `stream` their source named). ## Outputs - `points`: the points that stay.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# geometry.delete (procNode) Deletes the triangles a test selects. A triangle is selected when its value is strictly above `threshold`. The value each triangle is tested by is the `mask` field when it is wired, else the named primitive `attribute` (`field.attribute`), else 0. `invert` deletes the triangles the test did not select. `elements.keep` on the primitives does the removal: every point stays, and the triangles that remain keep their corners and attributes, counted on the device. ## Inputs - `geometry` (`Curves | Surface`): whose triangles are thinned. Point and detail attributes carry over as they are; primitive and vertex attributes stay with the triangles that survive. - `mask` (`Field`): read once per triangle for whether it goes. Wired, it is what the selection reads, and `attribute` is read only when this is empty. - `threshold` (`Float`, default 0.5): a triangle is selected when its value is strictly above this. Raising it deletes less. - `attribute` (`String`): a primitive attribute on the geometry to read the selection from, instead of a wired mask. A name the triangles do not carry is refused. - `invert` (`Bool`, default false): true deletes every triangle the test did not select, so a mask naming what to keep cuts away the rest. ## Outputs - `geometry`: the geometry with the selected triangles removed.
▲ 0↑ born
·
nodebox · born here
❒asset
# shader (nodebox) An author's own compute shaders as nodes. shader.compute runs a .computeShader over the elements of a geometry through the device.kernel op: each buffer binding is a column of the geometry, each param a knob of the node, and what the shader writes comes out as columns.
▲ 0↑ born
·
nodebox · born here
❒asset
# scene (nodebox) scene.query finds entity ids by name, component and hierarchy, scene.fetch brings entities in as points carrying their pose and components, scene.input is the entity the graph stands on, and scene.water is the water the scene holds.
▲ 0↑ born
·
procnode · born here
❒asset
# geometry.separate (procNode) Splits a geometry's triangles in two by a test. The value each triangle is tested by is the `mask` field when it is wired, else the named primitive `attribute` (`field.attribute`), else 0. Two comparisons against `threshold` follow (`field.compare`): strictly above, and at or below. `elements.keep` on the primitives runs once for each, so `a` holds the triangles above and `b` the rest. Both keep every point, and between them they hold every triangle once. ## Inputs - `geometry` (`Curves | Surface`): whose triangles are divided. Point and detail attributes carry to both halves as they are; primitive and vertex attributes stay with each half's own triangles. - `mask` (`Field`): read once per triangle for which half it joins. Wired, it is what the split reads, and `attribute` is read only when this is empty. - `threshold` (`Float`, default 0.5): a triangle goes to `a` when its value is strictly above this, and to `b` otherwise. - `attribute` (`String`): a primitive attribute on the geometry to read the split from, instead of a wired mask. A name the triangles do not carry is refused. ## Outputs - `a`: the triangles whose value is strictly above `threshold`. - `b`: the rest. A call answers both as a record by output name.
▲ 0↑ born
▣
module · born here
❒asset
# frame_budget The share of a frame that cooperative engine work spends before it hands the frame back. Some engine work is one long sequence of small units run on a task: a scene load applies one record after another, and the world-load `onRegister` sweep fires one instance's hook after another. Run back to back in one frame, a long sequence holds that frame for its whole length, and nothing else the engine does (answering a call, drawing, input) happens until it is through. Asking `due()` before each unit and yielding when it answers true runs the same work across as many frames as it needs, a slice of each. ```luau local FrameBudget = require("@builtin::modules.frame_budget") for _, item in ipairs(items) do FrameBudget.yield() process(item) end ``` - **One slice per frame, shared.** Each caller is charged the time it runs between its readings of the slice in a frame (`task.runTime`), whoever runs it, and the charges of every caller add up to the frame's slice. What the rest of the frame runs (systems, components, other tasks) is not charged, so a busy frame still gives the slice to the work. Two long pieces of work running at once share a frame's slice rather than taking one each. - **A unit is never split.** The first unit of a frame always runs, so a frame holds at most the slice plus the one unit that crossed it. A unit that is itself long stays one piece of work. - **Code that cannot yield runs in its frame.** `due()` answers false outside a coroutine that can yield, so a caller called from such code does all its units in the frame it was called in, as it would without the budget. A caller that does work of its own around the yield asks `due()` and calls `wait()`, which yields to the next frame and opens that frame's slice as the caller resumes; `yield()` is the two together. Work whose unit is a native call that bounds itself by time is told how long it may run: `remainingMs()` answers what is left of the current frame's slice, or nil for code that cannot yield, which then runs the whole of its work in the frame it was called in. The publish gate's script check runs this way: ```luau local block, checking = __spacetime_vcs.scriptPublishBlock(FrameBudget.remainingMs()) while checking do FrameBudget.wait() block, checking = __spacetime_vcs.scriptPublishBlock(FrameBudget.remainingMs()) end ``` ## The background lane Some work is started early so it is ready when asked for, and no picture waits on it, such as the search text an editor reads ahead of the first `tools.search`. `background(fn)` runs `fn` on the background lane: every `yield`, `due` and `wait` its work makes on that coroutine hands the frame back for as long as a hold on the lane stands, and takes its slice as usual once none does. ```luau FrameBudget.background(function() for _, path in ipairs(paths) do FrameBudget.yield() warm(path) end end) ``` Work the picture waits on holds the lane while it runs: `holdBackground(key)` until `releaseBackground(key)`. A world's entry holds it under `"world entry"` from the moment the world is ready (its `onRegister` sweep) until its `onWorldLoad` has returned, so the frames of the entry carry the world's load and the background work runs in the frames before and after it. A hold no one releases lapses after `BACKGROUND_HOLD_SECONDS` (or the seconds it was taken for), with a warning naming its key, so work on the lane always runs in the end. `backgroundHolds()` lists the keys holding the lane now, and `backgroundWaits()` answers whether the calling code's next unit waits for it (a walk with a clock of its own asks it between its pieces). `FrameBudget.DEFAULT_MS` is the slice a call that names none spends. `spent()` answers how much of the current frame's slice is gone. A caller with a budget of its own reads `mark()` where its work starts. `ranMs(mark)` answers how long it has run since, none of the time it spent suspended; `cpuMs(mark)` answers the CPU time of its work since: those stretches and the stretches of every coroutine it resumes, and every one they resume, while it waits on them, which a machine whose cores are taken by other work does not stretch, so a bound that refuses work for running too long refuses the same work on a loaded machine as on an idle one, and work handed to a coroutine as work run in place. A task it starts and waits for runs while it is suspended, which `cpuMs` does not count.
▲ 0↑ born
·
nodebox · born here
❒asset
# sim (nodebox) Simulation nodes: sim.spawn, sim.force, sim.collider, sim.scene_colliders, sim.particles and sim.shader, built on the runtime's g:state and g:step.
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
▲ 0↑ born
·
nodebox · born here
❒asset
# mesh The primitive solids and sheets a graph starts from: `mesh.box`, `mesh.sphere`, `mesh.cylinder`, `mesh.cone`, `mesh.capsule`, `mesh.octahedron`, `mesh.torus`, `mesh.rounded_box`, `mesh.plane` and `mesh.grid`. Each is made on the device from lattices and fans of the `make` kernel, with positions, normals and texture coordinates written as formulas over the lattice, and answers triangles centred on the origin that fill the box its parameters name. ## Conventions - Each node's folder name is its call name inside the box: `mesh.<folder>`. - Parameters keep the names and defaults of the op each node replaces. - `mesh.lattice` makes the lattices and fans the presets share, `mesh.spherical` the point of a sphere and `mesh.cube_faces` the faces of a cube; a preset writes its positions, normals and texture coordinates as formulas over the lattice.
▲ 0↑ born
·
nodebox · born here
❒asset
# io The ways in and out of a graph: `import` brings an asset in as the value its type states, `luau` runs a function of a Luau module on the CPU, `output` shows a value in the world and answers a Handle, `export` saves a value as an asset, and `engine` calls the engine bridge that `import`, `export` and the core reading nodes use. `output` holds `show.module` and `engine` holds `engine.module`, the functions they call.
▲ 0↑ born
·
nodebox · born here
❒asset
# entity (nodebox) entity.transform and entity.bounds read one entity's pose and bounds as values, entity.points reads a set of entities as points, and entity.geometry reads the mesh an entity's Model draws as a Geometry.
▲ 0↑ born
·
assettype · born here
❒asset
# assetType (asset type) An asset type says what a kind of asset is: the files an asset of the kind is made of, the code that gives it behaviour, the interface a person uses to work with it, and how it is found, pictured and checked. A `<typename>.assetType/` folder declares a type called `<typename>`, and every `<name>.<typename>/` folder is an asset of it. `assetType` is itself a type, so a type is an asset like any other: it is created, versioned, installed and contributed the same way. ## Making a type `asset.create("assetType", "<typename>")` scaffolds a type. The type registers the moment its folder is written, anywhere under `/zero/source/`, and from then on `<name>.<typename>/` folders are its assets. An asset of a type that is not registered yet is not an asset, so make the type first. A type folder is a root: `~.x` in any file inside it names the type's own `x`, wherever the type is installed. Keep the type's whole implementation inside its folder and reach it that way. What a type folder must hold is set by this type's own `type.yaml`, the same way every type's `type.yaml` sets what its assets hold. `asset.validate` on a type reports anything missing, and the scaffold produces a folder that passes. ## What sets your type's schema (`type.yaml`) `type.yaml` is the structural contract every asset of the type is checked against. The keys below are the ones the engine reads; a key not listed here is ignored. | Key | What it controls | |---|---| | `suffix` | The folder suffix of the type's assets. Defaults to `.<typename>`. | | `primary` | The file or files that are the asset's content: what the asset resolves to when it is used. | | `entry_files`, `primary_aliases` | Further files that load as the asset or share its identity. | | `is_container` | Whether the suffix stays in the identities of what the asset holds. | | `is_opaque_walker` | Whether a walk of the tree stops at the asset and registers only its primary. | | `plural_dir`, `classify_exts` | Loose files in a folder of this name, or with these extensions, are assets of the type. | | `is_text_default` | Whether the asset's files are text unless stated otherwise. | | `broadcasts_subassets` | Whether assets nested inside an asset of the type are found by their own short name. | | `root` | `true` makes every asset of the type a root, so `~.x` inside one names that asset's own `x`. | | `contract_ref: { field, category }` | A key of the primary file that names another asset the asset is built on. | | `files: { required, optional }` | The files an asset holds (below). | | `allow_unlisted` | `false` reports every file the type does not declare. | | `aliases_from: [{ file, key }]` | Further names an asset answers to, read from its own files. | | `settings:` | Typed per-asset settings (below). | | `inspector:` | The interface people use for the type and its assets (below). | | `preview:` | How an asset is pictured (below). | | `references:` | Names of other assets the type's files carry (below). | | `indexing:` | What search reads for each asset (below). | | `describe:` | How a missing description is generated (below). | ### The files an asset holds Each entry under `files.required` or `files.optional` is `{ path, kind: file | folder, one_of_group?, content? }`. `*` in a path matches within one segment. Entries that share a `one_of_group` are satisfied by any one of them. `content` lists checks on the file's bytes: | Check | Passes when | |---|---| | `non_empty` | the file has content | | `json_field { key, type?, non_empty?, accept? }` | the JSON holds the key (a dotted path) with that shape | | `yaml_field { key, type?, non_empty?, accept? }` | the same for YAML | | `described { keys?, headings?, message? }` | the file says what the asset is (see "Ask your assets to say what they are") | Each check takes a `message`, which is what the author is told when it fails. ### Settings `settings: { values, schema: { type | instance, export? } }` gives every asset typed settings. `values` names the file an asset's values live in; `schema.type` declares one schema for the whole type, and `schema.instance` names a file each asset declares its own in. `asset.create` writes the resolved values, and a write to the values file reaches `onChange` with what changed. ## The human side (`inspector.luau`) A type is used by people through its Inspector, and without one the type is usable only from code. The Inspector is the type's interface for a person: for a procedural graph it is the graph editor, for a kit it is the tracking view of what the kit holds and what is still missing. Writing it is part of writing the type. `inspector: { type, instance? }` in `type.yaml` names the files. `type` is the interface for the type itself and for its assets; `instance` names a file an asset may ship to add its own. Each returns: ```luau return { sections = { { id = "graph", title = "Graph", build = function(ctx) ... end } }, replace = { contents = { ... } }, -- replace a default section by id order = { "graph", "contents" }, -- section order } ``` `build(ctx)` receives the asset and builds the section. A section's `title`, and the text its rows carry, is a string or an `i18n.text` value read from a catalog (`i18n.text("inspectors.mesh.title")`), which follows the editor's language. `asset.create("assetType", ...)` scaffolds a working `inspector.luau` to start from. `asset.validate` on a type that names no inspector, or names one that does not load, reports it. ## Say what your type is for (`about.yaml`) Every type carries an `about.yaml` that says what the type is for, in three plain-language texts: ```yaml intent: "Sets the typeface of the text in your game: UI, labels, signs and 3D lettering." function: "A font, from a TTF, OTF or WOFF file, made available to all of Zero's text, including 3D text." usage: "You choose it by name for your UI or your text, and the text appears in that typeface." ``` - **`intent`** is what the type is for in someone's game, in the words a game maker uses. Up to 800 bytes. - **`function`** is how it works today: what an asset of it is made of and what the engine does with it. Up to 1500 bytes. - **`usage`** is what a person or an agent does with one. Up to 1200 bytes. Write about the type as a whole, not one asset of it, and say what it does now. Agents read these texts to learn when to reach for the type and how; people searching find the type by them. The scaffold starts each text with `[[describe]]` and a note on what to write; a text that still starts that way counts as not written. `services describe` can write them. They show up in `asset.inspect` as `detail.about`, in `assetTypeRef:getAbout()`, at the end of the type's `types/<typename>` guide, and at the top of the type's Inspector. ## Ask your assets to say what they are A type can require each asset to carry a description: a file, written by the author or generated, saying what the asset is and what it is for. Declare it with a `described` check: ```yaml files: required: - path: "README.md" kind: "file" content: - { check: "described", message: "Say what this widget is for and where it goes." } ``` A file that is missing, empty or still has a line starting with `[[describe]]` fails the check, and so does a YAML file whose named `keys` are missing or over their `max_bytes`, or a Markdown file missing a named heading. `asset.validate` names the asset, and a push that carries it is refused with `message`. `services describe` finds such assets and writes their descriptions. `describe:` steers what is generated: ```yaml describe: guidance: "Say what the widget shows, what input it reacts to, and where it fits in a UI." examples: - "<identity of an asset of this type whose description reads well>" ``` An example is an asset of your type whose description is a true, written one, never a placeholder and never the asset being described; with none, leave `examples` empty. A type whose assets the model cannot perceive (a sound, a motion) says so in `guidance`, and the description is drawn only from what the asset's own files state. Start the file unwritten in your `template/`: a heading and one line starting with `[[describe]]`, never example content, which every new asset would carry verbatim. A type whose assets say what they are through their own content (a mesh, a texture) declares no check. ## The type's code (`behavior.luau`) `behavior.luau` returns one table. These are the keys the engine reads from it; anything else on the table is the type's own. ### What the type's assets can do | Key | Shape | What the engine does with it | |---|---|---| | `ref` | `{ [name] = function(self, ...) }` | Every function becomes a method on every asset of the type: `ref:name(...)`. | | `modules` | `{ [name] = require(".x") }` | Code the type's assets reach with `asset.containing(__FILE__).modules.<name>`. | | `events` | an events schema | Events an asset fires. Readers subscribe through `ref.events.<name>:connect(...)`; the type fires them. | | `refShapes` | `{ [method] = function(self) -> (typeExpr, source?) }` | The result type of a `ref` method for one particular asset (below). | | `namePattern` | a Lua pattern | The names `asset.create` accepts for the type's assets. Default `^[A-Za-z][A-Za-z0-9_]*$`. | | `derive` | `{ output, module, compute, fingerprint, matches?, required?, timeout? }` | A file computed from the asset when it is committed; a `required` one holds the commit until it lands. | Some `ref` names mean the same for every type, and the engine calls them: - **`instantiate(self, target?, opts?) -> (root, idMap)`**: puts the asset in a scene. Defining it is what makes the type scene-instantiable. Its return is a contract (below). - **`inspect(self) -> detail`**: what `asset.inspect` reports for the asset beyond the common record (below). - **`preview(self, opts)`**: renders the asset's picture; it wins over the type's `preview:` recipe. - **`previewMaterial(self) -> { material }`**: the material a `surface` preview paints. - **`saveDefinition(self)`**: writes the asset's in-memory edits back to its files in edit mode. Some names are answered for every asset before the type is asked, so a `ref` entry of the same name is never reached: `getSource`, `getBytes`, `getText`, `exists`, `deps`, `canInstantiate`, `canPreview`, `preview` (which calls yours when you define one), `meta`, `runtime`, `events`, `typeRef`, `modules`, and the residency flags `has_backing_asset`, `has_runtime_changes`, `cpu_resident`, `gpu_resident`. ### When the engine calls the type | Hook | Signature | When it runs | |---|---|---| | `onCreate` | `(name, opts) -> { [path] = contents }` | On `asset.create`. Returns the files of the new asset, laid over the type's `template/`. Annotate `opts`: its type is the schema `asset.create` checks the caller's arguments against. A `""` key writes a single loose file. | | `onReplace` | `(dest, files) -> files` | On an `asset.create` over an asset already at `dest`, after `onCreate`, so what the author added can be carried into the replacement. | | `onRegister` | `(self)` | Once per asset, when it first registers: when the world loads, on a live `asset.create`, and when an asset arrives later (installed, pulled, synced). This is what makes an asset take effect the moment it is written. | | `onChange` | `(ref, change)` | On every write to a file inside an asset of the type. `change` is `{ path, asset, type, kind, origin }`, plus `settings` and `settingsChanged` for a write to the settings values file; `kind` is `edited` or `seeded`, `origin` is `local` or `remote`. Filter on `change.path`. Writes to one asset arrive in order, each after the hook for the one before has finished, and the hook may wait on what it reads. A write the hook makes inside its own asset arrives later like any other, so keep the hook convergent. | | `onDependencyChange` | `(ref, change)` | When a module the asset's code requires is re-run, or a name the asset carries starts resolving. `change.kind` is `dependency`. | | `onDelete` | `(ref)` | When an asset of the type leaves the world: deleted, or the world it is in is swapped away. | | `validate` | `(ref) -> { { code, message, severity?, path? } }` | On `asset.validate`, after the `type.yaml` checks, for the type's own rules. `severity` defaults to `error`. Runs on every push, so a type's rules hold at publish. A hook that fails reports `validate.hook_failed`. | ### Settings hooks | Hook | When it runs | |---|---| | `settingsDefaults(name, opts, asked) -> table` | Once per `asset.create`, for values the schema's defaults do not give. | | `settingsCorrections(values, name, opts) -> (corrections?, reasons?)` | On every settings write. A correction to a field the writer named refuses the write, giving the reason. | | `settingsDerivedDefaults(values, explicit, changed)` | On a settings write, for fields derived from others. | | `normalizeSettings(values, stored?)` | On every read and write, to map an earlier spelling of a field to the current one. | | `settingsHealed(values, stored)` | On a read, to repair stored values. | | `settingsSchemaProblem(schema, ref) -> string?` | When an asset's own schema is read; a returned string refuses the schema. | `creationInputs` (`{ [opt] = true | selectorOpt }`) names `asset.create` options that are inputs to the type rather than settings. ### Reloading An edit to `behavior.luau` reaches existing assets with no restart. ## How an asset is pictured (`preview:`) | `kind` | The picture is | The type provides | |---|---|---| | `instantiate` | the asset placed in the preview studio through its `instantiate` | `ref.instantiate` | | `image` | a file the asset holds, fitted to the frame | `source: { files }`, the candidate files in order | | `surface` | the asset painted on a mesh | `mesh`, and `ref.previewMaterial` | | `custom` | whatever `ref.preview` returns | `ref.preview` | ```yaml preview: kind: surface mesh: sphere ``` `angle: [yaw, pitch]` turns the camera. The studio owns the light, the backdrop and the framing, so an asset pictures the same in every world. A type with no `preview:` that defines `instantiate` still answers `ref:preview()`. A picture is rendered when something asks to view it (the editor showing the asset, `ref:preview()`), when previews are generated on request (`assets.generatePreviews`), and when the asset is staged. An edit alone renders nothing. The picture records what it was made from, so a stale one is told from a current one. ## The names your type's assets hold (`references:`) Where your type's own format or API carries the name of another asset, declare it here: ```yaml references: keys: # a top-level key of the type's files that holds a name, or a table of them - { key: "shader", type: "shader" } args: # an argument of a call, counting from 1 - { call: "g:node", position: 2, type: "procNode" } fields: # a field of the options table a call takes - { call: "fx.beam", field: "material", type: "material" } ``` `type` is the category the name resolves in. `asset.declareReferenceKey`, `asset.declareReferenceArg` and `asset.declareReferenceField` declare the same from a script. ## What search reads (`indexing:`) `indexing:` is how assets are found. Search reaches an asset only through what its type's `indexing:` names, and adds nothing of its own. That includes you: an asset indexed badly is one you cannot find later, when you are making something else and need it. A type whose assets are never looked for says `indexing: none`. ```yaml indexing: data: # text, read from the asset's files - role: identity extractor: verbatim source: { file: "README.md" } - role: interface extractor: symbols source: { files: ["init.luau"] } - role: implementation extractor: verbatim source: { files: ["init.luau"] } content: # the picture - role: identity modality: image source: { file: "preview.png" } facets: # what a query filters and re-ranks by file: ".metadata" rigged: { type: bool, from: { components: { contains: SkinnedModel } } } roughness: { type: number, filter: range, from: { file: "mat.yaml", field: "floats.roughness" } } ``` **Roles.** Each `data` and `content` entry has a `role`, and a query matches in two slots: - **`identity`**: what an asset is. For anything you look at, the picture; for anything else, the text that says what it is. - **`capability`**: what it does and how it is made. `interface` (the signatures or shape a caller uses) and `implementation` (the body) both count as capability, and a type with code usually declares both. Ask what a person would recognise an asset of the type by, and what it does, and point each role at the file that says it. For text, that is the asset's description: the file your template starts with a `[[describe]]` block, which the author writes or `services describe` fills in (see "Ask your assets to say what they are"). **`data`.** `extractor: verbatim` embeds a file's text as it is; `symbols` embeds the declared signatures of code. `source` is `{ file }` or `{ files: [...] }`. Never index a file name (`source: { field: name }`): one or two words carry nothing to match. **`content`.** `modality: image` embeds the picture itself, so a text query matches what the asset looks like. A type whose assets are looked at makes the picture its identity. **`facets`.** What a query narrows and re-ranks the matches by. `file` is embedded whole, so keys nobody declared in it are still found. Each further key is computed for every asset and states a value for every one, including `false`: a file can imply "not rigged" but never say it, and a query separates rigged from unrigged only because the unrigged ones say `rigged: false`. A key is `{ type: bool | number | enum, filter?: range, from }`, where `from` is `{ file, field }` (a field of one of the asset's files, dotted for nesting), `{ metadata: key }`, or `{ components: { contains | any_outside } }` (what the asset's entities carry). ## What blocks a push A push checks every asset it carries against its type. These refuse it: - a required file that is missing, a `content` check that fails, a `described` file not written yet; - an error from the type's `validate`. Unlisted files and warnings do not. A `described` file blocks only a push that changes the asset. When a push is refused, the message names each asset and what it lacks. `world.publishBlockers()` and `zm status` read the same list without pushing. ## Typing a result from the asset (`refShapes`) A `ref` method whose result depends on the asset (one entry per child folder, per row of a config, per control a map declares) can only be annotated as `{ [string]: Thing }`, which accepts any key. `refShapes` states the result for each asset instead: a function returning a Luau type expression for that asset, and the module whose types the expression uses. Read the asset; never run it. ```lua -- inputMap.assetType/behavior.luau M.refShapes = { activate = function(self): (string, string) local names = {} for _, control in ipairs(M.ref.controls(self)) do table.insert(names, control.name .. ": Handle") end if #names == 0 then return "", "" end return "{ " .. table.concat(names, ", ") .. " }", "@builtin::modules.zinput.scheme" end, } ``` With it, `map.jump:onPressed(fn)` is checked and `map.noexisting` is reported. A per-asset type applies where the call site names which asset: a component field whose default names it, or an annotation `AssetRef<"inputMap", "<identity>">`. `asset.resolve(name, category)` carries only the category, and a name computed at runtime carries nothing, so calls on those keep the declared return. The type belongs to the call's result: index it there, or bind what you need from it there, and the names stay checked. `require("@builtin::assetTypes.assetType.shared.refShapes").published()` shows what was published: `categories` (each type's method surface) and `returns` (per-asset results by identity, then method). An identity missing from `returns` was never published. Results are recomputed when an asset is written; at most 64 assets of one type are read. ## Putting an asset in a scene (`ref.instantiate`) A caller writes one piece of code against every instantiable type, so what `instantiate` returns is fixed: ```lua local Instantiable = require("@builtin::assetTypes.assetType.shared.instantiable") M.ref = { instantiate = function(self, target, opts) local root = Instantiable.root(self, target, opts) -- compose the asset under `root`, now return Instantiable.result(self, root, idMap) end, } ``` **In.** `target` is the entity the asset lands under, or onto for a hierarchy type; with none, the type spawns a new root. `position`, `rotation` (three numbers in degrees, or a quaternion), `scale`, `name` and `temporary` mean the same for every type: `Instantiable.root` applies them to a root you make, `Instantiable.place` to one you adopt. Document any options of your own in the hook's `--!arg` docs. **Out.** `(root, idMap)`. `root` is the composed root, live when you return: build synchronously, never defer to a component's `awake`. `idMap` maps each original id to the spawned one, so a component that composes the asset again on every load can pass it back in and keep references into the composition. Every call goes through `Instantiable.result`, which refuses a root that is not live and turns a missing `idMap` into `{}`. ## Inspecting an asset (`ref.inspect`) `asset.inspect(ref)` builds a record every asset shares (`identity`, `name`, `guid`, `source`, `typeName`, `typeDefinitionPath`, `scope`, `origin`, `description`, `tags`), then calls `ref.inspect(self)` for the type's own `detail`: ```lua M.ref = { inspect = function(self) -- read the asset's own files, never runtime state: inspect works on an asset -- that has not been compiled, uploaded or registered return { --[[ what makes this asset what it is ]] } end, } ``` Without it, the record is the shared part alone, and an agent inspecting the asset learns nothing of what it is. A hook that raises leaves `detail` empty and sets `record.warning`. ## Discovery - `asset.list("assetType")`: every registered type. - `asset.inspect("<typename>")`: the type, its README and its `about.yaml` texts. - `asset.resolve("<typename>", "assetType")`: the type itself.
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# prefab.place (procNode) Place one prefab inside another: put a whole prefab, a geometry's prefab among them, under a named entity of a host prefab at a local position, rotation and scale. Builds a hierarchy out of parts: a wheel under an axle, a lamp on a post, a door in a wall, each part its own entity. The placed records are renumbered and re-parented, so the same prefab can be placed any number of times. Every placed record takes the id `place<n>_<its id>`, n being the number of records the host held before it (raised past any id the host already holds). A placed record's `parent_id`, and every string in its components' data that names a placed record's id (what `prefab.link` writes), take the new ids, so links inside the placed prefab keep pointing at their own entities. Each placed root keeps its own pose inside the frame `position`, `rotation` and `scale` pose: a root at (0, 1, 0) placed at (2, 0, 0) stands at (2, 1, 0) under `parent`. Built from `prefab.edit` (`what = "place"`). ## Inputs - `prefab` (Prefab). The host prefab the placed one goes into. It comes out as a new value; the prefab wired in keeps the shape it had. - `placed` (Prefab). The prefab placed: every record of it is appended, its root (each record with no parent) hung under `parent`. `prefab.from_geometry` makes one of a single mesh. - `parent` (String, optional). The name of the host entity the placed prefab hangs under: the first record carrying it. Left out, it hangs on the host's root; a name the host does not carry is an error. - `position` (List<Float>, default { 0, 0, 0 }). Where the placed prefab's root stands, local to `parent`. - `rotation` (List<Float>, default { 0, 0, 0, 1 }). The placed prefab's root rotation local to `parent`, a quaternion (x, y, z, w). - `scale` (List<Float>, default { 1, 1, 1 }). The placed prefab's root scale local to `parent`. ## Outputs - `prefab` (Prefab). A new prefab value, `{ records = { ... } }`: the host's records, then the placed ones. ```luau local cart = g.prefab.empty({ name = "cart" }) cart = g.prefab.entity({ prefab = cart, name = "axle" }) local wheel = g.prefab.from_geometry({ geometry = g.mesh.cylinder({}), name = "wheel" }) cart = g.prefab.place({ prefab = cart, placed = wheel, parent = "axle", position = { 1, 0, 0 } }) cart = g.prefab.place({ prefab = cart, placed = wheel, parent = "axle", position = { -1, 0, 0 } }) ```
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
assettype · born here
❒asset
# Nodebox (asset type) A nodebox is a namespace folder that groups related `.procNode/` children, the way a toolbox groups `.tool/` children. A node's name is its folder name inside its box: `points.nodebox/disc.procNode` is called `points.disc`, and nothing inside the node states that name. Moving or renaming a node is a VFS move that keeps its guid. ## Where it lives - Source: `<anywhere>/<family>.nodebox/`, usually inside a `.package`, an effect or a world's content. - Identity: the folders above it and `<family>` (`fx.points` for `fx/points.nodebox`; the `.nodebox` suffix strips). A graph calls its nodes by `<family>.<node>` alone. - Folder shape (open child set): - `README.md`: what the family is for. Required. - `.metadata`: description and tags. Required. It also states where the box's nodes work: `context` (one of `proc.registry.contexts()`: `geometry`, `field`, `value`, `sim`, `raster`, `material`, `prefab`) and, when every node of the box reads the scene or assets beside its inputs or writes them beside its outputs, `pulls` / `pushes` (`scene` or `asset`). A node that works elsewhere states its own in its `.metadata`. `procgen` `describeNode` and the `context`, `pulls` and `pushes` filters of `searchNodes` read them. - `<node>.procNode/`: any number of nodes. ## How a graph reaches a node `g.<family>.<node>(args)` resolves the node by its asset identity: the box and the folder name together (`g.points.disc`), a path (`g["/zero/source/fx/ring.procNode"]`), `~` (the nearest enclosing package, effect or world root: `g["~/ring"]`) or a short name the asset system resolves (`g.disc`). A name that matches two nodes is an error naming both; a name that matches none is an error naming the closest nodes. Each call is recorded in the graph's reference table by the node's guid. ## How to create one ```luau asset.create("nodebox", "points", { folder = "fx" }) local box = asset.resolve("points.nodebox") asset.create("procNode", "disc", { into = box }) ``` ## Discovery - `asset.list("nodebox")`: every box. - `asset.inspect("points")`: the nodes in it and what each does. - `asset.list("procNode")`: every node, in or out of a box. ## In the Inspector Nodes: how many nodes the box holds, each node's full name and what it does, and a link to each.
▲ 0↑ born
❒
package · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# grid.box (procNode) The cell centres are `min + (coords + 0.5) * cellSize`, computed on the device from each element's index. The layout (`cells`, `min`, `max`) is stored on the detail as `grid`, which is what makes the value a Grid. Built from: `core.points`, `field.index`, `math.*`, `vector.*`. ```luau local air = g.grid.box({ size = vector.create(4, 3, 4), cells = vector.create(32, 24, 32) }) ```
▲ 0↑ born
·
procnode · born here
❒asset
# grid.cell_index (procNode) `floor((p - min) / cellSize)` per axis, flattened `x + nx * (y + ny * z)`; any axis outside `[0, n)` gives -1. Built from: `field.position`, `math.*`, `vector.floor`, `g.where`, `g.compare`.
▲ 0↑ born
·
procnode · born here
❒asset
# grid.neighbor_index (procNode) Each cell's coordinates plus the rounded `offset`, clamped to `[0, n - 1]` per axis and flattened. Gathering a channel through the result is a shift of the channel by one cell. Built from: `field.index`, `math.*`, `vector.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# grid.sample (procNode) The `grid` kernel in sample mode (trilinear) reads the channel at each position: `u = clamp((p - min) / cell - 0.5, 0, n - 1)` and a blend of the eight cells around it, over the grid as one tile with no apron. Built from: `op.device.kernel` (grid), `core.points`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.axis_basis (procNode) Outputs `axis`, `u` and `w`. `points.cone` and `points.cylinder` build their directions in this basis, and `curve.branch` turns a growing direction about an axis perpendicular to it. Built from: `vector.*` and `g.where` over sockets.
▲ 0↑ born
·
procnode · born here
❒asset
# points.box (procNode) The centres of a `grid.box` whose cells are `spacing` apart, as Points numbered by `id`. Built from: `grid.box`, `points.from_grid`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.cone (procNode) The direction is drawn evenly over the spherical cap the angle bounds: `ct = 1 - draw0 * (1 - cos(angle))`, then an angle around the axis from draw 1, and the distance from the apex is `length * draw2 ^ (1/3)`. Built from: `rand.unit`, `points.axis_basis`, `core.points`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.count_neighbors (procNode) The coordinates are rounded to cells and laid in as positions of a fresh point set; every cell's neighbours at lattice distance 1 (the 6 faces) or up to the cube's corner at 1.732 (the 26 cells) fall inside a search radius of 1.01 or 1.74, so `core.neighbours` counts them. The tally is written to the original points. Built from: `core.points`, `core.neighbours`, `vector.floor`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.cylinder (procNode) Draws on channels 0 to 2 of the `emit` scope: the angle around the axis, the radial share, and the height. Built from: `rand.unit`, `points.axis_basis`, `points.shell_radius`, `core.points`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.disc (procNode) Draws on channels 0 to 3 of the `points` scope: radius, angle, dome height and jitter. Built from: `rand.unit`, `core.points`, `math.*`. ```luau local pile = g.points.disc({ count = 200, radius = 3, height = 1.2 }) ```
▲ 0↑ born
·
procnode · born here
❒asset
# points.filter (procNode) The value each point is tested by is the `mask` field or the named attribute's values; the test is `> threshold` or, with `equals`, `== equals` (a label read through its index). `core.select` keeps the elements and renumbers the linkage. Asked for no test the points are returned as they are. Built from: `attribute.labels`, `g.compare`, `core.select`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.from_grid (procNode) `points.box` and `points.grid` end here: the cell layout leaves the detail so the value reads as Points, and the element index is written as `id`. Built from: member writes on the detail and point domains, `g.element.id`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.from_vertices (procNode) Reads the point column `P` (and `N` when the geometry's point names list it) and makes Points of that count in the same order. Built from: `core.points`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.grid (procNode) The centres of a `grid.box` one cell thick at height `y`, as Points numbered by `id`. Built from: `grid.box`, `points.from_grid`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.neighbors (procNode) `core.neighbours` in measure mode, which finds each point's neighbours through a spatial hash and writes `neighbors`, `nearest`, `centroid` and, when `mean` names an attribute, `neighbor_<name>`. Built from: `core.neighbours`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.on_curve (procNode) Per curve the count is `count`, or at a spacing `floor(length / spacing + 0.5)` plus one for an open curve, at least 1, held to `maxPoints` in all. `curve.lay_points` gives each laid point its curve and its index along it; the arc-length fraction is `index / count` around a closed curve (wrapping with `offset`) and `index / (count - 1)` along an open one (clamped). `core.sample_curve` finds the position and tangent there and `core.interpolate` carries the curve's attributes. A point that falls exactly on a vertex takes the direction of either segment that meets there. The point number `id` is an Int. Built from: `core.arclength`, `curve.lay_points`, `field.gather`, `core.sample_curve`, `core.interpolate`, `core.points`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.on_mesh (procNode) `points.surface_samples` on the `emit` scope: a face is picked by its share of the total area and a place inside it from draws 0, 1 and 2, and every attribute of the mesh is carried onto the sample. Built from: `points.surface_samples`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.on_surface (procNode) `points.surface_samples` on the `points` scope, reduced to `P` and the unit normal under each point as `normal`. Built from: `points.surface_samples`, `core.points`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.poisson (procNode) All the candidates of all `maxTries` rounds are thrown at once, about `(radius / minDist)^2` for each round, round after round, uniformly over the disc. Each round of a fold lets the candidates of that round stand where no point already standing and no other candidate of the round lies within `minDist`. Every point carries a tag, 1 when it stands and 1000 when it is a candidate of the round, and `core.neighbours` averages the tags of the points around each one, so a single query answers both counts. The points that stand are kept at the end by `core.select`, in round order. Later rounds fill the gaps earlier ones left, because a candidate near a standing point is dropped. Invariants (the parity test checks these, not the old op's exact points): no two points closer than `minDist`, every point inside the disc at height `y`, and the disc covered: a probe anywhere in it finds a point within twice `minDist`. Built from: `rand.unit`, `core.points`, `core.neighbours`, `core.select`, `g:fold`.
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# points.relax (procNode) Each pass asks `core.neighbours` (mode `repel`) for every point's push: the mean over the points within `radius` of the unit vector away from each, weighted `(radius - d) / radius`. The point then steps `strength * radius` along it. `g:fold` repeats the pass `iterations` times. Built from: `core.reduce`, `core.neighbours`, `g:fold`, `math.*`.
▲ 0↑ born
·
procnode · born here
❒asset
# points.shell_radius (procNode) `radius = (lo + (1 - lo) * draw) ^ (1 / dims)` with `lo = (1 - clamp(shell, 0, 1)) ^ dims`. Used by `points.sphere` (dims 3) and `points.cylinder` (dims 2). Built from: `math.*` over fields.
▲ 0↑ born
·
procnode · born here
❒asset
# points.sphere (procNode) Draws on channels 0 to 2 of the `emit` scope: `u` is the height on the unit sphere, then the angle around it, then the radial share `points.shell_radius` turns into a radius. Built from: `rand.unit`, `points.shell_radius`, `core.points`, `math.*`. ```luau local burst = g.points.sphere({ count = 500, radius = 0.2, shell = 0 }) ```
▲ 0↑ born
·
procnode · born here
❒asset
# points.surface_samples (procNode) `core.sample_surface` picks a face by its share of the total area and a place inside it from the draws of the named scope; `core.interpolate` carries each attribute of the mesh onto the samples; the normal is made a unit vector and the sampler's face and corner columns are dropped. `points.on_mesh` and `points.on_surface` end here. Built from: `core.sample_surface`, `core.interpolate`, `vector.normalize`.
▲ 0↑ born
·
assettype · born here
❒asset
# procNode: one reusable step of procedural generation A `.procNode` is a node authored as content: a folder whose `init.luau` is the node. It returns `proc.define(function(g) ... end)`, the same function-of-`g` form a `.procGraph` is written in, so a node is a small graph that other graphs call. Its `g:describe` text says what it makes and when to use it, its `g:input` declarations are what a call passes, and what it returns (or declares with `g:output`) is what the call gives back. ``` MyNode.procNode/ init.luau -- the node README.md -- what it produces, its inputs, its outputs .metadata -- description and tags ``` ## What a node states - **`g:describe(text)`**: what the node produces and when to use it. It is the text search, the node catalogue and the Inspector show. - **`g:input(name, default, opts)`**: one input of the node. The default types it (`Float`, `String`, `Bool`, `Vec3`, `Color`, `List<T>`, `Record`); `opts` adds `type` (for a default that does not state one, or none), `description`, `options`, `min`, `max` and `optional`. A call names inputs in a table, or passes them in declaration order. - **Outputs**: the returned table names them (`return { geometry = geometry }`), and `g:output(name, value)` declares one as the node builds. A node with one output answers that value to its caller; a node with several answers a record by output name; a node with none answers nothing. - **Written as literals.** What a node takes and gives is read from its source without running it, the way search and description read it here and the way ZeroMind reads it, so each declaration states its values as written: `g:describe` and each `g:input` once, at the top level of the function, with a literal name, default and options (a file constant holding a literal, or `asset.resolve("<identity>", "<type>")`, reads as one); outputs named by the table the function returns, or by `g:output`, the same names on every branch of a condition and never inside a loop. `asset.interface(node)` answers what the source declares, with each part it cannot read as a problem, and a push refuses a node with such a problem (`interface.unreadable`). - **The body** is the node's work: calls to other nodes, arithmetic over sockets, `for`, folds, steps and state, as the builder README (`proc.module/builder.module/README.md`) describes. A node that uses another node is recorded in the graph that calls it, so a node can be built from nodes. ## How a graph calls a node A node inside a `<family>.nodebox` is called by its box and folder name: `points.nodebox/disc.procNode` is `g.points.disc({ ... })`, and nothing inside the node states that name. A node is also reached by: - its path (`g["/zero/source/fx/ring.procNode"]`), - `~`, the nearest enclosing package, effect or world root (`g["~/ring"]`), - its guid, - a short name only one node answers to (`g.disc`). A name that matches two nodes and a name that matches none are errors that name the candidates. Each call is recorded in the calling graph by the node's guid, so the node travels with every graph that uses it, and a rename or a move keeps the reference. A `.procGraph` is called the same way and answers what it returns. ## Nodeboxes A nodebox is the family a node lives in: a namespace folder grouping related nodes (`points`, `mesh`, `field`, `terrain`). `nodebox.assetType` describes it. A node placed in a box takes the box's name as its prefix; a node outside any box is reached by path, `~` or guid. `asset.create("nodebox", family)` makes a box and `asset.create("procNode", name, { into = box })` makes a node in it. ## Finding nodes `asset.list("procNode")` lists every node. The `procgen` toolbox's `searchNodes` finds them by meaning across every published node, and with no query lists the ones this engine holds grouped by family; its `describeNode` answers one node's inputs, their types and defaults, and its outputs. Both read what each node's source declares and run no node. The type's `indexing` recipe embeds a node's README and its source, so a search by meaning finds a node by what its description and README say it is for: write them in the words someone looking for the node would use. ## Registration Every node the asset index lists is known to the procgen registry by what its source declares, read when it is asked for and read again when the source changes; nothing runs a node to list it. Its code loads the first time a build runs it. After that, the lifecycle hooks keep it current: `onChange` loads it again and hot-reloads on an edit, `onDelete` removes it. Editing `init.luau` cooks again every graph that reaches the node, and only the nodes downstream of the change do work. `init.luau` is compiled from its current source on each load, so a module it pulls in uses an absolute require (`require("@builtin::systems.procgen.proc")`). What a node is built from is more than its own file. A module its `init.luau` requires while it builds, at any depth of requires, is part of it: when that module changes, `onDependencyChange` loads the node again from the module as it now stands. A file its `init.luau` reads with `vfs.read` while it builds is part of it too, and so is a file a module it calls reads with `proc.read` (a module's own `vfs.read` is its own and makes no dependency). Writing such a file loads the node again (`proc.sourceChanged`). Either way the node's definition moves, so every graph and Generator reaching it cooks again, from one version of everything it was built from. `proc.builder.readsOf("<node>.procNode/init.luau")` lists the files its last build read. A graph that references a node which is not registered errors at load, naming the missing guid. A graph that reaches itself, directly or through other nodes, errors at cook. ## Content requirements `README.md` carries real text: what the node produces, its inputs and its outputs. `.metadata` carries a `description` (what the node computes and the value type it answers) and `tags` (the family, so search finds it). It may state where the node works: `context`, `pulls` and `pushes` (the values `proc.registry.contexts()`, `"scene"` and `"asset"` name). A node in a nodebox that states none takes its box's; `procgen` `describeNode` and `searchNodes` answer them. A node written with `proc.graph` and `g:node` (the `procNodes/` of the procgen package) is called only by a `proc.graph` graph, through `g:node`. A graph built with `proc.define` does not call it: `g.op.<name>` of it is refused where it is written, naming the node written in the call form that answers to the same name. ## In the Inspector Operation: the node's id and what it does, its cost and caching when it declares them, and its inputs and outputs, from the procgen registry's schema for it. A node that did not register says so.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.adjacency Answer a neighbour relation over a geometry: the faces, points or edges around a point, the faces across an edge, the faces across a face. A neighbour table (offsets into values, 0-based starts) plus a per-element neighbour count written as an attribute. A `group` limits the answer to the faces it selects: the table and the geometry then describe the geometry of those faces, whose faces and edges are numbered from 0 in their order and whose points keep their numbers. ## Inputs - `geometry`: The geometry whose neighbours are listed. - `query` (one of: edge_faces, edge_points, face_edges, face_faces, face_points, point_edges, point_faces, point_points): The neighbour relation to answer, named `<source>_<target>`: "point_points" is the points an edge joins a point to, "point_faces" the faces using a point, "face_faces" the faces sharing an edge with a face. The source half also decides what the table and the count attribute are indexed by. - `element`: One source element id to report the neighbour list of directly, in `adjacency.neighbours`; negative, only the whole table comes back. An id outside the source class's element count is an error. - `attribute`: Name of the per-source-element neighbour count written onto the geometry. - `group`: Names a 0/1 attribute on `class` restricting which faces take part in the answer; empty, the whole mesh takes part. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.borders For every edge of the geometry's edge table, how many of the faces that take part border it: 1 is an open edge of the participating faces, 2 a shared one. The faces taking part are all of them when no group is named. What `topology.edges` and `topology.boundary` read their open edges from. ## Inputs - `geometry`: The geometry whose edges are measured. - `group`: Names a 0/1 attribute on `class` restricting which faces take part; empty, the whole mesh takes part. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set. ## Outputs - `borders`: Per edge of the `core.edges` table, the number of participating faces that border it.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.boundary Find the open boundary of a surface: the edges exactly one face borders, as a 0/1 group on the edge and point classes, plus the ordered boundary loops. ## Inputs - `geometry`: The geometry whose open edges are traced. - `group`: Names a 0/1 attribute on `class` restricting which faces take part; empty, the whole mesh takes part. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set. - `output`: Name the boundary is written under: a 0/1 group on the edge class for the open edges, the same name on the point class for their endpoints, and a detail attribute `<output>EdgeCount`.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.convert Convert a component group between classes: points to the faces that use them, faces to their points, edges to their points, and back. `mode` = "any" selects a target element when any of its incident source elements is in the group, "all" when every one is; an element with no incident source element is selected under neither. ## Inputs - `geometry`: The geometry carrying the group converted. - `group`: The 0/1 attribute on `from` to convert. - `from` (one of: edge, point, primitive, vertex): The class the group is read from. - `to` (one of: edge, point, primitive, vertex): The class the converted group is written to. - `mode` (one of: all, any): How a target element reads the source elements incident to it: "any" selects it when at least one of them is in the group; "all" only when every one is. - `output`: Name the converted group is written under on `to`. Left empty it is `group`.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.edges Derive a geometry's unique edge set with face adjacency: the `edge` attribute class (points, faces, faceCount, length) plus the edge table. An edge is the unordered point pair it joins; its index is its position in the list sorted by (low point, high point), stable for a mesh. ## Inputs - `geometry`: The geometry whose edges are listed. - `group`: Names a 0/1 attribute on `class` restricting which faces take part in the answer. Restricting it changes what is measured: an edge between a participating face and a left-out one is bordered by one face here. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set. - `output`: Name of the 0/1 edge group written for the edges the participating faces border. Written only when `group` names a selection.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.islands Label a geometry's connected components: a per-primitive island id, and for each point the lowest island id among the faces using it. `connectivity` joins faces across a shared edge or a shared point. Ids run from 0 in order of the first face that carries them. Faces a `group` leaves out carry -1. ## Inputs - `geometry`: The geometry whose connected pieces are labelled. - `group`: Names a 0/1 attribute on `class` restricting which faces take part; empty, the whole mesh takes part. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set. - `connectivity` (one of: edge, point): What joins two faces into one island: a shared edge, or a shared point. - `attribute`: Name the island id is written under, per primitive and per point, plus a detail attribute `<attribute>Count` holding how many islands there were.
▲ 0↑ born
·
procnode · born here
❒asset
# topology.participation The faces a group selects, as a 0/1 column over the primitives: all of them when no group is named. A group on another class selects the faces every one of whose elements is in it (`promote` = "all") or at least one is ("any"). The selection every topology node restricts its answer by. ## Inputs - `geometry`: The geometry carrying the group. - `group`: Names a 0/1 attribute on `class` restricting which faces take part; empty, the whole mesh takes part. - `class` (one of: edge, point, primitive, vertex): The component class `group` lives on. - `promote` (one of: all, any): How a group on a class other than "primitive" becomes a face set: the faces every one of whose elements of that class is in the group, or the faces at least one is.
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
▣
module · born here
❒asset
# assetType runtime The machinery that reads a `<typename>.assetType/behavior.luau` and turns its declarations into live behaviour. A `behavior.luau` is a table of declarations — `ref` methods, `modules` shared code, an `events` schema, a `namePattern`, `refShapes`, and the `onCreate` / `onRegister` / `onChange` / `onDelete` / `validate` / `settingsDefaults` / `settingsCorrections` hooks. None of it runs itself. This is the code that runs it, and it lives here because reading a type's declarations is the **assetType type's own behaviour** — the same way `material.assetType` owns what a `.material` does. ## Sub-modules | Module | Reads | Responsibility | |---|---|---| | `ref.module` | `ref`, `modules` | Builds every `AssetRef` envelope, attaches the shared metatable, and dispatches per-type methods and shared modules onto it. Also owns edit-mode write-behind persistence. | | `create.module` | `onCreate`, `namePattern`, `validate` | Backs `asset.create`: resolves the type, checks the name against its pattern, runs `onCreate` (or clones `template/`), and writes the instance. `validate.module` beside it checks a creation `opts` table against the type's `createSchema`. Before running `onCreate`, resolves the type's settings chain (below) and hands the result to the hook as `opts.settings`. | | `settings.module` | `settings`, `settingsDefaults`, `settingsCorrections` | A type's declared settings schema and where its values live (`type.yaml`'s `settings:` block). `Settings.resolveForCreate` layers the schema's own defaults, the type's own `settingsDefaults(name, opts, asked)` hook (a DEFAULT the schema can't express — a name-derived convention, a fact read off a payload the caller handed it, a value following a field `asked` shows a higher layer naming; any later layer overrides it), the Preset Manager, an importer's settings, the caller's `settings` table, then the type's own `settingsCorrections(values, name, opts)` hook (a CROSS-FIELD CONSTRAINT the schema can't express, applied last over the fully merged values). A correction over a default/preset/importer value lands silently; a correction that would override what the caller's own `settings` table explicitly asked for refuses the creation instead, naming the field and why. Neither hook is ever handed a table to mutate; each returns what it wants changed (`settingsCorrections` may also return a `{ [field]: reason }` table for that refusal message). `Settings.cloneValues` deep-copies a values table — `create.module` hands `onCreate` a copy, never the table it stamps. `Settings.valuesOf` / `writeValues` read and write an asset's own values file. | | `typeYaml.module` | `type.yaml` | The folder a type lives in and its parsed `type.yaml`, decoded once per content version of the file. `settings.module` and `inspector.module` read their blocks through it. `about` / `aboutAt` read a type's `about.yaml` (`intent`, `function`, `usage`), leaving out any key that is empty or still starts with `[[describe]]`; `aboutRows` and `aboutMarkdown` lay the texts out for the Inspector and the `types/<name>` guide. | | `inspector.module` | `type.yaml`'s `inspector:` block | Which inspector a type declares for its assets (`inspector: { type: ... }` or `{ instance: ... }`), and the declaration that file returns — the sections it adds, the generic ones it replaces, and their order — or the problem that kept it from loading. | | `onRegister.module` | `onRegister` | Fires an instance's once-only registration hook — on arrival, on world load, and for `@builtin` library instances. | | `changeDispatch.module` | `onChange`, `onDelete`, `refShapes` | Routes a VFS source write or a folder delete to the enclosing typed asset's type hooks. | | `refShapes.module` | `refShapes`, `ref` | Publishes what every `AssetRef<category>` answers to, so a member read on an asset-typed value is checked against that category's real surface. | | `events.module` | `events` | The per-asset event runtime behind `ref.events`. | | `instantiable.module` | `ref.instantiate` | The instantiation contract an asset type opts into: `root` stands the root entity, `place` applies the base placement opts to one the type adopted, and `result` shapes the `(root, idMap)` every `instantiate` returns. Also registers the `sceneInstantiable` field-constraint validator. | | `declaration.module` | `type.yaml` | The type's decoded declaration, read once and held until a write inside an `.assetType` folder; what every question about a type as a whole reads. | | `previewRecipe.module` | `type.yaml` `preview:` | How an instance's `preview.png` is produced: which of the four recipes (`instantiate`, `image`, `surface`, `custom`) the type declares, and what that recipe needs. | ## Reaching it ```luau local rt = require("@builtin::assetTypes.assetType.shared") rt.ref.loadTypeBehavior("material") ``` Fields resolve lazily. The prelude requires the sub-modules directly, in dependency order (`ref`, then `changeDispatch`, `onRegister.install()`, `refShapes.install()`) — a table that required all six on load would take that ordering away from it.
▲ 0↑ born
·
procnode · born here
❒asset
# value.compare Two values compared, answering 1 when the comparison holds and 0 when it does not. Numbers compare by any op; text and true/false compare by `equal` and `not_equal` and must be the same kind. In a graph, `g.compare(a, op, b)` is the same comparison; this node is for an op picked by a parameter.
▲ 0↑ born
·
procnode · born here
❒asset
# value.expr (procNode) A number that follows one Luau expression over the graph's clock: `t` (seconds), `frame`, `fps`, `duration`, `pi`, the math functions by bare name (`abs`, `acos`, `asin`, `atan`, `ceil`, `cos`, `deg`, `exp`, `floor`, `log`, `max`, `min`, `rad`, `sign`, `sin`, `sqrt`, `tan`), `clamp`, `lerp(a, b, k)`, `smoothstep(a, b, x)`, `noise(x, seed)` and the names `variables` gives. The expression is run once with those names bound to sockets, so it becomes arithmetic in the graph: it follows the clock on every present and re-cooks nothing. ## Inputs - `variables` (`Record`, optional): the names the expression reads beyond the built-in ones, each a number, a graph input or another node's number. A built-in name is read before a variable of the same name. - `expression` (`String`, default `"t"`): one Luau expression, written without `return`. An empty expression is refused, and one that does not compile is refused with the compiler's message. ## Outputs - `value` (`Float`): the expression's value. ## Example ```luau local bob = g.value.expr({ expression = "height * sin(t * speed)", variables = { height = 0.5, speed = 2 } }) ```
▲ 0↑ born
·
procnode · born here
❒asset
# value.fallback The value wired into `value`, or `fallback` when nothing is: how a graph used as a node takes an input its caller may leave unwired. `fallback` is built only when it is the one taken. A device value passes through as it stands.
▲ 0↑ born
·
procnode · born here
❒asset
# value.get One field of a record value, by a dotted path: `vertexCount`, `bounds.max.y`, `centroid.x`. Each name is a member read; a name the value does not have is an error naming where the walk stopped.
▲ 0↑ born
·
procnode · born here
❒asset
# value.math `a <op> b` for two numbers, the op chosen by name. Either side can be an animated value or a live input, and the result follows it. In a graph written with operators, `a * b` is the same node: this one is for an operation picked by a parameter.
▲ 0↑ born
·
procnode · born here
❒asset
# value.present Whether anything is wired into `value`, as a Bool: what a graph used as a node asks of an input its caller may leave unwired, to decide what it does. The answer is known when the graph is planned.
▲ 0↑ born
·
procnode · born here
❒asset
# value.switch `ifTrue` when `when` is true, `ifFalse` otherwise. Only the branch taken cooks, so a branch that would refuse its inputs is never asked.
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
▲ 0↑ born
·
procnode · born here
❒asset
# math.abs (procNode) The magnitude of a value, element by element. The `abs` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.acos (procNode) The angle whose cosine is the value, in radians, from 0 to pi, element by element. A value past -1 or 1 reads as the nearest of the two. The `acos` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.add (procNode) The sum of two values, element by element. The `add` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.asin (procNode) The angle whose sine is the value, in radians, from -pi / 2 to pi / 2, element by element. A value past -1 or 1 reads as the nearest of the two. The `asin` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `a` (Value, default 0). The sine. ## Outputs - `value`. The angle in radians. ```luau local value = g.math.asin(2) -- 1.5708 (pi / 2) ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.atan (procNode) The angle of the point (`x`, `y`) from the x axis, in radians, element by element: arctangent of `y` over `x`, quadrant aware. The `atan` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.atan2 (procNode) The angle of the point (`x`, `y`) from the x axis, in radians, element by element: arctangent of `y` over `x`, quadrant aware, from -pi to pi. `y` comes first, as in `math.atan2(y, x)`. The `atan` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. It is `math.atan` given both operands. ## Inputs - `y` (Value, default 0). The vertical component. - `x` (Value, default 0). The horizontal component. ## Outputs - `value`. The angle in radians, from -pi to pi. ```luau local value = g.math.atan2({ y = 1, x = -1 }) -- 2.356 (3 pi / 4) ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.bor (procNode) The bitwise or of two whole numbers. The `bor` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.bxor (procNode) The bitwise exclusive or of two whole numbers. The `bxor` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.ceil (procNode) The least whole number not below the value, element by element. The `ceil` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.clamp (procNode) The value held between a lower and an upper bound, element by element. The `clamp` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.compare (procNode) Compare two values with a named operator: 1 where the comparison holds, 0 where it does not, element by element. Built from `math.lt`, `math.le`, `math.gt`, `math.ge`, `math.eq` and `math.ne`, one of which cooks, chosen by `op`. The operator is written as a name (`lt`, `le`, `gt`, `ge`, `eq`, `ne`, also `neq`) or as a symbol (`<`, `<=`, `>`, `>=`, `==`, `~=`, `!=`). `g.compare(a, op, b)` of the authoring surface resolves here.
▲ 0↑ born
·
procnode · born here
❒asset
# math.concat (procNode) Two texts joined end to end; the `..` operator over text values. Built from the Luau node (`io.luau`) calling `concat` of the counts module. The texts are plan values (attribute names, labels), not per-element data.
▲ 0↑ born
·
procnode · born here
❒asset
# math.cos (procNode) The cosine of an angle in radians, element by element. The `cos` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.cosh (procNode) The hyperbolic cosine of a value, element by element. The `cosh` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `value`. The hyperbolic cosine. ```luau local value = g.math.cosh(1) -- 1.5431 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.cross (procNode) The cross product of two Vec3 values: the vector perpendicular to both, per element. The `cross` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.deg (procNode) Radians as degrees. The `deg` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.div (procNode) The quotient of two values: `a` divided by `b`, element by element. The `div` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.dot (procNode) The dot product of two vectors: a number per element. The `dot` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.eq (procNode) Whether `a` equals `b`: 1 where it does, 0 where it does not. The `eq` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.exp (procNode) The number e raised to a value, element by element. The `exp` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `a` (Value, default 0). The exponent. ## Outputs - `value`. e to the power of the value. ```luau local value = g.math.exp(1) -- 2.7183 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.floor (procNode) The greatest whole number not above the value, element by element. The `floor` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.floordiv (procNode) The quotient of two values rounded down: the `//` operator. Built from `math.div` and `math.floor`.
▲ 0↑ born
·
procnode · born here
❒asset
# math.fmod (procNode) The remainder of `a` divided by `b` that keeps the sign of `a`, element by element: -7 divided by 3 leaves -1. A `b` of 0 answers 0. The `fmod` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. `math.mod` keeps the sign of `b`, so a repeating pattern wraps the same way on both sides of zero; `fmod` keeps the sign of `a`. ## Inputs - `a` (Value, default 0). The value divided. - `b` (Value, default 0). The divisor. ## Outputs - `value`. The remainder, with the sign of `a`. ```luau local value = g.math.fmod({ a = -7, b = 3 }) -- -1 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.frexp (procNode) A value split into a mantissa and a power of 2, element by element: `a` is `mantissa * 2 ^ exponent`, with the mantissa from 0.5 up to 1 in size and the sign of `a`, and the exponent a whole number. A value of 0 answers 0 and 0. Built from the operations of `proc.fieldc.operators` that answer each output. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. It calls the `frexp_mantissa` and `frexp_exponent` operations. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `mantissa`. The fraction of the value, from 0.5 up to 1 in size. - `exponent`. The whole power of 2 the mantissa is multiplied by. ```luau local mantissa, exponent = g.math.frexp(8) -- 0.5, 4 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.ge (procNode) Whether `a` is greater than or equal to `b`: 1 where it is, 0 where it is not. The `ge` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.gt (procNode) Whether `a` is greater than `b`: 1 where it is, 0 where it is not. The `gt` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.isfinite (procNode) 1 where a value is a number that is neither infinite nor NaN, otherwise 0, element by element. The `isfinite` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. Like the comparisons, it answers 1 or 0, so `where` takes it as a condition. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `value`. 1 or 0. ```luau local flag = g.math.isfinite(5) -- 1 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.isinf (procNode) 1 where a value is positive or negative infinity, otherwise 0, element by element. The `isinf` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. Like the comparisons, it answers 1 or 0, so `where` takes it as a condition. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `value`. 1 or 0. ```luau local flag = g.math.isinf(g.math.exp(1000)) -- 1 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.isnan (procNode) 1 where a value is not a number, otherwise 0, element by element. The `isnan` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. Like the comparisons, it answers 1 or 0, so `where` takes it as a condition. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `value`. 1 or 0. ```luau local flag = g.math.isnan(measured) -- 1 where measured is not a number ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.ldexp (procNode) A value times 2 to a whole power, element by element: `x * 2 ^ e`, with `e` cut to a whole number toward zero. The `ldexp` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `x` (Value, default 0). The value. - `e` (Value, default 0). The power of 2, cut toward zero to a whole number. ## Outputs - `value`. `x` times 2 to the power `e`. ```luau local value = g.math.ldexp({ x = 0.75, e = 3 }) -- 6 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.le (procNode) Whether `a` is less than or equal to `b`: 1 where it is, 0 where it is not. The `le` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.length (procNode) The length of a vector: a number per element, from the vector's components. The `length` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.lerp (procNode) The blend from `a` to `b` by `t`: `a` at 0, `b` at 1, element by element. The `lerp` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.log (procNode) The natural logarithm of a value, element by element. A value at or below 0 answers 0. The `log` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.log10 (procNode) The base 10 logarithm of a value, element by element. A value at or below 0 answers 0. The `log10` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `a` (Value, default 1). The value. ## Outputs - `value`. The base 10 logarithm. ```luau local value = g.math.log10(1000) -- 3 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.lt (procNode) Whether `a` is less than `b`: 1 where it is, 0 where it is not, element by element. The `lt` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.map (procNode) A value moved from one range to another, element by element: `x` at `inMin` becomes `outMin`, `x` at `inMax` becomes `outMax`, and the values between keep their place. A value outside the input range lands outside the output range. An input range of no width answers `outMin`. The `map` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. ## Inputs - `x` (Value, default 0). The value. - `inMin` (Value, default 0). The input range's start. - `inMax` (Value, default 1). The input range's end. - `outMin` (Value, default 0). The output range's start. - `outMax` (Value, default 1). The output range's end. ## Outputs - `value`. The value in the output range. ```luau local value = g.math.map({ x = 5, inMin = 0, inMax = 10, outMin = 100, outMax = 200 }) -- 150 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.max (procNode) The greater of two values, element by element. The `max` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.min (procNode) The lesser of two values, element by element. The `min` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.mod (procNode) The remainder of `a` divided by `b` that keeps the sign of `b`, so a repeating pattern wraps the same way on both sides of zero. The `mod` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.modf (procNode) A value split into its whole part and the fraction left, element by element, both with the sign of the value: 3.25 is 3 and 0.25, and -3.25 is -3 and -0.25. Built from the operations of `proc.fieldc.operators` that answer each output. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time. It calls the `modf_integer` and `modf_fraction` operations. ## Inputs - `a` (Value, default 0). The value. ## Outputs - `integer`. The whole part, cut toward zero. - `fraction`. What is left: the value minus its whole part. ```luau local whole, fraction = g.math.modf(-3.25) -- -3, -0.25 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.mul (procNode) The product of two values, element by element; a vector scaled by a number scales every component. The `mul` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.ne (procNode) Whether `a` differs from `b`: 1 where it does, 0 where it does not. The `ne` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.neg (procNode) The value with its sign flipped. The `neg` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
·
procnode · born here
❒asset
# math.noise (procNode) Perlin noise at the point (`x`, `y`, `z`), as `math.noise` makes it: a smooth value of about -1 to 1 that is 0 at whole-number points and repeats every 256 units. The first component of each operand is read. The `noise` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. The same function runs on the device, in the shader module `kernels/luau_noise`, so a chain of nodes holding it stays one dispatch. ## Inputs - `x` (Value, default 0). The first coordinate. - `y` (Value, default 0). The second coordinate. - `z` (Value, default 0). The third coordinate. ## Outputs - `value`. The noise at the point. ```luau local value = g.math.noise({ x = 1.5, y = 2.25, z = 0.5 }) -- -0.0775 ```
▲ 0↑ born
·
procnode · born here
❒asset
# math.normalize (procNode) A vector scaled to length 1; the zero vector stays zero. The `normalize` operation of the authoring surface, called through the Luau node on `proc.fieldc.operators`. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone.
▲ 0↑ born
backing path · systems/procgen.package/proc.module/registry.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.