Revamped Dungeon Generator: A Mind-Blowing Transformation

Find Saas Video Reviews — it's free
Saas Video Reviews
Makeup
Personal Care

Revamped Dungeon Generator: A Mind-Blowing Transformation

Table of Contents

  1. Introduction
  2. Limitations of the Old Generator
  3. Enter the Gungeon's Approach to Pacing
  4. Challenges in Room Placement
  5. Planar Drawing of a Graph
  6. The Physics Simulation Approach
  7. The Multi-Stage Layout Algorithm
  8. Compromises and Solutions
  9. Post-Processing Step for Room Types
  10. Finalizing the Dungeon Layout
  11. Conclusion

Introduction

Welcome back to another Indie MMO devlog! In this week's update, I will be discussing the changes I made to my dungeon generation algorithm. The old generator had some limitations that I wanted to overcome, and I experimented with different approaches to find the best solution. I'll share my experiences and the lessons I learned along the way, so you can avoid making the same mistakes in your game.

Limitations of the Old Generator

The previous dungeon generator functioned by placing a spawn room and then randomly deciding the direction to connect the next room. While simple, this approach had a few downsides. The room blocks had to be approximately the same size, causing collisions if they were too big or resulting in long, unnecessary hallways if they were too small. Additionally, the generator sometimes placed the boss room directly next to the spawn room, negatively impacting the pacing of the dungeon. To address these issues, I sought inspiration from other games and came across an article about Enter the Gungeon.

Enter the Gungeon's Approach to Pacing

Enter the Gungeon tackled the pacing problem by using a handcrafted graph as the basis for procedural generation. This abstract representation described the connections between rooms and the type of content each room would have. I found this approach suitable for solving my problems and decided to pre-define a few flow graphs for my dungeon generation. But, as it turned out, writing an algorithm to place rooms proved to be challenging and often involved backtracking.

Challenges in Room Placement

During the implementation of the new algorithm, I encountered numerous challenges, such as colliding rooms in hallways and tangled layouts. After further research, I discovered that what I was trying to generate was a planar drawing of a graph with minimized edge crossings. Several algorithms were available, but most of them would have produced dungeons with undesirable appearances. I then came across a heuristic-based algorithm called force-based graph drawing.

The Physics Simulation Approach

In the force-based graph drawing algorithm, a physics simulation was applied to the graph, causing the nodes to untangle themselves. Each connection acted as a spring, while every node behaved like charged particles, repelling each other. Although this approach resulted in decent results, finding the correct force weights to move rooms close to each other while maintaining an untangled graph proved to be challenging. It also caused some edges to cross each other, which was not ideal.

The Multi-Stage Layout Algorithm

To overcome the difficulties faced in the previous approach, I developed a multi-stage layout algorithm. In the first stage, nodes were continuously added while running a physics simulation to expand everything outward. The goal was to achieve a planar drawing without any edge crossings. This stage involved rerunning the algorithm multiple times and cutting off any part of the graph that contained edge crossings. At the completion of stage one, the second stage aimed to compress the graph, applying a gravitational force to pull nodes inward and adjusting the attractive and repulsive forces. However, finding the right balance proved to be challenging, and many edges ended up crossing each other.

Compromises and Solutions

Due to the complexities faced in the layout algorithm, I decided to reevaluate the problem and make a few compromises along the way. Firstly, I focused on addressing the original two problems: the placement of the boss room and the layout's naturalness. I used the random walk approach to simultaneously generate the room graph and its planar drawing on a grid. Then, a post-processing step was employed to assign room types and apply any pacing rules desired for the dungeon. This modification allowed for better-paced dungeons and the inclusion of rooms with various sizes that were not confined to the grid.

Post-Processing Step for Room Types

In the post-processing step, each node was assigned a room type, such as a spawn room, a normal room, a boss room, or a merchant room. The root node became the spawn room, while far-away leaf nodes were designated as boss rooms. This step also provided an opportunity to apply any additional constraints or rules desired for the dungeon layout.

Finalizing the Dungeon Layout

Once the well-paced dungeon and planar drawing of the room nodes were generated, a random room rectangle was chosen for each node type. To create a more natural feel, I applied a gravity compression technique by moving each room towards the spawn room. However, if a room collided with another room or lost alignment with its parent, the movement was undone for that specific room. Every step of the algorithm ensured that none of the room alignment constraints were broken, eliminating the need to repair hallways or relocate rooms.

Conclusion

In conclusion, after several iterations and improvements, I am satisfied with the final product of my dungeon generation algorithm. The new approach overcame the limitations of the old generator and provided better-paced dungeons with more natural layouts. The use of handcrafted graphs, planar drawings, and post-processing steps allowed for greater control over room placement and type assignment. Although the process of developing this algorithm was challenging, it ultimately resulted in visually appealing dungeons that align with my game's vision.

Highlights

  1. Overcoming limitations of the old dungeon generation algorithm
  2. Inspired by Enter the Gungeon's approach to pacing
  3. Challenges in room placement and tangled layouts
  4. The force-based graph drawing algorithm
  5. The development of a multi-stage layout algorithm
  6. Compromises made for more natural dungeon layouts
  7. Post-processing step for assigning room types
  8. Finalizing the dungeon layout with room alignment constraints
  9. Achieving well-paced dungeons with visually appealing designs

FAQ

Q: How did the old dungeon generation algorithm work? A: The old algorithm used a random walk approach to connect rooms, resulting in rooms of approximately the same size and potentially long, unnecessary hallways.

Q: What were the limitations of the old generator? A: The limitations included collisions between large rooms, long hallways with small rooms, and the possibility of the boss room being placed next to the spawn room.

Q: How did Enter the Gungeon address pacing in dungeon generation? A: Enter the Gungeon used a handcrafted graph as the basis for procedural generation, ensuring room connections and assigning room types for better pacing.

Q: What challenges were faced in room placement? A: Room collisions and tangled layouts were major challenges faced in the process of placing rooms.

Q: What is a planar drawing of a graph? A: A planar drawing of a graph represents the graph's connections in a two-dimensional space without any edge intersections.

Q: How was the physics simulation approach used in the algorithm? A: The physics simulation involved treating connections as springs and nodes as charged particles to untangle the graph.

Q: What compromises were made in the algorithm's development? A: To simplify the process, a post-processing step was introduced to assign room types and apply pacing rules.

Q: How were room types assigned in the post-processing step? A: The post-processing step designated the root node as the spawn room and chose far-away leaf nodes as boss rooms.

Q: How was the final dungeon layout achieved? A: The final dungeon layout was accomplished by randomly selecting room rectangles for each node type and applying a gravity compression technique to improve naturalness.

Q: What were the highlights of the new dungeon generation algorithm? A: The new algorithm overcame limitations, introduced better pacing, tackled challenges in room placement, and resulted in visually appealing dungeons.

Are you spending too much time on makeup and daily care?

Saas Video Reviews
1M+
Makeup
5M+
Personal care
800K+
WHY YOU SHOULD CHOOSE SaasVideoReviews

SaasVideoReviews has the world's largest selection of Saas Video Reviews to choose from, and each Saas Video Reviews has a large number of Saas Video Reviews, so you can choose Saas Video Reviews for Saas Video Reviews!

Browse More Content
Convert
Maker
Editor
Analyzer
Calculator
sample
Checker
Detector
Scrape
Summarize
Optimizer
Rewriter
Exporter
Extractor