Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

ttbr0_el1
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu May 09, 2024 1:30 am
Contact:

Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by ttbr0_el1 »

TL;DR
When Set Filters from circuit network is used on a Filter Inserter, prioritise what item the inserter picks up by sorting the items by the level from the circuit network.
What ?
Currently, circuit signals can control the item whitelist for Filter Inserters by sending a positive signal for an item.

When picking from a chest, Filter Inserters seem to randomly pick from the items on the whitelist. This feature request would change that behaviour to deterministically pick items on the whitelist in priority order using the level of the circuit signal.

For example, if a filter inserter is setting filters based on circuit signal, and is whitelisting with received signals of:
  • coal 10,
  • iron ore 2, and
  • copper ore 1,
then on each swing, it will first insert a full stack of coal if any is available, or iron ore if no coal is available, or copper ore if no coal or iron ore is available. Signal level ties would be broken arbitrarily. This would not change behaviour when setting filters from circuits for a blacklist.
Why ?
Filter inserters with a whitelist taking items from a chest seem to choose items from the whitelist randomly rather than fairly, which can result in starvation even though items of the required types are in the chest.

Overcoming this by only sending a signal of the preferred item, means that when none of the preferred items are available. Other items will not be inserted, and time/belt space is lost.

This is critical when unloading from multi-item buffers, especially in space-constrained builds.
Illiander42
Filter Inserter
Filter Inserter
Posts: 530
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by Illiander42 »

It's not a random order, it's based on the internal item ID number.

And the new combinator will let you build this.
ttbr0_el1
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu May 09, 2024 1:30 am
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by ttbr0_el1 »

Illiander42 wrote: Thu May 09, 2024 9:13 am It's not a random order, it's based on the internal item ID number.

And the new combinator will let you build this.
Thanks very much for the clue.

Is this something that could be achieved in 1.x with a mod?
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by SoShootMe »

ttbr0_el1 wrote: Thu May 09, 2024 3:46 am When picking from a chest, Filter Inserters seem to randomly pick from the items on the whitelist.
The order visible in the signal picker (reading order in English, I'm not sure if it is locale-dependent) is taken as descending priority [EDIT: mostly]. If I'm not mistaken this applies in all cases, eg for a non-filter inserter and/or for inserting/removing items to/from a crafting machine with a recipe that has multiple item ingredients/results.

It's unclear from what you've described why you need it (I'm curious though) - in similar cases (unloading a container with multiple item types using a filter inserter), buffering means the only problem I've had is a sub-optimal startup, which is irrelevant as long as things stay running and at worst not critical.

In any case, it sounds like 2.0 - and until then, the suggested mod - will meet your needs.
Last edited by SoShootMe on Fri May 10, 2024 9:25 pm, edited 1 time in total.
ttbr0_el1
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu May 09, 2024 1:30 am
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by ttbr0_el1 »

SoShootMe wrote: Thu May 09, 2024 11:48 am It's unclear from what you've described why you need it (I'm curious though) - in similar cases (unloading a container with multiple item types using a filter inserter), buffering means the only problem I've had is a sub-optimal startup, which is irrelevant as long as things stay running and at worst not critical.
Remember this feature request is for circuit-driven filter selection - so you don't have control over the reading order. If it was informed by the signal level, then the feature requested would already exist. From the comment above it seems like it is item-id order though.

This feature is really valuable in Warptorio: https://postimg.cc/Q99D0mQ5.

In this picture, buffer chests are filled from mixed ores and we need to pay out as much ore as possible of the best type, while maintaining the coal lane. The filter inserters would be informed by plate levels at the end of the smelter line, but coal needs to be maintained in the coal buffer chest.

Let me know if you see a better way to do this!
ttbr0_el1
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu May 09, 2024 1:30 am
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by ttbr0_el1 »

Nosferatu wrote: Thu May 09, 2024 10:27 am Is this what you are looking for?
https://mods.factorio.com/mod/selector-combinator
I think I could programme the desired behaviour using this combinator to turn the filter inserter from five-slot to one-slot and get the best load.

However, with space constraints, it would be better if I could leverage slightly smarter filter inserter behaviour..

Good to know about this though.
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Filter inserters: Prioritise item pickup based on Set Filter signal levels

Post by SoShootMe »

ttbr0_el1 wrote: Fri May 10, 2024 2:12 am Remember this feature request is for circuit-driven filter selection - so you don't have control over the reading order. If it was informed by the signal level, then the feature requested would already exist. From the comment above it seems like it is item-id order though.
"Item-id order" is an unsatisfying answer since there's no such property on prototypes, so it would have to be either somehow embedded (surely not) or derived in a deterministic way. It seems to mostly follow the order their signals are shown - which AFAICT is based on order properties of the group, subgroup and item prototypes - as I wrote before... but there are a few cases where that doesn't explain it. (I will edit my previous post in a minute...)
This feature is really valuable in Warptorio: https://postimg.cc/Q99D0mQ5.

In this picture, buffer chests are filled from mixed ores and we need to pay out as much ore as possible of the best type, while maintaining the coal lane. The filter inserters would be informed by plate levels at the end of the smelter line, but coal needs to be maintained in the coal buffer chest.

Let me know if you see a better way to do this!
Not really. I think I naturally avoid this sort of approach because it hurts my head too much to figure out if it could get stuck :). My first thought is to have separate buffers, then you can independently enable/disable the ores and merge them to feed the furnaces. There's no way that would be so compact though, which I am aware is a significant consideration in Warptorio.

Switching based on time might work and would allow computed ratios, although the simplest approach would give gaps if demand exceeds supply "at the moment" leading to underutilised furnaces.

Thanks for explaining though :).
Post Reply

Return to “Ideas and Suggestions”