As I was working to create my gamedev toolbox, I decided to tackle the city generation part. Here is a description of the solutions I’ve found to generate pieces of city.
These pieces can later be linked. Focus points buildings can be added to create good landmarks.
Here is the description of my Voronoï approach.
My first step as I create anything is to decompose my problem into sub tasks with two objectives in mind: easiness of implementation and re-usability.
For this tool I created 4 tools:
Here, I will only focus on the city layout generation with Voronoï
To obtain this result, I make the following operations :
1- Generate the blocks areas
2- Generate the road areas
3- Generate the sub-blocks areas
4- Segregate Buildings and greens areas
5- Merge areas
To control the density of the blocks per square meter, I use a density map that’s made by painting a density attribute on an uprez version of the input shape.
This density attribute is used to drive the scattering process, creating more dense point distribution where the attribute is higher.
When used by the Voronoi Fracture Node, I get more small blocks within the denses areas as shown bellow.
The blocks areas are now ready to subdivide in step 3
Road areas are created by substracting the blocks to the input shape
To generate the block subdivisions, the block polygon is resampled to keep only the number of points necessary to have the required number of Voronoi cells and we add a point at the centroid of the block to achieve the desired look (having a green area at the center of the block)
This version of the tool makes all areas bellow a certain threshold be green areas. The rest becomes a building.
Once all generated, the areas are merged and ready to be used as inputs to the different hda’s that creates the roads, parks and buildings
This tool gives access to the following inputs:
1- City plane input shape
2- Input a custom point set for the Voronoi fracture of the blocks
3- Painting Density
4- Selecting a map resolution
5- Setting Road Width
6- Setting number of buildings per block
7- Setting minimum size to create a block that can contains buildings
8- Setting minimum size for a single building on a Block
Here is my live presentation of this tool in french for the Houdinimatic community.
What do you think?