[Feature] Add & subtract shapes
Zeklandia opened this issue ยท 2 comments
I would like to be able to add or subtract shapes from each other when assigning an area for Chunky to generate. This would help when extending an area already generated, allow mixing different terrain generation in various patterns, or just allow the creation of worlds with weird shapes.
For example:
- Say I have already generated a circle with radius 15k blocks and I want to extend it to 20k blocks. By subtracting the first circle from the second, it would save time on Chunky checking the existing chunks.
- By subtracting a specific region from new terrain, I could then switch to another terrain generator and come back to fill in the subtracted area with a different kind of terrain. This would make it easy to have a custom spawn area with a vanilla world. While this can be accomplished with trimming, at large scales it would skip generating any terrain I'm not going to keep.
- By combining multiple subtractive shapes, it would be possible to create a single task for generating a more complicated shape. For me, this would allow me to create a single Chunky task for generating all the areas of a world I need generated, making it easier to track progress and also to let the task run asynchronously.
This is a really interesting idea. I see a couple of edge cases where this might get tricky but in general it sounds like a fair solution to the issues you've described (both generating multiple areas of a world, and skipping chunks in non-square shapes). Chunky should already more or less have support for this, but it'll probably need to add a new "composite" shape type which handles things such as adding or subtracting basic shapes.
I've determined that ultimately this idea as-is is not tenable given the complexity required as well as the maintenance burden it incurs. However, it is now (since 0cc7d22) possible to register custom shapes with chunky on startup. These can be as complex as you need them to be and should cover most use cases implied by this issue. If you need help with this please reach out on Discord.
Efficient skipping of chunks is effectively a separate concern and I am continually looking into ways to improve. I've got a few ideas that I want to try, and so hopefully there will be some further improvements in regard to this.