Dungeon generator
This is a procedural dungeon generator written in javascript.
Live demo
Features
- Pre-defined, tagged rooms
- Highly configurable
- Seeded rng
- Feedback about exits, perimeter, etc
- (Optional) corridors
- (Optional) circular paths
Output examples
Usage
@TODO
import Dungeon from 'dungeon-generator';
let dungeon = new Dungeon({
size: [100, 100],
seed: 'abcd',
rooms: {
initial: {
min_size: [3, 3],
max_size: [3, 3],
max_exits: 1,
position: [0, 0]
},
any: {
min_size: [2, 2],
max_size: [5, 5],
max_exits: 4
}
},
max_corridor_length: 6,
min_corridor_length: 2,
corridor_density: 0.5,
symmetric_rooms: false,
interconnects: 1,
max_interconnect_length: 10,
room_count: 10
});
dungeon.generate();
dungeon.print();
dungeon.size;
dungeon.walls.get([x, y]);
for(let piece of dungeon.children) {
piece.position;
piece.tag;
piece.size;
piece.walls.get([x, y]);
for (let exit of piece.exits) {
let {x, y, dest_piece} = exit;
piece.global_pos([x, y]);
}
piece.local_pos(dungeon.start_pos);
}
dungeon.initial_room;
dungeon.start_pos;