- Loops. After the map structure is created, the map generator looks for places on the map where distant (graph-wise) rooms can be connected with minimal structural changes to form loops that reduce player backtracking. After adding cavern corridors, the map generator struggled with creating loops. The patterns the map generator looked for to add loops (shared cells between adjacent but unconnected areas and areas that could be connected by short, straight paths) were no longer common. I expanded the criteria to include short, non-straight paths.
- Cavern generation visual aids. Cavern generation has been much more challenging than dungeon generation because the former involves non-rectangular shapes. I added visualization of potential connection points, wall cells shared by unconnected adjacent rooms, and potential corridor routes to form loops. These helped immensely with testing and troubleshooting.
- Refactoring. I extracted some of the map generation code into new classes because the functionality that the code provided was now needed in more than one place. For example, rooms needed to be generated for looping corridors, but the room generation code was encapsulated in the map generation command class for generating rooms. I extracted the room generation code into a new static class. Most of the refactoring I do now employs Data-Oriented Programming.
With cavern corridors wrapped up, next on the todo list is an assortment of new content, enhancements, and bug fixes for caves.
Leave a Reply