All ideas tagged "corridor"

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

#4260

 · 
vanilla

Sometimes, if there is space and there is no intersection with another corridor, a closet will extend 2 more spaces back (for a total length of 3). The middle space will be a secret corridor (or sometimes plain stone), and the second space will be a regular corridor with a chest with random contents.

#2956

 · 
vanilla

When generating corridors in the Dungeons of Doom, make corridor-drawing follow established corridor paths when possible instead of allowing long parallel double-wide corridors to be carved, because these are ugly.

A possible algorithm is to build the proposed corridor without editing the map, then identify all squares where the proposed corridor intersects with or is adjacent to existing ones, then pathfind to see which successive pairs of intersections are not already reachable, then only connect those pairs of intersections along the proposed path.

Another possibility is to let the corridors generate normally, and then do a postprocessing cleanup step, where all “unnecessary” corridor spaces are removed one by one until there are no more. An unnecessary space is defined as a CORR space where for each pair of orthogonally adjacent CORR spaces to it, the common corner of those orthogonally adjacent CORR spaces is itself a CORR. Though this may still produce some odd dead-end corridors.