[Still open] Recruitment for BetterGen: a world generator that bests the default

Discussion in 'Plugin Development' started by jtjj222, Aug 19, 2012.

  1. Offline

    jtjj222

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm sure many minecrafters have had this dilemma: the default terrain has just gotten worse through the updates, and now it just looks really messy and strange. Not to mention there is no real replacement for it yet; The world generator tab is really lacking. I think that if we could get a few plugin developers together, we can build something that has better, more extreme mountains, prettier swamps, better plains for building, as well as solve a major issue with the default generator; new versions of minecraft breaking old terrain. We have the technology. We have the man power. We have the passion. We have the pizza.

    I still haven't hammered out a plan for it, but I have set up a github group, and I am working on a base project to work from. I haven't used github much, so if there is anything I should do, tell me. If you can help in any way, let me know, and I will add you to the organisation. One goal of the project is to have the cleanest code possible, so if somebody could write up some good coding standards, that would be great. Also, I think that it will be very important to discuss the design of the generator, so we will need to find a way to do that.

    https://github.com/BetterMinecraftGeneratorTeam/The-better-generator-bukkit-plugin

    If anyone has any suggestions, please let me know. For now, I am on skype @ jtjj222.

    Devs who might be interested (I just picked out the top devs in the wgen catagory):
    @codename_B
    @daddychurchill
    @Jacek
    @Khoorn
    @mysource
    @Cayorion
    @escortkeel
    @richie3366
    @Canis85
    @magnificence7
    I can't think of anyone else off the top of my head right now, but if you know of someone who could help, tag 'em! I know for me, this will be a great learning experience, and if we can get enough interest in it, it will be epic.

    This post has been edited 1 time. It was last edited by jtjj222 Aug 19, 2012.
  2. Offline

    NSArray

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I am interested in this project. Although I've been programming for several years now, I am still fairly new to Java and Bukkit development, and even less experienced with world generation so I am not too sure about how much I can contribute (it depends who else will be contributing: given enough time I can do anything, but others may beat me to it due to prior experience), but I do write very clean code, and I really like to stick to standards. Also when programming, I often try thinking ahead to see if additional functionality will be added, and I code my classes anticipating those changes, so when the time comes to apply changes, it is a simple process and a minimal amount of code needs to be rewritten.
    jtjj222 likes this.
  3. Offline

    sd5

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm really interested in this. I already tried to make a generetor for beta 1.7.3 terrain *_*
    But minecraft has changed too much so i failed... I've been programing java for now 2 years and I now really much about plugin programming and a bit about worldgeeration too and i have basic experience with github too.
    jtjj222 likes this.
  4. Offline

    MuisYa

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I love your signature :)
  5. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    While I disagree about having the pizza, I agree with the rest of it ;)

    Me, and my giant bank of populators, are with you!
    jtjj222 likes this.
  6. Offline

    jtjj222

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Great! You see, I love terrain generation, but I was never formally taught java (or any programming language for that matter). You will make a great addition to the team. :D. What is your github username?
    :D. What is your username on github? EDIT: I added sd5, seems like it's you :D

    This post has been edited 1 time. It was last edited by jtjj222 Aug 19, 2012.
  7. Offline

    Kodfod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I would be glad to help you! I just started on a World Gen project for someone not too log ago porting a mod to a plugin.
    jtjj222 likes this.
  8. Offline

    NSArray

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    My username is DavidSkrundz
  9. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @jtjj222 how does this look for a base terrain btw?

    [IMG]
    jtjj222 and Kodfod like this.
  10. Offline

    jtjj222

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @codename_B
    Awesome! I am curious to see how you did that. My guess is about 5 or so 2d noise generators for the top, two for the bottom, with 3d noise in between, but I honestly have no idea. Did you push it to github yet? On an unrelated note, how are we going to tackle biomes? Will we just have an array of noise generators for each biome, then mix the generators when there are two biomes close to each other? Something else?
    On a different note, I think I am going to start working on the noise generators. I'm guessing so far that we are going to need 2d perlin, 2d/3d simplex with different interpolation options, and maybe a voronoi generator?
  11. Offline

    Kodfod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @codename_B
    I would like for you to put this on the github so we can see/use this. I would like to do a few tweaks with it if you wouldn't mind =)
  12. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    One 3d noise generator (perlin)

    Sure. For now, come onto my test server? ;)

    141.255.189.33:25567
  13. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Code:
    package de.bananaco.gen;
    
    import java.util.ArrayList;
    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.util.noise.OctaveGenerator;
    import org.bukkit.util.noise.PerlinOctaveGenerator;
    import de.bananaco.gen.populator.*;
    
    public class ChunkGenerator extends org.bukkit.generator.ChunkGenerator {
        double scale = 24.0; //how far apart the tops of the hills are
        double threshold = 0.07; // the cutoff point for terrain
        int middle = 64; // the "middle" of the road
        
        Material ground = Material.STONE;
        Material water = Material.WATER;
        Material surface = Material.GRASS;
        Material lining = Material.DIRT;
        
        List<BlockPopulator> pops = new ArrayList<BlockPopulator>();
        
        public ChunkGenerator() {
            PopulatorWrapper pops = new PopulatorWrapper();
            // underground stuff
            pops.add(NewCavePopulator.class);
            pops.add(LapisRing.class);
            pops.add(EmeraldRing.class);
            pops.add(OrePopulator.class);
            // advanced underground stuff
            pops.add(DungeonPopulator.class);
            pops.add(NewMineshaft.class);
            // above ground stuff
            pops.add(LakeAndCreek.class);
            pops.add(LakePopulator.class);
            pops.add(PumpkinPopulator.class);
            pops.add(MelonPopulator.class);
            pops.add(FlowerPopulator.class);
            pops.add(WildGrassPopulator.class);
            pops.add(TreePopulator.class);
            pops.add(SugarcanePopulator.class);
            // now add the main bit
            pops.save();
            this.pops.add(pops);
        }
    
        public List<BlockPopulator> getDefaultPopulators(World world) {
            return pops;
        }
    
        /*
         * Gets a block in the chunk. If the Block section doesn't exist, it allocates it.
         * [y>>4] the section id (y/16)
         * the math for the second offset confuses me
         */
        byte getBlock(int x, int y, int z, byte[][] chunk) {
            if (chunk[y>>4] == null)
                chunk[y>>4] = new byte[16*16*16];
            if (!(y<=256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0))
                return 0; //Out of bounds
            try {
                return chunk[y>>4][((y & 0xF) << 8) | (z << 4) | x];
            } catch (Exception e) {
                e.printStackTrace();
                return 0;
            }
        }
    
        /*
         * Sets a block in the chunk. If the Block section doesn't exist, it allocates it.
         * [y>>4] the section id (y/16)
         * the math for the second offset confuses me
         */
        void setBlock(int x, int y, int z, byte[][] chunk, Material material) {
            if (chunk[y>>4] == null)
                chunk[y>>4] = new byte[16*16*16];
            if (!(y<=256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0))
                return; //Out of bounds
            try {
                chunk[y>>4][((y & 0xF) << 8) | (z << 4) | x] = (byte)material.getId();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        
        @Override
        //Generates block sections. Each block section is 16*16*16 blocks, stacked above each other. //There are world height / 16 sections. section number is world height / 16 (>>4)
        //returns a byte[world height / 16][], formatted [section id][Blocks]. If there are no blocks in a section, it need not be allocated.
        public byte[][] generateBlockSections(World world, Random rand,
                int ChunkX, int ChunkZ, BiomeGrid biomes) {
            Random random = new Random(world.getSeed());
            OctaveGenerator gen = new PerlinOctaveGenerator(random, 10);
            
            byte[][] chunk = new byte[world.getMaxHeight() / 16][];
            
            gen.setScale(1/scale); //The distance between peaks of the terrain. Scroll down more to see what happens when you play with this
            
            double threshold = this.threshold; //scroll down to see what happens when you play with this.
    
            int smidle = middle-32;
            int mmidle = middle+64;
            
            for (int x=0;x<16;x++) {
                for (int z=0;z<16;z++) {
                    // set things to default "plains"
                    biomes.setBiome(x, z, Biome.PLAINS);
                    
                    int real_x = x + ChunkX * 16;
                    int real_z = z + ChunkZ * 16;
                    
                    setBlock(x, 0, z, chunk, Material.BEDROCK);
                    setBlock(x, 1, z, chunk, Material.BEDROCK);
                    for(int y=2; y<smidle; y++) {
                        setBlock(x, y, z, chunk, ground);
                    }
                    
                    for (int y=smidle; y<mmidle; y++) {
                        double noise = gen.noise(real_x, y, real_z, 0.5, 0.5);
                        double variable = (y-middle)/48.0; // this will generate the offset
                        //variable = Math.abs(variable); // skylands?
                        noise = noise - variable; // scale the terrain    
                        if(noise > threshold) //explained above
                            setBlock(x, y, z, chunk, ground);
                        else if(noise <= threshold && y < middle)
                            setBlock(x, y, z, chunk, water);
                    }
                    
                    
                    for (int y=smidle; y<mmidle; y++) {
                        int id = getBlock(x, y, z, chunk);
                        int idu = getBlock(x, y+1, z, chunk);
                        if(id == ground.getId() && idu == 0) {
                            setBlock(x, y, z, chunk, surface);
                            if(getBlock(x, y-1, z, chunk) != 0)
                                setBlock(x, y-1, z, chunk, lining);
                            if(getBlock(x, y-2, z, chunk) != 0)
                                setBlock(x, y-2, z, chunk, lining);
                        }
                    }
                }
            }
            return chunk;
        }
    }
    
  14. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Initially I was thinking we should have a different generator per-biome (but our own custom biome determiners perhaps?)
  15. Offline

    Kodfod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think so too
  16. Offline

    deltahat

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think this project is awesome. @codename_B Did you develop all those populators yourself?
  17. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    No, but those other folks who did are credited in comments :)
  18. Offline

    NSArray

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    If you need me to do something just let me know. I'll be working on some school work for the next few week so I won't be able to actively participate, but I'd be glad to help wherever it is needed during my 'breaks'.

    Also, how could I set up eclipse with github so I can have everything in one place? I haven't worked with git in eclipse yet.
  19. Offline

    escortkeel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Looks like I'm a bit late to the party, but I'd be happy to pitch in! This looks brilliant! :D

    I'm escortkeel on github. ;)

    Do you use windows? If you do, github has GitHub:Windows out which is really great for repo management. Also, git integration with eclipse is pretty well detailed here.

    Thanks,
    Keeley :)
  20. Offline

    sd5

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Sorry that I'm so stupid, but how can I add the project to github? Normally I uploaded all files to GitHub, .project and .classpath too and the root folder contained the src and bin folder like here: sd5/PVPLogger
  21. Offline

    Thumbz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I've spent absurd amounts of time working with TerrainControl and have a very good idea of how the generator should work. I recommend first getting rollings hills and cool caves and then working from there.

    Also, I'm willing to help with whatever I can.

    This post has been edited 1 time. It was last edited by Thumbz Aug 20, 2012.
  22. Offline

    Njol

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I hope you're kidding...
  23. Offline

    jtjj222

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    That was my code that had that comment originally... Also, is this really a productive thing to post on a recruitment forum?

    This post has been edited 2 times. It was last edited by jtjj222 Aug 20, 2012.
  24. Offline

    Njol

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yes, because if even codename_B didn't understand this then you would have a problem ;)
  25. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I just like to leave other peoples comments intact wherever possible, it's a manners thing ;)
  26. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Also 3d perlin with a shift (based around the water level) as seen in the screenshot I posted there is by far the best looking terrain I've been able to produce.

    Anyone got anything better looking yet?
  27. Offline

    Kodfod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    well i got a good plains going here using 2 3d simplex

    [IMG]


    Minus the random pillars, that's a 3rd simplex i was toying with xD

    This post has been edited 1 time. It was last edited by Kodfod Aug 20, 2012.
  28. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    For plains, we're as well using 2d (performance reasons) do you not think?
  29. Offline

    Kodfod

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    i've used 2d vs 3d and 2d is faster but i dont like 2d =P
  30. Offline

    sd5

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    For desert the same as for the plains would be good, maybe a bit more hilly...

Share This Page