City Layout Generation using Artificial Neural Networks and Procedural Generation

Project Summary

This project was completed as the dissertation for my BSc (Hons) Computer Game Applications Development degree from Abertay University. The aim was to implement and evaluate how effective the generation of city layouts would be using a combination of artificial neural networks and procedural generation.

First, roads from a user defined bounding box are extracted from OpenStreetMap using the API. The roads are then transformed into acyclic paths that lead to each node in the graph. These are then one-hot (categorically) encoded, and passed in a one-shot encoder-decoder recurrent neural network which utilizes gated recurrent units. The new map is generated by passing a part of the source (as the road paths are encoded effectively as words). The generated map is then evaluated versus a number of parameters to the source map.

The implemented method does not generate roads. Proposed solutions include: moving one-hot encoding to an embedding layer/generator to allow more samples to be passed in, moving to a recursive model to improve accuracy, experimenting with different units.

Plot detection is implemented by utilizing a modified version of the Dijkstra algorithm to find shortest cyclic paths which can be used as polygons. Due to time constraints plot generation was not added. However, polygon subdivision is the suggested approach for converting the detected polygons into plot like shapes.

Key Technologies Used

Abstract

Creating city layouts manually can be difficult and time consuming. Automating this process to be simple and versatile would benefit many users, such as game designers and artists who might otherwise spent a lot of time studying road layouts manually. Existing implementations use procedural generation, which often puts the burden onto the user to capture the rules of the city. Artificial neural networks can be used to 'learn' the distribution of data automatically, given that it is correctly configured and a lot of data is available.

This project aims to implement a combination of artificial neural networks and procedural generation methods to generate city layouts and evaluate its effectiveness.

The study implements a variety of evaluation techniques which are to be performed on generated roads, to compare its effectiveness in relation to the source map. The roads are generated by a recurrent neural network with gated recurrent units. This artificial neural network is trained on data extracted from OpenStreetMap. Plots are then detected using the Dijkstra algorithm and evaluated.

The road generation artificial neural network was unable to capture the source road map effectively. The plot detection algorithm was achieved, however due to time constraints plot generation using polygon slicing and subdivision was not implemented.

The study offers a basis for future development of similar problems, especially as no source code for the used Neural Turtle Graphics approach is available. Further development is required in regards to road generation and plot subdivision, especially regarding using an embedding layer instead of manual one-hot encoding to reduce memory usage.

More Details

You can read my dissertation here and view the source code here. If you are a recruiter, please look at other projects if you are looking for examples of my coding ability.

This dissertation is heavily based on the paper Neural Turtle Graphics for Modeling City Road Layouts by Hang Chu, Daiqing Li, David Acuna, Amlan Kar, Maria Shugrina, Xinkai Wei, Ming-Yu Liu, Antonio Torralba, Sanja Fidler. You can find the paper here and the project page here.

The plot generation takes inspiration from Probable Train's City Generator.