Hi guys,
I made a very simple random dungeon generator inspired by http://readmythings.com/blog/2013/02/20 ... -automata/.
Basically I just start by generating a random map of floors/walls and then apply some cellular automata rules to make it look a bit more pretty. Finally I remove all but the largest cavern.
Here is an example of a dungeon generated by my program:
You can check it out here: https://github.com/christiankolding/lov ... -generator. Feedback would be much appreciated!
Random dungeon generator
-
- Prole
- Posts: 17
- Joined: Sun Jul 22, 2012 11:15 am
- Location: Copenhagen, Denmark
- Contact:
Random dungeon generator
Last edited by christiankolding on Sun May 11, 2014 11:18 am, edited 2 times in total.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Random dungeon generator
The flat straight edges look weird. I preferred to use this method myself:
http://www.roguebasin.com/index.php?tit ... ike_Levels
(The square rooms and doors are post processing of course.)
So weird that everyone's getting into cave generation lately.
http://www.roguebasin.com/index.php?tit ... ike_Levels
(The square rooms and doors are post processing of course.)
So weird that everyone's getting into cave generation lately.
-
- Prole
- Posts: 17
- Joined: Sun Jul 22, 2012 11:15 am
- Location: Copenhagen, Denmark
- Contact:
Re: Random dungeon generator
Yep, I definitely agree about the edges. Perhaps I should take a look at your method and see if I can implement it. Still brand new to using both Lua and LÖVE, though. But I guess it's a pretty good way to practice doing some simple algorithms.
-
- Prole
- Posts: 17
- Joined: Sun Jul 22, 2012 11:15 am
- Location: Copenhagen, Denmark
- Contact:
Re: Random dungeon generator
I have improved the program now, such that it no longer generates the ugly borders. Thanks for linking the article. This is how an example dungeon looks now:
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Random dungeon generator
That looks a lot cleaner than what mine was doing. I like it. More of an actual cave.
-
- Prole
- Posts: 17
- Joined: Sun Jul 22, 2012 11:15 am
- Location: Copenhagen, Denmark
- Contact:
Re: Random dungeon generator
I have now added lava (orange), treasures (purple) and altars/power-ups (blue). Treasures are supposed to be nestled in corners, while altars should be in the open. I'm still looking for a way to generate these in a natural looking fashion and avoid that they cluster up as they sometimes do. I'm all ears if anybody knows of a good way to do this.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Random dungeon generator
You could do post-processing like I do for doors where you check to make sure two of some thing aren't too close together and remove one if so, and keep doing that until no two are closer than a certain amount.
-
- Prole
- Posts: 17
- Joined: Sun Jul 22, 2012 11:15 am
- Location: Copenhagen, Denmark
- Contact:
Re: Random dungeon generator
Right, that sounds like a simple and effective way to do it. Is your project open-source so I can check out your code?
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Random dungeon generator
I don't know how my project would help as the code bases are probably vastly different. I don't even know if I have working code anymore that would do what you need. (Since I've had to rewrite so much and the doors thing is so messed up I need to start over.)
You'd probably just run through the same table in a nested loop within a loop and check the first against the second, find out which ones are close enough together, mark each pair for checking later. Then later go through each pair and delete one at random.
I dunno. Maybe it'd be easier to do the check at creation. Forget the post-processing. Instead, when placing an item or whatever, loop through all the ones that already exist and make sure it's not too close to the spot you're trying to place the new item at. That'd probably be much easier. Have a specific threshold for how close two can be.
You'd probably just run through the same table in a nested loop within a loop and check the first against the second, find out which ones are close enough together, mark each pair for checking later. Then later go through each pair and delete one at random.
I dunno. Maybe it'd be easier to do the check at creation. Forget the post-processing. Instead, when placing an item or whatever, loop through all the ones that already exist and make sure it's not too close to the spot you're trying to place the new item at. That'd probably be much easier. Have a specific threshold for how close two can be.
Re: Random dungeon generator
I'm impressed. Good job.
Who is online
Users browsing this forum: No registered users and 9 guests