Reference

The moveby command

The package has one command, moveby build. It turns a scene, a road and an atlas file into a track. It runs in Node 22 or later, and it needs nothing else at run time: the scene compiler is bundled into it.

Usage

Terminal
$ npx moveby build
moveby build: a scene file and a road file are required
usage: moveby build <scene.moveby> <road.json> [atlas.json] [--out <dir>] [--watch]
  • scene.moveby is the scene, a program in moveby-lang.
  • road.json is the road. Its keys are in the reference.
  • atlas.json is the image description. It is optional: a page with no image, no field and no sign needs none. Its keys are in the reference.
  • --out <dir> writes the three outputs into a folder. Without it they sit beside the scene.
  • --watch builds again after each burst of saves, and never for its own writes.

What it writes

  • track.bin holds the road, the atlas grids and the font, as bytes.
  • scene.wasm holds the compiled scene. Your page calls it once in every frame.
  • track.d.ts holds the scene's inputs as a TypeScript type. This is the one for the Quick Start scene:
track.d.ts
// Generated by moveby from the scene module. Do not edit: build the scene again.

/** The dynamic inputs, one number each per frame: `scene.draw(dynamic)`. */
export interface SceneDynamic {
  position: number;
}

/** The using inputs the page gives once: `loadTrack(trackBytes, sceneBytes, { using })`. An asset is not among them: `asset()` declares it. */
export interface SceneUsing {
}

A build writes each file whole or not at all. A build that fails leaves the earlier outputs as they were.

Diagnostics

A fault is one line: the file, then a code, then a reading of the fault. A fault in a JSON file names the path inside it. A fault in a scene can name a line. A line with the time and the count of faults closes the output.

Terminal
$ npx moveby build scene.moveby road.json
scene.moveby  SCENE_COMPILE  m - unknown name `m`
Terminal
$ npx moveby build scene.moveby road.json
road.json#/route/gps  ROUTE_HEIGHT  2 of 3 points have a height: give a height on every point, or on none
Terminal
$ npx moveby build scene.moveby road.json
scene.moveby  SCENE_NAME  An out field of the scene is not camera_x or camera_y. (sun_height)

Exit status

StatusMeans
0the three files are written
1the build found at least one fault in a file, and wrote nothing
2the command line is wrong, or a file cannot be read

The runtime has its own codes. The error page lists every one of them.