6 ms·
Interesting, i thought minecraft had more complicated algorithms. Does anyone have any examples on a more specific 2d terrain generation (side-scroller).
by dexter313 14y ago
Interesting, i thought minecraft had more complicated algorithms.
Does anyone have any examples on a more specific 2d terrain generation (side-scroller).
- rcfox 14y agoYou can use simple cellular automata to create somewhat natural-looking cave formations: http://rcfox.ca/random-cave-map-generation/ http://rcfox.ca/random-cave-map-generation/
- dexter313 14y agoBy "set of stairs" do you mean a simple vertical line that cuts trough all of terrain?
- rcfox 14y agoWell, I see the image as top-down view of one level in a cave. Going down stairs would mean generating another level. It's entirely legitimate to see it as a side-view, in which case yes, you'd be cutting through the terrain.
- bhickey 14y agoNot a side-scroller, but here's a screenshot from a terrain generator that I wrote: http://i.imgur.com/HgMWbXe.png 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.
- bhickey 14y agoAnd for another example: I wrote a terrain generator for the Abyss in Dungeon Crawl. Since the player is trapped in a hellish Lovecraftian place, the requirements for coherence are much more lax than Minecraft for example. 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/source/dgn-proclayouts.h https://gitorious.org/crawl/crawl/blobs/master/crawl-ref/sou...
- simonh 14y agoMinecraft also has biomes, which customise the terrain generation to produce regions of a particular type of terrain like forest, desert, sea, etc and some intermediary biome types like beaches. I don't know how it distributes the main biomes, but it may use one noise algorithm for that and another within each biome. Plus applying some rules to handle the borders between biomes. There is a lot more to it that just "It's Perlin noise".