Need help at terrain generation script

Gen.rbxl (59.8 KB)

This is a terrain, Perlin-based generation script with caves, ores, and a half-working “biome” system

Now, The problems I have are :

  1. I can’t seem to add moutains properly while making most of the terrain smooth, I did add one at some point, but the height different make it seem like a chuck of land just got elevated while the rest didn’t, So if anybody know how to smoothen terrain effectively, or “bias-ing” the noise to make it mostly flat, with only a little bit of high value.
  2. The generation can get laggy and sometimes take a long time.
  3. While generating maps over 512x512, I can’t figure out how to “extend” the barriers without it being too buggy or inaccurate.
  4. The code is spaghetti, which makes it kinda hard for me to optimize/implement stuff.

So if anyone got ideas or how to implement the features I listed above, especially making the code simpler and shorter (That’s not too advanced), please help! Thanks!