Arc-Spline Transport

Every right-of-way is an arc spline; roads and rail are bundles of one or more of them.

Microscopic SimulationEngine & ToolingTransportEconomy

Core Model

One right-of-way = one arc spline — the CAGD term (Bolton 1975; Meek & Walton) for a tangent-continuous (G1) piecewise curve of circular arcs and straight line segments, a line segment simply being the infinite-radius special case of an arc. Straight segments cover the common case (a plain block-length street); finite-radius arcs are inserted only where the player actually curves the road. Curvature is well-defined everywhere, constant-width offsetting is trivial on both segment types, and the whole curve is cheap to sample by arc length.

Bundles

Editing Model

  1. Player sketches a centerline as a rough polyline.
  2. Auto-fit to a piecewise arc spline: near-straight runs stay line segments, curved runs get tangent-continuous arcs inserted (curvature-bounded per road class).
  3. Lane offsets are derived from the fitted centerline + bundle’s lane count/width.

Curvature Bound

Minimum radius per road class is the AASHTO formula R_min = V² / (15 × (e_max + f_s)), re-tightened live as the player adjusts a segment's speed limit. Exact e_max/f_s assumptions per class are being tuned.

Intersections

Bundle endpoints resolve into a junction node; turn lanes are generated as short connector arc-splines between incoming/outgoing lane endpoints — no separate hand-authored intersection meshes.

Data Model

Entity Fields
LaneSpline segments[] (each a Line or Arc), width, direction, speedLimit
Bundle lanes[], classification (street/avenue/highway/rail)
Junction incoming/outgoing lane refs, generated connectors
RouteGraph nodes: Map<string, RouteNode>, adjacency: Map<string, RouteEdge[]>
RouteEdge fromNodeId, toNodeId, spline, length, speedLimit, modes: ("walk" | "drive")[]
Route legs: RouteLeg[], totalLength, estimatedDuration, mode

Pathfinding & Route Graph Architecture

The transport network provides the topological routing substrate for all simulated city mobility. Pathfinding operates directly on a directed RouteGraph extracted from lane bundles and junction turn connectors.

Graph Construction & Mode Allocation

Origin/Destination Snapping & Parcel Access

Arbitrary 2D world points (building entrances, parcel centroids) connect to the network via geometric snapping (Spline.prototype.closestPoint):

A* Shortest-Travel-Time Search

Pathfinding evaluates the minimum-travel-time path using travel time ($t = \text{length} / \text{speed}$) as edge cost, guided by an admissible Euclidean heuristic ($h = \text{distance} / v_{\max}$). The search stitches together an origin driveway access leg, start lane remainder, intermediate lane and connector edges, end lane prefix, and destination driveway access leg into a continuous, composite Route.

Off-Thread Web Worker Solver

Route graph construction and A* queries run asynchronously on a dedicated Web Worker (transport.worker.ts) via a typed IPC bridge (TransportService / WorkerClient). To guard against prototype stripping across postMessage structured cloning, bundles and junctions are transmitted as plain serialized descriptors (SerializedBundle[], SerializedJunction[]) and rehydrated into graph topology worker-side.

Deterministic Traversal & In-View Frustum Embodiment

Background agent commuting progresses deterministically along route splines via a numerical step function (advanceAlongRoute). To eliminate 3D scene-graph overhead for off-screen trips:

Downstream Ties

Lane-spline geometry drives procedural road materials/markings (see Production & Materials docs) and gives traffic agents a cheap arc-length parameterization to move along (see Citizen Simulation doc).

Economy & Zoning

Because every right-of-way in the game is an arc spline (or a bundle of them), any reachable relationship between parcels in the city is mediated by the transport graph — there is no off-road movement. Roads, rail, bike paths, sidewalks, and future transit modes are all built from these arc splines, and an agent's path between two parcels is a route through whatever modes of that graph are available to them.

This means the economy & zoning sim does not have a spatial notion of "nearby." Its data store models the city as a graph of parcels keyed by ID, and the only meaningful proximity is network-reachability within a travel-time budget. Once the citizen simulation exists, that will look like:

In short: the transport network is the city's connective tissue for both traffic and the macroeconomy. Equity in transit coverage is an economic lever, not a flavor mechanic — a commercial zone that is only reachable by car is invisible to the poor households on the other side of town.

Future Work

Open Questions