Any City Generator · Documentation

Generating Cities and Regions

A city starts from a preset, a size and a seed. The generator lays out the streets and spawns one road network actor, which builds its roads, lanes and city blocks. Towns, countryside and the highways between them come from the same panel and join at their ports. This article covers the presets, size and seed, placement, the city highway, rural areas, corridors, growing a region, the blocks left for buildings and generating at runtime.

← All Any City Generator documentation

1 · Presets

A preset is a kind of city

Open Tools > Any City Generator > Any City Generator and pick a Preset. The stock presets are data assets in /AnyCityGenerator/Data/AnyCity/Presets: five make towns, three make the land and roads between them.

▾ Preset → what it makes

DA_City_Town A planned small town: a grid with an arterial on every fourth line and no highway
DA_City_Metro A planned city: a grid with roundabouts and an elevated highway. The panel's default
DA_City_Radial Arterial spokes from a centre roundabout through rings of streets
DA_City_Organic An irregular, grown town: uneven blocks, curved streets, and T, Y and skewed junctions inside a ring road
DA_City_Village A sparse organic village with a rural through road and no ring road, from 1 × 1 to 5 × 4 blocks
DA_Rural_Countryside Countryside between towns: winding main roads, farm lanes and fields
DA_Corridor_Highway A motorway between cities, 1 to 8 km long, with interchanges and overpasses
DA_Corridor_CountryRoad A country highway between towns, with crossroads, roundabouts and T-junctions

A preset holds a Generator (Grid, Radial or Organic City Generator, Rural Road Generator or Road Corridor Generator) with its settings inline, the road profile for each street class, the Driving Side and the block count for each size. To make your own kind of city, duplicate a preset and change these in its Details panel.

Profiles a preset needs. Local, Collector and Arterial are required. Without Local One Way there are no one-way streets; without both Highway and Ramp there is no highway. Give each slot its own profile asset, because the generators recognise streets by their profile.

2 · Size, seed and placement

How big, which variation and where

The panel's other options start fresh each time the tab opens and are never saved.

▾ Option → default

Size Medium. Picks the preset's block count along X and Y: Block 1 × 1, Small 3 × 3, Medium 6 × 6 and Large 12 × 10 by default, or Custom
Custom Block Count 6 × 6. Used when Size is Custom; at least 1 × 1
Seed 1. The same options and seed always give the same city
New Seed Each Generation Off. When on, each generation first picks and shows a new seed from 1 to 999999
Placement Viewport Center. Or World Origin, or Custom Location
Yaw Degrees 0. Turns a free-standing city about its centre
Spawn Traffic Manager If Missing On. Spawns a traffic manager after generating when the level has none

A block count reads differently per generator. A grid builds exactly that many blocks of 80 to 120 m. An organic town's outline holds about that many. A radial city builds X ÷ 2 + 1 rings, at least 2. A rural area is 400 m per block, and a corridor is 500 m long per block along X.

Viewport Center is where the active viewport's view ray meets Z = 0, or the point 100 m ahead when the camera looks level or up or is below Z = 0. For ground at another height, use Custom Location. Generate City spawns the network as AnyCity_<Seed>, selects it and builds it in one undo step; Generate Block does the same at Size Block. The status line reports the nodes, segments and ports, and any notes or failures are in the Output Log under LogAxCity.

Same seed, different city? The generator draws its random numbers in order, so changing a chance setting or the Local One Way profile can change how many draws one step makes and re-roll every step after it. A radial city ignores its seed: the same preset and size always give the same radial city.

3 · City highway

An elevated highway with diamond interchanges

With Add Highway on in the preset's generator, as in DA_City_Metro, the city gets a two-way highway along its south (−Y) side. It runs at full height from 50 m before the city to 50 m after it, then descends to a ground port beyond each end, where another network can continue.

▾ Generator > Highway

Add Highway Off by default; on in DA_City_Metro
Highway Elevation 8 m. Deck height
Highway Offset 100 m. City edge to the highway centre line
Highway End Ramp Length 200 m. Highway beyond each city end, descending to a port; 50 m or less drops the highway
Interchange Every Nth Arterial 2. Every second eligible arterial gets an interchange
Interchange Ramp Offset / Gap 200 m / 40 m. Arterial to the ramp junctions on the highway / highway to the ground junctions
Ramp Departure Angle 30° (15 to 60). The angle at which ramps leave and join the highway

Each interchange is a diamond. An arterial that meets the south side carries on along the ground under the highway, with a junction on each side and a port beyond, and four one-way ramps leave and join the highway on the curb side. Left-hand driving mirrors them. Corners are skipped; when no arterial meets the south side, the node nearest the middle of that side gets the interchange.

One straight highway, and only the interchanges that fit. The highway is a single straight west-to-east line along the south side. An interchange whose ramp junctions would come within 60 m of the previous interchange or of an end port is left out; with the defaults, interchange arterials must be about 460 m apart. The highway reaches the streets only through interchanges, so a city with none, such as a Block-size grid, gets no highway. The Output Log says when this happens. A ramp steeper than 7 % only adds a message.

4 · Countryside

Rural road networks

DA_Rural_Countryside fills an area with a sparse network for the land between towns: winding main roads, farm lanes and the fields between them. It has no edge street. Its roads run to the edge of the area and end there as ports, so towns, corridors and other areas can continue from them.

▾ Rural Road Generator

