Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dungeon-Generator

A simple application that procedurally generates a dungeon.

Given set constants for the number of rooms and area of the rooms, the program randomly generates rooms in a dungeon.

Running

If you are on a Windows device, this program can be run by navigating to the releases tab in Github and downloading the windows executable for the latest release. If you are using a different operating system, you maybe able to run this application by cloning the repo and manually compiling the code with cargo run in the root directory.

The Algorithm

The dungeon generator first starts by creating an empty dungeon set to a configurable size. Next, the individual rooms in the dungeon are randomly placed by first randomly selecting dimensions for the room so that the room is between a minimum and maximum area. Then the coordinates for the room are chosen randomly. The program then ensures that the room to place is not too close to an existing room. If the room is too close, than new coordinates are chosen. If the room is able to be placed, then it is placed and the process repeats until enough rooms are placed or the program fails to place a room too many times.

Next, the individual rooms are connected together. This program uses Prim's algorithm to do this. This algorithm allows for a minimum spanning tree (MST) to be constructed. A MST is essentially a bunch of edges that connects all the vertices together without cycles such that the minimum total edge weight it used. The algorithm goes through each room and finds the nearest room in manhattan distance to connect it to out of all the other rooms and then it repeats this for all the rooms.

Program Run Result

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages