So this has been a long standing work in progress for me. Not just procedurally generating an underground cave system like Terraria, but also setting the correct blocks. So it knows if it's a corner piece, middle piece, side piece, disconnect completely, etc. Right now it is based on a giant array filled with numbers. So it starts off with the entire array being filled in with a single number. Then through iteration it cuts out cave systems. After that it checks each block to figure out what it is, top left corner, top middle, top right corner, etc and gives it a number value in the array. Then of course we generate a tilemap based off the numbers. For me it takes about 20 seconds to load in the game. The entire map is 8400x2400, the player is 16x24 and the blocks are 8x8. I'm still working on finding a way to only render what is on screen to help with performance. Anyways without further adieu.
CONTROLS
ARROW KEY MOVES
MOUSE WHEEL ZOOM IN/OUT
LEFT CLICK PLACE BLOCK
RIGHT CLICK REMOVE BLOCK
LINK
http://florist-contraband-18753.bitballoon.com/