Dungeon generators

This family of map generators produces corridors and rooms. Room information can be retrieved after the map has been created by calling getRooms(); corridor information can be retrieved via getCorridors(). Rooms can also include door info:

ROT.RNG.setSeed(1234); var map = new ROT.Map.Digger(); var display = new ROT.Display({fontSize:8}); SHOW(display.getContainer()); map.create(display.DEBUG); var drawDoor = function(x, y) { display.draw(x, y, "", "", "red"); } var rooms = map.getRooms(); for (var i=0; i<rooms.length; i++) { var room = rooms[i]; SHOW(ROT.Util.format("Room #%s: [%s, %s] => [%s, %s]", (i+1), room.getLeft(), room.getTop(), room.getRight(), room.getBottom() )); room.getDoors(drawDoor); }

Digger

Random dungeon generator using human-like digging patterns; based on Mike Anderson's ideas from the "Tyrant" algo, mentioned at Roguebasin. Third constructor argument is a configuration object; allowed options:

var w = 40, h = 25; var map = new ROT.Map.Digger(w, h); for (var i=0; i<4; i++) { var display = new ROT.Display({width:w, height:h, fontSize:6}); SHOW(display.getContainer()); map.create(display.DEBUG); }

Uniform

Generates a set of rooms; tries to connect them afterwards. Third constructor argument is a configuration object; allowed options:

var w = 40, h = 25; var map = new ROT.Map.Uniform(w, h); for (var i=0; i<4; i++) { var display = new ROT.Display({width:w, height:h, fontSize:6}); SHOW(display.getContainer()); map.create(display.DEBUG); }

Rogue

The original Rogue dungeon algorithm, as documented at https://github.com/Davidslv/rogue-like/blob/master/docs/references/Mark_Damon_Hughes/07_Roguelike_Dungeon_Generation.md

var w = 80, h = 24; var map = new ROT.Map.Rogue(w,h); var display = new ROT.Display({width:w, height:h, fontSize:6}); SHOW(display.getContainer()); map.create(display.DEBUG);