Engine: Unity
Genre: Procedural Content Generation
Generates procedural cities using a generalized Binary Spatial Partition system in 3 different ways:
- The road map - Roads are generated in a grid-like pattern, but not uniform in size or shape.
- The zoning - A separate layer consists of "zoning" such as Residential, Industrial, Business, Office, and Hybrid.
- The blocks - Each partition in the road map BSP is subdivided again using parameters specific to lot size and shape. These partitions are where individual buildings are placed and scaled to fit the partition.
Building size and choice is based on:
- Location: Corner or Edge of a block (generated by road map BSP)
- Zone: City zoning ordinance (generated by zone BSP)
- Population: Tuneable curve on CityGenerator component.
- Size: Tuneable curve on CityGenerator component (generated by block BSP);
Buildings will be selected on a simple weighted random from a specified list (Example: Corner buildings of Industrial Type).
There are 5 zone types:
- Residential (green) - Family homes and Townhouses
- Business (blue) - Stores, markets, etc.
- Industrial (yellow) - Warehouses, factories, etc.
- Hybrid (magenta) - Compact city housing, businesses on ground floor
- Office (cyan) - Offices and corporate buildings
Additional Notes:
- Building height scales by floors, which is determined by the population density of the center of the lot, as well as the max floors configured for the given building. This way, you could have the same building be reused in various places with different heights.
- This was a final assignment for my Procedural Content Generation class, in which I received 100/100 credit.
- The buildings were made with primitive shapes in Unity. They are badly unoptimized. The lag you see in the demo is due to the amount of GameObjects in the level. Collider Components are used optimally (only on the ground level of buildings).
- This generation method is great for racing games, where the center of blocks is unseen.