Game::TextMapper::Gridmapper - generate dungeon maps
This generates dungeon maps. At its core, this uses a 3×3 layout, 9 sections total. 5 or 7 of these 9 sections get a room. The connections for the rooms (the "shape") is picked at random from a fixed list of configurations (plus flipped and rotated variants). The first room contains the stairs.
To generate bigger dungeons, more of these 3×3 layouts are added to the first. As the number of rooms is dynamic, the algorithm figures out how to best use a number of layouts containing 5 or 7 rooms to get to that number, and then simply drops the extra rooms.
If $pillars is true, then rooms with pillars are generated. This is usually a good idea. It's harder to pull off from Hex Describe because the description of the dungeon should mention the pillars but there's now way to do that. Perhaps, if $pillars were to be a reference of room numbers with pillars, it might work; right now, however, it's simply a boolean value.
$pillars
$n is number of rooms.
$n
If $caves is true, then the entire map uses cave walls instead of regular walls.
$caves
One of the shapes is picked, and then flipped and rotated to generate more shapes. This is why we can skip any shape that is a flipped and/or rotated version of an existing shape.
These are inspired by The Nine Forms of the Five Room Dungeon by Matthew J. Neagley, for Gnome Stew.
5 5 4--5 5--4 | | | | 4 3--4 3 5--4 3 | | | | | 1--2--3 1--2 1--2 1--2--3 1--2
5 4 | | 1--2--3
5 5 | | 3--4 4--3 5--3--4 | | | 1--2 1--2 1--2
4 | 5 4 5 3 | | | | 1--2--3 1--2
5 | 3--2--4 | 1
3 | 2 | 5--1--4
5 | 3--1--4 | 2
5--4 2--3--4 | | | | 1--2--3 1--5
High room density is a desirable property, so we can fill the 9 sections of the 3×3 base layout with more than just five rooms. The algorithm uses 7 room shapes in addition to the five room shapes.
7--6--5 7--6--5 4--5 7 | | | | | 4 3--4 3 6 6--5--4 | | | | | 1--2--3 1--2 1--2 7 1--2--3
7 5 7 5 7-----5 | | | | | | 6 4 6 4 6 4 | | | | | | 1--2--3 1--2--3 1--2--3
6--5 5--6 7 5 6--5 5--6 7 5 | | | | | | | | | | | | 7 3--4 4--3 7 6--3--4 7 3--4 4--3 7 6--3--4 | | | | | | | | | 1--2 1--2 1--2 1--2 1--2 1--2
7 5 7 4--5 7 5 7 7 4--5 7 5 7 | | | | | | | | | | | | 6 4 6 3 6 3--4 6 3--4 6--3 6--3--4 6--3--4 | | | | | | | | | | | | | | | | 1--2--3 1--2 1--2 1--2 5 1--2 1--2 1--2 5
4 5 7 5 7 5 4--5 7 5 7 5 | | | | | | | | | | | | 3--2--6 3--2--6 3--2--6 3--2--6 3--2--6 3--2--6 | | | | | | | | | | | | 1 4 1 4 1 7 1 4--1 4--1 7
7 3 7 7 3 7 | | | | | | 6 2 6 2--3 6--2 6--2--3 | | | | | | | | 5--1--4 5--1--4 5--1--4 5--1--4
5 6--7 5 6--7 5--6 5--6--7 5--6--7 5--6 | | | | | | | | | | 4--1 4--1 4--1--7 4--1 4--1 4--1--7 | | | | | | | 3--2 2--3 3--2 3--2 2--3 3--2
6--5 3--4 3--4 | | | | | | 7 4 2 5 2 5--7 | | | | | | 1--2--3 1--6--7 1--6
Gridmapper is a web application that lets you draw dungeons with strong focus on using the keyboard.
To install Game::TextMapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Game::TextMapper
CPAN shell
perl -MCPAN -e shell install Game::TextMapper
For more information on module installation, please visit the detailed CPAN module installation guide.