Skip to content

Em-Ant/dungeon-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DUNGEON MAP GENERATOR

v0.1

!! WARNING: Development version. No input data validation included.

Description

It adds a Global Object DungeonGenerator, which has a function memeber generate.

Usage:

Include it in your index.html scripts :

...
<script type="text/javascript" src="./js/dungeon-generator.js"></script>
...

then generate a map :

floorMap = DungeonGenerator.generate(config);
{Array[Array[{Object} cell]]} floorMap =
   DungeonGenerator.generate({Object} config);

 @param {Object} config - configuration object

 config = {
   rows: default 31 - better if odd,
   cols: default 51 - better if odd,
   minRoomSize: default 3 - odd only,
   maxRoomSize: default 7 - odd only,
   padding: map padding - default 2,
   rooms: expected rooms - default 15
   maxAttempts: max attempts placing rooms - default 500
 }

 @return {Array[Array[{Object} cell]]} - Matrix of cell objects

 cell = {
   type : 'wall' or 'empty',
 }

Test it live on my Codepen.

About

Simple JS Dungeon Map Generator plugin, for roguelike games

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published