Paul Miller > Games-RolePlay-MapGen > Games::RolePlay::MapGen::Generator::SparseAndLoops

Download:
Games-RolePlay-MapGen-1.5008.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source  

NAME ^

Games::RolePlay::MapGen::Generator::SparseAndLoops - The basic corridor generator

SYNOPSIS ^

    use Games::RolePlay::MapGen;

    my $map = new Games::RolePlay::MapGen;
    
    $map->set_generator( "Games::RolePlay::MapGen::Generator::SparseAndLoops" );

    generate $map;

DESCRIPTION ^

This is the sparseness and looping portion of Jamis Buck's Dungeon Generator.

http://www.aarg.net/~minam/dungeon_design.html

Jamis Buck's Dungeon Generator Algorithm (continued)

1. Start with Jamis Buck's perfect maze

2. Look at every cell in the maze grid. If the given cell contains a corridor that exits the cell in only one direction (in otherwords, if the cell is the end of a dead-end hallway), "erase" that cell by removing the corridor.

3. Repeat step #2 sparseness times (ie, if sparseness is five, repeat step #2 five times).

4. Look at every cell in the maze grid. If the given cell is a dead-end cell (meaning that a corridor enters but does not exit the cell), it is a candidate for "dead-end removal."

4a. Roll d% (ie, pick a number between 1 and 100, inclusive). If the result is less than or equal to the "deadends removed" parameter, this deadend should be removed (4b). Otherwise, proceed to the next candidate cell.

4b. Remove the dead-end by performing step #3 of Games::RolePlay::MapGen::Generator::Perfect, above, except that a cell is not considered invalid if it has been visited. Stop when you intersect an existing corridor.

SEE ALSO ^

Games::RolePlay::MapGen, Games::RolePlay::MapGen::Generator::Perfect

syntax highlighting: