2d voxel terrain

How can i get a smooth way to get 2d voxel terrain(think minecraft 2d or terraria)?
thanks

Very, very broad question. What are you looking for specifically? What have you tried?

You can use something like simplex noise to generate the height.

I want the terrain to be like a dumbed down terraria. no caves and structures though
[EDIT]: side view

Try this.

Thanks this really helped ;D

Simplex Noise is better than Perlin noise (in both speed and quality), but may be a bit trickier to understand. Hopefully that article explains it well enough. It also has source code at the bottom.

To use it:


double height =  SimplexNoise.noise(x/64.0, 0.0) * 64.0;

Then you simply convert height to an int, and fill the world with tiles from (x, bottomY) to (x, topY). (bottomY and topY being the limits of the world.)