Procedurally Generated Caves Redux

Looking back over some of my older projects that needed some tidying up or finishing, I realised I'd not applied tiles to the Procedurally Generated Caves demo (as posted earlier).

So, here's an updated version that includes some basic tiles that have been implemented in a very very cute way - read: not the usual method of having hundreds of painful nested if/else statements:



I wanted to have a better method than the "usual" so did a little digging around the net and found the following resource:

        http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/

It took me less than five minutes to apply this method to the original demo and it works beautifully.  Huge thanks to Sam Driver for this (Note: I've also pinched the tile graphics he used - hope he doesn't mind!)

Since then, I've also found the following resource which goes into more detail regarding this bit-mask method (and in particular, how to use it for more types of blocks):

        http://www.angryfishstudios.com/2011/04/adventures-in-bitmasking/

Press the PLAY MY CODE link on the bar above to see the code for the demo.

I've already started to turn this into a game so we'll see how that progresses, but first - I need to finish the Swarm game :)

Popular Posts