https://github.com/benckx/european-city-simulation
Procedural city layout generator
https://github.com/benckx/european-city-simulation
city-builder creative-coding game-development generative-art geometric-algorithms geometry procedural-generation strategy-game
Last synced: 8 months ago
JSON representation
Procedural city layout generator
- Host: GitHub
- URL: https://github.com/benckx/european-city-simulation
- Owner: benckx
- License: lgpl-3.0
- Created: 2025-09-17T12:39:08.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-28T11:56:05.000Z (9 months ago)
- Last Synced: 2025-09-28T13:24:50.879Z (9 months ago)
- Topics: city-builder, creative-coding, game-development, generative-art, geometric-algorithms, geometry, procedural-generation, strategy-game
- Language: Kotlin
- Homepage:
- Size: 466 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# About
I've been playing a lot of [Transport Fever 2](https://store.steampowered.com/app/1066780/Transport_Fever_2/) recently,
and I've noticed procedural city layouts in video games usually follow a grid pattern, similar to many US cities.
However, Europans cities are a bit more irregular. So I've been thinking about how a European city layout could be
generated.
I'm not sure how far I'll take this; it's just a little bit of fun. I might render the city in 3D
with [jMonkeyEngine](https://github.com/jMonkeyEngine/jmonkeyengine) later, and maybe turn this into a little game.
It's still very much a work in progress, so I won't spend too much time on documentation at the moment.

# How To
It's a Gradle-based Kotlin project. The easiest way could be to
run [GenerateLayout.kt](src/main/kotlin/simulation/GenerateLayout.kt) in IntelliJ.
# Gallery
Occasionally, the intermediary representations and debug outputs are kinda neat looking on their own, so I'll post them
to [r/generative](https://www.reddit.com/r/generative)
- [2025-09-21](https://www.reddit.com/r/generative/comments/1nmmkoc/working_on_a_procedural_city_layout_algorithm/)
- [2025-09-28](https://www.reddit.com/r/generative/comments/1nsjnea/intermediary_representations/)
- [2025-09-29](https://www.reddit.com/r/generative/comments/1ntlhoy/update_on_my_procedural_city_layout_algorithm/)
# TODO
- ~~Init triangulation could be incremental: if we find a triangulation with 15 points, we could keep those points then
add 3 points instead of starting from the start every time -> we could start from 10 points and then add 2 by 2 or
something like that~~
- If a quadrilateral is very trapezoidal, split it in 2 with right angles before subdividing should ensure
sub-quadrilaterals are more rectangular (because we have a side with right angles to start subdividing from)
- Also use taxi cab distance instead of Euclidean distance when creating points for the triangulation
- Merge the 4 contiguous triangles into 1 quadrilateral if 1 point is in the 4 triangles
- Split main function for all the different phases (maybe with a `T : { Layout? -> Layout }`)