feather-rs / feather

A Minecraft server implementation in Rust
Apache License 2.0
2.63k stars 144 forks source link

World generation #24

Open caelunshun opened 5 years ago

caelunshun commented 5 years ago

Roadmap:

This page will be a useful resource.

aramperes commented 5 years ago

I think a first step would be to load the generatorName and generatorOptions fields from the level.dat file.

Then, supporting basic super-flat generation using the layers in generatorOptions to set blocks in un-generated chunks wouldn't be too hard. Afterwards, we'd need basic decorators/populators for biome features like trees as defined in the options' structures.

We'll need a perlin-noise library to support terrain generation in "default" world types, as well as implementing the biome grid/map layers. The logic for the latter could be based off Glowstone, which has near-parity with Vanilla (but only for 1.12).

Larger structures like villages, caves, and strongholds will probably be later additions and be tracked in separate tickets when the time comes.

At some point we'll also have to be able to generate a world from scratch (including the level.dat).

Does this plan seem fair to you, @caelunshun?

caelunshun commented 5 years ago

Seems reasonable to me. Superflat generation does seem like a good way to start, given its simplicity.

I think generating a "bland" default world should be the next step—just simple use of Perlin noise to generate hilly variations. This would then lay the groundwork for biomes, caves, and such.

https://github.com/jackmott/rust-simd-noise seems like a good noise library to use—its benchmarks show it to be over eight times faster than alternatives thanks to SIMD.

I'll take a look at Glowstone's biome grid implementation to try to understand how that works. How to generate the variation between biomes has been my main concern regarding world generation.

As for where to generate worlds: when the chunk worker is requested to load a chunk which does not exist, it should spawn a task on the rayon thread pool to generate it and have the task send the generated chunk through a channel when completed. This would be entirely asynchronous and multithreaded, which is ideal for performance.

cheako commented 5 years ago

I was thinking about looking for a save file. Links and meaning a repo would help.... someone could generate saves for a handful of seeds and post them... just make sure you inject some art into selecting the seeds. A website or application that generates saves would be better.

I don't know much about MC other than I think I would like it, I just won't run MS applications.

hansihe commented 5 years ago

I implemented the Minecraft worldgen in this crate a few years ago

https://github.com/hansihe/voxel_worldgen

It has most of the base features including biome support and cavegen. I don't really care that much about it anymore, so you have my permission to change the license/incorporate it in the project as long as I am credited.

Tracreed commented 3 years ago

Great resource for how certain things in the latest Minecraft update is achieved. A lot of talk about world generation. https://www.youtube.com/watch?v=TycBrFKEteU