#include <williamwhitehouse.dev>

-home- -proj- -blog-

Procedural City Generation


For the "Advanced Technologies" module at university, I was tasked with creating a procedural city generator in the Unity game engine. In this short-term project, I implemented Model Synthesis and the Wave Function Collapse (WFC) algorithms to allow large scale cities to be generated from small artist-defined tiles at the click of a button!

Alongside the completed project, I wrote up a report detailing research, development processes and analysis. You can read the report for a more in-depth dive into this project!

Proc City Gen Proc City Gen
Proc City Gen Proc City Gen Proc City Gen
Proc City Gen Proc City Gen Proc City Gen

Development

The cities are generated on a uniform grid, they contain a fully connected road network with traffic lights and pedestrian crossings. The city is split into various districts such as parks, industrial, residential, commercial and highrise.

Districts are generated using the flood fill algorithm after road generation; each district has their own predefined spawning rules to make them feel natural. They also determine which props can spawn (which use poisson sphere distributions / blue noise to generate placement) and what rules the WFC algorithm follows for building generation.

Proc City Gen Proc City Gen

The city is generated from small predefined tiles, that use anchor points to generate valid neighbour relationships, allowing tiles to be iteratively placed using the WFC algorithm. Tiles have a custom inspector to make it easy to edit their anchor values, as well as custom "position handles" to move the anchors in the scene view. Tile Set (custom Scriptable Objects) manage multiple tiles and the generation of valid neighbour relationships as well as the individual tile generation probabilities during the WFC process.

Proc City Gen Proc City Gen
Proc City Gen