Home▸Articles▸Algorithms & AI

Procedural City: Recursive Road-Network Generator

An algorithmic approach to generating realistic 2D city layouts that mimic natural processes.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What is Procedural City?

Procedural City is a simulation of 2D city generation using an algorithm that recursively subdivides blocks to create complex road networks. This method mimics the natural growth patterns seen in urban environments, allowing for the creation of diverse and realistic city layouts.

The process starts with a simple rectangular block which is repeatedly divided into smaller sub-blocks until a desired level of detail or subdivision depth is achieved.

How Does It Work?

At each step, the algorithm randomly chooses how to divide the current block. This division can be along any axis and results in smaller sub-blocks that are further subdivided until a set condition is met, such as reaching a minimum size or achieving a specific number of divisions.

This recursive process ensures that the resulting road network appears organic and natural, with varying street lengths and intersections.

live demo · related simulation● LIVE

Why Does It Matter?

The procedural generation technique is crucial in fields like computer graphics, video game design, and urban planning. It allows for the creation of large-scale environments that are both detailed and varied without requiring manual design.

Moreover, this method can be adapted to simulate different city layouts based on various parameters such as density, road width, and height.

Real-World Applications

Procedural generation is used in video games to create vast open worlds with diverse landscapes. It also finds applications in urban planning for simulating the growth of cities under different scenarios.

In architecture, it can help designers explore multiple design options quickly and efficiently.

Frequently asked questions

How does the recursive subdivision algorithm ensure road networks are realistic?

The algorithm mimics natural processes by randomly dividing blocks in a way that resembles how cities grow organically over time, resulting in complex but plausible road networks.

Can this method be used to generate 3D city models?

Yes, the basic principles can be extended to 3D. By adding height information and using techniques like extrusion, it's possible to create pseudo-3D models with realistic buildings.

What is the significance of the 'time of day' option in the simulation?

The time of day affects the visibility of elements such as windows and street lights, providing a dynamic visual experience that changes throughout the day.

How does adjusting the building density slider impact the city layout?

Adjusting the building density slider controls how many buildings are generated within each block. Higher densities result in more compact urban areas with closer proximity of structures, while lower densities create more open spaces and larger lots.

Try it live

Everything above runs in your browser — open Procedural City: Recursive Road-Network Generator (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Procedural City: Recursive Road-Network Generator (2D) simulation

What did you find?

Add reproduction steps (optional)