Does anyone have any examples on a more specific 2d terrain generation (side-scroller).
Does anyone have any examples on a more specific 2d terrain generation (side-scroller).
http://i.imgur.com/HgMWbXe.png
the white dot in the center is a control point that the user can drag around. That point defines a mountain. Height decays exponentially with distance from the control point. The height function is perturbed by an underlying noise function.
Edit: It's all done in JS/WebGL using a fragment shader and blatting the output onto static canvas elements. These are then composited for the larger image. It supports scrolling and zooming. I could never get the performance quite to where I wanted it.
The algorithm defines some regular (columns, etc) and irregular (random walls) building blocks and then switches between them with Worley noise.
The code is available here: https://gitorious.org/crawl/crawl/blobs/master/crawl-ref/sou...
It's entirely legitimate to see it as a side-view, in which case yes, you'd be cutting through the terrain.