This was made as part of Royal Hackaway v9
This is an interactive city generator that creates a 3D map then exports it to JSON so that it can be integrated into Unity or Godot to produce a 3D map. It achieves this generation through fractals and by applying different patterns as selected by the user. These fractals are also heavily controlled to make sure that a smooth and logically designed city is able to be generated by the program.
What motivated this project were the following:
- Making cities/towns/settlements in games can be quite challenging and time consuming especially in regards to how to structure it. Creating a city generator that can be used to generate entire cities within a game engine such as Unity or Godot would be extremely beneficial to game developers as a whole
- Both of us were heavily interested and inspired by an existing city generator made by watabou: https://watabou.itch.io/medieval-fantasy-city-generator. THis is due to the interesting nature of the generator itself and how interesting it would be to create a similar generator that could have further applications and be able to converted directly into a 3D map within a game engine.
- The initial idea of using fractals for generation was proposed by Warith, who was inspired by the fractal structure of precolonial Benin City which heavily utilised fractals for its structure, as well as the overall concept of a fractal city being rather efficient due to its overall structure.
All the files needed to run the program are located in the src folder. Folders dprc1, dprc2, dprc3 refer to deprecated folders that include previous attempts at crafting the program itself that are no longer in used but may be used in future maintenace of the program.
This project overwhelmingly uses Python but uses C# for Unity integration and GDScript for Godot integration.
Run the CityGenerator.py file for the main city generation functionalities. Adjust the generation settings to what you desire then generate the city. You should then see an image of that city pop up afterwards with some statistics.
For Unity and Godot integration and conversion to 3D, first have a map be generated by the program then export the maps to JSON. Afterwards, run the UnityCityIntegration.cs script in Unity. For Godot, run the GodotCityIntegration.gd script in Godot. In both cases, make sure that you have added the JSON files to the Unity/Godot project as well as the script to the respective project in order for them to run.
Developers: Warith K, Alexander G