Asked by rapidflowstudios
Hello there! Haha yes - Me too, it has taken me a good while to understand the basic concepts of Perlin Noise, sometimes it still makes my mind wonder on what im doing, but i have got the hang of it now, it is fun just changing a number to a slightly different value, and looking at the amazing results you get in return.
At the moment i am coding it all in Javascript and HTML5 so i cannot really give any advice on using it in Java, i’m using a port from Stefan Gustavson’s java implemention to javascript, so you could research for his one, that may be easier to use? I’m only using that one because it was aviable to me at that time - Although i came across a library a good while ago called Processing i think? It included perlin noise functions in there, even though it’s different languages the concepts should still be the same, i don’t really play around with turbulence in Perlin either - I can acheive what i want with the default setup, at the moment i had a 3D noise map generating my terrain above ground (The hills, the lakes/oceans and random dirt islands in the lakes), and then i alter the output of it to generate certain veins of ore underground, to accomplish what i need, inbetween that there is of course the fading of the grass/dirt to stone block, just so it looks nicer, that is using a seperate perlin noise map, a 2d noise map, i reuse that one to get different results for “decorating” the land above the ground with various different blocks, for example the trees + baby trees placement, rocks, flowers ect…
Another tip can be that make sure you in some way cache or store the values you get out from the noisemap, mine i store in an array sorted by height, y then x value, just to obtain the blocks i need easier, this way i can preload the map before and store it on the server, when the user joins, pick a random one or create another one. Thats the plan anyway, but at the moment it just preloads a new map using a random seed each time they refresh the page. This is going to change though im sure.
For a simple snippet of how im using it to generate some blocks, take this, its a simple little feature i added to generate baby trees dotted around the map (I plan to have these grow into full trees over time).
I’ve uploaded a few examples of my code to pastebin, hopefully you will be able to understand my code - I agree it’s not entirely efficient, but at the moment i just want it working, then i will go back and optimize everything, it’s a working method for me.
If you need any more help, just ask. As you can guess i end up babbling on too much, but i hope this helps!
Design by Simon Fletcher. Powered by Tumblr.
© Copyright 2010