Log inGet started
·
agentskill · drop-in viewer
asset⌬ agentskillagentSkillprimary: skill.yaml·originates fromworld 07158574-5…

modeling.agentSkill

The modelling skill: how an object in a scene gets its shape (modelled in code with the quick geometry nouns, installed from the library, or generated from a description) and which fits what; where the code goes (a scene's `build.luau`, or a `.sceneModule` placed several times);…

by◐lumi·posted 1h ago
What it does

modeling

The modelling skill: how an object in a scene gets its shape (modelled in code with the quick geometry nouns, installed from the library, or generated from a description) and which fits what; where the code goes (a scene's build.luau, or a .sceneModule placed several times); how to pick each part's geometry and size it; and how to check that the object reads as the thing it is.

Interface

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

This asset doesn't declare a schema or structured payload.

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 up to 3 levels deep. Open a part to see what it holds further down.

87+items
·
assettype · born here
❒asset
# agentSkill A skill packages what an agent needs to do one job well: the instructions, the assets and toolboxes the job runs through, and — for jobs with distinct branches — subskills that go deeper. Skills advertise themselves. Every registered skill's name and one-line description rides the agent's tool responses, so an agent discovers what this world knows how to do without being told to look. Invoking one returns the instructions plus the exact identities and tool names the job needs. ## Shape ``` <name>.agentSkill/ skill.yaml # the manifest: description, when, checks, dependencies, order instructions.md # the prose an agent receives on invoke README.md # what this skill is, for a human reading the tree .metadata # tags <sub>.agentSkill/ # optional subskills, reachable as <name>/<sub> ``` ## The manifest ```yaml $schema: zero/agent-skill/v1 description: Making a character a person can actually play. when: > Reach for this when the player should look like something else, or when you are about to build a camera and a body and wire them together by hand. checks: - check: Holding a movement key in play moves the body across the ground. observe: Read its position before and after holding the key; the numbers differ. - check: The body animates while it moves. observe: A time-sampled collage from a camera outside the player, while the key is held. dependencies: - "@builtin::tools.scene" - "@builtin::tools.scene.player" - "@builtin::components.PlayerPrototype" - "@builtin::docs.core.multiplayer" order: [spawn-points, camera-rig] ``` `description` is the line the roster carries, and the whole basis on which a skill is chosen. Name the job the skill makes a reader competent at, in the outcome they are after — "getting a scene's player and view right", "making content the engine will load". A reader scanning the roster is matching it against the job in front of them, so the closer it reads to their own sentence about that job, the sooner they open it. `when` is the longer trigger — the situations that should send a reader here, in the words they would use for their own task. `kind` says what the skill is to its reader, and `job` is assumed when it is left out. A `job` is work taken on and finished: opening it holds it, so it rides the reader's tool responses until it is released, and its `checks` say when it is done. A `reference` is knowledge for the whole session, such as how the engine fits together: opening it does not hold it, it is never released, and it states no `checks`, `stages` or `verdicts`, because it describes no job whose end they would mark. A check on a reference turns it into a step that one pass completes, after which its reader stops applying it. `checks` is what the reader of a job is answerable for at the end, and it leads the rendered skill, ahead of the procedure. Each entry pairs a **condition that must hold** with **where it is seen**, and both halves are required — a condition alone is satisfied by any glance, and the wrong vantage is how a job passes while every one of its faults sits outside the frame. Write them as observations someone else could repeat and disagree with: a number that changed, a thing visible in a named shot, a count that came back as one. A job publishes only once it carries at least one. `stages` models a skill whose passes run in order, when the order is load-bearing. Each stage is `{ name, detail?, checks? }`, and a check that sits in a stage is answered after that pass has run — which is the difference between a criterion that means something and one that misleads. A skill with no meaningful order leaves `stages` out and lists its checks flat; a skill that has one may do both, and the flat checks then read as the final gate. `verdicts` names the fixed set of outcomes a reader reports — at the end of each stage when the skill has stages, and once at the end when it does not. Each is `{ verdict, means }`: the word, and what reporting it asserts. Both halves are required for the reason both halves of a check are. A verdict is a check one level up, deciding a whole pass rather than one condition, and a bare `refine` is a label each reader fills in privately — so two runs report the same word about different states and nothing downstream can tell them apart. Saying what it means settles the boundary in the skill instead of in whoever happens to be reading it. A check marked `perRun: true` is one whose content is written for the job at hand: the manifest can say *keep a list of every feature this object must have and answer against it*, but not what is on that list, because that is per run. It renders with that instruction attached. ```yaml verdicts: - verdict: continue means: Every check in the stage held, and the next stage can build on it. - verdict: refine means: A check failed on something this stage can still fix. Run it again. - verdict: stop means: A check failed on something an earlier stage decided. Go back to it. stages: - name: blockout detail: Mass and proportion only. checks: - check: Every part on the identity list has a stand-in at roughly the right size. observe: A capture beside the reference, at the same angle. perRun: true - name: material checks: - check: Metal reads as metal and cloth as cloth. observe: The metallic and roughness passes, after the lighting stage has run. ``` `dependencies` is one flat list of asset **identities**: a toolbox, a single tool, a guide, a component, a module, another skill. Each entry is resolved when the skill is opened and reported with what it turned out to be, so a skill never declares "this one is a toolbox" — the asset says so, and the reader groups by that. Identities are what make a skill portable. They pin like any other reference, so installing a skill into another world brings the toolboxes and guides it runs through along with it. A bare name (`scene`) or a guide path (`core/multiplayer`) resolves to nothing and is refused before publish. A toolbox entry lists the tools it carries, and a tool entry carries its own signature, so the instructions never restate a call contract that can drift. An identity this world lacks is reported as missing rather than dropped. Write instructions that name the toolboxes and tools a job runs through, and leave the call form to the reader — an agent may be holding the MCP tool surface, the shell, or Luau, and the signatures are listed for it either way. ## Subskills A `<sub>.agentSkill/` folder nested inside a skill is a subskill. It has the same shape as its parent and is invoked as `parent/sub`. Subskills are reachable only through their parent: they are absent from the roster and from `skills.list`, and appear in the parent's invoke result. A skill can therefore carry a dozen narrow procedures while costing the roster one line. `order` in the manifest names the subskills that lead. Any subskill it omits still appears, sorted by name, after the ordered ones — so adding a subskill folder is the only step needed to publish it. ## Publishing one Make a skill and it is live: it joins the roster agents read and it opens by name from the moment it exists. Edit its description and that is the line agents see next. A skill lives anywhere under `/zero/source/`. `asset.create` hands you a valid one to fill in: ```luau asset.create("agentSkill", "waveSpawning", { folder = "skills" }) ``` A skill's scope — `builtin`, `library`, or `world` — comes from where it lives rather than from anything it declares, so a world's own skill always reads as the world's. ## Opening one ``` agent_skill {} -- the roster agent_skill { name = "scenes" } -- one skill's instructions + deps agent_skill { name = "scenes/player-setup" } -- a subskill ``` The same three through the toolbox — `skills.list`, `skills.invoke` — and from Luau via `tools.use("skills", "invoke", "scenes")`. `asset.inspect` on a skill ref returns the structured record all of them render. Skills authored in a world are the world's own, and are labelled as world content wherever they surface beside built-in ones. ## In the Inspector Skill: what the skill is for and when it applies, how many checks and verdicts it declares, its stages, a link to each asset it depends on (and a problem for each that does not resolve), its subskills, and **Open** for instructions.md.
▲ 0↑ born
·
guide · born here
❒asset
# scenes-as-code guide Reference docs surfaced through `guides { path: "core/scenes-as-code" }`. The content lives in `guide.md`; this README is just the asset summary.
▲ 0↑ born
·
toolbox · born here
❒asset
# capture Render a screenshot of the scene from anywhere — an explicit position, a named camera station around an entity, a specific camera, or a mirror of the active viewport — and a grid of them in one image; or read back the frame the engine actually presented, exactly as the player saw it. The picture of the machine's own camera (a webcam, a phone camera) is `cameraInput`, covered by the `topics/camera-input` guide; this toolbox photographs the scene. Every source but `presented` and `window` (see [The presented frame](#the-presented-frame)) spawns an ephemeral offscreen camera, triggers one render, and returns the picture as an image value — returned from a tool, a probe or `execute`, it reaches you as a picture, with what the capture has to say about it (its size, the frame it is of, the cells of a grid) beside it. A PNG is written as well when you pass a `path`. The convenience wrappers render from a world-space position (with optional look-at), frame a target entity, mirror the active viewport camera including its layers, or render a specific camera by name from its exact authored pose and settings (`fromCamera`, with optional per-capture overrides that never touch the camera); each waits for the render and the GPU readback, cleans up its camera, and returns only once the picture is read back. The low-level oneshot spawns the camera, triggers one render, and returns the handles at once without waiting, leaving the readback and cleanup to the caller; the `capture` MCP tool is built on it. A cleanup tool clears the capture output directory. ## Where a shot lands A capture given a `path` writes the PNG there and says where those bytes stand, beside the path it wrote: `durable` is true when the PNG is on the path it names and the next session reads it back, and false when the play shadow took it (live in this session and discarded on a guarded play-exit unless kept, with `survivesRestart` saying whether a restart keeps it and `playShadow` naming the routes that keep it) or when the path is in `/source/tmp/` scratch (gone when the engine stops or restarts, with a `warning` opening `SCRATCH`). Every capture carries it on the picture it returns as `durability`. Shooting gameplay means shooting in play, which is exactly when a `/source` destination is the shadow's, so this is the field that says whether a shot survives leaving play — `vfs.promotePlayShadow(path)` keeps it with play still running. ## The presented frame `source = "presented"` reads back the frame the engine presented to the player instead of rendering one. Nothing is drawn for it: it is the frame the viewport drew, copied out as it was finished, after the post chain, the upscale, the display transform, the content UI and every post-scene pass, at the size it was composed at. So it is the one capture whose temporal antialiasing, motion blur, camera motion, auto exposure and render scale are the real ones, and the source to verify any of them with. `source = "window"` is the whole presented surface (the window, the browser canvas or the headless framebuffer) with everything painted on the window: the editor's chrome and every window-level UI pass. Where no Scene panel shows the viewport, the two are the same image: the scene fills the window and the editor's chrome is painted over it, and each such frame says so in its `note` (a cell of a `presented` capture, a frame `renderer.presentedFrames` returns) for as long as that chrome is on the window. Show the Scene panel (the editor toolbox's `layout` tool) to read the game view alone. `frames = n` (1-32) takes n presented frames, one every `interval` frames (default 1: consecutive), at real gameplay speed, and lays them out as a grid in the order they were presented. Each cell states what its frame was drawn with: `frame` (the renderer's count, so consecutive frames carry consecutive numbers), `rasterWidth` / `rasterHeight` (the size the scene rasterized at), `compositeWidth` / `compositeHeight`, `renderScale` and `scaleMode`, `jitter` (the projection's sub-pixel offset in raster pixels), `exposure` (what the display transform multiplied the scene by) and `historyReset` (the viewport camera's first frame, a cut, or a hand-over to another camera). A single frame comes back at the size it was presented at; `width` / `height` resample it, or size the sheet a grid is laid into. A presented frame is drawn through the camera, layers, lens and chain that drew the screen, so the options that aim, light or shape a rendered frame (`camera`, `entity`, `position`, `viewpoint`, `fov`, `pass`, `renderLayers`, `postProcessing`, `environment`, `mode = "collage"` and the collage axes) are refused for it; aim the camera holding the viewport instead, or take an offscreen capture. A source that renders refuses `frames` and `interval` the same way, since they count presented frames. `deterministic` and `clearAir` hold the clock and the air for the whole engine, so they reach the presented frame too. A diagnostic buffer of the viewport itself, under its real camera motion and history, is read the same way: put the camera holding the viewport on that pass (the camera toolbox's `set` with `debugPass = "motion_vectors"`) and take `source = "presented"`. The viewport's velocity buffer is the frame's travel against the frame before it, so a turning camera reads in it, where an offscreen `pass = "motion_vectors"` holds the objects' own motion alone. The `motion_vectors` picture is a visualization: each channel is the square root of 100 times the stored displacement's size on its axis (R horizontal, G vertical, B the length), the sign is dropped, and R reads 255 from `width / 200` px of horizontal travel, G from `height / 200` px of vertical travel (raster pixels). The rendering guide's part on motion (`topics/rendering-motion`), "What the `motion_vectors` picture encodes", states it in full. The same frames, with their pixels as `TextureCpuHandle`s, come from `renderer.presentedFrames({ scope = "viewport" | "window", frames, interval })`, and `velocity = true` adds the viewport's velocity buffer from each frame as numbers (`frame.velocity`, a `VelocityField`): each pixel's travel in pixels per frame, x right and y down, signed and unclamped, read with `field:at(x, y)`, `field:row(y)` and `field:region(rect)`. ## The feed Every capture publishes the frame it made to `@builtin::tools.capture.feed`, so a viewer can show the newest one without taking a shot of its own. `Feed.latest()` is that frame: a `src` an image widget draws (the render target's guid while the engine still holds it, the written path when the capture produced a file), with the size, the source and the pass beside it. `Feed.watch(fn)` calls `fn` as each new frame arrives. The editor's Capture panel is built on it, and the `watch` layout puts that panel under the scene. A viewer calls `Feed.shown()` to say it is drawing frames from the feed. From then on the feed holds the newest capture's render target so the picture stays up after the capture that made it is finished with it, and lets it go when a later frame replaces it; `Feed.shown(false)` stops. With nobody drawing, a capture's target is released the moment its capture is done, and nothing is held. ## Viewpoints A **viewpoint** names where the camera stands and which way is up in the image: `front`, `back`, `left`, `right`, `top`, `bottom`, `iso`. It replaces reverse-engineering a `{yaw, pitch}` pair, and names the seven stations that answer "is this built correctly". `basis` says which axes the name is measured against, and it is **required** alongside a viewpoint when a subject is being framed: - **`"local"`** — the subject's own axes. `front` is the side it faces however it is turned, and the frame is fitted to its own extents rather than to the world-axis box around them. - **`"world"`** — the world axes. `front` is whatever faces world +Z. For a crate turned 40 degrees those are different pictures, so the call says which one it wants. Framing a world position rather than an entity, both values mean the world axes and either is accepted. ## Passes `pass` names **what** the frame holds, by name. `"final"` is the lit picture; a built-in diagnostic pass (`albedo`, `normal`, `depth`, `motion_vectors`, …) replaces the shaded image with the buffer behind it; and any capture **view** a render feature has published (`renderer.captureView.list()` enumerates them) is selectable by its own name. A name that is neither is refused against the list of what is registered. The name carries two decisions: which channel the camera renders, and which render layers that channel is legible under. A diagnostic buffer is read flat, so the sky behind it and the post-process chain over it come off; a view that draws its own geometry declares the layers it needs and is rendered under them. Stating `renderLayers` answers that second question yourself, for the one call. `passes` spreads the same vocabulary across the cells of a collage, and each cell reports the layers it was read under. ## Projection `projection = "orthographic"` covers a fixed world-space height at every distance. Parallel edges stay parallel and two equal-size objects at different depths cover equal pixels, which is what makes it the projection to check a shape or compare sizes under — a perspective frame's convergence hides both. `orthoHeight` sets that height; omit it and it is fitted to what is being framed. Any camera can be orthographic, not only a capture: it is a field on the `Camera` component. A capture through a camera the scene holds (`fromCamera`, `viewport`, and `source = "camera"`, `"screen"` or the scene camera) takes that camera's `projection` and `orthoHeight` with the rest of its lens, and its lighting `environment` with an `isolated` camera's background and ambient; a `projection` or `orthoHeight` stated for the call stands over the camera's. ## Which entity a capture framed A capture names an entity, or a camera to render from, by its id or by its name. A name exactly one entity carries means that entity. A name several entities carry means none of them on its own, so the capture is refused, and the refusal says how many entities carry it and names each by name and id; pass the id of the one you mean. A player is drawn as its body, so a capture of a player identity (an entity carrying `UserIdentity`, named `user`) frames the body its `avatar` names. A player prototype is absent from the live scene while it plays, so its name reaches no entity there: a capture of that name is refused, and the refusal names each player spawned from the prototype, by its identity and its body, with their ids. Every cell of a capture aimed at an entity reports what it framed under `subjects`: one `{ id, name }` per subject, carrying `playerIdentity = { id, name }` when the picture is the body of the identity the capture named. ## Isolate Framing a subject fits the **frame** to it; it does not decide what is drawn in that frame. Everything else standing there is still rendered — and a scene's default player spawn sits at the world **origin**, which is exactly where a prop usually gets built, so a tight shot of a new prop at the origin can come back showing the player instead. `isolate = true` draws the subject without the other geometry. It changes exactly that — lighting, sky and post-process are untouched, so a final frame stays a final frame, and a flat read of the geometry is a `pass`. Excluded geometry still casts shadows onto the subject and still bounces light into it, the same as any render-layer exclusion. In a `setups` collage each cell shows the entity its own set-up frames alone, and a set-up can state `isolate` for its own cell; a set-up aimed from a position or a camera frames no entity and is refused when it is to be isolated. ## The tone the frame carries Every capture reports `luma` on its cell record: the tone of the pixels it just encoded, in code values on the 0-255 scale the image is delivered at. ``` luma = { pixels, min, max, mean, p1, p5, p50, p95, p99, span, spread, crushed, clipped } ``` `span` is `max - min` — the whole range, a single stray pixel included. `spread` is `p95 - p5` — the range the body of the picture occupies, which is the reading that answers whether a shot is legible. `crushed` and `clipped` are the shares of the picture sitting at code 0 and at code 255. A frame's mean cannot answer that question: half a picture at 40 and half at 200 carries the same mean as a flat field at 120, and only one of them has anything in it. A subject can be modelled, shaded, lit and drawn and still arrive inside a handful of code values, in which case the image looks like a wash and every other field here reports success. `spread` is the number that says so. The same reading is available anywhere pixels are: `cpu:tone()` on a `TextureCpuHandle` — from `renderer.texture.readback(rtHandle)` on a capture handle, from a render-to-texture camera's target, from a CPU canvas — and `cpu:histogram()` under it, the per-code-value counts for luminance and for each of the three channels, which every reading above is a sum over. `cpu:histogram(x, y, w, h)` counts one rectangle of the picture alone, so a reading per region of the frame — how much of each cell is dark, lit or a given colour — is one call per region. `cpu:flip(reference)` holds the picture against another of its size by NVIDIA FLIP, the comparison a golden is judged by; `@builtin::modules.postMetrics` carries it with the golden runner, the pixel metrics (banding, temporal variance, halo overshoot, ring energy, hue drift) and the scopes, each reading a presented frame or a capture result as it comes. ## The grade an offscreen frame carries A capture spawns its own camera and renders offscreen, and the post-process chain runs over that frame the way it runs over the viewport's — for a station, for an orbit around an entity, for a named camera, for a render-to-texture camera alike. Inside an effect, `engine.view_proj` / `engine.prev_view_proj` / `engine.inv_view_proj` are the camera THAT render was drawn from and `engine.resolution` is that target's own size, so a grade that reconstructs world space from scene depth reconstructs against the station and lens the capture asked for. That makes an offscreen capture an oracle for an authored look: it photographs a chosen station and lens without taking the on-screen camera away from whoever else is driving the scene, and moving that camera somewhere else does not move the frame this one returns. An offscreen render keeps no view history of its own, so `engine.prev_view_proj` there holds that same matrix rather than the frame before it, and a pass taking camera motion from the two reads none. On the viewport the pair is a frame apart, so a camera's motion (and the blur and temporal reconstruction built on it) is read from the presented frame: `source = "presented"`. A render feature's passes reach an offscreen render the same way, against the same camera — the `renderFeature` assetType README carries that half, including `@frame.camera`, its own per-target camera input. `render(ctx)` itself runs once a frame for the main viewport, so `ctx.viewport` is the window's size rather than the captured target's; a feature sizes its scratch with `screen = true` and lets the engine track the drawn target. `postProcessing = false` takes the chain off the frame a capture returns, and with it the film a render feature draws — the flare and grain, a short focus's bokeh, the shutter's smear. It is a `Camera` property rather than a render layer, so `renderLayers` does not reach it. A capture naming a diagnostic `pass` drops the chain by default, so the buffer comes back as the value it encodes. ## Collage `collage` renders a grid of frames into one image. What varies across its cells is what you pass — `setups` for a cell per whole camera set-up, `viewpoints` for a cell per view of one subject (or `"sides"` for all six), `passes` for a cell per render pass, `duration` for a cell per sample over time. A collage with no axis is refused rather than quietly sampling time. `setups` is the shot list: each entry is written the way a single capture is aimed (`source`, `camera`, `entity`/`entities`, `position`, `lookAt`, `rotation`, `distance`, `angle`, `margin`, `viewpoint`, `basis`, `projection`, `orthoHeight`, `fov`, `near`, `far`), plus `label` to name the shot on the result, and a field an entry leaves out comes from the collage's own options. `setups` and `viewpoints` are one axis — both say where the camera stands — so a request names one of them; either crosses with `passes` into a 2D grid, a row per station and a column per pass. The shot most of this exists for is one call: six sides of one object, each an orthographic elevation, nothing else in frame. Authoring the cameras themselves — creating, listing, aiming, framing, and setting their parameters — is the `camera` toolbox.
▲ 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
·
assettype · born here
❒asset
# sceneModule — a part of a scene, authored as code A `.sceneModule` is a recipe for scene content: a folder whose `init.luau` declares the inputs a placement may set and returns the function that builds the content. Placing one runs the builder and lands what it built in the scene as ordinary entities — named, selectable, movable, saved in `scene.json`, and replicated like anything else an author placed by hand. ``` CoinPusher.sceneModule/ init.luau -- declared inputs + the build code Coin.mesh/ -- an asset the build makes (see The assets a build makes) .build.assets -- which init.luau produced each of them README.md .metadata ``` The entities are not baked into the folder — the scene holds those. What the folder holds is the code, and the assets that code makes. ## The builder is ordinary engine code ```lua inputs = { seed = Field.number(0, NoSync), coinCount = Field.number(40, NoSync), stroke = Field.number(0.8, NoSync), } return function() local base = entity.spawn("base") base.component.add("Model", { model = asset.resolve("PusherBase", "mesh") }) local pusher = entity.spawn("pusher", { parent = base }) pusher.component.add("PusherDrive", { stroke = inputs.stroke }) math.randomseed(inputs.seed) local coinMesh = asset.resolve("Coin", "mesh") for i = 1, inputs.coinCount do local coin = entity.spawn("coin_" .. i, { parent = base }) coin.localPosition = { math.random() * 1.6 - 0.8, 0.5, math.random() * 2 - 1 } coin.component.add("Model", { model = coinMesh }) end end ``` Real loops, real conditionals, real locals, real `require` — `entity.spawn`, `component.add`, and transform writes are the same calls they are anywhere else. The builder **authors**; components **behave**. A coin pusher's machine, coins, and colliders are construction, so they belong in the builder; `PusherDrive` is runtime logic, so it stays a component the builder attaches. The builder runs inside a capture scope, which records what it created and holds it to the operations that end up in the scene. A build accepts an operation exactly when a scene record carries its result; anything else is refused by name while the build runs — never applied and then dropped, so nothing the builder appears to do goes missing later. A refusal is cheap, so try the thing you are unsure of. The refused call never lands, the build is abandoned whole, and the previous build stays in the scene untouched — one rebuild tells you the answer and costs nothing. `guides { path: "core/scenes-as-code" }` states the rule and works through placing an asset that expands into a hierarchy, such as a `.bundle`. Anything the entry script pulls in uses an absolute require (`require("@builtin::modules.json")`): the script is compiled into its own environment, which is what gives `inputs` its meaning below. That environment holds `inputs` and `build`, and falls through to the engine's global one for every other name, so a builder reaches everything a script reaches anywhere else — `entity`, `asset`, `Transform`, `math`, `require`, `vfs`, `task`, `tools`, `world`, `string`, `table`, `os`, `Field`, `NoSync`. `Transform.quatFromAxisAngle(ax, ay, az, angle)` and `require("@builtin::modules.json")` behave inside the builder exactly as they do outside it, so the engine's own maths and modules are the ones to reach for. A toolbox is reached with `tools.use("wld", "mode")`, the same call it takes anywhere. ## Inputs `inputs` follows the component `public` convention exactly. The table literal **declares** the fields with the same `Field.*` constructors components use, and a read of `inputs.<name>` inside the builder returns the **resolved** value for the placement being built — the param override when the placement sets one, else the declared default. ```lua inputs = { -- a placement that sets nothing builds with 0 seed = Field.number(0, NoSync), style = Field.enum({ "brass", "steel" }, "brass", NoSync), lit = Field.bool(true, NoSync), } ``` The replication mode is the one every component field names, on the same constructors. The placement carries the whole resolved set in one `params` field, which is what replicates, so an input declares `NoSync`. Declare `inputs` as a global, the way a component declares `public`. Reading a name the module never declared raises and lists the ones it does, so a typo says so instead of silently building with nothing. ## The assets a build makes Some of what a module states is an asset rather than an entity — the coin mesh above is one. `build.asset(type, name, produce)` makes it: `produce` takes nothing and returns the creation parameters `asset.create` takes for that type, and the call returns the asset's `AssetRef`, which is what a component field holds. ```lua local coinMesh = build.asset("mesh", "Coin", function() local positions, indices = disc(0.4, 24) return { positions = positions, indices = indices } end) local coinGold = build.asset("material", "CoinGold", function() return { shader = "pbr", properties = { base_color = { 1, 0.84, 0.28, 1 }, metallic = 1, roughness = 0.25, }, } end) return function() for i = 1, inputs.coinCount do entity.spawn("coin_" .. i).component.add("Model", { model = coinMesh, material = coinGold, }) end end ``` The first argument is the type, so a module makes every kind of asset its content names, not only geometry. A material's overrides go in **one `properties` table**, colours as `{r, g, b, a}` arrays; passing a `floats`, `colors`, `ints` or `bools` section name is refused with the shape to use. The producer owns what it makes. Editing a generated asset at runtime — setting a property on the live material, hand-editing its files — leaves it in a state the next produce does not know about. Edit the producer and rebuild. The asset is authored inside the module's own folder — `CoinPusher.sceneModule/ Coin.mesh` — and the module records which `init.luau` produced it in `.build.assets`. So `produce` runs when the entry script changed and never otherwise: every later placement and rebuild reuses the asset, while editing the disc re-authors `Coin.mesh` **in place**, keeping its path and its guid. That is what holds the reference — `scene.json` names assets by guid. This is the answer to a refusal that names a runtime resource: `renderer.mesh.create` makes a GPU mesh that lives as long as the session, which no record can hold, and the same geometry made as an asset is held by every record that names it. ## Placement A sceneModule defines `instantiate`, so it is accepted anywhere a scene-instantiable asset is: an `Asset`-style field gated by `Field.instantiableRef`, a viewport drop, a tool argument. ```lua local pusher = entity.spawn("pusher_0") pusher.component.add("SceneModule", { source = asset.resolve("CoinPusher", "sceneModule"), params = { seed = 0 }, }) ``` `SceneModule` is the placement component: it holds the module the placement is bound to and the params it sets, and it is what re-runs the build. Placing the same module twice with different params yields two different results from one asset, each with its own stable ids. See its README for the full field set. ## Rebuilds hold ids Editing `init.luau`, or changing a placement's params, re-runs the builder in edit mode and **reconciles** the result: an entity the previous build placed is updated in place, one the build no longer emits is removed, and a new one is spawned. Same entities, same ids, updated contents — so a reference to a built entity survives every rebuild. A change is what rebuilds. A placement that already holds a build runs nothing when the scene loads or the mode flips — the entities are there, holding what the last bake gave them. `SceneModule:rebuild()` forces a rebuild for a change nothing else reports, such as a module edited while the world was closed. In play of an editor session the placement builds into the play scene alone and records nothing. A runtime-profile boot builds nothing: the entities are already in `scene.json` and load as authored content, and the placement component is inert. ## Ref methods - `ref:build(params)` — run the builder and return the records, leaving the scene untouched. - `ref:inputs()` — the declared inputs, sorted: `{ name, kind, default, values? }`. - `ref:getInitScript()` — the entry script source. - `ref:instantiate(target?, opts?)` — the uniform placement call. ## In the Inspector Selecting a scene module opens its **Inputs** section: a table of the inputs the builder declares, each with its kind, default and allowed values, and an opener for `init.luau` in the Code panel. A placement sets their values on its SceneModule component.
▲ 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
·
assettype · born here
❒asset
# guide A guide is a single-file documentation asset: a `<name>.guide/` folder whose body is `guide.md`, surfaced through the `guides` MCP tool, the `man` shell builtin and the Docs panel. Drop one anywhere under `/zero/source/`, a `.package` included, and it shows beside the built-in guides. ## Linking guides together A markdown link in a guide is followed when it is clicked in the Docs panel: `[Bindings](controls-guide)` opens another guide by any name `guides read` takes, `[Slots](#save-slots)` a heading of the same guide (its text in lower case, punctuation removed, spaces turned into `-`), `[Slots](save-kit#save-slots)` a heading of another, and `[the module](../saveKit.module)` a file or asset, relative to the guide's own folder. A link the panel cannot follow says why above the guide. ## In the Inspector Guide: the guide's word count, its headings, and **Open in Docs**, which opens it in the Docs panel.
▲ 0↑ born
·
tool · born here
❒asset
# capture.cleanup Clears every file from the capture output directory, removing the PNGs left behind by earlier captures. Safe to call when the directory is missing or already empty.
▲ 0↑ born
·
tool · born here
❒asset
# collage A grid of frames in one image. One picture that answers a question no single frame can: what does this look like from every side, what does this frame look like under each diagnostic pass, what moved over the last three seconds, which of these twenty shots is the shot. ## The axis is always stated A collage varies one thing across its cells, and the argument you pass is what that thing is: | Argument | One cell per | |----------|--------------| | `setups` | whole camera set-up — a shot list, each entry aimed the way a single capture is | | `viewpoints` | named view of one subject — a list, `"front top left"`, or `"sides"` for all six | | `passes` | render pass — `final`, `albedo`, `normal`, `depth`, `motion_vectors`, or any content-registered capture view | | `duration` | sample, spread across that many seconds of gameplay | `setups` and `viewpoints` are one axis — both say where the camera stands — so a request names one of them. Naming a station axis **and** `passes` lays out a 2D grid: a row per station, a column per pass. Reading across a row is one set-up under every pass; reading down a column is one pass from every set-up. A collage with no axis is refused, naming all of them. It does not fall back to time — a silent time default is exactly what taught callers that a collage could only ever be time, so nobody looked for a grid of views. `duration` cannot combine with `setups`, `viewpoints` or `passes`. A cell that differs both in what it looks at and in when it was taken answers neither question; take one collage per axis. ## The shot list Each entry of `setups` is written the way a single capture is aimed — `source`, `camera`, `entity`/`entities`, `position`, `lookAt`, `rotation`, `distance`, `angle`, `margin`, `viewpoint`, `basis`, `projection`, `orthoHeight`, `fov`, `near`, `far` — plus `label` to name the shot on the result. A field an entry leaves out comes from the collage's own options, so a shot list writes down only what makes each shot differ: ```lua zero capture collage --setups '[ { "position": [-14.6, 1.35, 4.5], "lookAt": [-16.3, 1.1, 1.6], "fov": 28, "label": "doorway" }, { "position": [8, 3, 12], "lookAt": [0, 1, 0], "fov": 50, "label": "wide" }, { "entity": "hero", "viewpoint": "front", "basis": "local", "label": "closeup" } ]' ``` Three stations, three lenses, three subjects, one instant, one picture — which is the comparison a framing pass is made of. A key outside that vocabulary is refused where it was written, so a misspelled `fov` names itself instead of quietly framing a shot nobody asked for. ## Reading the result The grid shape is worked out from the number of cells — pass `grid` (`"3x2"`) to state it, and it is an error rather than a silent crop if it cannot hold them. Every cell comes back labelled in `cells`, with its `label`, the `viewpoint` and/or `pass` that made it differ, the `eye` it was rendered from and the lens it was rendered through. A grid is meant to be readable from the response, not guessable from the pictures. Only a time collage reports the window it covered — a station or pass grid samples one instant, and reporting a span for it would invite reading the difference between cells as motion. ## Aiming it Exactly as a single capture is aimed: `entity` (with `viewpoint` and `basis`, or `angle` and `distance`), `position` with `lookAt`, `camera`, or nothing at all for the main scene camera. `projection`, `orthoHeight`, `isolate`, `renderLayers`, `fov`, `width` and `height` all mean what they mean for one frame, and apply to every cell a set-up of its own does not override. The shot most of this exists for is one call: ```lua zero capture collage --entity crate --viewpoints sides --basis local \ --projection orthographic --isolate ``` Six sides of one object, each an orthographic elevation, nothing else in frame.
▲ 0↑ born
▣
module · born here
❒asset
# feed The newest frame a capture produced on this engine, and who is watching for it. Every capture core publishes here. `latest()` is that frame: a `src` an image widget draws (the render target's guid while the engine still holds it, the written path when the capture produced a file), with the size, the source and the pass beside it. `watch(fn)` calls `fn` as each new frame arrives, and `unwatch(token)` drops the subscription. `shown()` says a viewer is drawing frames from the feed. From then on the feed holds the newest capture's render target so the picture stays up after the capture that made it is finished with it, and lets it go when a later frame replaces it; `shown(false)` stops. With nobody drawing, a capture's target is released the moment its capture is done. The release path asks `retains(rtHandle)` before destroying a target, which is how a held frame survives its own capture. `capture.shared.releaseFrame` is the one place that asks.
▲ 0↑ born
·
tool · born here
❒asset
# capture.fromCamera Render the scene from a specific named camera's authored pose and settings, returning the picture as an image value (and writing a PNG as well when a `path` is given). By default it uses the camera's exact world-space pose plus its whole lens (fov/near/far, and the projection it builds with the orthoHeight an orthographic camera covers), its diagnostic debugChannel, its post-process setting, its lighting environment (an isolated camera's background and ambient with it) and the scene layers it draws: the camera's own `renderLayers` with the editor's chrome (`EditorUI`) and the authoring overlays (`debug`) taken off, since those are drawn for whoever is editing rather than by that camera into the world. So the frame is precisely what that camera draws of the scene, without changing what is on screen. Pass overrides (`renderLayers`, `debugChannel`, `fov`, `near`, `far`, `projection`, `orthoHeight`, `width`, `height`) to change any of those for the one capture without touching the camera; `renderLayers = "all"` is how the overlays are captured on purpose.
▲ 0↑ born
·
tool · born here
❒asset
# capture.fromEntity Renders a screenshot orbiting a target entity. The camera frames the union world-space bounds of the entity (or a list of entities): it is aimed with a `viewpoint` plus `basis`, or a raw `angle` ({yaw, pitch}), stands at the distance that fits the subject (or a pinned `distance`), and leaves `margin` around it, with a configurable field of view and output size. Returns the picture as an image value, and writes a PNG as well when a `path` is given; fails when the entity is missing or its position can't be read. The call waits for the render and the GPU readback and returns only once the picture is read back (and the PNG written, when a `path` is given).
▲ 0↑ born
·
tool · born here
❒asset
# capture.fromPosition Renders a screenshot from an explicit world-space camera position and returns the picture as an image value. Aim it with a look-at target (defaulting to the origin) or a quaternion rotation that takes precedence, and set field of view, output size, and near/far clip planes. A PNG is written as well when a `path` is given. It spawns an ephemeral camera, triggers one render, reads the frame back, and despawns the camera automatically — the call waits for the render and the readback, and returns only once the picture is read back.
▲ 0↑ born
▣
module · born here
❒asset
# isolate Show the subject without the other geometry drawn, then put everything back. A prop inside a built scene is behind whatever stands in front of it. The render-layer system already expresses "draw only these" — an entity is a member of layers, a camera renders a filter over them — but it does not remember what it displaced, so every caller wanting one clean shot of one thing hand-rolls the same record, swap and restore. This is that, once, with the restore guaranteed. ## What it changes Exactly one thing: the other geometry is not drawn. Sky, post-process and UI are left exactly as the capture's own render-layer spec stated them, so a final frame stays a final frame. A caller who wants the geometry read flat — no lighting, no atmosphere — asks for a **pass** (`pass = "albedo"`, `pass = "normal"`), which is what passes are for. ## What it does not change Excluded geometry still **casts shadows** onto the subject and still bounces light into it. Lights are not filtered by render layer at all, and the layer mask drives object culling and the geometry passes rather than the shadow passes. This is the render-layer system's deliberate behaviour — a wall stays out of the shot while it still exists for lighting, shadows and physics — so a shadow with no visible caster in an isolated capture is the system working, not a bug. ## The layer One reserved layer name, `captureIsolate`, reused by every isolated capture. Membership is a 32-bit mask with six reserved bits. A layer minted per call would exhaust the namespace in twenty-six captures and leave a trail of empty layers that `renderLayer.list` would show forever. ## Restoring `begin` records each affected entity's membership before moving anything, so the token describes the whole subtree even if the move fails part-way. `restore` puts every entity back to the layers it carried — and an entity that carried **no** explicit membership ends with none, rather than an explicit `default` that looks identical in a picture and different in the data. `restore` is safe to call twice and safe on a token whose subjects have since despawned, which is what lets a caller restore unconditionally on every exit path: success, failure, and once around a whole collage grid rather than between its cells.
▲ 0↑ born
·
tool · born here
❒asset
# capture.oneshot The low-level one-shot capture primitive. Spawns an ephemeral offscreen camera configured from a source — the viewport, an entity (or several), a world-space position, or a UI window — triggers a single render, and returns the camera and render-target handles synchronously so the caller drives the readback and cleanup itself. It does not wait for the render: it returns at once, and the caller reads the target back and cleans up, which makes it the path for a caller that must not yield (the `capture` MCP tool is built on it). When framing an entity, omitting the distance auto-fits the camera to the union world-space bounds of the target(s), so the subject is guaranteed fully in frame at any scale — a small prop and a large building both fill the shot. Because the data drives the camera, an empty result is a real signal that the geometry or material is wrong rather than a framing mistake; a distance can be passed to force a fixed orbit radius, and an angle sets only the viewing direction. Further options select the output by `pass` name (or `view`, or a raw `debugChannel`), set which render layers draw with a `renderLayers` spec such as `"all !ui"`, turn the post-process chain on or off with `postProcessing`, choose an orthographic `projection`, and set field of view, clip planes, and output size. The returned camera is left disabled so it can be re-triggered to produce additional frames on the same target, as when stitching a collage.
▲ 0↑ born
▣
module · born here
❒asset
# shared Module Cross-tool helpers for the `capture` toolbox. Every tool inside this toolbox can pull these in with `require(".shared")`. ## Purpose This module holds the small set of helpers that more than one tool in the toolbox needs — typically the `ok(value, formatted?)` / `fail(message, exitCode?)` constructors that produce the canonical `captureToolResult` shape, plus any toolbox-wide parsers, validators, or shared state. Keep it focused: per-tool implementation stays inside each `<x>.tool/init.luau` (with its own `--!desc` / `--!arg` / `--!return` / `--!example` annotations). ## Usage ```luau local shared = require(".shared") function M.someTool(...) if not ok then return shared.fail("reason", 1) end return shared.ok(value, "") end ``` ## Exports See `init.luau` for the full export surface. Typical exports include `shared.ok(value, formatted?)` and `shared.fail(message, exitCode?)` for building the toolbox's standard result envelope.
▲ 0↑ born
▣
module · born here
❒asset
# subject What a capture of an entity is a picture of. Every path that frames or isolates an entity (`fromEntity`, `oneshot`, a `setups` or `viewpoints` collage, `isolate`) resolves the name, id or proxy it was given here, so they agree on which entity a name means. ## A player is drawn as its body A player identity (an entity carrying `UserIdentity`) is the registry anchor a connected user is known by. The player is drawn as the body its `avatar` names, a standalone entity at the scene root, so a capture of an identity frames and isolates that body. In play, a player prototype's spawn turns the prototype's copy into the joining user's identity under the prototype's own name and stands the body it names at the spawn point. A capture of the name an author gave their player prototype therefore frames the player's body in play, and the prototype's subtree in edit. ## What a refusal names `describe(target, via)` is the phrase a framing refusal uses for each subject it looked at: the entity's name and id with the number of descendants it holds, and the player identity it is the body of when it was reached through one, or, for a player identity with no live body bound, that the body is missing. | Function | Returns | |----------|---------| | `resolve(t)` | the entity a capture pictures for a name, id or proxy (nil when none matches), and the player identity it was reached through | | `bodyOf(target)` | the live body a player identity is drawn as, or nil | | `isPlayerIdentity(target)` | whether the entity carries `UserIdentity` | | `describe(target, via)` | the refusal phrase for one resolved subject |
▲ 0↑ born
▣
module · born here
❒asset
# viewpoints The named camera stations a capture can be taken from, and the rule that decides what a name like `front` means. A **viewpoint** is a direction with an image-up: where the camera stands relative to what it is looking at, and which way is up in the resulting picture. Naming one replaces reverse-engineering a `{yaw, pitch}` pair, and names the seven stations that answer "is this built correctly" — the six sides and the corner. | Viewpoint | Sees | |-----------|------| | `front` | the side the subject faces | | `back` | the opposite side | | `right` | the subject's right | | `left` | the subject's left | | `top` | plan view, the subject's front toward the top of the image | | `bottom` | the underside | | `iso` | the corner view where all three axes project equally | An entity faces its local -Z, so the camera that sees its front sits on its +Z. `top` and `bottom` take their image-up from the subject's forward axis, because world up is undefined when you are looking straight down it — that is what puts the subject's front at the top of a plan view instead of leaving the roll to whatever the yaw happened to be. ## Basis `basis` says which axes the name is measured against, and it has **no default**: - **`"local"`** — the subject's own axes. `front` is the side the subject faces, whichever way it is turned, and the frame is fitted to the subject's own extents (`entity:orientedBounds()`). - **`"world"`** — the world axes. `front` is the side facing world +Z, whatever the subject is doing. For a crate turned 40 degrees these are different pictures, so the caller states which one it wants. A default would mean one call site's `front` is the crate's front and another's is the world's, and the difference only shows up in the image. With no subject to take axes from — a capture framed on a world position rather than an entity — both values mean the world axes, and both are accepted. ## Orthographic size `orthoHeightFor` answers the question an orthographic frame asks that a perspective one does not: how big is the frame? A perspective camera backs off until the subject fits; an orthographic camera does not converge, so its size is decided by the subject alone — project the bounds' eight corners onto the camera's up and right axes and take whichever needs more room. Its `half` extents and `axes` must be stated in the same frame. A resolved viewpoint carries both: `frame` axes to use with local-frame extents, and its world axes to use with world extents.
▲ 0↑ born
·
tool · born here
❒asset
# capture.viewport Renders a screenshot mirroring the active viewport. It mirrors the on-screen camera through the shared capture core, so the frame carries that camera's pose, its lens (`fov`, clip planes and the projection it builds), the lighting environment it states (an `isolated` camera's background and ambient) and the layers it draws the screen with, so the image matches the viewport's picture: the scene, its debug overlays and the content UI. The editor's own chrome (the `EditorUI` layer) is never in the frame. The raster is the viewport's own pixel size, the size `getViewportSize()` reports. Returns the picture as an image value, and writes a PNG as well when a `path` is given; fails when no active viewport camera exists. Its one argument is a path to also write the PNG to, or a table overriding any of that for one capture: `width` / `height` for a raster of some other size, `renderLayers` for the frame under a different layer spec (`!EditorUI` is always appended to it, whatever it names; `"all !debug"` is the frame without the debug overlays) and `postProcessing` to take it with the grade off. ```lua tools.use("capture", "viewport", "/source/tmp/capture/shot.png") tools.use("capture", "viewport", { path = "/source/tmp/capture/clean.png", renderLayers = "all !debug" }) tools.use("capture", "viewport", { width = 960, height = 540 }) ```
▲ 0↑ born
·
assettype · born here
❒asset
# toolbox (asset type) A toolbox is an asset grouping set of `<tool>.tool` assets around one area of work. Each tool in it becomes callable under the toolbox `<toolbox>.<tool>`, and is a shell command, `zero <toolbox> <tool> <args>`; `guides core/tools`, "A tool's command line", covers its flags, paths, `render.luau` and exit status. ## When to group tools together When creating tools for the engine, a common theme should be identified and and a toolbox created to house them, this allows each individual operation to be easily accessible instead of being scattered in a million places. ## Sharing functionality between tools A toolbox features ability to define functions that code inside each individual tool inside it can access, this is usefull when establishing helpers etc so you dont have to duplicate code for each new tool you write. A `shared.module` inside the toolbox root is where this code lives, each tool inside a toolbox can access its functions by requiring it with `require(".shared")`. ```luau -- <toolbox>.toolbox/shared.module/init.luau local M = {} -- One step a tool reports in its result. export type Step = { name: string, ok: boolean, detail: string? } --!desc Check that a numeric argument lies within bounds. --!arg arg The argument's name, for the error. --!arg value The value passed. --!arg min The lowest value allowed. --!arg max The highest value allowed. --!return The value; raises naming the argument and the range when it lies outside. --!example "count", 12, 1, 100 typed function M.range(arg: string, value: number, min: number, max: number): number if value < min or value > max then error(string.format("%s must be between %s and %s, got %s", arg, tostring(min), tostring(max), tostring(value))) end return value end --!desc A byte count as a readable size. --!arg bytes The count. --!return The size in B, KB, MB or GB. --!example 2681107 typed function M.size(bytes: number): string local units = { "B", "KB", "MB", "GB" } local i = 1 while bytes >= 1024 and i < #units do bytes /= 1024 i += 1 end return if i == 1 then string.format("%d %s", bytes, units[i]) else string.format("%.1f %s", bytes, units[i]) end --!desc A step for a tool's result. --!arg name What the step did. --!arg ok Whether it succeeded. --!arg detail What happened, when there is more to say. --!return The step. --!example "copy textures", true typed function M.step(name: string, ok: boolean, detail: string?): Step return { name = name, ok = ok, detail = detail } end --!desc The asset of `kind` that a caller named, looked up by that name. --!arg kind The asset type to look in. --!arg name The name the caller passed. --!return The asset; raises naming the kind and name when nothing matches. --!example "material", "gold" typed function M.named(kind: string, name: string): AssetRef local ref = asset.tryResolve(name, kind) if ref == nil then error(string.format("no %s named '%s'", kind, name)) end return ref end return M ``` This shared code should be limited to being used by the tools inside it, dont put general functionality you might need otuside the toolbox into its shared module. Instead reference those in the shared module should you wish to utilize something. A benefit the shared module shares with the tools own code is that it allows the author to write code that has computed references, meaning eg resolving an asset from a computed variable `asset.resolve(<type>,name)` that is normally not allowed in other parts of the engine surface, due to said references not being recorded. This is usefully for utilizing tools to handle operations that are called by users/agents and are dynamic in nature, such as finding/inspecting/testing assets, or content based on an input etc. When writing a shared module, you should follow standard module practices, please see `module.assetType` readme.md for more indepth information. ## Describing the toolbox When writing the readme for your toolbox, ensure you focus on the overall area what the toolbox focuses on, rather than listing individual tools inside it, discovery surfcaces already group tools and toolboxes together so a toolbox can be discoverd by the tools it hosts and doesnt require separately maintaining a list of the tools in it's readme. ## What are tools and when do i create ones? Tools are typed operations with a known serialized output format, made to enable efficient operation in the engine and provide an easily callable interface for operations around a topic. They are also useful in that they can be called from a multitude of surfaces, from `execute`, to `bash` to `tool_exec` to users Tools portion in the edui. A toolbox and its tools differ from eg a module that has multiple callable functionm in that they might return anything, and come with no guarantee that the output is meant to be inspected directly, where as tools are meant to perform an self contained operation and return results/info/relevant data in a readable format, including eg. image data. Whenever you identify an operation that requires specific orchestration and or is something that could be a repeated operation and makes it easier to manage the project/task or when you want to expose logic written in `luau` to the other call surfaces like `bash` under its `zero` command,you should reach for creating a toolbox. Toolboxes also come in handy for limiting control/inputs, exposing a limited set of functionality in a clean manner or ensuring the caller doesnt have to understand the entire code. For comparison, you could think of toolboxes as programs, and the tools inside them as commands. A package might contain tens of tousands of lines of code, dozens of modules, components etc, a toolbox turns that surface into a system that any agent/user can then utilize without having to read or understand the code inside. Its the UI equilevant to operations. For the indepth explanation of what `tool.assetType` is and does, read it's readme.
▲ 0↑ born
·
procgraph · born here
❒asset
# ModelGraph The graph a scene's parts are drawn by. The nouns record a scene's tree; at the end of the build one `Generator` is spawned on this graph, and the tree is its two plain inputs: - `objects`: the objects of the tree, parents before their children. Each is `{ name, parent, pose or channel and values, components?, leaves }`: `parent` is the number of its parent object (0 for the first), `pose` is its position, rotation quaternion and scale as ten numbers (an object that stands still), `channel` and `values` name a formula of `channels` and the constants it puts in it (an object whose pose follows the clock), and each leaf is `{ shape, material, matrix }`: `shape` is `{ op, args, ops? }`, where `op` names a `g.shape` node, `args` are its inputs and `ops` are the modifiers applied in order (bevel, subdivide, taper, twist, bend, boolean), `material` is `{ color, metallic, roughness, emissive, opacity?, doubleSided? }` and `matrix` places the leaf in its object (row-major 4x4). A shape whose `op` is `loft` carries its cross-sections in `args.sections`. - `channels`: the formulas of the poses that follow the clock, each `{ nodes, out, width }`. The graph composes the tree into the parts that stay where they are, each an entity with its parent and local pose, and the parts that move, grouped by formula and shape and drawn as instances, one population per group, the formula running on the device every frame. A graph that states a program (`g:program`) is stood by that program where it takes the tree, and cooked as this graph where it does not. The graph's clock runs forward and loops. A material is one node per distinct colour, metalness, roughness, emissive, opacity and sidedness, shared by the parts that state it. Opacity below 1 or a double-sided material is made from the pbr shader with a transparent blend. Modifiers run through procgen's own nodes: `geometry.bevel`, `geometry.subdivide` (points joined first), `geometry.boolean` and `geometry.loft`; taper, twist and bend are field arithmetic on the point positions.
▲ 0↑ born
·
scene · born here
❒asset
# V8Dyno A 90 degree cross-plane V8 engine on a stand, turning at 60 rpm: crankshaft with counterweights and flywheel, pistons and connecting rods in liners, both cylinder banks with cam shafts, valves, springs and lobes, the ghosted block and heads, intake runners and exhaust headers. `build.luau` states it with the quickGeometry nouns (`Group`, `Mesh`, the `*Geometry` constructors) and states every motion as a formula of `Time`; the scene's one Generator draws it, so there is no per-frame script.
▲ 0↑ born
▣
module · born here
❒asset
# curve `makeCurve(spec)` builds a function of `t` from `0` to `1` for a curve spec: a Catmull-Rom spline through points (`closed` joins the ends) or a helix. The `tube` node sweeps along it.
▲ 0↑ born
·
guide · born here
❒asset
# quickGeometry guide Three.js-shaped nouns for stating 3D geometry in a scene's `build.luau` and a `.sceneModule`'s entry script: parts, shapes, modifiers, materials, motion and lighting. The quickGeometry package's guide. Surfaced through `guides { query: "quick geometry" }` and `guides { path: "systems/quickGeometry/documentation/quickGeometry" }` (likewise `man`).
▲ 0↑ born
▣
module · born here
❒asset
# expr A value that changes with time, written with ordinary arithmetic: `Time`, `Expr.sin`, `Expr.cos`, `Expr.sqrt`, `Expr.atan2`, `Expr.abs`, `Expr.min`, `Expr.max`, `Expr.mod`, and `+ - * / ^`. The result holds its whole formula as data, which the `ModelGraph` graph evaluates on the device every frame. A number is a constant, and arithmetic on numbers alone folds to a number. ```luau local angle = Time * 6.28 piston.position.y = 1.74 * Expr.cos(angle) + Expr.sqrt(32 - 3 * Expr.sin(angle) ^ 2) ```
▲ 0↑ born
▣
module · born here
❒asset
# math The vector, colour and number helpers a build writes with, in the shapes three.js has them. `sceneNouns` re-exports `Vector3`, `Color` and `MathUtils`. ## Vector3 `Vector3(x, y, z)` holds a point or direction; missing components are 0. Methods change the vector and return it, so calls chain; `clone` makes a copy. `set(x, y, z)`, `setScalar(s)`, `copy(v)`, `clone()`, `add(v)`, `sub(v)`, `addScaledVector(v, s)`, `multiply(v)`, `multiplyScalar(s)`, `divideScalar(s)`, `negate()`, `dot(v)`, `cross(v)`, `lengthSq()`, `length()`, `normalize()`, `setLength(l)`, `distanceTo(v)`, `lerp(v, t)`, `equals(v)`, `toArray()`. The operators `+`, `-`, unary `-`, `*` (by a number or component-wise by a vector) and `==` return new vectors. ```luau local axis = Vector3(1, 0, 0):cross(Vector3(0, 1, 0)) -- (0, 0, 1) local mid = (a + b) * 0.5 ``` ## Color A `Color` holds linear red, green and blue. Hex values and `setRGB` are sRGB, the way a colour is written. `Color()` is white. `Color(value)` takes a hex string (`"#a3141b"`, `"a3141b"`, `"#fa0"`), a number (`0xa3141b`), a name (`"red"`, `"gold"`, `"navy"` and the other basic names) or another `Color`; `Color(r, g, b)` takes sRGB channels in 0 to 1. Any other value is an error that lists these forms. Methods: `set(value)`, `setHex(n)`, `setRGB(r, g, b)`, `setHSL(h, s, l)`, `copy(c)`, `clone()`, `getHex()`, `getHexString()`, `getHSL()` (returns h, s, l), `lerp(c, t)`, `add(c)`, `multiplyScalar(s)`, `equals(c)`, `toArray()`. A material's `color` and `emissive` take a `Color` wherever they take a hex string. ## MathUtils `DEG2RAD`, `RAD2DEG`, `degToRad`, `radToDeg`, `clamp`, `lerp`, `inverseLerp`, `mapLinear`, `smoothstep`, `smootherstep`, `euclideanModulo`, `isPowerOfTwo`, `ceilPowerOfTwo`, `floorPowerOfTwo`. The random functions `seededRandom()`, `randFloat(lo, hi)`, `randInt(lo, hi)` and `randFloatSpread(range)` draw from one sequence that `setSeed(s)` restarts. The sequence starts at the same place on every build, so a scene built twice has the same random values.
▲ 0↑ born
▣
module · born here
❒asset
# quickGeometry.model The program of a quick-geometry model. It reads the object tree a build hands the Generator (`objects`, parents before their children, and `channels`, the formulas of the poses that follow the clock) and stands what the graph draws without cooking it: - an object is `{ name, parent, pose or channel and values, components?, leaves }`: `parent` is the number of its parent (0 for the first), `pose` its position, rotation quaternion and scale as ten numbers, or `channel` the number of a formula and `values` the constants it puts in it, and each leaf is `{ shape, material, matrix }`, the matrix (row-major 4x4) placing the leaf in its object; - one mesh for each distinct shape, made by array kernels (`proc.compiled`), or by a graph of its own for a piece whose chain has an op with no kernel; - one material for each distinct material; - one instanced draw for each piece and material, the leaves the rows of a transform buffer. A row is the world matrix of its object times its leaf's matrix; the world matrices are composed down the tree, and each frame only the objects that move (a channel, or a parent that has one) are placed again and only their rows are written; - an entity for each object that carries components and stands still, at the pose its parents give it. `check(params)` answers nil when the program takes the parameters, else why it does not (no tree, an object that does not follow its parent, a formula that is not stated, a component on an object that moves). `run(owner, params, opts)` stands a model under `owner` and answers the standing, or `nil` and the reason the program does not take the parameters. `opts.previous` is the standing this one replaces: what the two share is taken from it, and it is let go of afterwards. `opts.yield` is called between the units of work (the Generator hands the frame back there) and `opts.cancelled` says the run is no longer wanted, which ends it with nothing stood. `tick(standing, t)` places every moving row at the clock `t`. `release(standing)` lets go of the draws, the buffers, the entities, and the pieces and materials no other standing holds. A standing's `stats` states the objects, kernels, graphs, meshes, materials, draws, rows, entities and triangles it made and the milliseconds each took. `flat` states the formulas as data (`flatten`, the list of operations a pose is, shared by every object whose pose has the same shape) and composes a tree into the `parts` and `moving` groups `ModelGraph.procGraph` draws when the program does not stand the tree (`params`). Part of `@builtin::systems.quickGeometry`; required as `@builtin::systems.quickGeometry.model`.
▲ 0↑ born
·
nodebox · born here
❒asset
# model (nodebox) Holds `model.columns`, the node the `ModelGraph` graph uses to give each point of a moving group its own constants.
▲ 0↑ born
▣
module · born here
❒asset
# quickGeometry.modelpiece The graph of one piece of a model: a shape node call (or a loft of cross-sections) and the modifiers its shape states, in order. `ModelGraph.procGraph` builds each of its pieces with it, and the model program cooks a piece whose chain has an op with no array kernel the same way. - `build(g, spec)`: the geometry of `spec = { op, args, ops? }`. - `modify(g, geometry, m)`: one modifier (`bevel`, `subdivide`, `taper`, `twist`, `bend`, `boolean`) applied. - `placed(g, geometry, matrix)`: a geometry moved by a row-major affine matrix of 16 numbers. Part of `@builtin::systems.quickGeometry`; required as `@builtin::systems.quickGeometry.modelpiece`.
▲ 0↑ born
▣
module · born here
❒asset
# quickGeometry.modelpose The parts of one group of a model, placed. A group's parts share a formula of the graph clock for their pose (position, rotation quaternion, scale) and each puts its own constants in it. `place(g, group, set, several)` writes the formula as nodes over a column of the constants, gives every part its pose as a point, and answers what `instances.to_points` makes of them: the `instances` that draw the group's piece set once at each pose. `ModelGraph.procGraph` places each of its moving groups with it. Part of `@builtin::systems.quickGeometry`; required as `@builtin::systems.quickGeometry.modelpose`.
▲ 0↑ born
▣
module · born here
❒asset
# normals `computeNormals(positions, indices)`: smooth vertex normals for an indexed triangle list, sharing each position's normal across the triangles that meet at it.
▲ 0↑ born
▣
module · born here
❒asset
# outline Flattens a shape's path commands into points (`shapePoints`), reports a polygon's `signedArea`, and `triangulate`s a simple polygon. The `extrude` and `flatShape` nodes use it.
▲ 0↑ born
▣
module · born here
❒asset
# quickLighting Lighting and post-processing for a scene's `build.luau` in one statement each. It is the quick way: everything it writes is an ordinary stored component (`Light`, `ProceduralSky`, `EnvironmentLighting`, `PostProcess`), so the same lighting can be written with `entity.spawn` and `component.add`, and either way the entities can be selected and edited. The module joins the `sceneBuild` and `sceneModule` contexts, so its exports are globals in a scene's `build.luau` and a `.sceneModule`'s entry script. ```luau function content() 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 }, vignette = { intensity = 0.45 }, }) end ``` - `Lighting{ sun, ambient, sky, background, environment }`: the sun (`color`, `intensity`, `position` or `direction`), an ambient light, the procedural `sky` (a preset name, a table of its fields, or `false` for none), a solid `background` colour, and the `environment`, the scene's sky lighting matte and metal surfaces (a number for both terms, or `{ diffuse, specular }`). - `PostProcessing{ bloom, vignette, colorGrade, fog, blur, ... }`: each key naming a builtin post effect adds it (a table sets its values, `true` takes its defaults), run in a fixed order. `exposure` and `toneMapping` (`"none"`, `"reinhard"`, `"aces"`, `"neutral"`) set the display transform. `effects = { { shader, values } }` adds any other post shader. One call states the whole stack. - `DirectionalLight(color, intensity)`, `PointLight(color, intensity, distance)`, `AmbientLight(color, intensity)`: add one light; a directional light takes its direction from `light.position` toward the origin, as in three.js.
▲ 0↑ born
▣
module · born here
❒asset
# sceneNouns The three.js-shaped nouns a `build.luau` or `.sceneModule` models with: `Group`, `Mesh`, the geometry constructors, `Shape` and its profile helpers, `LoftGeometry`, `BufferGeometry`, the materials, `Vector3`, `Color`, `MathUtils`, `mergeGeometries`, `Time` and `Expr`. The package README lists each with its arguments and shows a scene that uses them. The module joins the `sceneBuild` and `sceneModule` contexts (`--!context sceneBuild sceneModule` in its header), so every export is a global in a scene's `build.luau` and a `.sceneModule`'s entry script. `_beginRun` and `_finish` are called by the build machinery around each build run: `_beginRun` opens a tree for the run (a scene that places a module runs the module's build inside its own, so each run saves the one that was open), and `_finish` turns the tree into the `Generator` that draws it.
▲ 0↑ born
·
nodebox · born here
❒asset
# shape (nodebox) The shape generators of the quickGeometry package: `g.shape.box`, `cylinder`, `sphere`, `torus`, `circle`, `plane`, `ring`, `capsule`, `torusKnot`, `polyhedron`, `lathe`, `extrude`, `tube`, `flatShape` and `buffer`. Each is one self-contained node whose body is a call into a module in its own folder, and each answers one `geometry` output that the rest of procgen takes: `geometry.bevel`, `geometry.subdivide`, `geometry.boolean`, `geometry.loft` and every other node that reads a Geometry. A new shape is a new node here: a folder `<name>.procNode` holding `init.luau` (the inputs and one `g.io.luau` call), a `<name>.module` with the CPU function that builds the arrays, and a README. Name the node for the shape, give each input the name and default the three.js constructor has, and add the constructor to the quickGeometry nouns so a scene can call it. ```luau local proc = require("@builtin::systems.procgen.proc") return proc.define(function(g) local post = g.shape.cylinder({ radiusTop = 0.1, radiusBottom = 0.1, height = 1.2, radialSegments = 16 }) local base = g.shape.box({ width = 1, height = 0.1, depth = 1 }) g.io.output({ value = g.part.merge({ parts = { post = post, base = base } }) }) end) ```
▲ 0↑ born
▣
module · born here
❒asset
# quickGeometry.shapes The arrays of the shape nodes by name. A shape node reads its inputs, calls the array function (`arrays`) of its module and turns the arrays into a geometry; `shapes.arrays(op, args)` answers the arrays alone for the node's inputs by name, an input left out taking the node's default. - `has(op)`: whether `op` (`box`, `cylinder`, `lathe`, `torus`, `sphere`, `circle`, `plane`, `tube`) has an array form. - `arrays(op, args)`: `{ positions, normals, uvs, indices }`, flat, indices 0-based. Part of `@builtin::systems.quickGeometry`; required as `@builtin::systems.quickGeometry.shapes`.
▲ 0↑ born
·
scenelight · born here
❒asset
# studioKey The key light of the `studioLighting` setup: a warm directional light from high above and to one side, at 1.6, casting shadows. It states its own direction; the studio backdrop draws no sun, so nothing turns it.
▲ 0↑ born
·
scenesetup · born here
❒asset
# studioLighting A studio for showing a model: a grey studio backdrop, a warm key light and a sky light that lights the model from the backdrop. Its members are its own assets beside it, `studioSky.sky` and `studioKey.sceneLight`, and the `@builtin::systems.sky.skyLight` render feature. The sky light captures the backdrop and adds its diffuse light (0.6) and its reflection (1.0) to every lit surface, so polished metal shows the studio's bright top and dark floor; with `publishReflection` on it also fills the environment's sky slot, which transparent surfaces reflect. The V8Dyno scene places it as its `lighting` entity.
▲ 0↑ born
·
sky · born here
❒asset
# studioSky A studio backdrop drawn by the procedural backdrop: light grey overhead, mid grey at the horizon and near black below, with no sun disc, moon or stars. It draws the sky behind a model and lights nothing; the `studioLighting` setup lights the scene from it through its sky light, so polished metal reflects a bright top and a dark floor.
▲ 0↑ born
·
assettype · born here
❒asset
# Package (asset type) A package is an asset — a `<Name>.package/` folder that bundles components, modules, scenes, presets, tools, and any other typed sub-assets under one identity, installed into a world as one unit. Packages are how authoring sets get distributed across worlds. A **library** is the addressable root scope content resolves under (`@builtin`, `@<name>`) — a whole world mounted into this one under a namespace, via `zeromind.installLib` / `world.installLibrary`. A package is an asset that lives inside such a root, and one library holds as many packages as its author put there. A package is installed by guid the way every asset is (`zeromind.installAsset`). ## When to use one - You're authoring a coherent feature suite (character controller stack, voxel engine, UI kit, animation library) and want to ship it as one install target. - You want a stable identity worlds can install and resolve sub-assets against (`@<lib>::pkg.sub_module`). - You want versioning + a per-package metadata layer that travels with the contents. If you're authoring inside a single world and don't need a separate install lifecycle, you don't need a package — drop your `.component` / `.module` / etc. directly in `/zero/source/`. Packages are for cross-world distribution. ## Where it lives - Source: `/zero/source/.../<Name>.package/` (or, for legacy packages, a folder containing `package.yaml` at its root). - Identity: `<Name>` (the `.package` suffix collapses in identity — mirrors `.module`). A file at `<Name>.package/<sub>/init.luau` resolves under the same identity it would at `<Name>/<sub>/init.luau`. - Folder shape (container-style — open child set): - `package.yaml`: metadata (name, version, description) and the packages it depends on (`dependencies`). **Required.** - `README.md` — instance documentation. **Required.** - `.metadata` — agent-editable tags + free-form fields. **Required.** - Sub-asset folders: any combination of `.component/`, `.module/`, `.scene/`, `.preset/`, `.tool/`, `.toolbox/`, `.material/`, `.shader/`, etc. The validator permits unlisted children (`allow_unlisted: true`) by design — packages are open containers. ## How to create one ```luau asset.create("package", "<Name>") -- Creates: /zero/source/<Name>.package/ -- package.yaml (metadata scaffold) -- README.md (instance README template) -- `folder` places it in a subfolder of /source instead of the root: asset.create("package", "<Name>", { folder = "systems" }) ``` Then scaffold sub-assets inside it: ```luau local pkg = asset.resolve("<Name>.package") asset.create("component", "Spinner", { into = pkg }) asset.create("module", "util", { into = pkg }) ``` ## `package.yaml` ```yaml name: inkBlocks # optional; the folder stem when absent version: "1.0.3" description: "Ink and paper style blocks" dependencies: - { name: starterBlocks, version: "1.0.8" } - styleKit # a bare name states no version ``` `dependencies` lists the packages this package needs. Each entry's `name` is a reference the package records, the same kind of reference a `require` or an asset name in a data file makes: - **It resolves in the author's world.** Install the dependency here first (`zeromind.installAsset`); the entry then names the copy this world holds. A push refuses a package whose dependency resolves to nothing, naming it. - **An install brings it along.** Installing the package installs every dependency it lists, at the version this world holds when the package is pushed, under `/source/deps/<owner world>/`, deduplicated against what the installing world already holds. `zeromind.preview` lists each one before anything is written, and the install's `deps` lists what it brought. Uninstalling the package leaves a dependency that another installed package still uses. - **`version` is checked, not chosen.** A stated `version` has to equal the `version` the dependency's own `package.yaml` states in this world; `asset.validate` (and so the push) refuses the package naming both when they differ. To depend on another version, install that version here. An install lands one release of each dependency its closure names, so in a world the package is installed into, itself or as a dependency of the package installed, it runs the release the install placed, and `asset.validate` names a stated `version` that release does not state as a warning. ## How it operates 1. **Registration.** Writing `package.yaml` indexes the package with the package registry. 2. **Install.** A package is read before it is installed: `zm ls-tree @<guid>` in the shell lists what it contains, and `zm show @<guid>:<path>` and `zm grep <pattern> @<guid>` read it, so candidates are compared by what they do. The one that fits is installed by guid, the way every asset is: `zeromind_install` over the engine's MCP, or `tools.use("zeromind", "installAsset", <guid>)` inside the engine. The install writes the package's files (and the deps its `.refs` record, the packages its `package.yaml` lists under `dependencies` included) into this world's source, so its sub-assets resolve here. `tools.use("zeromind", "preview", <guid>)` reports what an install would write before it writes anything. 3. **Sub-asset resolution.** Because `.package` collapses in identity, sub-asset paths work whether the package folder is suffixed (`<Name>.package/<sub>`) or not (`<Name>/<sub>`). 4. **Updates.** `tools.use("zeromind", "updates")` lists installed content with upstream changes available; re-running the install pulls them. 5. **Metadata.** `package.yaml::name` overrides the folder stem if present (rare); `version` + `description` are surfaced in the package index. 6. **Hot reload.** Edits to sub-assets hot-reload as normal; edits to `package.yaml` reload package metadata. ## Discovery - `asset.list("package")` — every registered package. - `asset.inspect("<name>")` — sub-asset catalog, source, this type README. - `ls /zero/source/<Name>.package` lists the files the folder holds. - `library.list()` — the library assets registered in this world, including the ones packages under an installed library contribute. ## Authoring conventions - Name packages by their feature (`voxels`, `cameraRigs`, `dialogSystem`), not by their owner — the host library is the `@<lib>::` scope prefix. - Cluster cohesive sub-assets together. A "character controller" package should ship the controller component, its preset configs, its supporting modules, and a demo scene — not just the component. - Document the package's surface in `README.md` — what install installs, what each sub-asset does, how they relate. Agents reading `cat /zero/source/<Name>.package/README.md` get the full picture in one shot. - Version conservatively — breaking a package means breaking every world that installed it. Use semantic version bumps. ## Common pitfalls - **Missing `package.yaml`.** Without it the folder isn't recognized as a package even if it has a `.package/` suffix. - **A dependency named only by a string the code builds.** A package whose files reach another package only through a name assembled at runtime records no reference to it, so an install arrives without it. List that package under `dependencies` in `package.yaml`. - **Identity collapse.** Sub-asset paths skip the `.package` suffix. Don't include `.package` in `require` strings. ## Referencing inside a package: the `~` rule `~` means **this package**, resolved structurally from the referring file's own location. It is the only package-specific syntax. It is rename-safe (no package name is ever written) and library-agnostic (it never names the host library, so it survives `@builtin` being renamed or the package being mounted elsewhere). `~.tail` maps to `<pkg>.package/tail` from anywhere inside the package. | Referencing from | Use | Example | |---|---|---| | An asset/module **inside this package** | `~.tail` | `require("~.modules.myThing")`, `shader: "~.shaders.myThingBlend"` | | A **different package** under the same root | root-relative identity | `require("@root::systems.otherPkg.modules.x")` | | A **different library's** public API (a deliberate external dependency) | `@otherlib::…` | `require("@physics::modules.rigidbody")` | **Never write `@builtin::` (or any host-library name) to reference your own package** — that couples the package to the library it currently lives in and breaks if the library is renamed or the files move. Use `~.`. It works from Luau `require()` and from asset-reference strings in data files (a material's `mat.yaml` `shader:` field, a component's default asset ref); the engine resolves it against the referring file's own package. `asset.resolve` takes a `~.` name the same way, against the package of the file that calls it: `asset.resolve("~.materials.myThingStandard", "material")`. `~.` is the package-relative self-reference; `@root::` is the root-relative one (the library root, or the world source tree for non-library content). The `core/requiring-modules` guide covers the root model in full. A package that ships substantial functionality should include a `.guide` asset (a `<name>.guide/guide.md` folder anywhere under the package); the `guides` tool discovers it live, so collaborators find the system the way they find built-in guides. A package's test suite reaches the shared `Test` framework through its enclosing asset: `local Test = asset.containing(__FILE__).modules.shared` (`asset.containing` returns the deepest enclosing typed asset, the `.testSuite`, not the outer `.package`). ## Related types - Any of `.component`, `.module`, `.scene`, `.preset`, `.tool`, `.toolbox`, `.material`, `.shader`, `.style`, `.service`, `.importer` — packages bundle these. ## In the Inspector Package: the name, version and description package.yaml declares, how many things the package holds and what they are, and **Open** for package.yaml. A package.yaml that does not decode is listed under Problems with the decoder's error.
▲ 0↑ born
▣
module · born here
❒asset
# yaml.module YAML decode + encode for authored engine content. Pure Luau, no engine dependencies — a general parsing library, not data-system plumbing. ```luau local Yaml = require("@builtin::modules.yaml") local doc = Yaml.decode(vfs.read(path)) vfs.write(path, Yaml.encode(doc)) ``` ## Supported subset - Block mappings (`key: value`) and block sequences (`- item`), nested to any depth. - Compact sequence-of-mapping entries (`- path: x` / ` kind: y`). - Flow collections — `{ a: 1, b: 2 }` and `[1, 2, 3]` — single line. - Plain scalars with type inference: `~` / `null` → nil, `true` / `false` → boolean, numeric literals → number, everything else → string. - Single- and double-quoted strings (`''` escapes a literal quote inside a single-quoted string; `\n` `\t` `\r` `\\` `\"` inside a double-quoted one). A quote opens a quoted scalar where a scalar begins — after `key:`, after a `- ` entry marker, or inside a flow collection — so a plain scalar carries an apostrophe as data (`note: the world's rules`). Quoted keys are read in flow mappings. - `#` comments — honored outside quotes, so a `#` inside a quoted string is kept as data. - Literal (`|`) and folded (`>`) block scalars, with a chomping indicator (`-` strips the final newline, `+` keeps every trailing blank line, none keeps one newline) and an indentation indicator (`1`-`9`: the content's indent past the parent's), in either order (`|-`, `>+`, `|2`, `>1-`). A block scalar's content is literal text: quotes (balanced or not), `#`, `key: value` and `---` inside it are data. - An optional leading `---` document marker. ## Loud-error contract Constructs outside the subset above raise instead of misparsing: anchors/aliases (`&`, `*`), tags (`!`), directives (`%`), multi-document streams (a second `---`), a block-scalar header it cannot read (`|x`, `|-+`, `|0`), tab indentation, and inconsistent indentation (both block structure and block-scalar bodies). Every error carries the offending line number (`yaml: line N: ...`), so a bad config points straight at the line to fix. Tab indentation is rejected everywhere — including block-scalar body lines whose leading whitespace contains a tab. A tab after the first non-space character of a line is content and passes through. ## API - `Yaml.decode(text: string): any` — decode a YAML document into a Luau value (table, scalar, or nil for an empty document). Raises on malformed input or an unsupported construct. - `Yaml.decodeWithComments(text: string): (any, boolean)` — decode as `decode` does, and report whether the text carries a comment by the decoder's own rule: a `#` at a line's start or after whitespace, outside a quoted scalar and outside a block scalar. Re-encoding the value drops such comments, so an editor that writes a document back reads this first. - `Yaml.encode(value: table): string` — encode a Luau table as YAML (block style, two-space indent, alphabetically sorted keys). Raises on values YAML can't represent (functions, userdata, non-string mapping keys). A top-level empty table encodes to an empty document, which decodes back to `nil` (the YAML empty-document ambiguity).
▲ 0↑ born
·
agentskill · born here
❒asset
# interfaces The screen-building skill: author a UI as a styled widget tree the way you write HTML and CSS, register it, and then see it and drive it through the `gui` toolbox rather than reasoning about the tree. Covers the layout and paint model, entrance and idle animation, callbacks that fire in play mode, placing a HUD marker, a name tag or an off-screen edge arrow over a 3D object (projecting a world position to screen coordinates, and the mouse cursor position against the UI), and the build → capture → play → iterate loop that gets a screen from blank to built.
▲ 0↑ born
·
agentskill · born here
❒asset
# debugging Finding out **when** something went wrong in a running world. The job this skill covers is not "what is the current value" — the current value is downstream of the moment that matters. It is: attach an instrument to running code, keep working, and be told the instant the thing happens. It exists because the reflex it replaces does not work. Running something, waiting, and taking a capture aims at a moment you cannot see: seconds pass between the call and the frame, and adding a wait only moves the guess. Polling is the same guess with more steps. Covers: probing a function call, a source line, or a value; using a condition to name the moment rather than every step toward it; reading the state a value was taken in before trusting the value; and cancelling what you armed. The trap it spends the most words on is the expensive one — a right value read in the wrong world, where the match already ended or the scene already swapped, nothing announced it, and every number afterwards means something else.
▲ 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
backing path · skills/modeling.agentSkill

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.