Skip to content

Conversation

@BoySanic
Copy link
Contributor

@BoySanic BoySanic commented Oct 25, 2025

This PR splits out structures and hashing from biomes.zig into structures.zig and src/utils.zig respectively.

This change should be done for the following reasons:

  1. It cleans up Biome-independent structure tables #2129. A lot.
  2. Splitting it out from biomes.zig into another file makes it a bit cleaner once we add the changes from Biome-independent structure tables #2129 that introduces the StructureTable struct for example. It's technically feasible to leave it all in biomes.zig, splitting it out made the most sense to me at the time for organization purposes.

@nekonesse
Copy link

does this allows addons to add structures to preexisting biomes? 🥺

@BoySanic
Copy link
Contributor Author

does this allows addons to add structures to preexisting biomes? 🥺

With #2129 yes. Not by itself though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this can stay in utils.zig, it doesn't need its own file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Collaborator

@Argmaster Argmaster Oct 25, 2025

Choose a reason for hiding this comment

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

Alright, I have a vague memory of previous attempt to make hashGeneric widely available and I think it was rejected by Quantum with argument that generic functions like this one tend to cause problems and hashGeneric should remain isolated from the rest of the codebase as part of world gen code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. We could maybe stick it in terrain.zig instead? At least then it'd be accessible to more terrain-related structs. Currently only Biome and StructureTable need it due to both using SimpleStructureModel.

I could also see the argument for avoiding this PR altogether and just throwing everything into biomes.zig. If that's ultimately what's wanted I don't mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've put the hashing functions in terrain.zig instead for now.

Also rebased onto QD's latest commit since there were changes there in conflict with mine.

const terrain = main.server.terrain;
const Biome = main.server.terrain.biomes;

pub const SimpleStructureModel = struct { // MARK: SimpleStructureModel
Copy link
Member

Choose a reason for hiding this comment

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

Please update this to the state after #2125


pub const structure_building_blocks = @import("structure_building_blocks.zig");

pub fn hashGeneric(input: anytype) u64 {
Copy link
Member

Choose a reason for hiding this comment

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

This is only meant to be used by the biomes, so pelase keep it in biomes.zig for now.

@BoySanic BoySanic moved this to WIP/not ready for review in PRs to review Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: WIP/not ready for review

Development

Successfully merging this pull request may close these issues.

5 participants