Simple way to prevent asteroid collector from overfilling

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

You probably have noticed that space is filled with lots of asteroids, way much more than what you can consume with your spaceship x).

This often leads to throwing asteroid overboard, but when doing this it means asteroid collector was inefficient in its grabbing. This is particularly painful in late game when you want to grab promethium chunk as fast as you can and you don't want your collectors to grab some ice or iron which you have wayyyyyy too much of.

Another thing that lead me to this build was the observation that asteroid grabbers have quite the inventory space, particularly as their quality increases.

I then decided to make it so that asteroid collector would fill in from every ore, but not overfill, and would leave room to collect the most precious ones at all time :
limited collector.png
limited collector.png (122.22 KiB) Viewed 13197 times



This works using overflow, the constant combinator holds value for the 3 common chunks that are just 5 under the largest number possible to represent with circuits. This can be obtained in game easily by writing 2^31-X as value for the different signals. ( with X = 5 in the example )

The asteroid collector is set to "read content" and "set filter", but it won't set filter based on its own content if you do not forward the signal with an arithmetic combinator.

The content of the collector and the very large value in the constant are summed, and then those sums are used to "set filter".

This means when the collector has more than X of a asteroid chunks, the sum 2^31-X+[current count] will overflow and instead of being a large number it will be a negative number, which will disable the filter.

This means with only 1 arithmetic combinator and 1 constant combinator per asteroid collector, you can have a nice inventory filter to limit intake.

Now you could refine it to make it even more efficient and only use a single constant combinator in the whole ship for all collector, and only a single arithmetic per asteroid collector. But that require more wiring and is left as an exercice for the reader :D

It works well with an inserter that output onto a wired belt which read & hold the value for all belts which can use the same trick to limit the number of asteroid chunks on it.
User avatar
MBas
Fast Inserter
Fast Inserter
Posts: 112
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by MBas »

My solution to this problem is this

Image

As you can see from the input red signal, the constant combinator has a value of one for each type of item to ensure it functions correctly for that category. Now, everything will be collected until the limit reaches 13. A benefit of this approach is that you can adjust the values in the constant combinator to "simulate" inventory space for each item type if you want to allocate more room for certain items.

The number 13 is just an example, which fills the common collector up to this amount for basic asteroids. If set to 15, more frequent items will be stored in greater quantities, and so on. If you need to store an item in a higher quantity based on criteria other than frequency, you can tweak the constant combinator values to achieve precisely what you want.

Note: Inserters are not part of this setup; they serve as an additional level of filtering to prevent overfilled belts. I never throw anything back into space.

mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

MBas wrote: Fri Nov 01, 2024 10:25 am A benefit of this approach is that you can adjust the values in the constant combinator to "simulate" inventory space for each item type if you want to allocate more room for certain items.

The number 13 is just an example, which fills the common collector up to this amount for basic asteroids. If set to 15, more frequent items will be stored in greater quantities, and so on. If you need to store an item in a higher quantity based on criteria other than frequency, you can tweak the constant combinator values to achieve precisely what you want.
I don't see how it is a benefit, as there is no difference with my setup where you can modify the number that you remove from 2^31 for each type of chunk, like 13 or 15 or 5 to achieve the same result.

However, the fact that the constant 13 is stored on a decided combinator on your approach doesn't allow to change it with logistic group, which would require editing all of the decider if you were to increase the quality of collectors.

I tried something like this at first, but i went to refined it to make it easier to use.
T-nm
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Nov 24, 2021 4:59 am
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by T-nm »

You can set the value on the decider combinator with another variable from the same constant combinator so that it could be centralized elsewhere. With MBas' solution it is also simpler to understand what the logic does, in my opinion. Both solutions achieve the same result except yours allows individual values.
Barn
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun May 28, 2017 4:54 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by Barn »

Screenshot 2024-11-01 171932.png
Screenshot 2024-11-01 171932.png (1.73 MiB) Viewed 13001 times

This is the setup I've been using; very similar to MBas's except it allows you to set individual counts for each chunk type by comparing each red value (from the grabber inventory) against each green value (configured in the constant combinator).

The red/green filters might be my favorite thing about the 2.0 combinator changes.

mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

