iceiix / stevenarella

Multi-protocol Minecraft-compatible client written in Rust
Apache License 2.0
1.45k stars 59 forks source link

world: cubic chunks support #435

Open PureTryOut opened 3 years ago

PureTryOut commented 3 years ago

I don't mean support for the mod necessarily, but support for loading chunks vertically so worlds higher than 256 blocks can be generated. The height limit in Minecraft always felt a bit limiting to me and I loved to play in the past with mods like CubicChunks to increase the world height and even generated the skylands and nether above and below the overworld.

It'd be awesome if Stevenarella supported chunk loading vertically as well early on. I'm not sure how it can be made so it stays compatible with vanilla Minecraft however, as I believe it would require changes to the world save format?

Vresod commented 3 years ago

i dont think stevenarella supports creating world and therefore has no world save format

PureTryOut commented 3 years ago

Not currently no, but I assume it will in the future?

iceiix commented 3 years ago

Cubic chunks support would be cool, but yeah the big problem is server-side support. This could be useful: https://github.com/OpenCubicChunks/CubicChunks (maybe enhance Stevenarella to recognize OpenCubicChunks chunk format?)

Currently definition of the the Chunk struct: https://github.com/iceiix/stevenarella/blob/master/src/world/mod.rs#L1210

pub struct Chunk {
    position: CPos,

    sections: [Option<Section>; 16],
    sections_rendered_on: [u32; 16],
    biomes: [u8; 16 * 16],

    heightmap: [u8; 16 * 16],
    heightmap_dirty: bool,

    block_entities: HashMap<Position, ecs::Entity, BuildHasherDefault<FNVHash>>,
}

stores an array of 16 chunk "sections" (16x16x16):


pub struct Section {
    pub cull_info: chunk_builder::CullInfo,
    pub render_buffer: render::ChunkBuffer,

    y: u8,

    blocks: storage::BlockStorage,

    block_light: nibble::Array,
    sky_light: nibble::Array,

    dirty: bool,
    building: bool,
}

cubic chunk support would entail expanding Chunk to support arbitrarily many sections (etc.), and loading vertically as well. How big are OpenCubicChunks chunks, 16x16x16? (or 32x32x32?)

mpfaff commented 3 years ago

Based on this, the chunks in OpenCubicChunks are 16x16x16.