Cell Size 400 m of area per block. Medium is 2.4 km square
Main Road Spacing 1.2 km. One west-east main road per band, the middle one an arterial trunk, linked by south-north collectors
Main Road Max Deviation / Wander 20° / 5°. How far and how quickly main roads wind
Branch Spacing Min / Max, Branch Chance 150 / 450 m, 0.6. How often lanes branch off
Branch Length Min / Max 150 / 800 m. Shortest lane kept, longest lane grown
Max Branch Depth 2. Lanes branching off lanes
  • Lanes wander and end at a farm (a dead end with a turnaround bulb), at another road, or at the edge as a port.
  • Roads never cross without a junction. A lane that meets a road joins it at a T-junction when the angle and spacing allow; otherwise it stops short.
  • Loops make fields. Where a lane joins another road, the land it encloses becomes a large block.
  • Rural profiles have no sidewalks. Rural Lane (50 km/h), Rural Road (80 km/h) and Rural Highway (100 km/h) have painted edge lines instead, and a lane meeting a rural road gets a yield or stop sign from the road classes.
  • Add Highway works here too: the highway runs south of the area, with interchanges on the south ends of the south-north roads.

5 · Corridors

Highways and country roads between cities

A corridor is one long main road heading along +X, 500 m per block; the corridor presets give 1, 2, 4 and 8 km. Each end and every crossing road ends in a port. Main Road Class sets the kind: Highway (DA_Corridor_Highway) builds a grade-separated motorway, Arterial (DA_Corridor_CountryRoad) a country road with crossings at grade.

▾ Road Corridor Generator

Main Road Class Highway. Arterial, Collector or Local give a country road
End Heading 0°. Where the far end points, −80 to 80
Max Meander Angle / Meander Length 12° / 800 m. Gentle swings around the heading
Min Curve Radius 1 km. The tightest curve
Crossing Spacing Min / Max 800 m / 1.6 km between crossings
Crossing Road Length / Class 300 m / Collector. How far crossing roads run to their ports, and their profile
Interchange Chance 0.5. On a highway: an interchange, otherwise an overpass
Overpass / Crossroads / Roundabout Chance 0.15 / 0.5 / 0.2. Crossings on a country road

On a highway corridor the highway stays on the ground and crossing roads bridge it at 7.5 m. A diamond interchange adds four one-way ramps on the curb side to ground junctions 150 m either side of the highway. An overpass is the same bridge without ramps, so the two roads don't connect. A country road instead gets crossroads (some of them roundabouts), T-junctions and the odd overpass. Crossing roads run straight, square to the main road.

Add Highway doesn't apply to a corridor; a message says so. Without a Ramp profile in the preset, every highway crossing becomes an overpass. A bridge climbing more than 7 % only adds a message.

6 · Growing a region

Connect a new network to an open port

Generated networks end in ports: the port stubs on each side of a town, the city highway's ends, and the road ends of rural areas and corridors. A new city, area or corridor can start from any open port of an existing network.

  1. Select the existing network in the level.
  2. In the generator panel, turn on Connect To Selected Network and pick a port in Connect Port. It lists only the open ports, as Port <id>.
  3. Pick the preset, size and seed, then click Generate City.

The port sets the location and heading, so Placement and Yaw Degrees are ignored: the new network lies beyond the port, facing away from the existing one. A connection road with the port's own profile leads to the new streets (60 m, or at least 260 m when the new city has a highway), and the two networks join at the port. Where a city street meets a highway corridor, the profile changes at the corridor's first node. A region is built the same way:

▾ Building a region

1 · City A Generate any city preset
2 · Corridor DA_Corridor_Highway connected to one of city A's ports. It starts there, heading away from A
3 · City B City B's preset connected to the corridor's far port
4 · The land between DA_Rural_Countryside connected to a crossing road's port, or DA_City_Village for a hamlet

When a connection stops. A port pick belongs to the network that was selected when you made it: with another network selected, generation stops and clears the pick, so pick again. A port that has been connected since, or is already stitched, also stops it. A preset with the other driving side still generates, with a message, but its lanes won't join.

7 · City blocks

Space left free for buildings

The generators lay out roads only and leave the land between the streets empty. Each network finds that land as city blocks when it builds: the areas enclosed by ground roads, inset to the outer edge of the road and its sidewalks.

  • See them: turn on Debug > Draw Blocks in the network's Details panel.
  • Use them: once the network is built, Get Blocks on the network (Blueprint or Python) returns each block's Outline, Area, Centroid and bounding segments. They are actor-local, so transform them by the actor's transform for world positions.
  • What makes no block: the highway, ramps and other elevated roads pass over blocks instead of splitting them, port stubs and interchange extensions enclose nothing, and areas under 40 m² are dropped.
  • In the countryside, the loops between lanes and roads are large blocks: fields.

8 · Runtime

Generating a city in a running game

The generator panel is editor-only, but generation is runtime code. Two Blueprint nodes under City > Generation take the same request as the panel: Preset, Size, Custom Block Count, Seed, Origin, Yaw Degrees and, to connect, Connect To Network and Connect To Port Node Id.

▾ City > Generation

Generate City Layout Returns the layout, counts and messages without touching the world. Use it to check a request
Spawn City Network Spawns the network class, such as BP_AnyRoadNetwork, with the layout; it builds and registers itself on BeginPlay. Returns none on failure and only logs why

Networks don't replicate. In a multiplayer game, run the same request on every machine: the same preset, size, seed and port give the same layout. Traffic is local and cosmetic too, so every machine runs its own.

Next: turn real roads from OpenStreetMap into road networks.