Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Compared 4 Dungeon Generation Algorithms. One of Them Never Works.

Four algorithms. Same grid. Very different dungeons. I implemented BSP trees, cellular automata, random walk, and room placement, ran each one 20 times on an 80x40 grid, and measured everything: connectivity, open space, path length, speed. The Results Algorithm Open Space Connected Rooms Path Length Speed BSP Tree 42.1% 100% 1.0 105 steps 0.88 ms Cellular Automata 55.8% 0% 15.2 78 steps 52.8 ms…

In a recent experiment, the author compared four different dungeon generation algorithms on a 80x40 grid. The algorithms tested were BSP trees, cellular automata, random walk, and room placement. Each algorithm was run 20 times, and the results were measured across several criteria: open space, connectivity between rooms, average path length, and speed of generation.

The BSP tree algorithm was found to provide the most structured layout with 100% connectivity between rooms. On average, paths in this method were 105 steps long, and the generation process took 0.88 milliseconds per run. This method ensures that every room is reachable from any other, making for a more predictable and navigable dungeon.

Cellular automata, on the other hand, produced cave systems with zero percent connectivity. Across 20 runs, every single map generated by this algorithm had areas that were completely unreachable. This algorithm creates organic-looking cave systems that lack the structured paths found in the other methods.

Random walk and room placement both maintained 100% connectivity between rooms, similar to the BSP tree. However, their path lengths were comparable, with random walk averaging 73 steps per run and room placement at 81 steps. Despite this, random walk took the longest time to generate maps at 274.7 milliseconds per run, likely due to its more complex nature involving random movement.

In conclusion, while cellular automata offers a unique and organic approach to dungeon generation, it falls short in terms of connectivity. The BSP tree provides the most reliable and navigable layout, making it the best choice for structured dungeon maps. Random walk and room placement offer a middle ground, balancing connectivity and generation speed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Open Source Contribution

Hello folks, this is my first Dev post. I was searching for some good repos for open source contributions. As i have completed last year Hacktoberfest, i am not newbie but also i haven't contributing…

Traceroute devlog #6

This week I finally got to watch something run that had existed only as a paragraph in a planning document for months. An automated pipeline that generates a new puzzle on its own schedule, hands it…

Apple Planning AI Home Security Camera and Service for 2027

Apple could release a home security system and service in 2027, according to Bloomberg . The company is designing a privacy-forward home security camera that will "use AI to monitor the surrounding environment instead of actual video footage." It will apparently work with a new home security and monitoring service, but no additional…

More from Friday 4 September →