At the close of 2022, three of the four Map Generation 2.0 objectives have been completed:
- Structuring – layout of walls and floors in rooms, corridors, caverns, and other shapes (done)
- Sections – map partitioned into separate areas with discrete structures, themes, and content (done)
- Data-driven stocking – replace the existing hardcoded dungeon stocking with a data-driven implementation (done)
- Node pattern-based stocking – identify the best locations on the map to place specific types of content using node patterns on the map graph (in progress)
There’s also an aspirational fifth objective, which is to use generated background stories for each map to select, place, and customize content.
I’ve been working on map generation exclusively for the past two months. It’s been fun and challenging but I’m starting to feel burned out on it. I need to complete objective 4 and switch over to something else.
Accomplishments this week:
- New Room Type Map Elements: Barracks, Bedchamber, Bone Pile, Corpse
- New Objects: Beds (Plain, Dirty, Fancy), Prison Door, Blood Fountain
- Data-driven Map Elements. Map Elements, the procedural generation objects used to stock the dungeon, are now data-driven. Previously, a class was created for each Map Element. For the most part, Map Elements define what objects go in a room, and where those objects are placed. So, a separate class was needed for each room type. Now, new room types can be created from the Unity Inspector. With this new capability, I was able to quickly recreate the class-based Map Elements and add some new ones. Odin has been an incredible tool for this.
- Expanded object placement capabilities. Objects can now be placed in grids with random element sizes and rows and columns. Objects can now also be placed in clusters, which is useful for objects that typically appear next to each other such as barrels. Parameters have been added to some existing placement patterns for more flexibility. For example, corners can now be offset relative to the edge or the center of the room. Placed objects can now be grouped, with conditions for placing groups (such as minimum room size). Groups can be configured to place all of the objects they contain or a single, randomly selected object. These improvements provide many more ways to populate rooms in the dungeon.
- Section-based structure. Map sections can now have distinct structures. For example, catacombs sections have longer corridors and smaller rooms.
- Map generation performance improvement. The recent additions and changes to map generation really slowed it down. A quick and impactful fix was adding some caching. There’s more work to be done here, but the current performance is tolerable again.
Next week, I’ll start on the node pattern-based dungeon stocking. I believe the design work is done; I’ve cataloged many patterns using the graphs generated during testing. Some pattern recognition already exists, as it was implemented before I had the big picture. For instance, sequences of rooms and required rooms are identified during generation.