Page 1 of 1

[0.2-Alpha] Biome API - Now With Trees

Posted: Fri Dec 07, 2012 13:25
by jordan4ibanez
Since terrain generation became greatly sped up, this is now possible to do in an ethical manor.

Download

Jungle biomes can be brought back with this.
Image

Currently this has support for 3 layers of biome, an ore that generates in the 3rd layer, and trees.

This is how you use this:

Code: Select all

new_biome(required_noise,first_layer_depth,first_layer,second_layer_depth,second_layer,third_layer_depth,third_layer,ore,ore_chance,tree,tree_height,tree_chance,stump,leaves,remove_tree)
Required noise: The rarity of the biome (0-1, Higher is rarer)

First_layer_depth: How deep the first layer is (example: 10)
First_layer: What node makes up the first layer? (example: "default:glass")

Second_layer_depth: see First_layer_depth
Second_layer: see First_layer

Third_layer_depth: see First_layer_depth
Third_layer: see First_layer

Ore: What ore should generate in this biome? (example: "default:mese")
Ore_chance: How rare should the ore be? Now I recommend you use 0.05 and below or your biomes will be FLOODED with ores! (example: 0.05)

Tree: Spawn trees? This must be a boolean (True/False)(example: True)
Tree_height: How tall should the trees be? (example: 5)
Tree_chance: How thickly should these trees spawn? (example:0.05)
Stump: What should the body of the tree be made of? (example:"default:wood")
Leaves: What should the leaves be made of? (example: "default:stone")
Remove_tree: Should the map generator remove default trees in the biome? This must be a boolean (True/False) (example: True)

And in case all that doesn't make sense, here's a jungle biome I created:

Code: Select all

new_biome(0.0,1,"default:dirt_with_grass",5,"default:dirt",30,"default:stone","default:stone_with_iron",0.08,true,10,0.1,"default:jungletree","default:leaves",false)
Have fun!

Posted: Fri Dec 07, 2012 22:18
by jordan4ibanez
Hey guys, released alpha 0.1, now you can make some simple biomes, have fun!

Posted: Sat Dec 08, 2012 04:07
by InfinityProject
Nice!
Image

Posted: Sat Dec 08, 2012 05:39
by jordan4ibanez
InfinityProject wrote:Nice!
Image
Nice!

Now the Biome API supports tree generation!

Posted: Sat Dec 08, 2012 09:52
by Jordach
YOU ARE EPIC. THIS IS WIN.

Posted: Sat Dec 08, 2012 13:59
by rubenwardy

Posted: Sat Dec 08, 2012 15:52
by InfinityProject
Code to nyan biome:

Code: Select all

new_biome(0.0001,2,"default:nyancat",6,"default:nyancat_rainbow",18,"default:cloud","default:mese",0.05,false,6,0.1,"default:nyancat_rainbow","air",true)
Is the size of a biome chosen at random when it's generated?

Posted: Sat Dec 08, 2012 17:36
by jordan4ibanez
InfinityProject wrote:Code to nyan biome:

Code: Select all

new_biome(0.0001,2,"default:nyancat",6,"default:nyancat_rainbow",18,"default:cloud","default:mese",0.05,false,6,0.1,"default:nyancat_rainbow","air",true)
Is the size of a biome chosen at random when it's generated?
Yes, it uses perlin noise

Posted: Thu Jan 03, 2013 16:34
by Inocudom
It appears you are aware of this mod now, Hybrid Dog. If those pictures are of a jungle biome you made yourself, then you are learning how to make biomes with this mod. It should be much faster than the habitat mod, which even it's creator says it takes up a lot of CPU to work, hence the lag with your swamp mod.

Posted: Thu Jan 03, 2013 17:07
by Sokomine
Let's hope jordan4ibanez will be back soon and include RealBadAngles new trees. Until then, maybe the tree generation of the biome api can be abused for planting saplings? (That is, "trees" with a height of 1 and no leaves). The diffrent layers ought to be fine for the swamp mod, and its vegetation could spawn with VanessaEs plantlife-master on the swamp nodes.

Posted: Thu Jan 03, 2013 21:10
by 0gb.us
Someone I know has requested perfectly flat biomes for easier building. Is there a way to generate those with your biome API?

EDIT: Never mind, I don't think it is possible. But I found a way to make flat biomes work buy reading your code. Thanks!

I don't see a licence on your code though. Is it alright if I use this part of your code in my plugin?

Code: Select all

    local env = minetest.env
    local perlin1 = env:get_perlin(112,3, 0.5, 150)
    local divlen = 16
    local divs = (maxp.x-minp.x);
    local x0 = minp.x
    local z0 = minp.z
    local x1 = maxp.x
    local z1 = maxp.z
    local ground_y = nil
    if not (perlin1:get2d({x=x0, y=z0}) > required_noise) and not (perlin1:get2d({x=x1, y=z1}) > required_noise)
    and not (perlin1:get2d({x=x0, y=z1}) > required_noise) and not (perlin1:get2d({x=x1, y=z0}) > required_noise)
    and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > required_noise) then
        return
    end