[WIP] [WGEN] Hills - Rolling hills :D

Discussion in 'WIP and Development Status' started by rymate1234, Feb 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    rymate1234

    So, not uploading jar file as I wanna keep it exclusive to my server for a while :p

    But I present you with images!

    [​IMG]

    [​IMG]

    Most of the populators were borrowed from BananaGen, but as that plugin has not been modified in 6 months and the developer has disappeared, I could hardly ask for permissions :p
    Also there is a better render here http://overviewer.org/rymate/map/

    I will probably release once I've changed some of it. I want to modify ore generation for example and caves. I also plan to have some configurable options to it :)

    Well, I've decided to release a WIP version. http://rymate.co.uk/Worldgen.jar
    To use it, just add this to bukkit.yml
    Code:
    worlds:
      <world name>:
        generator: WorldGen
    Where <world name> is the name of the world
     
  2. Offline

    DrAgonmoray

    rymate1234
    I demand you teach me how to make sexy generation like this
     
    thehutch likes this.
  3. Offline

    thehutch

    What he said ^
     
  4. Offline

    rymate1234

    Here's the main chunk generator :p
    Code:
    package me.rymate.WorldGen;
     
    import java.util.Arrays;
    import java.util.List;
    import java.util.Random;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.block.Biome;
    import org.bukkit.generator.BlockPopulator;
    import org.bukkit.generator.ChunkGenerator;
    import org.bukkit.util.noise.PerlinOctaveGenerator;
    import org.bukkit.util.noise.SimplexOctaveGenerator;
     
    class WorldGenerator extends ChunkGenerator {
     
        public WorldGen plugin;
     
        public List<BlockPopulator> getDefaultPopulators(World world) {
            return Arrays.asList(new BlockPopulator[]{new MetaPopulator(this.plugin)});
        }
     
        public boolean canSpawn(World world, int x, int z) {
            double xX = Math.random() * x;
            double zZ = Math.random() * z;
     
            return xX > zZ;
        }
     
        public int xyzToByte(int x, int y, int z) {
            return (x * 16 + z) * 128 + y;
        }
     
        public byte[] generate(World world, Random random, int chunkx, int chunkz) {
            byte[] block = new byte[32768];
            byte bedrock = (byte) Material.BEDROCK.getId();
            byte stone = (byte) Material.STONE.getId();
            byte dirt = (byte) Material.DIRT.getId();
            byte grass = (byte) Material.GRASS.getId();
            byte water = (byte) Material.STATIONARY_WATER.getId();
            byte sand = (byte) Material.SAND.getId();
     
            Random seed = new Random(world.getSeed());
            SimplexOctaveGenerator g = new SimplexOctaveGenerator(seed, 8);
            PerlinOctaveGenerator gg = new PerlinOctaveGenerator(seed, 8);
            g.setScale(0.0025D);
            gg.setScale(0.015625D);
     
            for (int x = 0; x < 16; x++) {
                for (int z = 0; z < 16; z++) {
                    int trueX = chunkx * 16 + x;
                    int trueZ = chunkz * 16 + z;
                    Biome b = world.getBiome(chunkx * 16 + x, chunkz * 16 + z);
     
                    for (int y = 0; y < 1; y++) {
                        block[xyzToByte(x, y, z)] = bedrock;
                    }
     
                    for (int y = 4; y < 48; y++) {
                        if (block[xyzToByte(x, y, z)] == 0) {
                            block[xyzToByte(x, y, z)] = water;
                        }
                    }
     
                    double n1 = g.noise(x + chunkx * 16, z + chunkz * 16, 0.45D, 0.7D) * 16.0D;
                    double n2 = gg.noise(x + chunkx * 16, z + chunkz * 16, 0.75D, 0.6D) * 16.0D;
                    double h = Function.get(trueX, trueZ) * 5.0D; //see http://forums.bukkit.org/threads/fun-wgen-create-a-world-from-trigonometric-functions.40213/
                    double noise = n1 - n2 * h;
     
                    if (b == Biome.DESERT) {
                        //lazy deserts :P
                        for (int y = 8; y < 48.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = sand;
                        }
     
                        for (int y = 47; y < 48.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = sand;
                        }
     
                        for (int y = 1; y < 40.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = stone;
                        }
                    } else {
                        //all other land
                        for (int y = 8; y < 48.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = dirt;
                        }
     
                        for (int y = 47; y < 48.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = grass;
     
                        }
                        for (int y = 1; y < 40.0D + noise; y++) {
                            block[xyzToByte(x, y, z)] = stone;
                        }
                    }
                }
            }
     
            return block;
        }
    }
    EDIT: @DrAgonmoray and thehutch
     
  5. Offline

    codename_B

    I taught him everything ;)
     
  6. Offline

    rymate1234

    He speaks the truth! :eek:
     
  7. Offline

    DrAgonmoray

    When can I learn? ;)
     
  8. Offline

    rymate1234

    Was bored today, so I decided to mess with it some more. Here is the latest render
    [​IMG]
    I feel that this version is much better than the one I originally posted. Its slightly flatter, but there's also larger land masses! If people want it, I'll upload the plugin later.

    And more!
    [​IMG]
    Slightly smaller render, just because its quicker to render / upload.
    Here is a link to the plugin https://www.dropbox.com/s/e3praxge6gmhxht/WorldGen.jar

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
Thread Status:
Not open for further replies.

Share This Page