Most of the time, voxels are distributed along the X and Z axis, since usually the world tends to spread on those directions. While also there are mountains, cliffs and peeks around the generated world, those are sparse and most blocks on Y axis above ground will be empty.
By changing chunk height to be a higher value, like many other Voxel Engine does, the number of Chunks is reduced by one magnitude, since it's most likely to have only a single chunk visible on Y axis. On worst case, there will be 3 chunks per Y axis, but that's way lower than currently one.
This should be done before #8, since it'll affect how chunks are cached.
Caveats
storage::chunk::BUFFER_SIZE is used in a lot of places, since until now it's a cubic size, so the code doesn't care which direction it's iterating over, but with this change, all code that iterates over any axis should be reviewed.
Benchmark is needed to measure:
FPS
Cache disk usage
Memory usage
Since chunks are now bigger, compression/decompression may be needed to have better IO performance
Currently chunk has a cubic size, defined by
AXIS_SIZE
here: https://github.com/afonsolage/projekto/blob/928d2eb9b30205665beb6444d8ca790c32275fb7/src/world/storage/chunk.rs#L11Overview
Most of the time, voxels are distributed along the X and Z axis, since usually the world tends to spread on those directions. While also there are mountains, cliffs and peeks around the generated world, those are sparse and most blocks on Y axis above ground will be empty.
By changing chunk height to be a higher value, like many other Voxel Engine does, the number of Chunks is reduced by one magnitude, since it's most likely to have only a single chunk visible on Y axis. On worst case, there will be 3 chunks per Y axis, but that's way lower than currently one.
This should be done before #8, since it'll affect how chunks are cached.
Caveats
storage::chunk::BUFFER_SIZE
is used in a lot of places, since until now it's a cubic size, so the code doesn't care which direction it's iterating over, but with this change, all code that iterates over any axis should be reviewed.Benchmark is needed to measure:
Since chunks are now bigger, compression/decompression may be needed to have better IO performance