Closed levlups closed 5 years ago
I tried also to the simplex3d but failed , could you added to the terrain types thanks
It sounds like you are using the new genAdvancedTerrain
function which I didn't have to time to write about it in the wiki yet. The setup is something like this.
var terrainOptions = {
a_zoom: 100,
a_height: 7,
b_zoom: 50,
b_height: 3,
c_zoom: 500,
c_height: 10
};
// worldDataNeeded Event
noa.world.on("worldDataNeeded", function (id, data, x, y, z) {
data = noaTerrainGen.genAdvancedTerrain(id, data, x, y, z, [grassID, dirtID, stoneID], terrainOptions);
// Tell noa the chunk's terrain data is now set
noa.world.setChunkData(id, data);
});
Now to generate the advanced terrain, we create 3 height maps, a
, b
and c
. The zoom of each height map, zooms the height map in, and the height is how much height the terrain can be.
Basically here is the math function:
var random = Math.floor((noise.simplex2((x1 + x) / options.a_zoom, (z1 + z) / options.a_zoom) *
options.a_height) + (noise.simplex2((x1 + x) / options.b_zoom, (z1 + z) / options.b_zoom) *
options.b_height) + (noise.simplex2((x1 + x) / options.c_zoom, (z1 + z) / options.c_zoom) *
options.c_height));
Also simplex3d
would not be good for terrain gen, as it is 3D, but things like clouds would be good 'cause they are 3D. The terrain is actually 2D. Just think about it top-down. The noise.simplex2
generates a height map like this:
The black parts are the deepest and the white parts are the highest. Now imagine putting three of those on top of each other, that's what genAdvancedTerrain
does.
Edit: Oh yeah you said you wanted huge hills. Well here is the terrainOptions
variable for that:
var terrainOptions = {
a_zoom: 100,
a_height: 7,
b_zoom: 50,
b_height: 3,
c_zoom: 500,
c_height: 100
};
You can mess around with these settings and get some crazy results. Have fun!
Edit 2: There is also a possibility that you spawn inside the hill in the huge hills.
it worked ,lets try to figuret out caves ect.. I found some reading to help https://github.com/UnknownShadow200/ClassiCube/wiki/Minecraft-Classic-map-generation-algorithm
I tried this after the big hills worked but it failed NoaTerrainGen.prototype.genAdvancedTerrain = function(id, data, x, y, z, blockIDs, options, seed) { var noise = noise.simplex3(x/20, y/50, z/20) if (seed) { noise.seed(seed); } else { noise.seed(this.random); } for (var x1 = 0; x1 < data.shape[0]; ++x1) { for (var z1 = 0; z1 < data.shape[2]; ++z1) { var random = Math.floor((noise.simplex2((x1 + x) / options.a_zoom, (z1 + z) / options.a_zoom) options.a_height) + (noise.simplex2((x1 + x) / options.b_zoom, (z1 + z) / options.b_zoom) options.b_height) + (noise.simplex2((x1 + x) / options.c_zoom, (z1 + z) / options.c_zoom) * options.c_height)); for (var y1 = 0; y1 < data.shape[1]; ++y1) {
if (y1 + y === random + 1&& noise>0.93) {
data.set(x1, y1, z1, blockIDs[0]);
} else if (y1 + y < random + 1 && y1 + y > random - 5) {
data.set(x1, y1, z1, blockIDs[1]);
} else if (y1 + y <= random - 5) {
data.set(x1, y1, z1, blockIDs[2]);
}
}
}
}
return data;
}
I used this in colorful example and I was getting massive sick caves var cloudY = 20 var cloudCutoff = .93 ; var noise = simplex.noise3D(x/20, y/cloudY, z/20)
if (y<groundLevel && noise > cloudCutoff/100) return stoneID if (y==groundLevel && noise > cloudCutoff/100 ) {
if (y < -4) {
if( Math.random()*100<50){
return emeraldID
}else{
return 0;
//return stoneID //stoneID
}
}
else if (y == -4) return dirtlitID
else if (y == -3) return grassID
else if(y<groundLevel){
return dirtID
}
Okay I'm going to make a separate issue for this, since this one is solved.
noa-terrain-gen.js:325 Uncaught TypeError: Cannot read property 'a_zoom' of undefined
where do I find a_zoom