Reference

The road file

road.json describes the ground the ride runs on: the route, its lanes, and the fields beside it. The tables below list every key of its schema, with its type, its default and its meaning. The site reads them from the schema file when it builds.

The road of a moveby page: its route, its lanes and its fields. This schema holds the rules of shape. The reader (packages/moveby-build/src/road.ts) adds the rules a schema cannot say, each with its own code.

road.json
{
  "version": 1,
  "route": {
    "segments": [
      { "length": 120 },
      { "length": 60, "turn": 45 },
      { "length": 150, "rise": 6 },
      { "length": 80, "turn": -90, "rise": -2 },
      { "length": 200 }
    ]
  },
  "lanes": [
    { "from": 0, "count": 2, "color": "#ffd400" },
    { "from": 180, "count": 3, "divider": "solid" },
    { "from": 400, "count": 2, "dash": [2, 6] }
  ],
  "fields": {
    "tiles": { "grass": 0, "sand": 1, "rock": 3 },
    "along": [
      { "from": 0, "left": "grass", "right": "grass" },
      { "from": 250, "right": "sand" },
      { "from": 450, "right": "rock" }
    ]
  }
}

The Quick Start walks through this file.

Which way turn goes

turn counts clockwise, seen from above. A positive turn goes right. A negative turn goes left.

moveby road

The road of a moveby page: its route, its lanes and its fields. This schema holds the rules of shape. The reader (packages/moveby-build/src/road.ts) adds the rules a schema cannot say, each with its own code.

KeyTypeDefaultMeans
$schemastring——
version
required
integer = 1——
route
required
route—One form only: `segments` (length, turn, rise) or `gps` (lat, lng, height). The reader gives ROUTE_FORM when a file has both or neither.
laneslanes—The lane change list. Each entry runs from its `from` to the next entry's `from`; the last entry runs to the route's end. A `from` is metres along the route.
fieldsfields—The ground beside the road. `tiles` names the tiles of the field atlas by their cell. `along` is the field change list. The grid of the atlas is not here: it lives in atlas.json.

route

One form only: `segments` (length, turn, rise) or `gps` (lat, lng, height). The reader gives ROUTE_FORM when a file has both or neither.

KeyTypeDefaultMeans
segmentsarray of segment——
gpsarray of point——

segment

One road segment. `length` in metres, at least 0.01 (the track file holds centimetres). Every metre value is at most 10 000 km: the track file holds it as a 32-bit count of centimetres. `turn` in degrees over the segment, positive clockwise (a right turn). `rise` in metres.

KeyTypeDefaultMeans
length
required
number, 0.01 to 10000000——
turnnumber, -360 to 3600—
risenumber, -10000000 to 100000000—

point

One GPS point. `height` in metres. The reader gives ROUTE_HEIGHT when some points have a height and some do not.

KeyTypeDefaultMeans
lat
required
number, -90 to 90——
lng
required
number, -180 to 180——
heightnumber, -10000000 to 10000000——

laneEntry

One lane change. `count` is the number of lanes (default 2). An entry with the defaults alone (2 lanes, dashed, white, 3/9) closes the lanes here: the road is the default from `from` on, and the entry writes no lane span.

KeyTypeDefaultMeans
from
required
number, at least 0——
countinteger, 1 to 82—
divider"dashed" | "solid" | "double""dashed"—
colorstring, matches ^#[0-9a-fA-F]{6}$"#ffffff"The divider's colour, #rrggbb.
dashdash[3,9]The painted and the gap length of a dashed divider, in metres. The engine carries it for every divider; it draws it for a dashed one only.

fields

The ground beside the road. `tiles` names the tiles of the field atlas by their cell. `along` is the field change list. The grid of the atlas is not here: it lives in atlas.json.

KeyTypeDefaultMeans
tiles
required
object of integer, 0 to 65535——
along
required
array of alongEntry——

alongEntry

One field change. An entry names the sides that change: a side it does not name keeps its span, a side it names with null has no field from `from` on. A named side's span runs from `from` to the next entry that names that side, or to the route's end.

KeyTypeDefaultMeans
from
required
number, at least 0——
lefttile—A tile of `fields.tiles`, or null: no field on that side.
righttile—A tile of `fields.tiles`, or null: no field on that side.