Virtual Spelunking: Procedural Textures (or How to Make a Dirty Floor)

One of the main advantages of procedural content is being able to generate a near-infinite number of variations on your content without having to waste valuable artist time. This is especially true when you want to make variants on what is generally “boring” background content, like rocks, trees, walls, and floor tiles. Instead of having an artist make 10 variations of rocks for your level, you can simple have them make one (or none!) and create 100 variations by applying perturbation functions to the content in code. Continue reading

Virtual Spelunking: Exits and Treasure

I’ve spent several posts detailing how to procedurally generate a cave for a player to explore. Now, it’s about time for me to fill that cave with things for the player to do. The most basic goal for any player dropped into the middle of a cave is to find a way out, so the first thing I’ll do is drop a starting point and an exit point into the cave. Just trying to escape a cave by itself is a little too sparse though, so I’ll also add treasure for the player to find and collect while they’re looking for the exit. Now, it’s starting to sound like a real game. Continue reading

Virtual Spelunking: Turning on the Lights

Continuing my adventure in interior decoration for imaginary places, it’s about time for me to start populating my procedural cave with objects. This time around, I’ll focus on adding light sources to my cave. There are two major reasons for this: 1) light sources, like torches, won’t have to be collidable so I can lay them out without worrying about breaking the navigability of my cave; 2) rendering the lights gives me an excuse play around with pixel shaders.

In order to lay out the lights, I need to come up with rules for their placement that will produce results that are neither too regular nor too random. Since I’m planning on eventually rendering the lights as wall-mounted torches, I need to make sure the lights are located on cave walls and not lying some place in the middle of the floor. I also need to make sure that the lights I place are on walls neighboring floor tiles, otherwise I might end up with lights buried inside large wall sections. Continue reading