Changed MazeDesigner to prune out some unnecessary doorways at random by
removing edges from the room graph. Previous mazes allowed all side
paths to exist, which resulted in a kind of circular layout. Although
that was disorienting to people at first, if you realized it was a
circle, it became simple to navigate through the maze. This update makes
branching paths more common.
Doorways are now placed in different ways, depending on the dimensions
of the walls that they're on. This includes that large walls get two
doorways connecting to the same room.
Fixed a bug in MazeDesigner that would connect some rooms with duplicate
doorways. The problem was in how intersections were being tracked to
improve the efficiency of adjacency checks.
Adjusted the size of mazes slightly to reign in huge rooms. If the
problem persists, we can consider other options such as dropping dungeon
sizes a little more, increasing the number of splits, or biasing the
split plane selection toward the middle of the range.
Added code to minimize the number of doorways that involve dropping
through the floor. Added a DisjointSet class as part of the
implementation. I also split the maze construction process into two
classes (MazeDesigner and MazeBuilder) to make it clearer.
Deleted old function for removing random rooms. Fixed the occasional NPE
described in my previous commit - deferred the removal of nodes from the
graph until after iterating over their collection. Added conditions for
removing maze sections that are too small to be useful.
Completed the second step of maze generation. In this step, a graph is
built that describes which rooms can be connected to each other by
doorways. A maze is created by removing nodes (rooms) from the graph.
The algorithm is incomplete, but it already produces interesting mazes
comparable to DD's hand-made mazes.
A few details for the future:
1. Doorways are currently carved into walls at default locations. This
is just for testing and placement should be improved later. Some
doorways should be removed and redundant doorways should be possible.
2. The size of a section should be assessed and the section should be
discarded if it has too few rooms.
3. An NPE occurs every so often when a maze is generated. It's possible
that it happens because of removing a node from the graph that is
coincidentally the current node for LinkedList's iterator. The solution
would be to add nodes to a list and defer removals until after the
iteration is done.
Made some progress on the second step of our maze generation algorithm:
building an adjacency graph for setting up doorways later. Renamed the
SpatialNode class to PartitionNode to better represent its role.
Made some changes to maze generation to prune out random rooms from the
structure. This doesn't look as nice as I'd hoped, so I'm going to try
some other approaches.
Added classes for generating maze dungeons. At the moment, the dungeons
are generated in place of our pocket dimensions to make testing easy.
We'll need to restore pocket generation later and integrate the mazes
into the dungeon packs later. Currently, the structures are very
incomplete (they don't even have doorways), but this is only the first
step.