Skip to content

JnyJny/DungeonGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DungeonGenerator

Procedural Dungeon Generation with Python and Pygame

Screenshot

I wrote this after reading an article on "Procedural Dungeon Generation Algorithm".

To be honest, I'm a sucker for graph paper dungeons and the word 'algorithm' so it was impossible for me to avoid implementing the dungeon generator described in the article.

This code is very dependent on the excellent pygame framework.

The Generate module will put up a window and draw each phase of the algorithm as described in the article with it's animated gifs. The StateMachine module was something I reused from my pacman implementation to help keep everything from happening at once. Dungeon is the interesting part, describing a Dungeon class that manages Room objects.

The biggest diversion between the article and my implementation is my failure to implement a Delauny triangulation to build a guarunteed connected graph. My graph uses a closest neighbor function that mostly generates connected graphs but sometimes results in two islands.

A lesser diversion is the hallway construction where I admit I got lazy. My only defense is it looks like a more "Dwarven" dungeon to my eye, so I kept it.

I hope this provides someone some amusement, I enjoyed writing it.

About

Procedural Dungeon Generation with Python and Pygame

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages