lithium-fabric icon indicating copy to clipboard operation
lithium-fabric copied to clipboard

Implement a faster biome array implementation for the overworld

Open jaskarth opened this issue 4 years ago • 4 comments

With the introduction of vertical biome support in 1.15, biome storage has moved from a 16 * 16 array in favor of a 4 * 64 * 4 low-resolution array where each element represents a 4x4x4 cube which is then upscaled to represent the whole chunk. While the nether and end use 3d upscaling via VoronoiBiomeAccessType, the overworld uses 2d upscaling through HorizontalVoronoiBiomeAccessType, so we can get away with only sampling the horizontal coords and using it to fill in the rest of the column. A quick sampling shows a 2x improvement in biome array setting times. Granted, it wasn't much to begin with in vanilla, but with more complicated biome layer setups this can make a huge difference. Before: image After: image

I would like to thank @alcatrazEscapee for the original implementation of this patch and allowing the usage of his code :)

jaskarth avatar Dec 26 '20 22:12 jaskarth

You forgot to add the Mixin to the config file. I PR'd to your fork so you can pull in and this PR will be updated. I don't care about contributing, so you can manually type the Mixin into config rather than pulling in my config file (if you want).

Ended up doing it manually since it's just one line. Thanks though!

jaskarth avatar Jan 27 '21 20:01 jaskarth

I am considering to merge this in the 1.17 branch. Is the horizontal biome array only meant to be used during generation, or also after a chunk reload? Either way the save format needs to be like vanilla, as users may uninstall lithium or disable the mixin at any time. Could this be an issue?

2No2Name avatar Jun 02 '21 16:06 2No2Name

The horizontal biome array is just a modification of one of the constructors. It only affects sampling when the initial biome layers are passed in.

  • Save format is identical, as once constructed, the horizontal biome array behaves (and stores the exact same data) that vanilla does.
  • It will not be used after a chunk reload (nor does it gain any benefit from doing so) as all biomes are saved to the chunk and do not gain any benefit from the horizontal only sampling that this biome array uses.

alcatrazEscapee avatar Jun 02 '21 17:06 alcatrazEscapee

Closing as the changeset is out of date and doesn't apply to modern versions.

jaskarth avatar Dec 04 '22 20:12 jaskarth