# Procedurally placing buildings on noise-field

So, I have a procedurally generated planet. In my case it's 3D (hexagon/pentagon globe) but for simplicity let's assume it is a 2D grid.

I have distributed resources over this planet, using Simplex Noise, with a cut-off value, giving me a binary distribution.

One of the things I generate in this way, are fields of wheat, shown in yellow below.

After the wheat-fields are generated, I want to procedurally place farms on the planet.

If I would just randomly pick a "yellow tile" (tile with wheat on it) then I run the danger of having them poorly distributed, as shown on the left.

What I want, is a nice distribution where farms favour large wheat areas that are still unoccupied by other farms, as shown on the right.

Is there a simple algorithm that can do this placement?

NOTE: I want to use this approach for other buildings like mines, quarries, lumberjack operations, etc. So I want to avoid placing first, and then growing resources around it. I want the noise field to drive the placement, not the other way around.

NOTE: Farms will not consume the wheat. I've made wheat fields binary wheat/no-wheat but also have scaled distributions with "potency" for e.g. forests, where the number of trees per tile can vary.

• First of all, I just want to say I love the aesthetic in that screenshot. Awesome work. – Peethor May 30 '19 at 17:19
• Apart from that, there are multiple possibilities. I don't think I have a well founded answer (that's why this is a comment) but what have you tried? Logically, I would say a farm requires x wheat fields. If the patch of connected fields contains y fields, you can place y / x = z farms on the patch. Or you could just keep placing farms on patches, and subtract the closest x fields from that patch. Then check if the patch is still big enough, or perhaps broken up by the older farm. – Peethor May 30 '19 at 17:26
• Come to think of it, I think wheat is planted around farms, not the other way around. Plant farms first (perhaps distribute them evenly over fertile land) and place x wheat fields around it. That could be easier. – Peethor May 30 '19 at 17:27
• How does the farm affect the field? Does it "consume" a field, does it have a range? Are all the fields created equal, or a field that has other fields around it is "more potent"? – Vaillancourt May 30 '19 at 17:40
• Do farms have a range? – Vaillancourt May 30 '19 at 18:09