Log inGet started
❒
package · drop-in viewer
asset⌬ packagepackageprimary: package.yaml·originates fromworld 0a0b119f-a…

cityKit

A city as a function of a seed and a set of rules. Nothing in it belongs to one game: a game supplies rules (data) and gets back data, geometry and answers.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

cityKit

A city as a function of a seed and a set of rules. Nothing in it belongs to one game: a game supplies rules (data) and gets back data, geometry and answers.

ModuleWhat it is
cityKit.planThe plan: Plan.plan(seed, i0, i1, j0, j1, rules) gives the road graph (nodes, edges with class, carriageway and pavement), superblocks, blocks (convex polygons with their kerb and building lines), lots (oriented rectangles with district, use, storeys, what stands at each side), the river's water, quays and bridges, a park, the plan's outline. A larger rectangle adds city and never changes what was there.
cityKit.massingWhat is built on a lot: Massing.program(lot, districtName, buildRules) gives one building's program for a kit-of-parts generator (kit, footprint, tiers with setbacks, seed, placement, colours, boxes). Sizes snap to the kit's bay and heights to a ladder, so thousands of lots ask for a few hundred different buildings.
cityKit.streetsThe ground as geometry: Streets.build(plan, look, { toWorld, level }) gives, by superblock, the roadway, kerbs and pavements with rounded corners, crossings, stop lines and lane lines, the river with quay walls and parapets, bridges on arches, the city's edge; and the walls that stop a body. It draws nothing.
cityKit.queryThe plan at run time: Query.new(plan) answers what stands at a point (district, block, lot, surface), gives roads as lanes and pavements, routes, lots by use, spawn points, and pushes a body out of buildings and parapets.
procPacks/city.procPackThe op city.plan: the same plan as procGen PointClouds (lots, roads, areas) with attributes, for graphs to build on.
graphs/CityPlan.procGraphThat op as a graph with exposed inputs (seed, rectangle, rules as JSON).
tests/cityKitPlan.testSuiteThe plan's promises, checked in the engine.

How a plan is made (and how a game steers it)

  • Avenues stand on an endless lattice. The seed moves every crossing off the square (a jitter, two long bends), so superblocks are different quadrilaterals and avenues turn at their crossings. A game pins what it designs: whole lines (rules.arterial.lines), single crossings (rules.arterial.nodes["i,j"] = { x, z }: the way to trace the avenues of a real city), a calm zone (rules.arterial.calm).
  • A river is optional (rules.river = { axis, index, width, quay }, or nil for none): one row or column of the lattice is water; the avenues along it are quays, the avenues across it bridges.
  • Districts are placed by the game (rules.zones, rules.park.ring) and fall by a seeded Voronoi elsewhere. Each has its own block size, street profile, lot frontage and depth, building module, storeys, uses, green share.
  • Streets cut each superblock from gate to gate. Gates are places along a road fixed by the seed alone, so the streets of two districts meet each other across an avenue.
  • Lots stand in rows along each side of a block, whole modules wide and deep; the block's middle is its yard.
  • Skyline (rules.skyline): points round which a district's storeys climb to its most.
  • Landmarks (rules.landmarks): named squares and gardens where the game wants them.
  • A park (rules.park = { i, j, ring, walk }): one superblock left open, its corners unmoved, the eight superblocks round it one district.

Plan.DEFAULT_RULES shows every field. A complete game configuration is metropolis.config in the Painted Metropolis world.

Frames and units

Metres. The plan's frame is x east, z north (counter-clockwise polygons have their inside on the left). A lot's front runs from (ox, oz) along the unit vector (ex, ez) for w metres and the lot goes d metres deep along (-ez, ex); the street is on the other side of its front. A game that lays the plan elsewhere in its world gives toWorld to Streets.build and converts at its own edge for Query.

Run-time interface for a game (cityKit.query)

local q = require("cityKit.query").new(plan)
local index, name = q:districtAt(x, z)                    -- which district a point is in
local what, thing = q:surfaceAt(x, z)                     -- "road" | "pavement" | "lot" | "yard" | "square" | ...
local edge, t, dist, side = q:nearestEdge(x, z, 40)       -- the road beside a point
for _, lane in q:lanes(edge) do ... end                   -- each lane's middle line, in the way it is driven
for _, walk in q:pavements(edge) do ... end               -- each pavement's middle line
local path = q:route(fromNodeId, toNodeId)                -- shortest way by road
local shops = q:lotsByUse("shop", index)                  -- lots by use (and district)
local cars = q:spawnPoints("kerb", 40, seed)              -- "lane" | "kerb" | "pavement" | "door"
local x2, z2, moved = q:push(x, z, radius)                -- out of buildings' feet and parapets

The graph itself is plan.nodes ({ id, x, z, edges }) and plan.edges ({ id, a, b, ax, az, bx, bz, len, cls, half, walk, lanes, line, district }); traffic drives on the right (lanes gives each direction's lanes).

Status

Run and tested in the engine (Zero): the plan's suite passes; the ground, massing and query are exercised by the Painted Metropolis (paintedValley.city.city). Not yet done: curved (arc) avenues between crossings, islands in the river, coasts; streets are straight between gates.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

This asset doesn't declare a schema or structured payload.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.