The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Game::TextMapper::Gridmapper - generate dungeon maps

DESCRIPTION

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.

METHODS

generate_map($pillars, $n, $caves)

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.

$n is number of rooms.

If $caves is true, then the entire map uses cave walls instead of regular walls.

LAYOUT

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.

5 Room Dungeons

These are inspired by The Nine Forms of the Five Room Dungeon by Matthew J. Neagley, for Gnome Stew.

The Railroad

          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

Foglio's Snail

       5  4
       |  |
    1--2--3

The Fauchard Fork

       5       5
       |       |
       3--4 4--3 5--3--4
       |       |    |
    1--2    1--2 1--2

The Moose

               4
               |
    5     4 5  3
    |     | |  |
    1--2--3 1--2

The Paw

       5
       |
    3--2--4
       |
       1

The Arrow

       3
       |
       2
       |
    5--1--4

The Cross

       5
       |
    3--1--4
       |
       2

The Nose Ring

       5--4  2--3--4
       |  |  |  |
    1--2--3  1--5

7 Room Dungeons

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.

The Snake

    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

The Fork

       7  5 7     5 7-----5
       |  | |     | |     |
       6  4 6     4 6     4
       |  | |     | |     |
    1--2--3 1--2--3 1--2--3

The Sidequest

    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

The Unbalanced Fork

    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

The Triplet

    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

The Fake Fork

    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

The Shuriken

    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

The Noose

       6--5  3--4     3--4
       |  |  |  |     |  |
       7  4  2  5     2  5--7
       |  |  |  |     |  |
    1--2--3  1--6--7  1--6

SEE ALSO

Gridmapper is a web application that lets you draw dungeons with strong focus on using the keyboard.