Skip to content

benckx/european-city-simulation

Repository files navigation

About

I've been playing a lot of 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 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.

drawing

How To

It's a Gradle-based Kotlin project. The easiest way could be to run 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

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 })