Procedural City-Generation Project.
This project is a sub-project of the FindingYonghee project.
FindingYonghee
project has further implemented a Crowd Simulation based on Reinforcement Learning.[Warning] Because this project was developed with paid assets (3D models, toolkits), we intentionally did not upload them to this repository, so even if you download those assets and run the project, it may not work properly. If you want to test this project, please use released executable file.
Dependencies
Included
Not Included
Reference Paper
Citygen: An Interactive System for Procedural City Generation
Generate initial points with an appropriate distribution using Poisson disk sampling
and use them to create a Voronoi diagram.
Afther that, use Lloyd's Algorithm
to relax Voronoi Diagram with specified iteration count.
Set the outermost edges of the Voronoi Diagram as the Primary Road
.
Primary Road
is a wide road, from which the Secondary Road
, a narrower road, branches off.
First, find a bounding rectangle that contains all of the sites in the previously created Voronoi Diagram, and make it 3 times the distance between the centers of each site compared to original Voronoi Diagram, so that each site is larger.
This will result in two Voronoi Diagrams, grouping all the Lower Voronoi Diagram
sites inside the sites of the Upper Voronoi Diagram
(the larger one), which we call City Cells
.
City Cell
is not a site in the Upper Voronoi Diagram
, but rather to a set of sites in a grouped Lower Voronoi Diagram
. In the following steps, the City Cell
is used as the basic unit.After that, All of the outer edges of this City Cell
are then set as Primary Roads.
Secondary Road
from the Boundary of the City Cell
created above.Probability
.
Left
, Forward
, and Right
, and a Random Angle Offset
is added to these to create various shapes of roads.Once we know which direction and what size roads will be generated, we need to validate that they are valid. Below, the new vertex is the end point of the road that will be created.
Repeat this procedure until reached at specified Dimension(Stack)
.
Create the actual road mesh based on the road data we have created so far.
Use B-Spline
to connect the straight roads into a single spline, and if there is an intersection, place a Pre-Defined Intersection Prefab
at the location and connect the splines.
Sub-Point
s using the vectors to the previous and next points based on the created points.Primary Building
is a building that is created next to a Primary Road
.
It tries to place the building within a specified width area based on the vertex pair of the created Primary Road Spline
.
Secondary Building
is a building that is created next to a Secondary Road
, placement method is the same as above.
Additionally, Parks
are placed at regular intervals, and if space is not available, buildings in that space are deleted and Park
is placed.