Coldwave Read the docs

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.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
stepintegerHow 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
stepintegerHow 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 r289, 2026-11-30 by the binary itself: do not edit by hand.