Coldwave

Protocol: frame, part 1 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.capture#

frame.capture {width?: integer, height?: integer, overlay?: text, target?: text, view?: record, eye?: record, pose?: record, step?: integer, from?: integer, inputs?: [record], steps?: integer, fill?: value, fast?: value, times?: value} -> {png: png, width: integer, height: integer, view: record, view_size: record, view_projection: [number], game_rect: record, took: record} · read, read-only

Draws the game as it is now, off-screen, and returns the picture: whole, or shrunk to fit inside a width and a height for a client that shows it small.

ParametersTypeMeaning
width?integerThe most pixels across, 1 or more. The picture keeps its shape, the smaller of the two bounds decides, and it is never larger than the frame. A project with filter = "linear" is shrunk smoothly, any other to hard pixels. Left out: no bound. With eye: the picture's width, exactly, 1 to 4096, drawn at that size and never shrunk; left out, the frame's.
height?integerThe most pixels down, 1 or more. Left out: no bound. With eye: the picture's height, exactly, 1 to 4096; left out, the frame's.
overlay?text"physics": every collider's outline, every joint and every contact drawn over the frame, one pixel wide, from what physics.read answers. Grey is static, blue kinematic, green dynamic, yellow a mover, pink a sensor, orange a one-way platform, white a joint and red a contact. "skeleton": the bones of every thing a 3D game poses (a Pose on a model with bones), as the pose drawn places them, a pose asked for the picture's too: a yellow (ffec27) line from each bone to the bone above it and a white 3-pixel square at each joint, over everything, one pixel wide; refused in a game with no rigged model. Left out: the frame alone.
target?textOne of the frame graph's own targets, by its name in the project's [render], as the frame left it, in place of the frame: what a pass drew before an effect read it. A 16-bit float target is cut to 0 to 1. Not with overlay, and not with eye, whose picture keeps none. Left out: the frame. render.passes lists the targets.
view?record{left, bottom, right, top}: a rectangle of the world in world units, y upwards as frame.view gives it, drawn in place of what the game's camera shows: what an editor that sees more than the camera, or less, shows. The picture is the rectangle's shape, at the frame's own pixels to a world unit as the camera's zoom gives them, its longer side at most 4096 (then smaller, keeping its shape), before width and height shrink it. What is on the screen (the interface, a Screen thing) is drawn on the camera's rectangle at the camera's scale, never stretched over the view. The game is not changed: the same step, the same checksum. Not with overlay or target. In a 3D game E0449: it is looked at from an eye. Left out: what the camera shows, as ever.
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.
step?integerA step to draw in place of the game as it stands: the picture a game.seek to that step would show, without seeking. The run is the one a seek winds through, the game loaded from its files and stepped on its recording (at rest past its end), not input held live; the engine plays it aside from the moment it keeps nearest at or before the step (else from the start, on a game loaded aside from the same files) and draws that world, with eye, pose, view and the rest as for any picture. The game is not moved: its step, world, checksum and kept moments and snapshots are as they were. Refused past the furthest of the steps the session has played, its recording's end and its replay's. Its cost is the replay: about a step's time a step from the moment it starts at.
from?integerA snapshot's id (game.snapshot): draw the game a game.try of inputs from it would leave, without moving the game, byte for byte what that try then a capture shows. Played aside: the game's step, world, checksum, kept moments and snapshots are as they were, and eye, pose, view and overlay combine as for any picture. Refused when the game has had a change since the snapshot that playing the inputs does not make again: a client's change at a step inside the stretch (named, with its step and command), or a script's code swapped since. Not with stepStep. Its cost is the replay: a step's time a step, and a copy of the world each way.
inputs?[record]With from: the input to play from the snapshot, as game.try takes it, one {steps, ACTION: value, ..., player} per stretch. Left out: none, every player at rest.
steps?integerWith from: how many steps to play, each player at rest past their own inputs. Left out: as many as the longest player's inputs come to.
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.
fast?valuetrue: the PNG is written 25 to 35 times faster and is a tenth to a fifth larger, with the same pixels; for a picture shown live and thrown away. Left out: as small as it can be.
times?valuetrue: the answer says what the picture took, as took. Left out: false.
ResultTypeMeaning
pngpngThe frame as a PNG file, in base64.
widthintegerThe picture's width in pixels.
heightintegerThe picture's height in pixels.
viewrecordThe part of the world the picture shows, {left, bottom, right, top} in world units, as frame.view gives it: the world at the picture's edges, whatever size it is shrunk to. With view, the view asked: the rectangle the picture shows, to its edges. null with eye: its picture shows no rectangle of a flat world, and view_projection says what it shows.
view_sizerecord{width, height}: with view, the picture's size in pixels as it was drawn, before width and height shrink it: the frame's own pixels to a world unit at the camera's zoom, unless the longer side would pass 4096 (then fewer, the same each way). Pixels of frame.at, frame.in and blame.pixel with the same view are of this size. null without view.
view_projection[number]In a 3D game, the 16 numbers the meshes of this picture were drawn with: 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.
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.
tookrecordWith times true: {draw, read, encode, text}, what the picture took in milliseconds: its drawing, submitted (the device's wait is in read); its read back from the device, with the physics drawn over it and its shrinking; its PNG; and its base64 text. Time is not part of the game and differs from run to run. Left out without times.

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