T-nm wrote: Fri Nov 01, 2024 5:37 pm You can set the value on the decider combinator with another variable from the same constant combinator so that it could be centralized elsewhere. With MBas' solution it is also simpler to understand what the logic does, in my opinion. Both solutions achieve the same result except yours allows individual values.
I understand what you mean by setting "13" in the constant instead under another signal. That would work i think.

But you could already go for individual values with MBas' solution i think too, if you change the value in the constant combinator then on the red wire there will not be 1 but 2 or 3 or 4, and that means removing those from the 13 before the filter disappear. But that means if you want to keep 7 chunks you need to write 13 in the constant as the limit for the other chunks and - 6 to create an offset for one chunk. Whereas with the arithmetic and overflow thing you write 2^31-7 if you want 7 chunk, or 2^31-5 if you want 5 or 2^31-9 for 9 chunks, there is no subtraction to do in your head for writing the value.
Barn wrote: Fri Nov 01, 2024 10:31 pm This is the setup I've been using; very similar to MBas's except it allows you to set individual counts for each chunk type by comparing each red value (from the grabber inventory) against each green value (configured in the constant combinator).
I like this, i think it makes it easier to set the individual values for each chunk type, but i don't think that was impossible in MBas' setup either !
Barn wrote: Fri Nov 01, 2024 10:31 pm The red/green filters might be my favorite thing about the 2.0 combinator changes.
That is sure a powerful feature, but it's not necessary to use there strictly speaking as i wanted to show :D The other feature that i use is the fact that you can now write "2^31-5" in a combinator field to mean "a number to which adding 5 would turn into negative" which is a very useful trick to know.


Also it should feature a way to collect promethium at all time for demonstration purposes of having the collector unrestricted for some chunks !
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

Used this trick to control the whole ship buffer with a single constant :


geezer62
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri May 08, 2020 2:46 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by geezer62 »

Both of these techniques work fine for me as long as I dedicate a combinator to a single collector. I was hoping instead to maintain global per-type limits across multiple collector storage areas, but it doesn't work. I wonder if anyone can explain WHY it doesn't work.

So for example, this works perfectly:

Constant combinator (CC): 12 metallic, 9 carbonic, 18 oxide (optimal ratios for white science production in Nauvis orbit)
Decider combinator (CC): Condition R * < G *, Output * 1
green wire from CC to DC input
red wire from Collector #1 to DC input
green wire from DC output to Collector #1
Set filters, Read contents, Include hands on Collector #1

Then:

Double the CC values to 24 / 18 / 36 to cover the additional 39 slots of a second collector
red wire from Collector #2 to DC input
green wire from DC output to Collector #2
Set filters, Read contents, Include hands on Collector #1

The Input and Output signals on the DC continue to be correct, but the filters on the two collectors no longer reflect the DC Output signals state. Eventually, both collectors reach Output full states, and the overall totals vary wildly from the values in the CC.

Can anyone explain what happens to the filters when I add Collector #2 as described above?
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

geezer62 wrote: Tue Feb 25, 2025 6:28 pm Both of these techniques work fine for me as long as I dedicate a combinator to a single collector. I was hoping instead to maintain global per-type limits across multiple collector storage areas, but it doesn't work. I wonder if anyone can explain WHY it doesn't work.

Can anyone explain what happens to the filters when I add Collector #2 as described above?
I'd be happy to provide some more dedicated help in the gameplay help section, or if you provide a blueprint as i'm not sure i understood the attempt you made.

It should be possible to use a single combinator to keep track of a quantity that would be distributed amongst several collectors, with the quirks that can happen if a collector whose buffer is full grabs an additionnal chunk. That thing is avoided with the original setup, but if you expect 2 collector to hold 39*2 chunk, and one fills up first, you will have an overflowing collector.

And you will potentially have all the chunk of one type in a collector ,and all the chunk of another type in another, depending on the supply chain, it can be risky and backfire !
geezer62
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri May 08, 2020 2:46 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by geezer62 »

mmmPI wrote: Wed Feb 26, 2025 11:38 pm I'd be happy to provide some more dedicated help in the gameplay help section, or if you provide a blueprint as i'm not sure i understood the attempt you made.
Thank you for this and for your other comments.

