ThisTestUser / FarLandsChronicles

A documentation of a journey into the far lands
5 stars 1 forks source link

Soil depth far lands #4

Open muzikbike opened 3 years ago

muzikbike commented 3 years ago

Like with fundamental terrain itself, the thing that dictates how deep dirt/sand/etc. generates at a given position is indeed also controlled by a noise generator. While I haven't seen these at all in vanilla or minor modifications, CubicWorldGen's implementation of this can absolutely be broken like the others.

This requires directly changing the preset text as the setting we're after has no slider. Our target variable is cubicgen:biome_fill_noise_freq near the bottom. By default, this is set to a value that would result in it first generating at 34,359,738,368 blocks out, which is currently inaccessible as no known mods allow terrain generation at this distance, so the value will need to be increased to have it overflow within achievable bounds. To have it break at normal Far Lands distance, set it to 21.38787509 (preferably moving the Far Lands to generate farther away for convenience). Multiplying the frequency setting with the position the overflow starts at will always yield 268435456.

Here are examples of the overflowing in action: 2021-01-25_06 18 40 2021-01-25_06 22 52 2021-01-25_06 26 03

A notable thing about these far lands is the gravel that generates everywhere as a result. This must correspond to the noise generator hitting 0 or negative values. This also is therefore implied to happen in vanilla generation, as sufficiently deep bodies of water have gravel at the bottom. Indeed, the Far Lands that generate as a result will clearly affect oceans, resulting in dirt and disks generating on ocean floors like with beta 1.8-1.6.4: 2021-01-25_06 22 12

Digging underneath the lines will result in the non-gravel lines going very deep into the stone below. Hacking the mod to remove the limitations on this noise generator's accepted values (its corresponding setting in CubicWorldGen does not appear to be functional) results in these lines going infinitely deep down.

It's important to note, though, that CubicWorldGen isn't actually modifying vanilla terrain generation, but rather has its own recreation of vanilla world generation settings which it allows users to customize. As such, this soil depth noise must break differently from what vanilla's would be expected to. Notably vanilla uses simplex noise for soil depth, whereas CubicWorldGen employs usual perlin noise for this purpose. I have no knowledge of how simplex noise overflows as there are no other noise generators that use it that I can easily overflow.

muzikbike commented 1 year ago

This is very much breakable in Beta 1.7.3 as well. In ChunkProviderGenerate, a bit above terrain shaping noises, there's the following line:

stoneNoise = field_908_o.generateNoiseOctaves(stoneNoise, i 16, j 16, 0.0D, 16, 16, 1, d 2D, d 2D, d * 2D);

By default, this would overflow out at 34,359,738,368 blocks. Let's instead crush things inwards a bit by changing the first two instances of d 2D to d 200000D - this should instead force an overflow at 343,597 blocks: 2023-03-13_08 00 28 2023-03-13_08 01 14 2023-03-13_08 01 42

As expected, we get long, one-dimensional lines of regions with deep soil alongside regions where the soil is incredibly deep, reaching all the way down to the bedrock layers. 2023-03-13_08 08 10

As this predates release 1.7's ocean generation changes, we have regions of exposed stone (the classic "basins") instead of gravel. Above the sea level, the topmost level is replaced with air, meaning that these areas are one block deeper than the surrounding terrain. Underwater, such regions are coplanar with the normal terrain.

The seed used here is 1.

This also exists in the Nether, in which it works much the same. For some reason, it still assumes that the sea level is 64 in the Nether, so when terrain dips below that after this overflows you'll be seeing a lot of misplaced lava. This remained an issue until release 1.16 or so.

allamassal commented 1 year ago

It seems that in newer versions, the biome fill noise far lands don't exist, and soil depth just becomes three blocks (4 if including the topmost block) everywhere after a certain point. This is because it was changed from Perlin to simplex noise (most likely in release 1.7).