worldgen lag upon entering misty world
lag42 opened this issue ยท 14 comments
it was taking a while so i checked the log and it said this
[13:30:02] [Server thread/WARN]: Misty World loaded a new chunk (-28, 3 Dimension: 69) during chunk population, causing cascading worldgen lag. Please report this to the mod's issue tracker. This log can be disabled in the Forge config.
hey sorry for commenting on a closed issue but i believe (from a bit of testing) worldgen lag is still a big issue and there are solutions for cascading worldgen that are relatively well-documented nowadays
It depends on the world gen implementation, but most of the time this happens because of biome decorators or other things generating objects (trees, pumpkin patches, small lakes, ores) that overlap into other chunks. You can do this, but only into the 3 positive neighboring chunks, so if you decorate a chunk with trees, you can only place blocks in the 4 chunks (x,z),(x+1,z),(x,z+1),(x+1,z+1).
Assuming that what you generate is smaller than one chunk, you can just offset the position you generate at by half the chunk (+8,+8).
You can find some more insight in this reddit thread and a snippet that does this as an example.
Dumb question, I'm not familiar with the implementation details of your generator, but would it be possible to simply use a noisemap to check for whether you're near a cliff?
Hey I just had a poke at one of the worldgen crashes (caused by another mod, I already reported it to their tracker) which had a big stacktrace of cascading worldgen, and I believe I identified two problems. world.setBlockState(pos,block,2) will update observers, which causes a worldgen cascade, I think you can fix this by using 2 & 16 (=18) as your flags on all worldgen related world.setBlockState calls. The other problem is that LooseRockGenerator appears to cascade still.
I had a peek at the relevant code in my dev enviroment (I'm pleasantly surprised that there appears to be api related stuff) and it looks like the LooseRockGenerator will generate rocks in a 16 block radius, it would probably be perfectly safe if it generated rocks in a 8 block radius instead, considering it's called for every chunk anyway.
Yes thank you...
This decision I have long found and fixed what was possible to fix. However, in my case, this, unfortunately, is not an option. One of the main generators in the world is a generator that removes water near the edge of the cliff. And it can not work without looking at the pile of neighboring chunks.
Yes, you are right about the LooseRockGenerator... It is necessary to reduce its radius, although the result from the radius of 16 I like more )
At the expense of flag 18 I will try to do it ... Thank you.
But, what do you mean by observers? Updating neighboring blocks?
It means that it will update adjacent observer blocks from vanilla if flag 16 is not set, but the problem is that it will call getBlockState for all 6 adjacent positions, and when that happens to be an ungenerated chunk it will generate it.
Then for the water generator it will not work )))
It is based on this principle. It finds all the places where the water is in contact with the cliff and drains the entire volume.
But in all other places I will do it )
it should work for the other place i found a setBlockState call at, i believe it's related to forming ice and snow, ChunkProviderMist.populate()
as for the water thing, that may not be such a big problem for cascading, maybe the rock change and setBlockState change will already work out well enough
Well. I did everything as you said. And I can say that the problem is in the water generator. Without it, there is no lag. However, the water generator is a very important part of the process and it can cover large areas.
So, we will assume that the lag is not a bug )))
However, with the flag 18 it became much faster to generate a snow biome.
Thanks for the help!
Update for forge 2393.
Added a setting in the configuration file that disables the message about cascading worldgen lag. Temporary measure until I find a solution to the problem.
I see that this is a common problem and so far no one has found a successful solution to it.
Is this forge-1.11.2-13.20.0.2228?
Yes, there is such a problem.
But, unfortunately, in this version of forge I did not find how to disable it.
I recommend installing the latest version of forge.