Dungeon generator
This is a procedural dungeon generator written in javascript.
Features
- Pre-defined, tagged rooms
- Highly configurable
- Seeded rng
- Feedback about exits, perimeter, etc
- (Optional) corridors
- (Optional) circular paths
Output examples
Usage
@TODO
; let dungeon = size: 100 100 seed: 'abcd' //omit for generated seed rooms: initial: min_size: 3 3 max_size: 3 3 max_exits: 1 position: 0 0 //OPTIONAL pos of initial room any: min_size: 2 2 max_size: 5 5 max_exits: 4 max_corridor_length: 6 min_corridor_length: 2 corridor_density: 05 //corridors per room symmetric_rooms: false // exits must be in the center of a wall if true interconnects: 1 //extra corridors to connect rooms and make circular paths. not 100% guaranteed max_interconnect_length: 10 room_count: 10; dungeon;dungeon; //outputs wall map to console.log dungeonsize; // [width, heihgt]dungeonwalls; //return true if position is wall, false if empty forlet piece of dungeonchildren pieceposition; //[x, y] position of top left corner of the piece within dungeon piecetag; // 'any', 'initial' or any other key of 'rooms' options property piecesize; //[width, height] piecewalls; //x, y- local position of piece, returns true if wall, false if empty for let exit of pieceexits let x y dest_piece = exit; // local position of exit and piece it exits to piece; // [x, y] global pos of the exit piece; //get local position within the piece of dungeon's global position dungeoninitial_room; //piece tagged as 'initial'dungeonstart_pos; //[x, y] center of 'initial' piece