Experimenting with random level generation in Unity
You can now play with this!
Inspired by supermeerkat’s post about his cave generator (found here), I wanted to see what all I could pull off. I started out by researching various procedural generation algorithms, and eventually settled on one aptly called “Drunken Walking”.
The concept itself is quite simple. Given a starting set of coordinates, you move that point in a random cardinal direction each cycle (or walk, as I’ve come to reference it as). This has the effect of giving you a random path, but one that’s always connected. The downside however is you generally don’t get anything more advanced than random blobs. That’s when you bring in the concept of biases.
The bias concept is also quite simple. Given a random chance, the direction the point is moved is based on certain criteria instead of a random direction. The code I’ve written includes three of these. A corridor bias...