Mining Patch Planner

by rimbas

Adds a planner that designs a mining drill layout for a resource patch.

Utilities
15 days ago
1.1 - 2.0
116K
Mining Blueprints

b "Overfill with mining drills" Option does not fully overfilll mining patches.

18 days ago
(updated 14 days ago)

This option seems to almost always miss potential mining drills around the outer edge of the patch.

https://i.imgur.com/51xzPA7.png

Here is an example of a mining patch where I had to manually place extra drills. Mining patch planner places 383 mining drills on this patch automatically, but I am able to fit 409 with manual placing. With the option disabled, it places 351 drills, so it gets close, but not quite there.

One of these drills is placed outside of the pattern, so that one is understandable to be missed, but all of the others are within the pattern, so they shouldn't be missed.

18 days ago
(updated 18 days ago)

The mining drill placement heuristic in overfill mode avoids placing mining drills that don't have resources directly under them or don't reach a significant amount in the outer area. (like some of those manual miners look like they reach only a single resource tile). And there's a certain performance optimization that I made myself work around to have overfill work when mining drills have a large reach.

I'll see if I can tune it around that limitation but I'd rather rewrite the overfill setting to work on a scale of "how filled you want it"... but I don't have an ETA when.

14 days ago
(updated 14 days ago)

For those wanting more aggressive drill placement like me, you can edit the common.overfill_miner_placement function in the layout/common.lua file from this:

---@param miner MinerStruct
---@return HeuristicMinerPlacement
function common.overfill_miner_placement(miner)
    local size, area = miner.size, miner.area
    local neighbor_cap = (size/ 2) ^ 2 - 1
    local leech = (area * 0.5) ^ 2 - 1

    return function(tile)
        return tile.neighbors_inner > 0 or tile.neighbors_outer > leech
    end
end

To this:

---@param miner MinerStruct
---@return HeuristicMinerPlacement
function common.overfill_miner_placement(miner)
    local size, area = miner.size, miner.area
    local neighbor_cap = (size/ 2) ^ 2 - 1
    local leech = (area * 0.5) ^ 2 - 1

    return function(tile)
        return true
    end
end

I'm not familiar with Lua, but this seems to make the heuristic always place a drill if it can. I tested on a few differently sized ore patches and it does still miss a drill every now and then, but it places about 20-30 more drills than the default overfill pattern. It's possible this has side effects but it seems to work well for me and fits my use-case perfectly.

New response