jaskarth / simplexterrain

A Fabric mod to generate new and more interesting terrain!
GNU Lesser General Public License v3.0
53 stars 8 forks source link

Village spawning issue #23

Open BrekiTomasson opened 4 years ago

BrekiTomasson commented 4 years ago

This is an issue with several mods that affect terrain generation, but as yours is the one I prefer (by far!), I'm raising this issue here.

Very often when encountering a village in a Simplex world - even with the default settings - houses can appear as floating in mid-air, supported only in a single corner, or they spawn with terrain inside of them, sometimes suffocating the villager that spawns inside.

I'm not sure how best to fix the problem of floating houses, unless there's some way to modify the terrain generation to raise the terrain to meet the bottom of houses and then somehow (re-)iterate terrain generation from there once the village has been placed, but I'm sure you know the code better than me and can think of something there. As for the buildings spawning with stuff inside of them, the best solution that I can think of is to somehow iterate through the structures, block by block and forcing anything not already dedicated to be a specific block to be set to minecraft:air instead of whatever the terrain generation has placed there.

Here's an an image illustrating a desert village spawning with sand inside the house.

image

jaskarth commented 4 years ago

Yeah this is an old issue that's been plaguing the mod for a long time. I'm not entirely sure how to fix it, but I'm gonna try a few things. I think part of the problem is that the normal world generator smooths the land around the village but I didn't include that in simplex terrain because that code is horribly obtuse. That being said I think I know a workaround; I'll keep you posted if I fix it.

Derpford commented 4 years ago

I can think of a couple possible avenues for fixing this:

  1. Shove villages upward. Force villages to generate their structures higher than normal, so they at least don't generate buried houses.
  2. Try to detect when terrain is generated inside a village structure, and respond by clearing out the space around the structure block's location.
  3. Turn all terrain within the village's boundaries into flat terrain.
WrongWeekend commented 3 years ago

village In addition, village fields often generate in odd patterns or replace the wrong blocks.

jaskarth commented 3 years ago

farm tree bottom text Jokes aside, I'm going to look into this very soon. Seems like village fields use the wrong heightmap or something, causing them to replace the topmost block. I'll look into a fix.

Barteks2x commented 3 years ago

Ideally you should be using the height value used by structure placement computed directly from noise here, not the actual heightmap (and possibly just force this to be flat instead of following terrain shape to make it more efficient)...

And you probably need to implement whatever vanilla does to make terrain around structures flat. There is special code for that in the chunk generator.

jaskarth commented 3 years ago

Yeah, that's true. I've avoided that code for now because the math scares me :P

Barteks2x commented 3 years ago

It honestly doesn't seem very complicated to me once you deobfuscate it. It essentially has a lookup table by x/y/z distance of the "weight" (may be "reversed"?) of the structure's Y coordinate vs real noise. Should be even simpler than vanilla if you don't have 3d noise.

ridjack commented 3 years ago

Has there been any movement on this issue? I would love to use Simplex in the modpack I'm putting together, and this issue with villages (and structures in general) is the only thing stopping me.

DVIcable commented 3 years ago

I would love to see this issue fixed. Makes exploring structures a pain.

FewerFlaws commented 3 years ago

I might be mistaken about something, but it seems like half of this problem could be resolved by editing the data for village structures such that the interior of buildings is filled with "minecraft:air" blocks where necessary. Has anyone looked into this?