Giter VIP home page Giter VIP logo

Comments (18)

ronmurphy avatar ronmurphy commented on August 22, 2024

i THINK it is how some one had planned to generate terrain ... but i dont think that it ever went any where.

from minecraft.

Jimx- avatar Jimx- commented on August 22, 2024

Terrain.py is a terrain generation algorithm. It uses 2D Perlin Noise to generate a random height map(Minecraft uses 3D Perlin Noise).

from minecraft.

Jimx- avatar Jimx- commented on August 22, 2024

I just tested the new terrain generation algorithm in terrain.py and now it seems to be able to generate some minecraft style terrains:)
a9

from minecraft.

 avatar commented on August 22, 2024

@Jimx- 👍

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

@Jimx- 👍 That is Awesome!

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

@Jimx- How can I make this the default terrain generator?

from minecraft.

BertrandBordage avatar BertrandBordage commented on August 22, 2024

Consider this as a question from everyone :)

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

Glad it is not just me :) I have been trying to figure out how to make this the default for an hour now...

from minecraft.

Nebual avatar Nebual commented on August 22, 2024

I think Jimx has far more locally than he's committed, theres nothing that interfaces with the rest of the engine in .generate_chunk yet. Also, attempting to run just the PerlinNoise.fBm function once per block took a good 6 seconds for a single Region. His current design runs that at least 5 times per block, so this implementation is currently not possible for realtime generation.

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

Is anyone else having terrain issues? i did git pull today... and terrain land (flat) generates past the wall... and up in the sky. is this just me, or am i so dense that i am missing obvious code changes?

from minecraft.

Nebual avatar Nebual commented on August 22, 2024

Yes, I added that in #60, to show that the wold is now infinite. If you want to try inventing a generator, the flat grass is from world._show_sector

from minecraft.

BertrandBordage avatar BertrandBordage commented on August 22, 2024

???? I don't think we still have a proper terrain generator…

from minecraft.

Nebual avatar Nebual commented on August 22, 2024

Oops sorry, misclicked! Did not mean to close this.

from minecraft.

Jimx- avatar Jimx- commented on August 22, 2024

So far it takes a long time to generate the terrain...So I don't think it's a good idea to make it the default terrain generator.

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

but it would be nice to see how it works...

from minecraft.

BertrandBordage avatar BertrandBordage commented on August 22, 2024

Yes, it could be cool if you explain us how to get it working!

from minecraft.

ronmurphy avatar ronmurphy commented on August 22, 2024

maybe if we reduce the height map from what looks to be 40 blocks to 20, or 15, the terrain would generate faster. I am sure that all of us would much rather have this generator than the current one... not that anything is bad with the current one, just... this one has the potential to be so much better :)

from minecraft.

Jimx- avatar Jimx- commented on August 22, 2024

Sorry for not replying earlier...I have to go to school...
Notch wrote a post about the terrain generation in Minecraft here: http://notch.tumblr.com/post/3746989361/terrain-generation-part-1

To generate the terrain, this generator first uses PerlinNoise to generate some smooth random values, and adds them up to get a density. If a block has a density lower than 0, it will be air. And if a blocks has a density >= 0, it will be ground. I currently use 6 Perlin Noise Generators: one for base terrain, two for river/ocean, two for mountain/hill and one for cave. The formula is:

density = -y + (((32.0 + base_terrain * 32.0) * self._clamp(river + 0.25) * self._clamp(ocean + 0.25)) + mountains * 1024.0 + hills * 128.0) * flatten

-y makes sure that the bottom layer is solid but the top isn't. Because density will be smaller and smaller as y increases.

(((32.0 + base_terrain * 32.0) * self._clamp(river + 0.25) * self._clamp(ocean + 0.25)) generates the base terrain, if ocean and river are both small values, it will generate river or ocean.

mountains * 1024.0 + hills * 128.0 generates mountains and hills, it will generate some blocks at higher positions if mountains and hills are positive.

And here are the lines with which I generated the terrain:

tg = TerrainGenerator(seed)
c = tg.generate_chunk(0, 0, 0) # generate the chunk at (0, 0, 0)
for x in range(0, CHUNK_X_SIZE):
      for z in range(0, CHUNK_Z_SIZE):
           for y in range(0, CHUNK_Y_SIZE):  # set blocks
                self.init_block((c.world_block_xpos(x), y, c.world_block_zpos(z)), c.get_block(world_block_xpos(x), y, world_block_pos(z)))

This is how the terrain generator works. And I just found that math.floor() is much faster than my fast_floor()...

from minecraft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.