Procedural Road Networks

2016-07-10 procedural-generation 3 min read

The following post is a short description of an algorithm to generate a semirealistic city road network:

The algorithm goes as follows:

  1. Start with a grid where each edge has a high movement cost.
  2. Select two points on the map using a normal distribution. The normal distribution will model a higher activity center and less active outer areas.
  3. Run a pathfinding algorithm to find the fastest route between the two points.
  4. Reduce the movement cost along all edges of the path. If the cost has reached the minimum, increase it by a big amount. This will ensure roads won't get too busy.
  5. Repeat until you have a convincing road network.

Since the pathfinding algorithm will prefer cheaper routes, routes that have been used already will get bigger and bigger over time.

Here is a javascript version:

(the pathfinding used is https://github.com/bgrins/javascript-astar)