Game Development Reference
Step 11. Select the plane in the Hierarchy and find the makeCity
script in the Inspector. Set the size of Buildings to 8 and drag and drop
each building prefab onto the exposed building array elements in the
script. Note that you can have any number of buildings and the code
will adjust for it.
Step 12. Play. The result will be a small city as illustrated in Figure 7.28 .
FIG 7.28 A procedurally generated city.
As Perlin Noise creates smooth regions that graduate between white and
black when drawn as a grayscale, you can use these values to determine
the city density at these locations. For example, white might represent
high density and black low or no density. Where the map is densest use
the skyscraper type building models and where it is lower use small
houses. This will create a relatively realistic city.