Poor ore visualizer

This is the place to request new mods or give ideas about what could be done.
Post Reply
coppercoil
Filter Inserter
Filter Inserter
Posts: 477
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Poor ore visualizer

Post by coppercoil »

It would be nice to visualize tiles where ore concentration is below configurable threshold (e.g. 10K).
OreDiscriminator.png
OreDiscriminator.png (4.19 MiB) Viewed 2298 times

Why this mod?
When I place ore miners, I have to avoid poor tiles because they deplete too early and mining setup will not be able to keep blue belts compressed. Long story short, I want to grant ore delivery for X hours to test my megabase. I calculate how much ore I need and what ore richness is required. Of course, I could add some miners for redundancy, but again: where and how much? I don’t want to examine thousands of tiles manually, just want to plop down a blueprint and go further. If I knew what part of ore field is suitable for me, I could move way faster.

What’s important:
  • Simple way to turn on/off poor zone visualization, e.g. by shortcut or by button (it’s not necessary to be on the screen all the time).
  • Threshold value can be changed in the middle of the game. Standard mod settings are ok.
  • Poor zones should be clearly visible regardless of ore color, brightness, facture, sand/grass color and so on. There can be non-Vanilla ore fields.
  • Mod should not restrict to place miners on the poor zone if player wants to.

What would be nice but not important:
  • Different threshold levels for different ores.
P.S.
Mod used for illustration: AAI Zones

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Poor ore visualizer

Post by slippycheeze »

coppercoil wrote:
Fri Jul 05, 2019 6:42 pm
It would be nice to visualize tiles where ore concentration is below configurable threshold (e.g. 10K).
Mod used for illustration: AAI Zones
Are you sure that it wouldn't be easier to have this done with a blueprint, and the AAI programmable structures?

Adapting the "remove the zone marker when there is no ore" to "replace the zone marker with the 'poor' marker <= 10k" wouldn't be a particularly difficult problem, as in, approximately zero effort. Couple that with a second one that just loops over the "poor" markers and removes them if they hit zero, or use one extra decider set, and you have the ability to manually throw down your copper zone wildly, and it'll clean up in the next few seconds to only where there is ore, and to highlight the "poor" quality blocks.

I'm not saying a mod wouldn't be easier, just ... this sounds like a trivial application of the existing tools, and I doubt everyone has the same idea of what "poor" consists, so maybe better worth something like the blueprint?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Poor ore visualizer

Post by eradicator »

Sample implementation (someone else can make a "full mod" of it if they want). Use a deconstruction planner while holding shift over an ore field (don't forget to enable alt-mode). Numbers are auto-deleted after a minute and show ore content in thousands (configurable).

Code: Select all

/c

local factor = 1000 --[[ore content]]

local timeout = 1 --[[minutes]]

local gradient = {
  [0]  = {r=1,g=1,b=1}, --[[default color]]
  [10] = {r=0,g=1,b=0}, --[[more than 10 * factor]]
  [20] = {r=1,g=0,b=0}, --[[more than 20 * factor]]
  }

script.on_event(defines.events.on_player_deconstructed_area,function(e)
  game.print('Showing...')
  game.print(e.alt)
  if not e.alt then return end
  local p = game.players[e.player_index]
  for _,ore in pairs(p.surface.find_entities_filtered{
    type = 'resource',
    area = e.area,
    }) do
    
    local amt = math.floor(ore.amount/factor)
    local color
    for i=amt,0,-1 do color = gradient[i] if color then break end end
    
    rendering.draw_text{
      text = amt,
      surface = p.surface,
      target = ore,
      target_offset = {0,-12/32},
      color = color,
      scale = 1,
      time_to_live = 60 * 60 * timeout,
      players = {p},
      visible = true,
      draw_on_ground = true,
      alignment = 'center',
      scale_with_zoom = false,
      only_in_alt_mode = true,
      }

    end
  end)
  
altmodeore.jpg
altmodeore.jpg (679.77 KiB) Viewed 2258 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

coppercoil
Filter Inserter
Filter Inserter
Posts: 477
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Poor ore visualizer

Post by coppercoil »

slippycheeze wrote:
Fri Jul 05, 2019 10:47 pm
Are you sure that it wouldn't be easier to have this done with a blueprint, and the AAI programmable structures?
I'm not familar with AAI Programmable Structures mod. I just read its description, do I need to connect Tile Scanner to Zone Controller via some circuit network? Sounds interesting, I have to learn more about it. Thank you for an idea.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Poor ore visualizer

Post by slippycheeze »

coppercoil wrote:
Sat Jul 06, 2019 11:16 am
slippycheeze wrote:
Fri Jul 05, 2019 10:47 pm
Are you sure that it wouldn't be easier to have this done with a blueprint, and the AAI programmable structures?
I'm not familar with AAI Programmable Structures mod. I just read its description, do I need to connect Tile Scanner to Zone Controller via some circuit network? Sounds interesting, I have to learn more about it. Thank you for an idea.
Yes. I mean, what you probably want to do, and I gave very poor guidance earlier, is visit the forum post for the AAI Programmable Vehicles mod, and go down the tutorials until you get to the "Clear Empty Resource Zone" combinator widget. That shows you how to wire up the circuits to scan a zone, and if there are zero resources in a marked tile, remove the mark.

That gives you the basics: how to iterate through a zone, how to check the resources present. Adjusting it so that it changes the mark for "low ore level" should (I think) be a reasonably easy thing to do; you can probably have a single combinator widget do both "remove if zero" and "change zone if low ore level", but I'd just use two - "plenty of ore" to "not enough ore", and "not enough ore" to "no ore" - so if you mark an empty tile manually it'll first flip to "low ore", and then "no ore" in two moves.

Slightly less nice display, but much easier to build. YMMV, depending how long you want to invest in the logic for it vs the cost of a second set of buildings.

When I say I gave poor guidance I mean that I believed those were in the post linked from the AAI Programmable Structures mod, but they are not. That only has the low level technical details, and the higher level stuff is in the AAI Programmable Vehicles mod.

You can ignore (or use) all the other stuff like automatically finding zones and marking them, and managing vehicle AI, as you prefer. The tech tree for the structures doesn't force you to go through any of the other AAI vehicle related stuff. Though I found the whole thing an interesting addition to the game, and like the "logistics carts" mod, added a whole lot of depth by giving me viable solutions to problems other than belts, bots, and trains: now train vs vehicle, and carts vs both belts and bots are choices. They all work, and they all have their own advantages and disadvantages, which is great as far as I'm concerned.


Again, this is definitely much, much harder to use than a mod that just drops the overlay in place. OTOH, if I wanted the easiest solution I wouldn't be playing Factorio, and so I figure you can at least know what exists. Then you can make your own choice. :)

coppercoil
Filter Inserter
Filter Inserter
Posts: 477
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Poor ore visualizer

Post by coppercoil »

I watched several tutorials and found that scanning and zone assignment are quite simple. Though I don’t like slow and ineffective scanning using radius signal. Due to its random nature some tiles are scanned twice and some stays unexplored for a long time. It’s an issue for me because ore fields are really large. I think I need controlled iterative scanning in spiral form. I found some people have done it, but no BP available, so I’m going to do it by myself. I have not so much experience using circuits, so it’s a not trivial task for me :)

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Poor ore visualizer

