Jump to content

[Forge 1.8] Help Understanding Minecraft's Noise Generation


MCZaphelon

Recommended Posts

Hi there!

 

I've been coding my mod, The Creep Mod, for a while now, and have been quite successful in making it. The only thing that bothers me is that I have been generating floating islands above ground with the ore generator. This would be fine, except for the fact that:

a) The islands are too elliptical, and

b) It is quite possibly the slowest thing in the universe, causing almost game-breaking lag.

 

That's why I want to start generating these islands with the noise generator. I understand how noise generators work, albeit in a basic sense (generating a greyscaled image, and then interpolating between the pixels). My only problem is with how Minecraft implements and uses noise generators, as the variable names make it cryptic to say the very least. If someone could provide me with an explanation and, if possible, some code on how to implement basic noise, that would be brilliant!

 

Cheers,

~ MCZ

I'm a casual modder and gamer! I'll always do my best to be nice, and to help with code issues even though there are better modders out there. If you're trying to help me, I have a good understanding of Java and programming techniques.

 

Please do not PM me on this website, instead, head over to the Minecraft Forums and PM me there (same account name), as I check that more. Remember, I'm only as good as the errors I know how to fix.

Link to comment
Share on other sites

Generating islands in the ocean doesn't use noise generators. It uses biome generator, which is implemented as GenLayer class.

 

After biomes generated, chunk provider uses the information and several noise generators to make terrains.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Link to comment
Share on other sites

Generating islands in the ocean doesn't use noise generators. It uses biome generator, which is implemented as GenLayer class.

 

After biomes generated, chunk provider uses the information and several noise generators to make terrains.

 

Ah, you misunderstand my goal here. I'm trying to generate FLOATING islands, separately from the normal biome heightmaps. What I have thought about doing is running a basic noise generator, but clamping it so that if it goes below a certain value, it doesn't generate at all. I'm thinking Voronoi noise would be good here. I'm trying (without much success) to sort this out now.

I'm a casual modder and gamer! I'll always do my best to be nice, and to help with code issues even though there are better modders out there. If you're trying to help me, I have a good understanding of Java and programming techniques.

 

Please do not PM me on this website, instead, head over to the Minecraft Forums and PM me there (same account name), as I check that more. Remember, I'm only as good as the errors I know how to fix.

Link to comment
Share on other sites

Sorry about my misunderstanding.

 

I read about terrain generation code in vanilla minecraft, and those variable names confused me, but I still find something useful.

 

Noise generators in minecraft are 3-dimension perlin noise generators, which makes a density value for points in 3d space (for example, from 0 to 1). One simple thought is that if it is less than 0.5, it's stone block, otherwise air block. But this will make a nether-like terrain. Each biome has highest and lowest surface levels. The chunk provider will add a value to the raw density. This value depends on y position. If y < lowest, the output density < 0.5, vise versa. A floating island is a coincidence of raw density and y position.

 

That's what I know about terrain generation. May it help you.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Link to comment
Share on other sites

Sorry about my misunderstanding.

 

I read about terrain generation code in vanilla minecraft, and those variable names confused me, but I still find something useful.

 

Noise generators in minecraft are 3-dimension perlin noise generators, which makes a density value for points in 3d space (for example, from 0 to 1). One simple thought is that if it is less than 0.5, it's stone block, otherwise air block. But this will make a nether-like terrain. Each biome has highest and lowest surface levels. The chunk provider will add a value to the raw density. This value depends on y position. If y < lowest, the output density < 0.5, vise versa. A floating island is a coincidence of raw density and y position.

 

That's what I know about terrain generation. May it help you.

No problem! Thanks for your help. Currently I'm trying to make a Voronoi noise function. It seems to be coming together, somewhat.

I'm a casual modder and gamer! I'll always do my best to be nice, and to help with code issues even though there are better modders out there. If you're trying to help me, I have a good understanding of Java and programming techniques.

 

Please do not PM me on this website, instead, head over to the Minecraft Forums and PM me there (same account name), as I check that more. Remember, I'm only as good as the errors I know how to fix.

Link to comment
Share on other sites

More:

There're particulars about implementation.

1. Not all density values of points in world are generate from noise generator. In vanilla minecraft, density values of points in a 4x8x4 zone are interpolated from those of its 8 vertices.

2. Density value resolution can be increased by using multiple noise generator. For example: density = (1 - d0) * d1 + d0 * d2, where d0, d1, d2 can only be 0, 0.33, 0.67, 1. The density can have 10 different values.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Link to comment
Share on other sites

Based on a thread from a few weeks ago, your largest source of lag for generating your floating islands might be the lighting updates.  The farther up the block is placed, the more blocks that need to be rechecked for lighting changes.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Based on a thread from a few weeks ago, your largest source of lag for generating your floating islands might be the lighting updates.  The farther up the block is placed, the more blocks that need to be rechecked for lighting changes.

 

Yeah, that was my thread and I wasn't really able to solve the problem. I had a structure that when placed at ground level took about 4 seconds, but when placed at cloud level took 40 seconds, and any height in between was in between.

 

I tried to solve this by actually trying to bypass some of the setblock code, and tried directly writing to the chunk storage, in both cases trying to bypass the lighting stuff but couldn't quite get it to work. Without lighting calculations the structure placement only took about 40 milliseconds but would crash afterwards. I'm sure someone could figure it out there, it felt like I was close to a solution.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Based on a thread from a few weeks ago, your largest source of lag for generating your floating islands might be the lighting updates.  The farther up the block is placed, the more blocks that need to be rechecked for lighting changes.

Interesting, I was under the impression that the ore generator was forcing new chunks to be generated all at once by trying to place blocks outside of the active chunk... But lighting also seems like it would cause a bunch of lag. Thanks for alerting me to that, I'll see what I can do. And now that I think about it, jabelar, my ore generators DO generate faster below ground level...

 

Kudos to the both of you :)

I'm a casual modder and gamer! I'll always do my best to be nice, and to help with code issues even though there are better modders out there. If you're trying to help me, I have a good understanding of Java and programming techniques.

 

Please do not PM me on this website, instead, head over to the Minecraft Forums and PM me there (same account name), as I check that more. Remember, I'm only as good as the errors I know how to fix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.