The cave map generator is tuned to make maps that are both attractive and usable. As a gamesmaster you can quickly generate a layout that you like, save a copy in Old School format with room numbers for use in your adventure notes, then change the style and download a high resolution image or Universal VTT file for online play.
The map number is used as a seed for the random number generator. The seed can be anywhere from 1 to 2,000,000,000. (That's two billion!) Multiply that by three size and three density options and you have 18 billion possible combinations, not including colours and the grid. That's a lot! Assuming it took you 5 seconds to set the options and load a map, it would take you over 2,800 years to see them all.
The process is split into two parts. First a two-dimensional map grid is generated, second the grid is used to build an image.
Create an empty grid the size of the map. Add caves to the grid, starting with the entrance, then adding more as space is found. At this stage the "density" setting is important as the higher it is the more caves are added. Caves are rectangular spaces at this point.
With the caves in place add tunnels to link them all together. This is done with enough randomisation to ensure that tunnels are not all straight lines.
For each cave select a shape, resize it to the dimensions of the cave (including random flip and/or rotate), then paste it on the image.
Do the same with each tunnel square to finish with a single coloured matte.
Find the wall edges by scanning the image.
Draw the dark areas on to the preferred base then add shadows or shading along with the walls.
The map image is now complete.
The original cave map generator used lower resolution graphics and different techniques to build the initial map. The old process produced caves that tended to have lots of tunnels coming out from a single point whereas the newly updated algorithm makes more natural looking networks of caves.
There is a lot of large image manipulation that has to go on to make a map image. For the largest image size this can be hundreds of megabytes of data in memory. Processing that can take a moment, but good things come to those who wait.
Unfortunately not. The way in which the code works is part of the “special sauce” that makes Gozzys.com work. The good news is that you can reuse the maps that are produced under a Creative Commons license.