After some small fixes, I get better caves. There are still minor issues (torchs inside rock...). Now I've got decent clean-dungeon and caves generator. The tricky part is to generate the intermediate levels, which should slowly evolve from the clean generator to the cave generator. For those interrested, the cave generator is adapted from the cellular automata article on roguebasin. I added a connection step at the end that should theoretically create corridors between disjoint parts of the dungeon (but I'm not sure it works), by tagging (with a floodfill algorithm) the first empty area found and then finding empty areas that have not been tagged. Each time an untagged area is found, I join it to the nearest tagged cell, then floodfill it and look for the next untagged area.