Game Development Reference
In-Depth Information
7.3.3 Procedural Cities
Generating realistic cities with code is more challenging than landscapes.
While terrain can reuse trees, rocks, grass, and dirt textures, reuse of the
same building or random street structures can look unrealistic. In the same
way that fractals can be used for generating terrain and layout, they too can
be used to create objects on the terrain such as trees and buildings.
A Lindenmayer system or L-system is a fractal algorithm used commonly
for generating trees as it has a natural branching structure. An L-system is
constructed from a string representing drawing commands. The string is built
through an iterative process where parts of the string are replaced with other
strings. An L-system begins with an axiom and a set of rules thus:
F -> F+F
Starting with the axiom as the original string, each character in the string
matching a rule is replaced with the rules string. Therefore, after one
iteration, the aforementioned becomes:
Then, each F in the new string is replaced by the rule in the next iteration,
Note that only the character F is replaced, and with F + F, the already
existing + carries over to the next string. This is illustrated in Figure 7.22 .
FIG 7.22 L-system rewriting.
Search Nedrilad ::

Custom Search