After reading other discussions from last fall - I'm a new player - I realize that there is a fundamental weakness in circuit feature functionality that explains much of the counter-intuitive behavior I have observed and requires excessively complex and clumsy solutions to implement some simple, obvious ideas. This assessment appears to be shared by the development team, and they have expressed interest in delivering a relevant improvement in release 2.1.

So rather than investing lots of effort designing complex circuits that may soon become obsolete, I have decided to wait for 2.1. In the meantime, I'll limit my use of circuits to applications where the simple, intuitive solution is effective.

Some links:
A comment from developer boskid explaining what he did to allow a single collector to be controlled as of 2.0.20. He also explains why the obvious multi-collector solution fails.
A topic discussing the proposed new feature.
A comment within that topic on using a one-way wire solution to control N collectors as a group.
Kovarex's comment indicating interest in implementing the feature for 2.1.
Tertius
Smart Inserter
Smart Inserter
Posts: 1167
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by Tertius »

geezer62 wrote: Thu Feb 27, 2025 6:44 pm So rather than investing lots of effort designing complex circuits that may soon become obsolete, I have decided to wait for 2.1.
I wouldn't do this. Although the devs indicated they WANT to implement some change, it's not sure whether they actually DO implement it. If they're unable to do it for whatever reason, you waited for nothing. How long do you want to wait? 1 month? Half a year? 2 years? There are so many examples where game developers really wanted to provide some feature but were unable to deliver it in the end. So evaluate and treat the game you have in your hands as the final game. Don't expect any updates at all. Design your circuits with the current game state. The challenge in this thread can definitely be done with current circuits. No need to wait.
If some change really becomes reality, be happy and simplify your existing stuff. That's the way I do it. It's the chance to revisit old suboptimal stuff, and do more with it than just simplifying it: improve it beyond the simple feature upgrade.
geezer62
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri May 08, 2020 2:46 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by geezer62 »

Tertius wrote: Thu Feb 27, 2025 7:19 pm
geezer62 wrote: Thu Feb 27, 2025 6:44 pm So rather than investing lots of effort designing complex circuits that may soon become obsolete, I have decided to wait for 2.1.
So evaluate and treat the game you have in your hands as the final game. Don't expect any updates at all. Design your circuits with the current game state.
I agree with you. I do hope 2.1 arrives with the hoped-for functionality, but I'm happy with the game as it is today. But in my view, there are many possible 2.0 circuit designs that are complex and confusing to a degree that drains the fun out of it for me. When I bump into those limitations, I'll employ simpler solutions.
Tertius wrote: Thu Feb 27, 2025 7:19 pm The challenge in this thread can definitely be done with current circuits. No need to wait.
I agree - managing the storage of a single asteroid collector with circuits is straightforward, and I am happily doing so today. It scales pretty well too - one decider or arithmetic combinator per collector and a shared constant combinator for all of them.

Where I ran into trouble was in trying to use one decider or arithmetic combinator and one constant combinator for N collectors - the results were wrong but not obvious to me. I see now that I could implement the idea by using two additional combinators per collector to isolate the signals, but the solution is not pleasing to me. :-)
Tertius
Smart Inserter
Smart Inserter
Posts: 1167
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by Tertius »

Controlling one collector with a filter signal and reading collector content at the same time works, because the collector ignores (subtracts) its own content signal from the "incoming" filter signal, so the filter signal is restored and applied as filter properly.

Your attempt to control multiple collectors with the same filter signal fails, if all collectors are connected to the same wire. They subtract their own content from the wire, so they are able to regenerate the filter signal if they are alone, but not the content from the other collectors, so the filter signal they see is the actual filter signal plus the content of the other collectors. If they all have some chunks, the filter will eventually become all 3 chunk types permanently.

You need to isolate the incoming filter signal from the outgoing signals of other collectors, which requires one combinator per collector. And you need to isolate the outgoing content signal against the other outgoing signals as well with another combinator, otherwise the the content signal from one collector will be seen as filter by all the other collectors. But since you can balance each collector individually with just one combinator per collector already, it makes no sense in my opinion to add even more combinators for some global balancing.

Since the asteroid chunks are statistically evenly distributed over the map, the collectors should be able to collect them evenly, which isn't the case with a global filter, since this allows single combinators becoming full with one or two asteroid chunk types and no space for the 3rd type (usually oxide), so the 3rd type is always missed in the area of that collector as long as the collector is full. It's best statistically if every collector always has space for every chunk type and all collectors becoming full at the same rate, which is achieved best if every collector has its own balanced inventory.
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

