BlueStaggo / moderner-beta

MIT License
14 stars 1 forks source link

Terrain does not break down at extremely high coordinate scales in 1.12.2 recreation #19

Open xp2-882030kgz010602 opened 3 hours ago

xp2-882030kgz010602 commented 3 hours ago

To reproduce, keep all settings default, EXCEPT for the coordinate scale, which will instead be set to 545259520. Moderner beta simply produces flat terrain (this part is accurate). image If you do the same in vanilla 1.12.2, you get these crazy walls on the end of each chunk. Moderner Beta does not seem to reproduce these walls. image

xp2-882030kgz010602 commented 3 hours ago

The reason why these walls generate in 1.12.2 is because when Notch fixed the far lands by mod-2^24-ing everything, this modulo operation only happened at the beginning of each chunk. As a result, if the coordinate scale was high enough, the generator could still overflow before the chunk ended, allowing the far lands to start in each chunk, before being "reset" at the next chunk.

xp2-882030kgz010602 commented 2 hours ago

Let me try to be more detailed: MC samples noise every 4 blocks. I will refer to 4 blocks as a unit. Now: Let s be the coordinate scale, and suppose that we want to generate the terrain at a distance of x units. Beta 1.7.3 and earlier would sample the noise "at" x*s and (x+1)*s, with the (relatively in comparison)-well-known breakdown occurring when one of these values exceeded the integer limit. As I mentioned earlier, Beta 1.8+ takes things mod 2^24 at each chunk to prevent this overflow, and it works well enough for normal terrain generation, where s=684.412. Since 4 units make a chunk, we can write x=4a+b, and then MC passes (4as mod 2^24)+bs and (4as mod 2^24)+(b+1)s into the noise sampler. When s is high enough, overflow can once again happen, and thus we get the far-lands-starting-every-chunk phenomenon. The flat terrain generation is a different phenomenon involving high, low, and selector noise being sampled only at integer inputs, leaving only depth noise to drive world generation, which has very small values. I learned all this from Barteks2x, the cubic chunks dev. I don't mean to advertise here, but I do want to give credit where it's deserved.

xp2-882030kgz010602 commented 2 hours ago

Correction: Integer coordinates that are multiples of 256, not just integer coordinates. MC noise repeats mod 256.