delvr / Repose

Walkable hills in Minecraft.
https://minecraft.curseforge.com/projects/repose
6 stars 3 forks source link

Suggestions: Config options to avoid generation issues and cascading collapses #32

Open IdrisQe opened 6 years ago

IdrisQe commented 6 years ago

A number of mods add floating islands in the sky, near-surface caves generate with dirt and sand and gravel on top, and sometimes multiple layers of blocks that don't count as a full block spawn atop eachother (soul sand, Biomes O' Plenty Mud or Ash, etc.) and this can cause some pretty intense worldgen lag as the internal server panics trying to calculate the falling positions of hundreds of blocks at once.

Now, obviously, this can be solved by simply removing said blocks from the config, but then you lose the falling behaviour on many of them entirely. What I propose is some config options to help mitigate these potential issues:

  1. Boolean: "Blacklist non-full" or some better name than that. The idea would be that any block that doesn't count as a full block (soul sand, mud, redstone dust, torches, etc.) would automatically be exempt from the mod's features, to avoid cascades of layers upon layers of them breaking atop eachother then triggering more to break and more and more. repose.blacklistPartial=true

As an example, I generated a Biomes O' Plenty world and my world was immediately frozen for 10+ minutes as a mangrove biome spawned, the mud floor began to collapse, broke on the part of the second mud layer beneath it, which also then collapsed, leaving a huge sinkhole and floating trees. With this config, those wouldn't fall even if in the granular list, nor be automatically placed in the granular list, preventing issues like that.

  1. List: "Bottom Generation Blocks". This one would mirror the Granular list, but instead would make it so that on-generation, if either a non-full block or air is detected underneath, the block generated would instead be changed to the corresponding block in the Bottom Generation list. So for example: repose.granularBlocks=minecraft:dirt,minecraft:sand,minecraft:gravel,minecraft:soul_sand repose.bottomBlocks=minecraft:stone,minecraft:sandstone,minecraft:stone,minecraft:netherrack

And then for example, you have a floating island from a structure mod generate made from dirt, the bottom layer of dirt open to the air will instead become stone to prevent the whole island from crashing to the ground instantly.

  1. List: "Support Blocks" and "Friction Blcoks". The former would make it so that if a granular block is directly below, above, or beside one of the listed blocks, it won't fall due to being held up by the Support Block. The latter would decrease the chance of the block falling when disturbed if two or more horizontal sides (front, back, left, right) are against a Friction Block.

3a. repose.supportBlocks=minecraft.grass,minecraft.mycelium

This would make it so, say a cliff generated with grass on top, and a 2 block overhang of grass and dirt. Due to the grass's roots, the grass nor the dirt right below it will fall, despite both hanging over air, due to the grass that IS on the cliff beside the overhanging grass holding up the overhanging grass with its roots, and the overhanging grass holding up the dirt below it with its roots. If the grass/grass connection is broken, the grass will start to fall because there's no support beside or above it to hold it up, and the dirt below it would start to fall as a result too.

3b. repose.granularBlocks=minecraft.cobblestone repose.frictionBlocks=minecraft.cobblestone repose.allFriction=false repose.bottomFriction=false

And then you build a hollow box out of cobblestone. Due to the roof cobblestone being surrounded on all four sides by more cobblestone, it doesn't fall. if the integrity is compromised, there's a 25% chance that blocks with horizontal sides now exposed to the air due to the missing block will fall. 50% chance if two sides aren't against friction blocks. 100% if 3 or 4 sides have air beside them, instantly causing it to fall, not held in place by friction.

allFriction, if true would label every block as a friction block, making it so any granular block can only fall if 1-4 horizontal sides are exposed to air and it's not being held up by a Support Block. This would let sand roofs be stable so long as the sand block is surrounded on all four sides by any block that isn't a non-full block. Could also make cave-ins a significant hazard if you set Stone to be a Granular block and had allFriction on, so if you mine out a cave wall incorrectly there's a chance part of it will collapse.

bottomFriction, if true would make it so if there is any Friction Block directly under a Granular block, it cannot collapse outward when disturbed, essentially stabilizing them.

IdrisQe commented 6 years ago

Avalanche config option set to true, did not break any block. Severe FPS lag and physics rubberbanding due to the sheer number of blocks constantly falling, an entire sand dune collapsing into the ravine it generated next to. This is the kind of thing I'm hoping to get fixed. 2018-09-23_19 52 27

delvr commented 6 years ago

HI IdrisQe, thanks for reporting this. If I may quote myself from issue #33: this sort of thing tends to happen in modded worlds with more suspended gravity-enabled blocks than Repose normally has to deal with. There's a "safety valve" in the code that causes blocks to teleport instead of creating falling entities when the server starts to lag too much, but clearly that's not sufficient. I was planning to change this mechanic for 1.13 but I'll see if I can come up with a workaround for 1.12 in the meantime.

I like a lot of your suggestions, and explored some of them when first creating this mod but I was wary of modifying blocks as suggested in point 2). Now that the mod's been out for a while, this kind of thing makes more sense as long as it's configurable. My time is rather limited right now, but stay tuned for updates.

Sunconure11 commented 6 years ago

Recurrent Complex and Ruins have quite a few structures that use dirt and what not, why not try and pick up on those structures, and shut off the functionality of the mod on dirt, sand, and other such blocks spawned in their structures?

delvr commented 6 years ago

Hi Sunconure11, thanks for your suggestion. Unfortunately it's not possible to detect if a given block is part of a structure from an unknown mod. If they use special blocks, they'd be able to exclude them from Repose's config; if they use vanilla blocks it wouldn't be possible to treat them differently than the natural ones. So I'll be looking at the various other lag-reducing solutions available.