-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic Overworld world generation #120
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #120 +/- ##
===========================================
+ Coverage 58.54% 60.68% +2.13%
===========================================
Files 64 76 +12
Lines 8492 9197 +705
===========================================
+ Hits 4972 5581 +609
- Misses 3520 3616 +96
Continue to review full report at Codecov.
|
Height map generator is a bit messed up at the moment. Hope to figure out what's causing this problem. |
In Cuberite we moved away from heightmap generators in favor of shape generators cuberite/cuberite#1604. Basically, a shape represents if a block should be empty (air) or filled. The reason for this is because it was much harder to create proper overhangs if we're generating heights. |
Feel free to contact me with questions about terrain generation (I'm the author of most of the Cuberite Composable generator docs you mentioned). |
Yes, that's what I plan to switch to—the height map generator is just temporary. The issue, though, is that the noise function doesn't appear to produce smooth results, and there are visible lines between chunks. So switching to a density map will still cause issues. This image is a visualization of what the noise function outputs when called in chunks: See verpeteren/rust-simd-noise#9. Also, thanks for the excellent documentation—it's helping a lot. |
@madmaxoft so I have a question about the biome height interpolation method mentioned in the Cuberite docs. I can see how you could interpolate between heights by averaging when using a 2D height map, but the same doesn't apply when using 3D noise to generate a density map rather than a height map. What's your method for doing this? I see that Glowstone uses a 2D height noise with added 3D detail and roughness noises to add overhangs and such. They then use the 2D height noise to calculate interpolation between biomes. Is this a method you would recommend? |
We use a bit different method. Of course calculating all this would be too much for the CPU, so these noises are all linearly upscaled by a factor of 4 horizontally and 8 vertically, so that only a 5 * 33 * 5 values from each are needed for a single chunk. Here's the C++ code: |
Thanks, that makes sense. So from what I can tell, the amplitude for a biome indicates the impact of the Y coordinate on the density values, so lower amplitudes would mean higher terrain, e.g. mountains. This definitely seems like a better approach than the 2D heightmap + 3D roughness noises. I think we'll go with something like this. |
I plan to merge this PR within the next day and make incremental improvements to worldgen over time. @Momothereal any thoughts? |
Just tested the PR. Very impressive work! Sounds good to me |
This is a sad squashing of 49 laborious commits into one: * Lay groundwork for a true world generator * Implement basic height map and composition generators * more work * Initialize light values to 15 * Implement basic biome grid generator + visualization * Initialize biome values in chunks * Implement basic changing of topsoil blocks depending on column biome * Load seed from world save * Don't generate invalid biomes, such as TheEnd * Adjust some parameters and fix biome composition for certain biomes * Various fixes and tweaks * Implement basic two-level biome generator * Rename HeightMapGenerator -> DensityMapGenerator * Add basic ocean support * Correctly set water level below ocean surface * Refactor biome generators into separate files * Fix height map noise - don't use generate_scaled * Refactor density_map into multiple files * Begin work on linear interpolation for noise * More work on trilinear interpolation * Get tests to pass for trilinear interpolation * Initiial implementation of density map generator * Work more on linear interpolation * Rewrite linear interpolation algorithm using different approach * Fix bug with linear interpolation * Fix another bug with interpolation (no, it still doesn't work) * And another one * Sigh... nothing works. * Get density generation to work, after four days of painful debugging * Remove physics debug message which was accidentally added in this branch * Generate density based on biome * Composition fixes * Interpolate between biome parameter values * Minor Voronoi fix: don't use generate_scaled * Biome changes * Add snow finisher * Add shrub and lily pad generator * Fix Voronoi implementation * Add additional height noise to density generator * Add grass finisher * Fix NearbyBiomes impl, which caused cutoffs at biome boundaries * Add reproducability test
The aim is to implement a basic generator with Perlin noise and biome support. Caves, trees, etc. will be added in a later PR.
ComposableGenerator
based on http://cuberite.xoft.cz/docs/Generator.html