Sunday, October 1, 2017

Map Generation

To be honest, this whole project started off from playing/dabbling with roguelike map generation, and thinking "you could make a much more organic looking random map."  I'd say one of the more interesting recent takes on the matter is Diablo 3, which, while not really a roguelike, does do some neat level construction, in terms of stringing together good looking 3D set pieces in a random manner.

So, the whole project started out as generating ruined cities, and spiraled from there:





Our city has a number of buildings, in various stages of ruination, as well as roads and highway overpasses, and a river in this case.  Besides just building placement, the interiors of the buildings are constructed so that doors and rooms link up within them, as well as stairwells.  Although this example doesn't show it well, the highway has fallen sections which can be used to climb into the second level, and will have exit ramps linking it with ground level roads at appropriate places.

A close-up of the room generation (where cyan pixels are doors, and red is a shaft/up staircase)


Going vertically up a level, we see higher levels of selected buildings, as well as the overpass (orange squares are reserved spaces for special buildings (i.e. non-random map pieces that can be added))


Below ground, we have a drainage network linked to both building basements, and surface drains to the street.


Lastly, just an example of a different random city.  Speed is pretty acceptable on a modern computer, particularly if you offload generation to another thread, although item/person population would still have to be done at this point.