geezer62 wrote: Thu Feb 27, 2025 6:44 pm I realize that there is a fundamental weakness in circuit feature functionality that explains much of the counter-intuitive behavior I have observed and requires excessively complex and clumsy solutions to implement some simple, obvious ideas.
I don't think that's the case, but i can understand why a new player may have this feeling.

geezer62 wrote: Thu Feb 27, 2025 6:44 pm So rather than investing lots of effort designing complex circuits that may soon become obsolete, I have decided to wait for 2.1. In the meantime, I'll limit my use of circuits to applications where the simple, intuitive solution is effective.
Feel free to use the blueprint i posted then :)
geezer62
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri May 08, 2020 2:46 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by geezer62 »

Thanks for the detailed explanation, Tertius!
geezer62
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri May 08, 2020 2:46 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by geezer62 »

mmmPI wrote: Thu Feb 27, 2025 11:14 pm Feel free to use the blueprint i posted then :)
Actually, that's where I started, mmmPI, with your blueprint. It works perfectly!
NewcoLux
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 15, 2024 2:09 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by NewcoLux »

Hi everyone,
I found an alternative way to prevent overfill on my spacecrafts:
brief description:
  1. Connect green wire to every asteroid collector.
  2. Read whole belt loop via green wire.
  3. Use a decider combinator to output the "collect X asteroid type" recipe, based on a, via trial and error found, value for your desired threshold.
  4. Reminder to enable the option to allow the "set recipe Signal" in the collector.
While it lacks the fanciness of your solutions, it opened the opportunity to use the exact same procedure to control the crushers too.
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

NewcoLux wrote: Sun Mar 02, 2025 1:40 pm Hi everyone,
I found an alternative way to prevent overfill on my spacecrafts:
brief description:
  1. Connect green wire to every asteroid collector.
  2. Read whole belt loop via green wire.
  3. Use a decider combinator to output the "collect X asteroid type" recipe, based on a, via trial and error found, value for your desired threshold.
  4. Reminder to enable the option to allow the "set recipe Signal" in the collector.
While it lacks the fanciness of your solutions, it opened the opportunity to use the exact same procedure to control the crushers too.
If i understand correctly that's a bit different in that you are not using the asteroid collector inner buffer to store the asteroid in a controlled fashion.

This will allow to store a defined amount of asteroid chunks on the belts but the asteroids collectors will be empty and stop collecting when the number is reached.

It does work to prevent overfilling from unwanted chunks though :)
gGeorg
Filter Inserter
Filter Inserter
Posts: 483
Joined: Wed Jun 19, 2019 8:06 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by gGeorg »

mmmPI wrote: Mon Mar 03, 2025 8:15 pm
NewcoLux wrote: Sun Mar 02, 2025 1:40 pm I found an alternative way to prevent overfill
the exact same procedure to control the crushers too.
If i understand correctly that's a bit different in that you are not using the asteroid collector inner buffer to store the asteroid in a controlled fashion.
As long as storage space is expensive in space (ehm) I use both. Balanced collectors plus balanced belt_as_storage. Crushers are crushing as needed. On top, reproccesing is also balanced based on chunks on belt_as_storage. So crushers could do crushing or re-processing based on situation. It might happen that some crushers are crushing meanwhile others reprocess.

I dont use quality ( simply dont like the system ) so my collectors ale always one handed. Side effect is, max efficient usage of resources is a welcome challenge.
mmmPI
Smart Inserter
Smart Inserter
Posts: 4084
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple way to prevent asteroid collector from overfilling

Post by mmmPI »

gGeorg wrote: Mon Mar 03, 2025 11:11 pm As long as storage space is expensive in space (ehm) I use both. Balanced collectors plus balanced belt_as_storage.
This topic is only showing a method to keep balanced collectors. This is because many tiny ships do not even use belt storage !

Keeping belt storage balanced, if needed, can be done with a single constant combinator using the overflow trick ;)

I generally don't find it useful to do both "a selection of which chunk to pick up from space" AND "reprocessing" as usually i prevent my ships from collecting too much, and thus no reprocessing is needed.
Post Reply

Return to “Combinator Creations”