Page 1 of 1

Tile Autoplace Help?

Posted: Sun Jun 25, 2017 12:19 am
by PoisonedPorkchop
I've been trying to make island-like terrain gen, but keep running into lots of problems. Mainly, the islands keep turning out either too big, or I can't even start a map because there are no walkable tiles within 200 tiles of start. Ideally, I want lots of spread out small islands, but instead I get rare massive islands.

The first thing I did was remove all tiles autoplace, by looping through data.raw.tile and setting the autoplace to nil. I then add my own tiles in using the same function as vanilla seems to use.

Code: Select all

local autoplace_utils = require("autoplace_utils")

local function autoplace_settings(noise_layer, rectangles)
  local ret = {}

  if noise_layer then
    ret = {
      {
        influence = 0.1,
        noise_layer = noise_layer,
        noise_persistence = 0.7,
        octaves_difference = -1
      }
    }
  end

  autoplace_utils.peaks(rectangles, ret)

  return { peaks = ret }
end
I then add in my tiles, setting their autoplace via

Code: Select all

--customfillertile
autoplace = autoplace_settings("fillertile", {{{10, 10}, {0, 0}}}),
and

Code: Select all

--customgroundtile
autoplace = autoplace_settings("walkabletile", {{{2, 2}, {0, 0}}}),
The result(after regenning the map like 10 times to get a walkable tile) being something like
screenshot.png
screenshot.png (74.29 KiB) Viewed 911 times
The ideal result is
ideal.png
ideal.png (6.29 KiB) Viewed 911 times
I think the problem is that I just don't understand the rectangles parameter of the autoplace_settings function, so any insight on that would be extremely helpful. Thanks in advance!

Re: Tile Autoplace Help?

Posted: Sun Jun 25, 2017 6:17 pm
by PoisonedPorkchop
Can I please get a reply? I've spent about 4 hours researching autoplace and the little information I did find basically said, "mess with the numbers until you get something you are satisfied with". Well, I've messed with the numbers and nothing I do will generate tiny islands scattered everywhere. If a dev could please explain what these numbers (rectangles parameter in the function) do it would be greatly appreciated, as I have spent maybe 10 hours straight trying different numbers but still keep getting absolutely huge islands! If I am simply blind and missing something crucial, please do point me in the right direction. Thanks in advance!