FamroFexl / Circumnavigate

Finite, Tiled, Seamless World Wrapping Mod for Minecraft.
https://modrinth.com/project/circumnavigate
GNU Affero General Public License v3.0
19 stars 1 forks source link

[Feature Request]: Wrapped World Generation #30

Open FamroFexl opened 4 days ago

FamroFexl commented 4 days ago

Suggestion

The main methods which need to be modified are in net/minecraft/world/level/levelgen/synth. The methods getValue(int x, int y) and getValue(int x, int y, int z) in SimplexNoise and most of the methods in ImprovedNoise need to be modified.

The 4D noise generation I have been testing in discussions uses OpenSimplex2S. The simple algorithm I have been using to wrap the noise is below:

public int getValue(double x, double z) {
        //This defines the size of the wrapped noise
        double xa = x / WorldTransformer.xWidth;
        double za = z / WorldTransformer.zWidth;

        //This actually wraps the noise by treating the noise values along an axis as a 1D circle of seamless noise.
        double rxa = xa * 2 * Math.PI;
        double rza = za * 2 * Math.PI;

        //OpenSimplex2S requires a seed value. This is retrieved via a RandomSource in minecraft's implementation
        //long seed  = new RandomSource(...);

        //noise4_Fallback is the simplest of the provided 4D noise generation methods, but there are others which may work just as well.
        double out = OpenSimplex2S.noise4_Fallback(seed, Math.sin(rxa), Math.cos(rxa), Math.sin(rza), Math.cos(rza));

        /** 
        * This converts the output to greyscale values so they can be displayed properly. 
        * Obviously, a different form of output will have to be used
        */
        //int colorValue = (int) Math.max(0, Math.min(255, out * 255));
        //return (colorValue << 16) | (colorValue << 8) | colorValue;
}
FamroFexl commented 4 days ago

As far as wrapping y values goes, I believe if it can be calculated independently of the x and z values, it can stay the same. Besides, I believe a 5D perlin noise implementation will have to be used in order to wrap 3 dimensional noise anyway, and I have yet to find any 5D perlin noise implementations.

FamroFexl commented 4 days ago

Implementations of SuperSimplexNoise might require a commissioned expansion for 4D and 5D implementations, since it appears the results of this implementation are less prone to scaling issues as might be the case with OpenSimplex2S.

FamroFexl commented 4 days ago

The original patent for simplex perlin noise also expired over 2 years ago see here, so implementations using that approach might be easier to implement or use than OpenSimplex2S, which was developed as an alternative to the patent.

FamroFexl commented 1 day ago

Step 1: Before we can convert minecraft 3d perlin noise to our 4d perlin noise, we need to integrate our 3d perlin noise (OpenSimplex2.noise3_Fallback()) into the existing code. This will tell us where we then need to put our 4d perlin noise.

FamroFexl commented 1 day ago

As it turns out, biomes have very little to no effect over noise generation. The minecraft wiki says it does affect terrain generation in specific cases. Here are two comparative images.

WITHOUT biomes 2024-11-21_17 07 10

WITH biomes 2024-11-21_17 07 23

FamroFexl commented 1 day ago

NormalNoise uses PerlinNoise BlendedNoise uses PerlinNoise PerlinSimplexNoise uses SimplexNoise PerlinNoise uses ImprovedNoise

Therefore, the only actual noise classes are SimplexNoise and ImprovedNoise

FamroFexl commented 1 day ago

SimplexNoise is used for End Islands. PerlinSimplexNoise is used for Biome temperature, frozen temperature, and biome info. ImprovedNoise is used in PerlinNoise only. PerlinNoise is used in NormalNoise and BlendedNoise only.

NormalNoise is used in a GeodeFeature.

BlendedNoise is used in base world generation for the overworld, nether, and end. It is also used in DensityFunctions to generate erosion, continents, jaggedness, ridges, etc.

FamroFexl commented 23 hours ago

I created this datapack to create simple overworlds that could quickly be analyzed. simple_overworld.zip