0 Members and 2 Guests are viewing this topic.
- Set a height variable to what you want for the average height of the levelloop accros each collum: - generate a random number and use that to determine if the ground level should get higher or lower (for example, a random number between 0 and 4: 0: decrease height variable, 4: increase height variable, other values: do nothing.) You might want to decrease the chance of moving up when above the average height, and decrease the chance of gowing down when under the average height to make the world height fluctuate around the average height. You can make the chance of changing the height depend on a biome variable as well. - fill the collum from 0 to a random number of blocks between the ground height of that collum. (set the bounds of that random to something that looks right) If the height for that collum is above the water height: (the water height depends on what type of map you want. Higher than the average height will give you islands, lower than the average height will give you lakes.) - fill the collum from above the last stone block to 1 block under the world height with dirt. Place a block of grass at the top else: - fill the collum from above the last stone block to the world height with dirt. Randomly replace the top block with sand or clay if desired. - fill the collum from the last dirt/sand/clay block up to the water height with water. endifend looptree placing loop: (repeat a random number of times. More means more trees, less means less trees) - Choose a random collum. - Get the location and type of the topmost block If the topmost block is grass: - place the blocks that form the tree at the location you got from the previous step endifend loopore generation loop: - shoose a random location (it's reccomended to use a logaritmic scale for the y-coordinate to make ores more common at the bottom of the world) - try to replace some stone blocks on and around that location by a vain of random ore (more valuable ores being less common)end loop
well, i want to create a 2D minecraft like game on my ipad, it would probably be a map of 1000*50, but i wouldn't know how to create a random world, one that makes sense, with little hills and no floating blocks etc....