World generation (Randomly)

Started by
5 comments, last by Daazku 13 years, 5 months ago
Hi,

I would like to know where to start in my project of generating a world (Randomly).

The matter of the world world will be made of cube.

I have no base in that domain so I thought that separate the process of world generation in steps would help me.

Step1 : Create a world make in earth cube with different height on the map.
Step2 : Add layer in that world. So under the earth cubes we should start to see rock cube if we dig
Step3 : Add some ores in the underground
Step4 : Add some tunnel, cavern in that world
Step5 : I should have some good knowledge of the basics at this step so I will try to do some funky thing like making flying islands, vegetation etc.

So guys I wanna know if you can give me advices, resources, books or tutorials that can help me to achieve that.

[Edited by - Daazku on November 9, 2010 11:17:29 AM]
Advertisement
Step 1: google for "random height map" or "fractal height map"
Step 2, 3: at each height, then for each location in your world, generate a new cube unless you want to randomly generate an ogre at that location.
Step 4: google for "3d maze generator." Generate a 3D maze and delete cubes at various locations.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Thanks will start with thoses!
If you're trying to make a minecraft clone with an earth instead of a flat map, then height maps may not be of much use I think.
Quote:Original post by rethan
If you're trying to make a minecraft clone with an earth instead of a flat map, then height maps may not be of much use I think.


It's the kinf of map I want yeah. Only made of cube that can be destroyed. From what I read the heightmap technique can be useful to have the to of the map (the first layer) but after that i will have to use other technique. That's why i have multiple step. But I you have more input be free to post them here!

This type of generation is ideal for using fractal noise techniques. There are libraries available that can help you generate fractal Perlin noise from various basis functions. libnoise is one of these.

Initially, fractal techniques are good for generating regularly bumpy terrain, but you will have to combine many different techniques in order to do "interesting" terrain. I suggest working through the libnoise tutorials to see how modules in that library are chained together to create more complicated functions.

As an example, for cave systems you could start with a ridged multi-fractal function. In 2-dimensions it looks something like this:



Imagine that in 3 dimensions, with "ridges" looping everywhere. You can start with that and apply a threshold function to it so that anything below a certain value outputs 0 (solid) and anything above the threshold outputs 1 (open):



Now this function can be applied against the functions that generate your ground layers, masking off parts of the ground to keep them open as a cave system. By applying additional modifications to the basis functions, playing with the threshold value, etc... you can tweak the exact character of the generated cave systems.

The ground layers themselves can also be based upon fractal functions. From what I have seen of Minecraft in the handful of videos I've watched, it looks like they have a lot of high mountains with steep cliffs. Discontinuities like that can sometimes be generated with methods like subtracting different functions, applying some sort of faulting function, or generating a function that incorporates discontinuities mathematically, blending different functions together, etc... It can take a lot of playing around to get what you need, and in the process you can discover some pretty interesting techniques.

Creating the different layers of ground shouldn't be too much of a problem, as long as you can construct a model of your world that makes sense. Each of the factors can be represented as a function. Distribution of minerals, placement of stone, sand, dirt, etc... Just codify a set of rules determining each.

For example, say you have a mineral called Unobtainium. It should only be found deep, and it should be quite rare. To model the distribution of Unobtainium, you could start with a fractal and apply a very high threshold to it so that only small, widely scattered pockets of it appear in the function. This function can further be modified by a gradient function that scales the threshold as you go deeper into the earth, so that at full depth you find deposits of Unobtainium, but as you approach the surface the deposits become smaller and rarer, until at a certain depth they disappear altogether.

Other minerals and ground types follow similar rules. Sand and loose dirt will typically mostly be found at the surface, and perhaps in trace amounts deeper in, but at the deepest levels where Unobtainium is found, loose soil should be quite a bit more rare. This could be represented by a function as well, bearing in mind that the presence of running water in caves can scale the function, making it more likely to find sand and dirt. And so forth.

You would be amazed at the amazing results you can achieve with just a few relatively simple fractal functions.

Thanks alot for your post!

I think I really need to start by learning more about fractal functions/techniques then I will check libnoise and play with it.
Will come with more questions after that :P

Quote:Original post by JTippetts
This type of generation is ideal for using fractal noise techniques. There are libraries available that can help you generate fractal Perlin noise from various basis functions. libnoise is one of these.

Initially, fractal techniques are good for generating regularly bumpy terrain, but you will have to combine many different techniques in order to do "interesting" terrain. I suggest working through the libnoise tutorials to see how modules in that library are chained together to create more complicated functions.

As an example, for cave systems you could start with a ridged multi-fractal function. In 2-dimensions it looks something like this:



Imagine that in 3 dimensions, with "ridges" looping everywhere. You can start with that and apply a threshold function to it so that anything below a certain value outputs 0 (solid) and anything above the threshold outputs 1 (open):



Now this function can be applied against the functions that generate your ground layers, masking off parts of the ground to keep them open as a cave system. By applying additional modifications to the basis functions, playing with the threshold value, etc... you can tweak the exact character of the generated cave systems.

The ground layers themselves can also be based upon fractal functions. From what I have seen of Minecraft in the handful of videos I've watched, it looks like they have a lot of high mountains with steep cliffs. Discontinuities like that can sometimes be generated with methods like subtracting different functions, applying some sort of faulting function, or generating a function that incorporates discontinuities mathematically, blending different functions together, etc... It can take a lot of playing around to get what you need, and in the process you can discover some pretty interesting techniques.

Creating the different layers of ground shouldn't be too much of a problem, as long as you can construct a model of your world that makes sense. Each of the factors can be represented as a function. Distribution of minerals, placement of stone, sand, dirt, etc... Just codify a set of rules determining each.

For example, say you have a mineral called Unobtainium. It should only be found deep, and it should be quite rare. To model the distribution of Unobtainium, you could start with a fractal and apply a very high threshold to it so that only small, widely scattered pockets of it appear in the function. This function can further be modified by a gradient function that scales the threshold as you go deeper into the earth, so that at full depth you find deposits of Unobtainium, but as you approach the surface the deposits become smaller and rarer, until at a certain depth they disappear altogether.

Other minerals and ground types follow similar rules. Sand and loose dirt will typically mostly be found at the surface, and perhaps in trace amounts deeper in, but at the deepest levels where Unobtainium is found, loose soil should be quite a bit more rare. This could be represented by a function as well, bearing in mind that the presence of running water in caves can scale the function, making it more likely to find sand and dirt. And so forth.

You would be amazed at the amazing results you can achieve with just a few relatively simple fractal functions.


This topic is closed to new replies.

Advertisement