#4290

 · 
vanilla

New room-joining algorithm for regular Dungeons levels and levels which use des.random_corridors:

  • Pick one random room and consider this room to be “the set of connected rooms”.
  • Repeat the following until every room is in the set of connected rooms:
    • Pick 2 random rooms, one from the set of connected rooms and one from the set of not-yet-connected rooms, and pick a random point in each room.
    • Draw a straight line between those two points. Route the line around intervening rooms if necessary.
    • If the line intersects with an existing corridor, dig only the part of the line from that intersection up to the unconnected room. Otherwise, dig the whole line out.
    • Identify the points where the line crosses the outer walls of the rooms, and make doors. If it enters or exits at a corner, shift it to an adjacent wall space.
    • Add the unconnected room to the set of connected rooms.