The final project for the Computational Simulations course in the CS department at the Delft University of Technology tasked us to procedurally generate a city that adhered to certain restrictions. Th city consisted on 64 plots of land, each 8x8 units wide, to be populated with a specific number of skyscrapers, high rises, offices, residential parks blocks and parks. Through first designing and generating city buildings, and then initializing the grid, and populating the city, w developed scoring, swapping and optimization algorithms to produce a successful city design based on building neighbors and sunlight (based on Diffuse, Phong and Blinn-Phong shading calculations).
Scroll below to watch a demo of the optimization process.

After placing all the buildings on the grid, to solve the problem of scoring the grid, we first created a function that would determine the locations of the neighbours of any given grid position. With this, we were then able to iterate through all plots of the grid, and score them based on a set of parameters. The details of each rule are detailed in table 2. Our score for the grid was composed of neighbour positions as well as the average light value for all HOUSES and PARKS in the grid. Exploring the scoring mechanism, we found that a system of both rewarding and penalizing neighbours, was necessary in order to reach the design goals, but also proved to be more efficient.







Snippets from presentation detailing scoring, swapping and optimization algorithms
Based our scoring algorithm, during each iteration, the design of the city did improve, however around 1000 iterations, the score increase plateaued - as can qualitatively be seen in the images below where the contrast in the urban design begins to be less apparent in the later iterations.

10 Iterations - Score = -534

50 Iterations - Score = 1229

100 Iterations - Score = 1431

200 Iterations - Score = 1589

300 Iterations - Score = 1833

400 Iterations - Score = 1868

600 Iterations - Score = 1965
