[Feature] Layered Generator
astrsh opened this issue ยท 3 comments
Pre-Request Checklist
- I have checked that I am on the latest version of Terra.
- I have searched github for similar features requests, including closed
ones, and found none. - I believe this is within the scope of Terra.
- This feature request is for all of Terra, and isn't something that
should be implemented by a pack or addon.
Feature Description
A generator that generalizes terrain, carving, and ocean, referred to as 'layers'. These layers and their generation behaviour would be config defined rather than hardcoded by the generator.
What Problem Does This Solve?
Adding new aspects of generation to a pack such as aquifers is difficult to do properly without code changes to facilitate it. Data driven generation layers should provide the functionality required for such aspects, and is also in line with the Terra design philosophy, such that concepts like 'ocean' and 'carving' are not hard coded in.
A Solution You'd Like
-
Pack defined generation 'layers'
-
A layer consists of block palette(s) distributed in some way, e.g via sampler:
-
These block palettes and distribution may be determined within the layer definition.
-
In addition individual biomes may define their own specific palettes and or samplers for a layer.
-
Whether a biome or the layer itself determines these parameters could be dependent on what the layer specifies:
Default palettes and or distribution would optionally be determined within the layer definition, otherwise if not
specified then biomes would be required to define palettes and distribution for the relevant layers.Biome specific palettes and or distribution config keys would dynamically be registered similar to keys under
features
.A layer palette would be analogous to the
palettes
key, and distribution would be analogous to the parameters under
terrain
.
-
-
Layers could also determine sampling and interpolation behaviour: see #126.
-
The way each layer generates would be determined by some kind of pack defined logic, e.g a binary decision diagram based on each layer's distribution.
For the layers
terrain
,ocean
andcarving
, the gen logic would be something like the following:if terrain if carving place carving palette (e.g air) else place terrain palette else if ocean place ocean palette else some other behaviour, or no op
Alternative Solutions
The best alternative available right now would be using features to generate things like aquifers, and underground lava oceans, however doing it that way lacks advantages of this generator such as control over interpolation and sampling, more control over initial chunk generation, etc..
This would probably be implemented in a new chunk generator addon, that way we can keep the noise 3d generator addon around for beginners/simple packs.
Mockup config for how the layered generator could work
# Layer predicates define a predicate that takes world coordinates
# Not sure how exactly these should be defined
# The functionality of terrain.sampler, terrain.sampler-2d, carving.sampler, and ocean.level would be utilized here
layer-predicates:
is-terrain:
is-carving:
is-aquifer-border:
is-aquifer-water:
is-aquifer-lava:
is-under-lava-level:
is-under-ocean-level:
# Layer palettes define sets of block placements
layer-palettes:
terrain:
type: BIOME_DEFINED # Allows biomes to specify a palette, this would be dynamically registered as a config key
default: # What the default palette is if a biome doesn't specify a palette
type: BLOCK # A single block palette
block: minecraft:stone
air:
type: BLOCK
block: minecraft:air
ocean:
type: BIOME_DEFINED
default:
type: BLOCK
block: minecraft:water
underground-lava:
type: BLOCK
block: minecraft:lava
aquifer-water:
type: BIOME_DEFINED
default:
type: BLOCK
block: minecraft:water
aquifer-lava:
type: BLOCK
block: minecraft:lava
# Converts to a binary decision diagram
# The 'if' key specifies a layer predicate
# The 'place' key specifies a layer palette
layer-placement:
if: is-terrain
then:
if: is-carving
then:
if: is-aquifer-border
then:
place: terrain
else:
if: is-aquifer-water
then:
place: aquifer-water
else:
if: is-aquifer-lava
then:
place: aquifer-lava
else:
if: is-under-lava-level
then:
place: underground-lava
else:
place: air
else:
place: terrain
else:
if: is-under-ocean-level
then:
place: ocean
else:
place: air
The following layer predicates could share the same sampler:
layer-predicates:
is-aquifer-border:
is-aquifer-water:
is-aquifer-lava:
So perhaps there would be another component that is used to construct the predicates, i.e a layer
distributor.
Layer distributors should supersede the capabilities of the biome keys terrain
, carving
,
and ocean.level
, such that you can do things like specify interpolation, combining 2D & 3D samplers, etc