Friday Facts #384 - Combinators 2.0
Re: Friday Facts #384 - Combinators 2.0
It would be nice if there were some way to monitor power networks directly, yes you can use accumulators, but it would be nicer if you could measure power and then make a decision, like shut down parts of the factory before you have a blackout
Re: Friday Facts #384 - Combinators 2.0
If you can select red/green wire as input source then you can divide a red input by green input. Now you just need a bunch of constant combinators to output the stack size of ever item. Inconvenient for a general, blueprintable station but no longer impossible. A stacksize in the airthmetic combinator would still be way more convenient.Hares wrote: βFri Dec 22, 2023 1:33 pm I still think we REQUIRE stack comb in the game because there is currently no way to DIVIDE an input signal by respective stack sizes. I.e., you are designing a Garbage Collector for your interrupt-based trains (a system that scans logistics inventory and pushes all items that can & should occupy a full train to a train). Let's assume we use 1-2 trains (1 locomotive, 2 cargo wagons). The train can hold up to 80 stacks of items. Okay, we know how to deliver it; we know how many to deliver, but WHAT to deliver?
What we SHOULD ACTUALLY do, is to export a logistics network inventory, divide it by a respective item stack size and select all signals >= 80. From those, we can now select a random one to put into a train. (The reverse, however, is quite possible because, unlike vector by-component division, vector by-component multiplication is possible due to the power of math.)
A more general idea of this would be that the input should have a unit multiplier, where unit can be 1, stacksize, size of chest / tank / vehicle, k/M/G (unit of 1000 multiplier), s/m/h/d (units of time multiplier). With that more general idea you wouldn't even have to check for 80 stacks of an item to fill 2 cargo wagon but you divide the items by "each * cargo wagon" and check for >= 2.
Note: mods have differently sized cargo and fluid wagons.
Re: Friday Facts #384 - Combinators 2.0
Especially if you could check the current and potential energy. Especially with solar power you need to know how much energy the solar cells can provide at the moment. I know you can make a clock and compute the amount but the clock can easily get out of sync and then all the calculation is wrong.
Why not have a wire connection on solar panels that give out the current power draw, maximum power and current power available?
Re: Friday Facts #384 - Combinators 2.0
Unfortunately, the screenshots in fff-384 show you can select the input source (red/green wire) with the new decider combinator, but not with the arithmetic combinator. The enhancement of the arithmetic combinator is just a display of the current values in the combinator GUI. Functions like EACH(red input) * EACH(green input) seems to be still not possible.
Re: Friday Facts #384 - Combinators 2.0
Verry unfortunately. But I think that problem has been stated multiple times here already.Tertius wrote: βThu Feb 22, 2024 11:23 amUnfortunately, the screenshots in fff-384 show you can select the input source (red/green wire) with the new decider combinator, but not with the arithmetic combinator. The enhancement of the arithmetic combinator is just a display of the current values in the combinator GUI. Functions like EACH(red input) * EACH(green input) seems to be still not possible.
Re: Friday Facts #384 - Combinators 2.0
Well, uh, it cannot be stated often enough.
Re: Friday Facts #384 - Combinators 2.0
I've recenently managed to design almost-fully-functinoal vector to vector divisor. It has some flaws (i.e., it likes off-by-one errors due to calcuations precision), but it generally works for larger numbers. How it works:mrvn wrote: βThu Feb 22, 2024 10:13 amIf you can select red/green wire as input source then you can divide a red input by green input. Now you just need a bunch of constant combinators to output the stack size of ever item. Inconvenient for a general, blueprintable station but no longer impossible. A stacksize in the airthmetic combinator would still be way more convenient.Hares wrote: βFri Dec 22, 2023 1:33 pm I still think we REQUIRE stack comb in the game because there is currently no way to DIVIDE an input signal by respective stack sizes. I.e., you are designing a Garbage Collector for your interrupt-based trains (a system that scans logistics inventory and pushes all items that can & should occupy a full train to a train). Let's assume we use 1-2 trains (1 locomotive, 2 cargo wagons). The train can hold up to 80 stacks of items. Okay, we know how to deliver it; we know how many to deliver, but WHAT to deliver?
What we SHOULD ACTUALLY do, is to export a logistics network inventory, divide it by a respective item stack size and select all signals >= 80. From those, we can now select a random one to put into a train. (The reverse, however, is quite possible because, unlike vector by-component division, vector by-component multiplication is possible due to the power of math.)
A more general idea of this would be that the input should have a unit multiplier, where unit can be 1, stacksize, size of chest / tank / vehicle, k/M/G (unit of 1000 multiplier), s/m/h/d (units of time multiplier). With that more general idea you wouldn't even have to check for 80 stacks of an item to fill 2 cargo wagon but you divide the items by "each * cargo wagon" and check for >= 2.
Note: mods have differently sized cargo and fluid wagons.
- Divide a very big constant by a denominator
- Use vector multiplication to multilply a nominator by the result of previous operation
- Divide the result by that big constant
Code: Select all
R = A / B - what wee need to find
C - Constant
R = A / B = A * (1/B) = A * C/C * (1/B) = (A * (C/B)) / C
Re: Friday Facts #384 - Combinators 2.0
Mind adding a blueprint and some discussion to this thread? If this one stays within +/-1 for any input, it's a decent size improvement over the one currently posted there.Hares wrote: βFri Feb 23, 2024 1:49 pm I've recenently managed to design almost-fully-functinoal vector to vector divisor. It has some flaws (i.e., it likes off-by-one errors due to calcuations precision), but it generally works for larger numbers. How it works:
- Divide a very big constant by a denominator
- Use vector multiplication to multilply a nominator by the result of previous operation
- Divide the result by that big constant
Code: Select all
R = A / B - what wee need to find C - Constant R = A / B = A * (1/B) = A * C/C * (1/B) = (A * (C/B)) / C
Re: Friday Facts #384 - Combinators 2.0
That about halfs the precision, so basically only for numbers up to 32767 in general. So generally useless.Hares wrote: βFri Feb 23, 2024 1:49 pmCode: Select all
R = A / B - what wee need to find C - Constant R = A / B = A * (1/B) = A * C/C * (1/B) = (A * (C/B)) / C
You can also generate the division in a loop taking a multiple of 32 ticks. Again generally useless when you have constantly changing inputs.
Re: Friday Facts #384 - Combinators 2.0
You are completely right, but the most common use-case of vector division is to determine how many stacks of each item is in the set, which this will do perfectly fine.mrvn wrote: βMon Feb 26, 2024 8:17 pmThat about halfs the precision, so basically only for numbers up to 32767 in general. So generally useless.Hares wrote: βFri Feb 23, 2024 1:49 pmCode: Select all
R = A / B - what wee need to find C - Constant R = A / B = A * (1/B) = A * C/C * (1/B) = (A * (C/B)) / C
You can also generate the division in a loop taking a multiple of 32 ticks. Again generally useless when you have constantly changing inputs.
Re: Friday Facts #384 - Combinators 2.0
With mods I have a stacksize for e.g. Landfill of 1000. Which means the division is limited to values up to 2 million, which my store of ore can exceed quite easily. So not even a general solution for computing stacks.
- dragon-architect
- Burner Inserter
- Posts: 16
- Joined: Sun Dec 17, 2023 7:41 pm
- Contact:
Re: Friday Facts #384 - Combinators 2.0
I'mm'a wake this thread back up a bit because I dunno if anybody else has asked about it but I would like to know:
Since y'all have certainly gone in and massively re-worked whole chunks of game code for both previous and subsequent FFF features, would it be possible to also overhaul the circuit network code to give the circuit network and especially circuit control behavior a more moddable API? It would certainly make it easier to not have to hack-mod reporting statistics into, say, the Constant Combinator, just to know more about what a particular entity is doing, when we could just mod the control behavior of the entity itself to have the entity directly output to the circuit network.
I know that this has been requested in the past elsewhere on this forum, and quite harshly shot down as a won't do, but that was before serious work had been started on Factorio 2.0, and the reasons given were that it would have required far, far, far too much refactoring of the game's code to make it happen.
Would this still be a too daunting task to refactor the circuit network code to implement a more moddable API?
Since y'all have certainly gone in and massively re-worked whole chunks of game code for both previous and subsequent FFF features, would it be possible to also overhaul the circuit network code to give the circuit network and especially circuit control behavior a more moddable API? It would certainly make it easier to not have to hack-mod reporting statistics into, say, the Constant Combinator, just to know more about what a particular entity is doing, when we could just mod the control behavior of the entity itself to have the entity directly output to the circuit network.
I know that this has been requested in the past elsewhere on this forum, and quite harshly shot down as a won't do, but that was before serious work had been started on Factorio 2.0, and the reasons given were that it would have required far, far, far too much refactoring of the game's code to make it happen.
Would this still be a too daunting task to refactor the circuit network code to implement a more moddable API?
Re: Friday Facts #384 - Combinators 2.0
First I would just want to have 3 or 4 colors for the wire. The interface already has 2 so enlarging that to 4 should not be such a daunting path.
- dragon-architect
- Burner Inserter
- Posts: 16
- Joined: Sun Dec 17, 2023 7:41 pm
- Contact:
Re: Friday Facts #384 - Combinators 2.0
Oh, yeah, definitely. Having a couple of extra circuit network channels would be nice. But I suspect that the idea may get turned down as overcomplicating it a bit too much.
Edit: After thinking about it, yeah. Adding additional wire colors would require having to re-do basically ALL of the entity graphics associated with the circuit network in order to add third or fourth connection points for the new channels.
Would it be awesome to see? Heck yeah. I'd love it.
Are we likely to see it? I'd be pleasantly surprised if the devs said they'd consider it.
Re: Friday Facts #384 - Combinators 2.0
Changing the graphics I think would be the least problem. I'm pretty sure there are lots of cases where the code basically reads:dragon-architect wrote: βWed Mar 20, 2024 9:42 pmOh, yeah, definitely. Having a couple of extra circuit network channels would be nice. But I suspect that the idea may get turned down as overcomplicating it a bit too much.
Edit: After thinking about it, yeah. Adding additional wire colors would require having to re-do basically ALL of the entity graphics associated with the circuit network in order to add third or fourth connection points for the new channels.
Would it be awesome to see? Heck yeah. I'd love it.
Are we likely to see it? I'd be pleasantly surprised if the devs said they'd consider it.
Code: Select all
for (i = 0; i < 2; ++i) { ... }
Code: Select all
for (i = 0; i < MAX_WIRES; ++i) { ... }
As for overcomplicating ... I would guess the opposite: "It makes wires too easy so there is less of a puzzle there." sort of argument.
- dragon-architect
- Burner Inserter
- Posts: 16
- Joined: Sun Dec 17, 2023 7:41 pm
- Contact:
Re: Friday Facts #384 - Combinators 2.0
I'm not going to speculate on what the code actually says, since I'm not one of the developers.mrvn wrote: βThu Mar 21, 2024 9:26 am Changing the graphics I think would be the least problem. I'm pretty sure there are lots of cases where the code basically reads:
instead ofCode: Select all
for (i = 0; i < 2; ++i) { ... }
. That goes for mods too.Code: Select all
for (i = 0; i < MAX_WIRES; ++i) { ... }
As for overcomplicating ... I would guess the opposite: "It makes wires too easy so there is less of a puzzle there." sort of argument.
But I do see the argument that adding wires would make complex circuits less of a puzzle as making some sense. It is certainly a pathing puzzle not too dissimilar to planning a 2-layer PCB.
Re: Friday Facts #384 - Combinators 2.0
If only there where instant through holes. A wire with one side red and the other side green.dragon-architect wrote: βThu Mar 21, 2024 5:36 pmI'm not going to speculate on what the code actually says, since I'm not one of the developers.mrvn wrote: βThu Mar 21, 2024 9:26 am Changing the graphics I think would be the least problem. I'm pretty sure there are lots of cases where the code basically reads:
instead ofCode: Select all
for (i = 0; i < 2; ++i) { ... }
. That goes for mods too.Code: Select all
for (i = 0; i < MAX_WIRES; ++i) { ... }
As for overcomplicating ... I would guess the opposite: "It makes wires too easy so there is less of a puzzle there." sort of argument.
But I do see the argument that adding wires would make complex circuits less of a puzzle as making some sense. It is certainly a pathing puzzle not too dissimilar to planning a 2-layer PCB.
- dragon-architect
- Burner Inserter
- Posts: 16
- Joined: Sun Dec 17, 2023 7:41 pm
- Contact:
Re: Friday Facts #384 - Combinators 2.0
That's not instant. That's got a delay of 1 tick.dragon-architect wrote: βFri Mar 22, 2024 9:22 pmI could suggest an arithmetic combinator set to Each+0=Each to accomplish that.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Friday Facts #384 - Combinators 2.0
I have a feeling the devs will not want to add anything that can take in a signal and then output another in the same tick due to the continuous loop issue.pleegwat wrote: βFri Mar 22, 2024 10:31 pmThat's not instant. That's got a delay of 1 tick.dragon-architect wrote: βFri Mar 22, 2024 9:22 pmI could suggest an arithmetic combinator set to Each+0=Each to accomplish that.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics