Biome-independent structure tables#2129
Conversation
|
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 |
|
I didn't mean to close that |
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 #2129. A lot. 2. Splitting it out from biomes.zig into another file makes it a bit cleaner once we add the changes from #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.
|
Memory leak fixed, and I added migrations stuff to it for whenever someone needs to migrate structure_tables in the future. This should be good to go for review. |
|
Whenever this is merged, #1283 can proceed as meteorites can be made into a structure table that spawns in any biome or biomes with specific tags. (Biomes currently have no tags, but coming up with those tags could be an issue on its own to discuss) |
There is a limit of a few blocks. Anything beyond that is not possible with the current, precomputed, blue noise map. |
Hmm, I see. Should individual structure chances be normalized to fractions of the total chance on the full table? (Like how we do structures in a biome right now, but instead of checking |
|
yes, though unlike biomes I'd say if present, it should always normalize to that value, even if it's below it. |
|
I'm not entirely sure I got it right, but I implemented it |
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Also there are still traces of #2129 (comment)
Furthermore I want the structure table for that unique and never seen before structure from ikabod.
|
I'll remove the "torches_everywhere" and "meme" structure tables now that we have a real one added. |
|
please fix the errors |
|
Should be good to go |
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 tags (new feature, currently unused) against the tags in each structure table that was loaded previously. If all tags on the table have matches in the biome's tags, add the structures from that table into the biome's internal structure table in memory at world load time.
Additionally, if a structure table has an empty .tags (len == 0), it should spawn those structures in all biomes. So those structures are added to all biomes' internal structure table.
Implementation details:
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.