Sunday, December 5, 2010

Generic City - now generating happily and almost ready

Here is Generic City almost ready for projection - generating happily with most of the intelligence I hoped for. This C Series is functionally evolved to make informed decisions about block states and structured differently to earlier series to make working with neighbours easier.

Generic City C6 with keystone mock up
Previously the Eden Growth Model that I was using was 'off-lattice' allowing growth in any direction and requiring collision checking - this has the advantage of accommodating non-orthogonal geometry but makes identifying and interacting with neighbours more complex. I have now contained the Eden Growth Model within a 2d integer array where a cell is either alive/exists (value = 1) or is dead/empty (value = 0) - thus making neighbour identification easy (x - 1, x + 1, y - 1, y + 1 etc), but limiting growth to an orthogonal regular grid. Fortunately I was already working with regular orthogonal geometry and at this stage am happy to be limited to this.

The primary geometry consists of streets that connect the bottom left (SW) corners of parent and child cells, along their boundaries. The cells as primary organisational units form square blocks of type or state as follows: vacant blocks; public squares; and private buildings arranged around lanes of varying configuration - running N-S and/or E-W, single lanes through the centre of blocks or twin lanes diving blocks in equal thirds, with circles, square circuits or courtyards potentially at centre.

Cells are given, at a particular age, an opportunity to grow - that is make a new child cell in an empty neighbouring cell - and if it is not possible to grow, then the cell has an opportunity to connect streets to neighbours by appropriating neighbours as additional parents. This can be understood as approximately radial streets from a centre in a conventional branching/tree configuration connected with concentric ring roads - as typified by conventional highway systems. Connecting streets are important to avoid a labyrinth necessitating travel through the centre.

The block state of new growth cells copies the block state of their parent cell or else remains vacant, is set by copying the block state most frequent amongst neighbours or is set randomly. Cells are then given at a particular age an opportunity to redevelop, ie change their block state. When redeveloping cells do not consider the block state of their parent cells, so give greater likelihood to copying neighbours. Unless copying a parent, cells can not be squares if there are already too many squares nearby and cells that are squares are less likely to be redeveloped. These relationships between parents and neighbours create a more realistic simulation of cities and unleashes potential for emergent neighbourhood patterns.

Variance between generated cities is established with switches for randomly disabling possible block types - squares, lanes, courtyards; changing lane configurations; and even turning off block rendering altogether to only show the street network. To ensure lane alignment all lanes in a particular orientation must either be single or twin; if lanes are twin in one orientation they must be single in the other orientation to avoid clutter; and circles do not align with twin lanes and so are always turned off when twin lanes are turned on. It would be possible to have many more block types and have greater variation in configuration of geometry, even with infinitely graduated geometric differentiation (as with Series A where squares had random dimensions). However, the limited palate of highly differentiated block states and geometric configurations which reads as diagrammatic in fact must better registers pattern and change.

Further variance is introduced by randomly disabling the functions to copy parents and neighbours block states, and to connect streets, as well as varying the grid size (block size), maximum neighbours (density of city development), maximum parents (number of possible streets connections), grow age (speed of new growth and redevelopment), maximum age (age, and therefore size, of city when it is cleared and a new city is generated) and start position/s (city centre/s).

One final small additional benefit of containing growth within a 2d array is that it provides an easy way of setting boundaries to stop the growth going off screen, ie to have a neat edge that avoids cropping. This does not deal with windows - we are hoping that the light projection will be transmitted through the windows and so not seen.

Generic City C6 - all block types and functions enabled, visable emergent neighbourhood patterns 

Generic City C6 - only squares and courtyards enabled

Generic City C6 - twin lanes turned on in N-S orientation, two start positions

No comments:

Post a Comment