Esempio n. 1
0
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        var noise = ProcNoise.Noise(x / 100, z / 100 + 3000) * 20;

        noise *= (1 - Math.Abs(ProcNoise.RawNoise(x / 30 + 2000, z / 30)));

        return(noise);
    }
Esempio n. 2
0
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        // the first 2 values affect the density of terrain of the higher areas, the higher the number the more dense the peaks will be
        var h = ProcNoise.OctaveNoise(x / 80, z / 80, 5) + 5;

        var g = ProcNoise.OctaveWorley(h / 1.6, 2000, 3);

        return(g * 200);
    }
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        var noise = ProcNoise.Noise(x / 400 - 3000, z / 400) * 25;

        noise += ProcNoise.Noise(x / 50, z / 50 - 3000) * 25;

        noise *= (1 - Math.Abs(ProcNoise.RawNoise(x / 70, z / 70 + 3000)));

        return(noise);
    }
Esempio n. 4
0
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        // the first 2 values affect the density of terrain of the higher areas, the higher the number the more dense the peaks will be
        var h = ProcNoise.Noise(x / 40, z / 40);

        // the final added value translates the terrain upwards, this is where you can control the water level ratio the first 2 values define the smoothness of the peak areas.  The higher the number the smoother and wider they become the octave affects the tightness and roughness of the density of peaks, lower values make the terrain much more cartoony and rounded
        var g = h / ProcNoise.OctaveNoise(x / 60, z / 60, 5) + 6;

        // the first 2 values affect the distribution of the terrain, the lower the value the smaller the islands and the tighter together they are the octave affects the ratio of landmass to water, it doesn't make them tighter like the noise values, but actually takes the same terrain and changes how much of it is present vs water.  Higher values mean more land and less water
        var j = g * ProcNoise.OctaveNoise(x / 440, z / 440, 3);

        // the multiplied value affects the difference in height between the high and low areas, the higher the number, the more everything tends to the world height
        return(j * 20);
    }
Esempio n. 5
0
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        var dx = ProcNoise.Noise(x / 5, z / 5 + 3000) * 10;
        var dz = ProcNoise.Noise(x / 5 + 3000, z / 5) * 10;

        var peaks = ProcNoise.OctaveInvWorley((x + dx) / 100 - 3000, (z + dz) / 100, 3) * 1.2;
        var noise = Math.Max(peaks * 50, 35) - 30;

        noise *= 5 * (ProcNoise.Noise(x / 70, z / 70) + 0.1);

        noise += ProcNoise.OctaveNoise(x / 50, z / 50 - 3000, 3) * 30;

        return(noise);
    }
Esempio n. 6
0
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        var j = ProcNoise.OctaveNoise(x / 420, z / 420, 4);

        // the first 2 values essentially translate to the radius of the creaters, smaller the number the bigger the creater
        // var h = ProcNoise.Worley(x / 400 + 200, z / 400 + 200, j) * 1.45;
        var h1 = ProcNoise.OctaveNoise(x / 110, z / 110, 4);
        var h2 = ProcNoise.OctaveNoise(x / 110 + 999, z / 110 - 999, 4);

        // the first 2 values essentially translate to the radius of the creaters, smaller the number the bigger the creater
        var h = ProcNoise.Worley(x / 400 + h1, z / 400 - h1, j) * 1.3;

        if (h < 1)
        {
            h = Circularize(h);
        }
        else
        {
            h = 1;
        }

        return(h * 80 + ProcNoise.OctaveNoise(x / 70, z / 70, 5) * 20 + 60);
    }
 public void SetSeed(long seed)
 {
     ProcNoise.SetSeed(seed);
 }
Esempio n. 8
0
 public void SetSeed(long nudSeedValue)
 {
     ProcNoise.SetSeed(nudSeedValue);
 }
Esempio n. 9
0
 /// <summary>
 /// Returns the height of the terrain at a given point
 /// </summary>
 /// <param name="x">The x coordiate of the point to sample</param>
 /// <param name="z">The z coordiate of the point to sample</param>
 /// <returns>A height between 0 and 255, inclusive</returns>
 public double GetTerrain(double x, double z)
 {
     return(ProcNoise.Noise(x / 100, z / 100) * 10 + Math.Abs(ProcNoise.RawNoise(x / 50, z / 50)) * 5);
 }
    /// <summary>
    /// Returns the height of the terrain at a given point
    /// </summary>
    /// <param name="x">The x coordiate of the point to sample</param>
    /// <param name="z">The z coordiate of the point to sample</param>
    /// <returns>A height between 0 and 255, inclusive</returns>
    public double GetTerrain(double x, double z)
    {
        var h = ProcNoise.Noise(x / 100, z / 100);

        return(h * 100);
    }