Dust

Dust

12.9k Downloads

Some structures do not account for surrounding ground levels

Laike-Endaril opened this issue ยท 3 comments

commented

As seen in this screenshot:
https://ibb.co/z4bmgkC

Basically, it seems to only account for ground height at the center

commented

Closing due to the discontinued development of the 1.12 version

commented

the question i have is your opinion on how to handle this? my current ideas are either generate a slab of ground with the structure, or check the area the structure needs to spawn and generate if there is room. im open to ideas here.

side note, i am currently working on (when i get time) redoing how all structures generate in world, along with fixing some existing issues and a few new machines (so i can finally get rid of placing machine blocks in structures) so i hope to resolve this in a future update.
~Thanks for taking the time to report this :)

commented

I think checking the surroundings and delaying generation if unsuccessful is probably the best approach for this structure, at least. Making sure it generates in a relatively flat area will lead to better results, immersion-wise.

When I say "delaying", what I mean is that if it fails in the current chunk, set a flag to make it attempt generation again next chunk, so as to keep the rarity of the structure about the same.

As for the terrain height limits, I'd say any area with no more than a 2 block height difference is fine; you can always adjust the surrounding terrain a bit to make it prettier if you want. Which is to say, your idea of generating a slab along with it, but instead, generate a small, round hill of dirt. The hill gen can clip into the existing terrain without issue, and acts as a buffer / "cushion". It can cancel generation of any hill dirt blocks that are not replacing "soft" blocks (I can't remember the proper term right now, but there's a method you can call somewhere that returns whether a spot is available to place a solid block in or not, commonly used for right click events with blocks, when players place them).

And if you wanted to take that further, you could make the hill match the block types already existing in the surrounding terrain. Ie. if the topsoil at the edge is dirt, generate dirt, but if it's stone, generate stone instead, etc.

So some pseudocode...

  1. Check the "try again" flag (false by default; set in a future step of a previous iteration) and the random gen chance to see whether we should try generation
  2. Find maximum and minimum surface height in the prospective area
  3. If height variation is too large, set the "try again" flag and then return/cancel
  4. Generate a hill which raises the entire area up to the highest height detected in step 2, and tapers down on the edges to the lowest height detected
  5. Generate the structure at the highest height detected (ie. on top of the hill)

You could also opt for the opposite (punching a roundish hole in the terrain), or a combination of the two (average smoothing of terrain). The hill is probably the simplest of the 3 though, since punching a hole is more likely to dig into non-surface block types.

Sorry for the speech! And don't worry about it too much, since it's not exactly a game-breaking thing. It's just a little immersion-breaking is all (and gives away the little secret that there are ores under the pillars :P)