Coldwave

Protocol: frame, part 2 of 2#

The frame commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to all commands.

frame.at#

frame.at {x: integer, y: integer, view?: record, eye?: record, pose?: record, width?: integer, height?: integer} -> {step: integer, x: integer, y: integer, hits: [record], drawn: record} · read, read-only

Says what is drawn at a pixel of the frame: every entity that draws there, the one in front first. It asks the batch a frame is drawn from, so it needs no graphics device, takes no picture and changes nothing. In a 3D game it also says each thing the ray through the pixel meets, by its collider or else its mesh's box, the nearest first. What an editor asks to pick the thing under the pointer.

ParametersTypeMeaning
xintegerThe pixel's column, 0 at the frame's left edge, as in a frame.capture at full size.
yintegerThe pixel's row, 0 at the frame's top edge.
view?record{left, bottom, right, top}, as frame.capture takes it: x and y are then pixels of that picture at its full size (before width and height shrink it), and boxes are counted in them too. Left out: pixels of the frame.
eye?recordIn a 3D game, {at: [x, y, z], turn: [x, y, z, w], fov?, near?, far?, ortho?}: a place the game is looked at from in place of its Camera, for this answer only: what an editor that looks around a paused game draws, picks and measures through. at is in the world; turn is a quaternion as a Transform's qx to qw, one long (made so within a hundredth, refused beyond), looking along its own -z with +y up; fov (degrees bottom to top, 1 to 179), near (0.0001 or more) and far (more than near, or 0 for none) are the game Camera's where left out. ortho, in place of fov, is a picture with no perspective (a Top, Front or Side view): how many world units it shows from its bottom to its top, more than 0; its far end, where far is 0 or the Camera's is, is 10000 past near, its view_projection has w 1 everywhere, and a hit's distance is then measured along the way the eye looks, from the plane it is in. The picture is width by height pixels, the command's own (1 to 4096 each, the frame's where left out), drawn at exactly that size, and fov and ortho are held from bottom to top whatever its shape, so a wider picture shows more to the sides. The answer's view_projection is this eye's and that shape's, and frame.at and frame.in ask the picture it shows. What the layers draw (a HUD) is the game's own view and is left out: not drawn, and no hit. Nothing is written or kept: the world, its checksum, the input and the next answer without an eye are as they were. E0449 in a 2D game, whose view is a rectangle.
pose?recordIn a 3D game, {entity, clip, time?}: one thing (by name or id, with a Mesh whose model has clips) drawn time seconds (0 or more; left out 0) into one of its model's clips, for this answer alone, in place of what its Pose says: what an editor scrubbing a clip on a thing in the game shows. Nothing is written: the world, its checksum, its Pose and what the recording replays are as they were, and the next answer without it draws the Pose again. A clip that goes round is drawn round, one that does not holds its end, as a Pose plays it. Picking (frame.at, frame.in) meets things by their box at rest, with or without it. Refused (BadParams) for a thing with no Mesh, a model with no clips, or a clip its model has not, naming its clips.
width?integerWith eye: the width in pixels of the picture it is asked about, 1 to 4096, as a frame.capture with the same eye, width and height draws it: the pixels counted, the boxes and view_projection are that picture's. Left out: the frame's. Without eye it is refused: the game's own picture is the frame's size.
height?integerWith eye: the picture's height in pixels, 1 to 4096. Left out: the frame's.
ResultTypeMeaning
stepStepintegerHow many fixed steps have run.
xintegerThe column asked.
yintegerThe row asked.
hits[record]One {entity, name, kind, tile, node, layer, alpha, coverage, added, fills, box, turned, pass, material} per entity that draws at the pixel, the one in front first; none where only the background shows. kind is the component it draws there with: "Rect", "Sprite", "Text", "Tilemap" or "Shape"; an entity that draws with two is there twice. A sprite counts only where its picture is not clear, a text where a letter has ink. tile is null, or for a Tilemap {column, row} of the tile there: column 0 is the left one and row 0 the first line of rows. node is true for an interface node (an entity with a Node; ui.tree says what it is). layer is the layer it is drawn in. alpha is how much it covers of what is behind it at the pixel, 1 to 255: its colour, its Opacity and its picture there; nothing that covers 0 is listed. coverage is its picture's own alpha at the pixel, 1 to 255, and 255 for what draws with no picture: a client that wants to pass through nearly clear pixels compares this. added is true when it is added to what is behind and hides nothing. fills is the share of the frame, 0 to 1, that the box around everything the entity draws with that component covers: a backdrop is near 1. box is that box, {x, y, w, h} in the frame's pixels with x and y its top-left corner, counted as the pixel asked is: it stands upright around a thing that is turned, is not cut at the frame's edges (x and y may be below 0), need not be whole numbers, and for a Tilemap is around the tiles that touch the frame. turned is for a thing that is turned (a Rotation): {x, y, w, h, angle}, the box around the same, measured along its own sides as it would stand unturned about its own middle and counted as box is, and the turn about that middle in degrees, anticlockwise as the picture shows it, above -180 and up to 180, to three places. Turned so, it is where the thing is drawn, its Scale and Pivot in it: an editor draws it as the thing's outline. turned is null for what is not turned (a whole turn is none), for a Text and a Tilemap, and where what the entity draws with that component is not all turned alike: then box is its outline. pass is the frame graph's pass that draws its layer (render.passes lists them), null when none does; material is what it is drawn with: "sprite", the built-in material every quad has. In a 3D game the things themselves come after what the layers draw over the meshes, the nearest first: each thing the ray through the pixel's middle meets between the camera's near plane and its far one, by its Collider as physics.read gives it (kind "Collider"), else by the box around its Mesh's model where its parents put it (kind "Mesh"); a thing with neither is not met, nor one the ray starts inside. Such a hit has projected true, point, [x, y, z] where the ray meets it in the world, and distance, from the camera to there; its box is around what frame.view's view_projection makes of the box about it, cut at the near plane and the far one only, so a thing that passes the camera has a very large one; layer is 0, alpha and coverage 255, tile and turned null, pass the meshes' pass for a thing with a Mesh and else null, material its Mesh's or null; box, fills, point and distance are to three places. It also has part: for kind "Mesh", {index, mesh, primitive, material, point, distance}, the first triangle of the model the same ray meets, whichever way it faces, as the model stands in its file (nothing moves its corners): index the part among the model's parts as they are drawn (its primitives of one material are one part), mesh the name of the mesh the triangle came from (its node's name in the glTF file, else its mesh's, else "mesh N"), primitive that primitive's place in the mesh, material its material's name in the file ("material N" where the file names none, null for a primitive with no material), point and distance where the triangle is met, at or behind where the box is; null when the ray is in the box and meets no triangle, so nothing of the model is drawn at the pixel, and null for kind "Collider".
drawnrecordIn a 3D game, what is drawn at the pixel: of every thing with a Mesh, the triangle the ray through the pixel's middle meets first past the near plane, as the thing is drawn (its matrix, its pose's shapes), whatever colliders the game has: {entity, name, part (its place among the model's parts as drawn), mesh and primitive (of its file), triangle (its place among the primitive's), material (its name, or null), masked (its material cuts out under an alpha, which is not looked at), lod (the level of detail drawn at the pixel: 0 the model's own file, 1 or 2 its .lod1/.lod2 beside it; in a band where two are drawn, the one whose screen door keeps this pixel), point, distance}. The device decides a pixel on a triangle's very edge. And how it is lit, as the lit pass works it out (frost_gfx::lit, the pass's twin, held to the device's pixel within one level): light, one {name, kind, share, why} for every light of the game (ambient, sky, sun, point, spot; reflection for the sky mirrored by metal; glow for the surface's own and inherited emission; fog, an independent Fog without Sky, or haze, the Sky's, when it fades the point into its horizon: its share is how far, the lights' theirs of what it leaves), share its part of the pixel's brightness before it is cut to 1 (they sum to 1), why the frame's words ("in shadow" from the sun's shadow map read where the pass reads it, "faces away", how far, "outside its cone"); a point or spot light that gives the pixel nothing because it is off, not among the sixteen the picture chose, or too far away is left out of light and counted in lights_left_out, {off, not_drawn, out_of_reach}; color, the pixel the twin works out [r, g, b]; Material roughness, metal, inherited tint and emission follow the shader. With transparency, color is the premultiplied sRGB surface contribution, cover is its coverage, and light shares describe only that surface; the destination behind it remains unread. unread names the missing calculations and texture samples (white or a flat normal is used for a missing sample), so color and shares are partial while unread is nonempty. Null where no mesh is drawn; a 2D game's answer has none.

frame.in#

frame.in {x: integer, y: integer, w: integer, h: integer, view?: record, eye?: record, pose?: record, width?: integer, height?: integer} -> {step: integer, x: integer, y: integer, w: integer, h: integer, hits: [record]} · read, read-only

Says what is drawn inside a box of the frame: every entity that draws something whose box touches it, the one in front first. By boxes only: a sprite is there though its picture is clear where the box is. In a 3D game it also says each thing whose box, as the camera projects it, touches the box asked. What an editor asks to select with a rubber band.

ParametersTypeMeaning
xintegerThe box's left column, a pixel of the frame as frame.at counts them.
yintegerThe box's top row.
wintegerIts width in pixels, 1 or more. A box that runs past the frame is cut at its edge.
hintegerIts height in pixels, 1 or more.
view?record{left, bottom, right, top}, as frame.capture takes it: x and y are then pixels of that picture at its full size (before width and height shrink it), and boxes are counted in them too. Left out: pixels of the frame.
eye?recordIn a 3D game, {at: [x, y, z], turn: [x, y, z, w], fov?, near?, far?, ortho?}: a place the game is looked at from in place of its Camera, for this answer only: what an editor that looks around a paused game draws, picks and measures through. at is in the world; turn is a quaternion as a Transform's qx to qw, one long (made so within a hundredth, refused beyond), looking along its own -z with +y up; fov (degrees bottom to top, 1 to 179), near (0.0001 or more) and far (more than near, or 0 for none) are the game Camera's where left out. ortho, in place of fov, is a picture with no perspective (a Top, Front or Side view): how many world units it shows from its bottom to its top, more than 0; its far end, where far is 0 or the Camera's is, is 10000 past near, its view_projection has w 1 everywhere, and a hit's distance is then measured along the way the eye looks, from the plane it is in. The picture is width by height pixels, the command's own (1 to 4096 each, the frame's where left out), drawn at exactly that size, and fov and ortho are held from bottom to top whatever its shape, so a wider picture shows more to the sides. The answer's view_projection is this eye's and that shape's, and frame.at and frame.in ask the picture it shows. What the layers draw (a HUD) is the game's own view and is left out: not drawn, and no hit. Nothing is written or kept: the world, its checksum, the input and the next answer without an eye are as they were. E0449 in a 2D game, whose view is a rectangle.
pose?recordIn a 3D game, {entity, clip, time?}: one thing (by name or id, with a Mesh whose model has clips) drawn time seconds (0 or more; left out 0) into one of its model's clips, for this answer alone, in place of what its Pose says: what an editor scrubbing a clip on a thing in the game shows. Nothing is written: the world, its checksum, its Pose and what the recording replays are as they were, and the next answer without it draws the Pose again. A clip that goes round is drawn round, one that does not holds its end, as a Pose plays it. Picking (frame.at, frame.in) meets things by their box at rest, with or without it. Refused (BadParams) for a thing with no Mesh, a model with no clips, or a clip its model has not, naming its clips.
width?integerWith eye: the width in pixels of the picture it is asked about, 1 to 4096, as a frame.capture with the same eye, width and height draws it: the pixels counted, the boxes and view_projection are that picture's. Left out: the frame's. Without eye it is refused: the game's own picture is the frame's size.
height?integerWith eye: the picture's height in pixels, 1 to 4096. Left out: the frame's.
ResultTypeMeaning
stepStepintegerHow many fixed steps have run.
xintegerThe box's left column.
yintegerIts top row.
wintegerIts width, cut at the frame's edge.
hintegerIts height, cut at the frame's edge.
hits[record]One record per entity and component, as frame.at gives them, with coverage and tile null: no one pixel is meant, and alpha is the most the entity's own colour and Opacity give, without its picture. In a 3D game, also every thing whose projected box, as frame.at gives it, touches the box asked, the nearest part first, with projected true and no point or distance.

frame.view#

frame.view {eye?: record, width?: integer, height?: integer, fill?: value} -> {step: integer, width: integer, height: integer, passes: [text], view: record, view_projection: [number], game_rect: record} · read, read-only

Says how big the frame is and which part of the world it shows, as the game's camera looks now. It draws nothing, needs no graphics device and changes nothing. With eye, in a 3D game, as it is looked at from there. What an editor asks to put a point of the world on the picture, or a pixel of the picture in the world.

ParametersTypeMeaning
eye?recordIn a 3D game, {at: [x, y, z], turn: [x, y, z, w], fov?, near?, far?, ortho?}: a place the game is looked at from in place of its Camera, for this answer only: what an editor that looks around a paused game draws, picks and measures through. at is in the world; turn is a quaternion as a Transform's qx to qw, one long (made so within a hundredth, refused beyond), looking along its own -z with +y up; fov (degrees bottom to top, 1 to 179), near (0.0001 or more) and far (more than near, or 0 for none) are the game Camera's where left out. ortho, in place of fov, is a picture with no perspective (a Top, Front or Side view): how many world units it shows from its bottom to its top, more than 0; its far end, where far is 0 or the Camera's is, is 10000 past near, its view_projection has w 1 everywhere, and a hit's distance is then measured along the way the eye looks, from the plane it is in. The picture is width by height pixels, the command's own (1 to 4096 each, the frame's where left out), drawn at exactly that size, and fov and ortho are held from bottom to top whatever its shape, so a wider picture shows more to the sides. The answer's view_projection is this eye's and that shape's, and frame.at and frame.in ask the picture it shows. What the layers draw (a HUD) is the game's own view and is left out: not drawn, and no hit. Nothing is written or kept: the world, its checksum, the input and the next answer without an eye are as they were. E0449 in a 2D game, whose view is a rectangle.
width?integerWith eye: the width in pixels of the picture it is asked about, 1 to 4096, as a frame.capture with the same eye, width and height draws it: the pixels counted, the boxes and view_projection are that picture's. Left out: the frame's. Without eye it is refused: the game's own picture is the frame's size.
height?integerWith eye: the picture's height in pixels, 1 to 4096. Left out: the frame's.
fill?valuetrue: the game's own camera draws the frame into a picture of exactly width by height pixels (both needed, 1 to 4096) with no bars: the frame in the middle, as large as fits at its own shape, its interface laid out in it as ever, and beside it what the same camera sees on (in 3D, its meshes, the camera's field of view held within the frame), so the frame's part is the game's own picture. game_rect says where it is. Not with eye, view, target or overlay. Left out: false.
ResultTypeMeaning
stepStepintegerHow many fixed steps have run.
widthintegerThe frame's width in pixels, as frame.at counts them and frame.capture draws them at full size; with fill, the picture's.
heightintegerThe frame's height in pixels.
passes[text]The frame graph's passes that run, in order, by name: one, "layers", for a project with no [render]. render.passes says what each does.
viewrecord{left, bottom, right, top}: the world's x at the frame's left and right edges and its y at its bottom and top edges, in world units, y growing upwards. A point of the world at x, y is at the pixel ((x - left) / (right - left) * width, (top - y) / (top - bottom) * height). With no Camera the world and the frame are the same; with one, the Camera's Transform is at the frame's middle and its zoom, when above 0, shows that many times less. What is on the Screen is placed in the frame's own pixels: the camera does not move it.
view_projection[number]In a 3D game, the 16 numbers a frame.capture of the frame at its own shape draws its meshes with now: the matrix from the world to clip space, its four columns one after another (column-major), multiplied with a point (x, y, z, 1) on the right. After the divide by w, clip x and y from -1 to 1 span the whole picture, bars included, x to the right and y up, so a point is at the pixel ((x + 1) / 2 * width, (1 - y) / 2 * height); depth is reversed, 1 at the camera's near plane and 0 at its far one (or towards 0 for ever with no far plane), and a point behind the camera has w at or below 0. It is the camera of the step drawn, paused or sought to as it is; a pass that bends the picture (panini) moves its pixels from where this puts them. Left out in a 2D game, whose view says it. With fill, the filled picture's.
game_rectrecordWith fill: {x, y, w, h}, where the frame stands in the picture, in whole pixels from its top left; the rest is what the camera sees beside it. Left out without fill.

Generated from Coldwave 0.0.1 r335, 2026-11-30 by the binary itself: do not edit by hand.