Solved World generation

Discussion in 'Spigot Plugin Development' started by ArsenArsen, Jun 13, 2016.

Thread Status:
Not open for further replies.
  1. Hello!
    I am trying to make a custom world generator, buuuuut I never tried before, and I looked at the example by Dinnerbone called "BukkitFullOfMoon". I know the basic way to do it, with perlin noise, and/or octaves, but I always get results like:
    2016-06-12_11.36.47.png
    but I am aiming for something like in mod Galacticraft.

    ^E5D09C1DD2E0D3DAB1505B9757ADC7CE7A39DC305CEB471206^pimgpsh_thumbnail_win_distr.jpg
    I realise that the problem is perlin noise. And a simple algorithm.

    But how do these algorithms work?
    I do not need any spoonfed code, I just need to know how to do it, because I cannot think of the algorithm, and even if I do, how to I keep it smooth for the next chunk?

    Thanks for help in advice.

    // I have no real idea how to do chunk generation
     
    • Informative Informative x 1
  2. I know there is a plugin called EpicWorldGenerator. I haven't used it before, but I know it has the option to make your own custom terrain and biomes :)
     
  3. There's also terrain control, but I want to make it much more custom than that. Also I want to eventually put the plugin up for download.
     
  4. I have no idea how to do auto chunk loading, but to make a custom terrain you can start of with the vanilla (maybe amplified?) terrain and modify a few biomes with voxel. Just use a bit of tnt, use the /b e fill and /b e smooth brushes and then do a /b over d3, /v grass with an arrow on the terrain to cover it with grass.

    I have no idea how to code an automatic generating terrain plugin, but I wish you good luck with it :)
     
    • Optimistic Optimistic x 1
  5. Yea thank you, but no manual one isn't an option. =3
     
  6. I think simplex noise would be a more efficient solution. There's a fantastic article on using it for terrain generation here.
     
  7. That is what I was doing. Simplex noise is very similar to perlin noise. T he ts what I meant.

    But that only gives me repeating smoothed out ups and downs, but I want it like normal world, some low, flat areas and some Hills, et cettera.
     
  8. Based off the later MC updates with generation of more extreme biomes, I don't see why you wouldn't be able to set different noise for different parts of the world based off of various things. Seems like a lot of work to copy what's already been done, though. Do you absolutely need to re-invent the wheel?
     
  9. Yea okay. I will try. I tried that before but it didn't really work out. I'll try again, and get back to you. Thanks.
     
  10. Yeah okay, I got the math done, and a basic idea of per biome math coefficients, but I have another problem, it wont generate.. The world is null.

    Any up-to-date tutorials on how to do it?
     
  11. com.arsenarsen.moon.Generator.DCMoonChunkGen.getFixedSpawnLocation(DCMoonChunkGen.java:125)
     
  12. Yes, there's a null pointer at argument world. Meaning world is null. As I said.
     
  13. It just doesnt work.

    Code (Text):
       
        public int getY(int x, int y, int v, int a, World world){
            SimplexOctaveGenerator g = getGenerator(world);
            Biome b = world.getBiome(x, y);
            g.setScale(a);
            double c;
            if(cof.containsKey(b)){
                c = cof.get(b);
            } else c = 30;
            double r = g.noise(x/c, y/c, a, v)*v;
           
            return SimplexNoiseGenerator.floor(r);
        }

    @Override
        public ChunkData generateChunkData(World w, Random r, int cx, int cz, BiomeGrid b) {
            ChunkData cd = createChunkData(w);
           
            cd.setRegion(0, 1, 0, 16, 1, 16, Material.BEDROCK);
            for(int x = 0; x < 16; x++){
                for(int z = 0; x < 16; x++){
                    cd.setRegion(x, 2, z, x, 2+Math.abs(SimplexNoiseGenerator.floor(getY(cx*16 + x, cz * 16+z, 40, 30, w)+50)), z, Material.BONE_BLOCK);
                }
            }
           
            return cd;
        }
     
    That just makes empty chunks, and I really dont know why.

    It worked some time before hand and it stopped all of a sudden. Still I have no real idea how to do it, that code was just a guess. Im still looking for tutorials on how to do it using generateChunkData(), as thats the only non deprecated method.


    Thank you for all your help to and from this moment everyone.
     
  14. BUMP
     
    • Funny Funny x 1
  15. Use multiple maps noise. Minecraft uses one for things like overhangs, another for overall heightmap - and each biome has values that influence the base height and height variation.

    One simple mistake is sampling noise for every block - this is extremely laggy and slow (50-100 times slower than vanilla generator) - you need to sample every few blocks and average between then.
     
    • Informative Informative x 2
  16. Ok yea that worked. Thank you very much good sir. And thank you @egg82 for showing me that article.
     
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.