Post by slippycheeze »

coppercoil wrote:
Sat Jul 06, 2019 8:08 pm
I watched several tutorials and found that scanning and zone assignment are quite simple. Though I don’t like slow and ineffective scanning using radius signal. Due to its random nature some tiles are scanned twice and some stays unexplored for a long time. It’s an issue for me because ore fields are really large. I think I need controlled iterative scanning in spiral form. I found some people have done it, but no BP available, so I’m going to do it by myself. I have not so much experience using circuits, so it’s a not trivial task for me :)
Yeah, I'm unsure about that myself. So far I've used it where I lay down an initial "scan here" marker, and the scanner walks through that - like the fusion of the "check for empty" and "scanner" code, basically getting the location from something hand-placed. No randomness, but also I don't have to be very careful about where I throw down those markers, and all the resources are correctly separated and identified. :)

coppercoil
Filter Inserter
Filter Inserter
Posts: 477
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Poor ore visualizer

Post by coppercoil »

slippycheeze wrote:
Sat Jul 06, 2019 9:05 pm
Yeah, I'm unsure about that myself. So far I've used it where I lay down an initial "scan here" marker, and the scanner walks through that - like the fusion of the "check for empty" and "scanner" code, basically getting the location from something hand-placed. No randomness, but also I don't have to be very careful about where I throw down those markers, and all the resources are correctly separated and identified. :)
Finally, I did it 8-)



This setup requires AAI Programmable Structures mod (which also requires AAI Signals and AAI Zones)

PoorOre.png
PoorOre.png (3.28 MiB) Viewed 2167 times
How to use:
  1. Build it anywhere. Adjust it to your needs:
    • Set AAI zone marker for start in the constant combinator marked by green circle. Do not change other signals.
    • Set required poor ore threshold level in the constant combinator inside of the blue circle.
    • Set poor zone marker in the decider marked by yellow circle.
  2. Set start zone marker (typically in the center of the ore field) using AAI zone planner tool. One tile is enough, more tiles are also ok. Do not add or delete start zones once scanning has started.
  3. Wait until entire ore field is scanned. Don't try to cover multiple fields in one scan, it will take too long.
  4. Stop scanning: remove start zone markers (all of them) using zone planner tool,
     or
    activate automatic start marker cleaner by turning on the constant combinator inside of the red circle. Turn it off when red light becomes yellow.
If you want to turn off entire scanner, turn off the constant combinator in the green circle.

Lamp colors:
  • White: ready.
  • Green: working.
  • Red: deleting start markers.
  • Yellow: markers deleted, still in erase mode.
You can run two scanners if you have set them up for different start markers.

Known issue: several ore tiles neighboring to the start tile will not be scanned. It’s not a real problem.

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Poor ore visualizer

Post by slippycheeze »

I'm so stealing that, thank you!

Post Reply

Return to “Ideas and Requests For Mods”