# Cave procedural generation

## Recommended Posts

Hello all,

I have been searching for 3 hours on how to generate levels like spelunky's.

I could find tutorials for dungeons but not like spleunky's

sorry but i am a very beginner.

##### Share on other sites

I've been searching for 3 seconds on how to generate levels like Spelunky. Top hit in Google: http://tinysubversions.com/spelunkyGen/

##### Share on other sites
2 minutes ago, rich said:

I've been searching for 3 seconds on how to generate levels like Spelunky. Top hit in Google: http://tinysubversions.com/spelunkyGen/

I've seen it, the problem is that the canvas is hidden after it loads, i tried 3 web browser, proxy and everything, and it didn't work

##### Share on other sites

Welcome!

Interesting procedurally generated levels are hard! Hence a lack of beginner tutorials! There is a procedural generation wiki, the quality and relevance of articles varies wildly but there is some good stuff in there, pretty sure I've read something from there specifically referencing spelunky.

There are lots of different algorithms for procedurally generating terrain, from 'walking' algorithms to using seeded number generators to produce some 'consistent' randomness (yes, that is a thing!), and lots and lots of other stuff.

Walking algorithm can be used to fill or remove sections from a terrain map i.e. take a full terrain map (assume 2 dimensional, say 10x10, each tile can be either solid or air, lets go with all solid to start with), create a number of seeds (walkers) with varying properties and iterate over a number of rounds, each round consist of the walker making decisions. So, for example, a walker may be allowed to move one square in any random direction and convert that new square into air, after 10/20/50 iterations you're going to see some random passages appear. This is an example of cellular automata to procedurally generate a 'world'.

That is only one example, and the 'walking' algorithm could be paired with several other algorithms, all adding stuff to your generation. Rich's example has a fairly detailed explanation of another algorithm, in a similar fashion it sounds like it iterates over a number of steps, introduces some randomness, and generates a world. Many examples of procedural generation work this way.

##### Share on other sites
1 hour ago, FrankenStein said:

I've seen it, the problem is that the canvas is hidden after it loads, i tried 3 web browser, proxy and everything, and it didn't work

Appears fine here. Normal stable release of Chrome, nothing special. The canvas appears at the start, then vanishes, but then as soon as I scrolled it re-appeared again.

same here

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account