-
Notifications
You must be signed in to change notification settings - Fork 170
Biome-independent structure tables #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| .tools = .{}, | ||
| .biomes = .{}, | ||
| .biomeMigrations = .{}, | ||
| .structureTables = .{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new asset type, why not just add the structures directly to the biomes when loading the structure table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that could work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm investigating this a little and it might be easiest to use the approach I took with a new asset type.
At least this way we can have assets load in the structure tables and have a place to put them.
Otherwise, I'm not sure how you'd load structure tables without adding another way to load assets that isn't the standard flow in assets.zig, which may not be preferable due to diverging ways to load assets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just put this directly into utils.zig? It's small enough that it doesn't need its own file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this to a new file should probably be in a separate PR, it make the diff hard to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a single commit for this that I can cherrypick and PR separately before we tackle this one.
If that's preferred I can split that out and PR it on its own to simplify this PR (for when it's no longer a draft)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, definitely. Quantum doesn't like multiple less related changes in one PR (I don't either)
|
On the topic of this PR, I was thinking about how addons might target biomes and with the current approach they'd use biome tags. I think it may make sense to allow the structure table to use the biome's id as a tag, too. Just check if the structure table's biomeTags contains the biome's Id (it would just be an In the future I envision we start categorizing biomes. like |
Fixes #1805
Implements biome-independent structure tables.
The way these work:
Structure tables are loaded into the game along with all other assets.
When loading biomes, each biome checks its biomeTags (new feature, currently unused) against the biomeTags in each structure table that was loaded previously. If any biomeTags match, add the structures from those tables into the biome's internal structure table in memory at world load time.
Additionally, if a structure table has an empty .biomeTags (len == 0), it should spawn those structures in all biomes. So those structures are added to all biomes' internal structure table.
Implementation details:
Moved hashing functions out of src/server/terrain/biomes.zig into src/utils/hash.zig
Moved SimpleStructureModel into src/server/terrain/structures.zig from src/server/terrain/biomes.zig.
Example structure table .zig.zon in assets/cubyz/structure_tables in this branch.