Skip to content

Add cave layers#2826

Merged
IntegratedQuantum merged 2 commits intoPixelGuys:masterfrom
IntegratedQuantum:cave_layers
Apr 6, 2026
Merged

Add cave layers#2826
IntegratedQuantum merged 2 commits intoPixelGuys:masterfrom
IntegratedQuantum:cave_layers

Conversation

@IntegratedQuantum
Copy link
Copy Markdown
Member

@IntegratedQuantum IntegratedQuantum commented Apr 5, 2026

This moves (most) height restrictions of biomes to layers instead. Biomes are now assigned to layers using tags. This allows having multiple distinct layers of caves broken up by other biomes (→#2464 #1463).

Furthermore this will make cave layers more addon friendly. e.g. an addon could add their own layer between e.g. the caves and the root. The engine would then automatically shift down the layers below by the size of the new layer.

Note: The depth hint only decides the order of the layers and is not representative of the actual depth. The actual depth is computed using the layer heights of all layers above it (or below for sky layers).

Root and sky layers are currently set to 10000 to allow addons to place other things above/below it. However as long as no such layers exist, the root/sky will continue until the integer limit.

To @ikabod-kee and @careeoki I'll put this in requires artistic review for you to look at the new way to specify cave biome height and the new layers.

@IntegratedQuantum IntegratedQuantum moved this to Waiting for artistic review in PRs to review Apr 5, 2026
@Crepestrom
Copy link
Copy Markdown
Contributor

im not sure i understand could you give a bit more detail on how it works?

@Crepestrom
Copy link
Copy Markdown
Contributor

DepthHint may not be the best name for the variable
something like BaseDepth or similar may work better

@Crepestrom
Copy link
Copy Markdown
Contributor

also what happens when layers overlap?

@IntegratedQuantum
Copy link
Copy Markdown
Member Author

DepthHint may not be the best name for the variable
something like BaseDepth or similar may work better

I wanted to emphasize that it's a hint and does not necessarily reflect the actual height

also what happens when layers overlap?

That can't happen. One of them will be placed first, and the other one will be placed after the first one's layerHeight

@ikabod-kee
Copy link
Copy Markdown
Collaborator

Ooooh hell yes this is sick. Can layers overlap, or is that not allowed?

@Argmaster Argmaster self-requested a review April 5, 2026 19:36
.{
.isCave = true,
.minHeight = 10000,
.tags = .{.sky_island_layer},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to, by mistake, leave .tags empty, it would be nice to get an error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, if I were to not assign a biome to any layer, that might happen even if there are tags

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are valid use-cases for having biomes that are not assigned to any layer. An addon may want to add biomes to layers introduced by other addons, while still allowing you to use it standalone.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, for that I would say to provide an extra tag .no_cave_layer_required or alike, so we make sure this is not done by mistake.

Btw I assume that biomes which are not part of a cave layer do not generate, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way good catch. I actually did miss some biomes.

I decided to require cave layers to end with _layer, this makes it easy to detect mistakes even when non-layer tags are present.

…his allows adding an error to detect if a biome is missing them.
};
if (self.isCave) {
for (self.tags) |tag| {
if (std.mem.endsWith(u8, tag.getName(), "_layer")) break;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but do we reserve a no_layer or similar tag for marking the biomes explicitly unassigned?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, There is currently no reason to have an unassigned cave biome, since it wouldn't spawn under any circumstances. If you want to temporarily disable a biome you can also set the chance to 0.

Copy link
Copy Markdown
Contributor

@careeoki careeoki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@ikabod-kee ikabod-kee moved this from Waiting for artistic review to In review in PRs to review Apr 6, 2026
@IntegratedQuantum IntegratedQuantum merged commit 3a7b558 into PixelGuys:master Apr 6, 2026
1 check passed
@IntegratedQuantum IntegratedQuantum deleted the cave_layers branch April 6, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants