Procedural City Generator

Thats awesome!!


well… I see two approaches then, given that I don’t have enough memory nor time to pregenerate the whole map I’m planning.

  1. First users will start at the very same position (map tile, eg. the origo). As they can move to only neightbouring tiles (no teleport), the map will grow in all directions as the users aproach uncharted territories. This gives me the freedom of generating a roadmap that starts at the origo, and grows in all directions, taken into account that some faraway places may have impact on the generation.

  2. the other way is to use a modified Voronoi diagram instead. It’s feature points could be distributed and scaled by the population density, where the roads are formed by the lines connecting these points. Then the lines are smoothed to the terrain, and can be discarded on some constraints (eg. there’s no acceptable route from A to B where the elevation between the neighbouring values does not exceed a given threshold.)

    This second option might be extended to generate roads on a selected tile only, while being able to put the puzzle together.

    One requirement that would make it easier for me, is that I do not need the roads as objects in the game, I can simply go with a texture that tells where the roads are. I use the procedural terrain in a similar way. It generates static heightmaps, that can be later modified by the players or an artist. In a similar way roads can be added and destroyed through a game, and that is hard to do with only procedural ways. So I only need a way to generate roadmaps as textures, in which I can also embed the info what type of buildings are placed by these roads.

You can also use some tips like to say that each zone square have one road in the east, one on north, etc and no other. Then the road networks are independant and never cross in other places. You can’t generate cities between zone in this case.

Or in the same way, your zones can store some random road start on their border, sharing these initial roads with direct neighbor. Then, each zone have it’s seed of generation, and grow it’s own network starting from these initial allowed road. in this case, the roads generated will must connect inside the zone and can’t create a new exit. This is easy to implement and should give some good result. Plus the generation is all procedural and stochastic, you don’t have to precompute anything.

1 Like
each zone square have one road in the east, one on north, etc and no other

taking forward this approach, from a noise generator I can tell how many roads cross a given edge of a zone, and even where these crossings are... this way I could grow cities beyond edges.