Hey all,

I don’t know if this is the right subforum for this as I don’t really have any code to show, this is a more abstract question. I have become enamored with how versatile terrain generation can be in Minecraft and have become interested in something similar for playing with genetic algorithms and artificial life.

I’ve done some reading up on how this is accomplished within Minecraft, and honestly, I don’t see much room for improvement. Basically it’s a 3D perlin noise function (which Panda certainly supports!) What I did to start; just to learn a bit more about the engine, is I made a very simple 10x10xN grid. There is a random int value between 0 and 2 for each space at the second level so that I have a solid bottom. If the value of my random number is 0, then I instance no cube; if it’s 1 or 2, then I do.

Once I get to building the next layer, if there is no block below the current block (everything is stored in a multi-dimensional array, so I can do like if (chunk[x][y][z -1] == 0): don’t create a cube). But this gives ugly and jagged terrain. Which brings me back to the perlin noise function used by Minecraft…

I have figured out how to create a geom plane and apply perlin noise to it; but what I can’t for the life of me figure out how to conceptualize is how to use the values of the perlin noise function to determine where to place my instanced cubes.

I assume I need to somehow reduce the resolution of the function but increase the scale so that it looks sort of “blocky” if it were rendered, then load up each pixel value into a multidimensional array and draw cubes based on where I want to draw them from the functions result.

So…is there a way in Panda3D that I can save the pixel data and access each pixel of the perlin noise function to accomplish this?

edit to add for clarity: Specifically, saving the pixel data for the perlin 3d noise function. I’m sure there are plenty of python plug-ins for reading image data on a pixel by pixel basis (though I’ve yet to look into it as my interest is the 3D function)

Thanks in advance!

-ZM