Random Terraria-like terrain generator

How would I make one in GD? I’d like to see example, because I don’t know where to get started.

//edit: I managed to do this: www65.zippyshare.com/v/52079679/file.html

but I’m not very happy with it:

Though when I constrain generator to just one type of material (like stone) and disable probabilities terrains generated looks nice, so it isn’t complete failure.

Well, any help on that?