Khaligufzel / Dimensionfall

A survival game inspired by Cataclysm: Dark Days Ahead and Bright Nights.
GNU General Public License v3.0
15 stars 7 forks source link

City generation tool (not implemented in-game yet) #412

Closed snipercup closed 1 month ago

snipercup commented 1 month ago

Fixes #411 Requires #410

Implements a basic city generation algorithm. I tried to do it with a wave function collapse, but it lacks performance. I came up with my own algorithm which creates something basic but needs work.

It follows these steps:

  1. create a "tile" for each rotation and each neighbor_key for each of our maps and sort them by key and rotation and connection
  2. Place a starting tile, right now it's hardcoded to be from the "urban" key
  3. Place the neighbor tiles based on the provided weights and connection options
  4. Loop over all the neighbors, and their neighbors and so on until the grid is filled

The current implementation is still lacking functionality to make it useful in-game so I want to re-do the way the city is defined in the data.