five-on-it / packages/catalogue/src/city/spec
packages/catalogue/src/city/spec
The level spec of the city template (version 1): a city drawn freely, as Riverbend is, written as data. Its streets are roads of six classes (and its roads out in the country, country roads and dirt tracks, two more) drawn through points, splines by default, that start and end on each other, at a roundabout's arm, on a grid's lines or along a river's bank; turned grids lay out a quarter's streets; rivers cross the map (a road over one gets a bridge); hills rise outside the town (a road ending at a hill's top climbs it, a road tunnel runs under it); the town's own ground may rise and fall (relief: rises and slopes its streets climb and its buildings stand on, on pads); lakes lie in it; districts take the lots nearest their seed, each built and dressed in a style (styles.json, Riverbend's thirteen quarters), one of them perhaps a walled compound; parks, greens and squares are areas. solve.ts resolves it into a plan or says, at its path, what it cannot build.
Everything is in the game's frame and in metres: a point is [x, z] with x growing westward (east is −x) and z northward, the map's middle at [0, 0]; a bearing is a compass's (0 north, 90 east). See The city spec.