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:
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.
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:
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.
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.
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.