Page 1 of 1

One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 9:07 am
by McDuff
TL;DR
Replace "Red Wire" and "Green Wire" with "data cable," allow setting channels for signals as colours.

What ?
Circuits are often difficult to visually read in combinator layouts, and anything that requires multiple inventory signals can require vast amounts of combinators.

I have in the past proposed adding more than just red and green, but I appreciate this adds much more complexity, especially to the visual reading of things, and increases the number of wire connections needed on the graphics.

A simpler and perhaps more comprehensible solution, allowing for better combinator functionality, would be to replace the two types of cable with a single data cable. Red, Green, or additional channels could be selected at device level.

Devices with multiple functions, such as inserters, could have different functions assigned to different network addresses, making, eg "hand contents" and "set filter" possible on the same inserter without the use of multiple combinators per inserter. Combinators could have inputs and outputs set to different channels, to enable for eg "each red" / "each green" on arithmetic combinators or "each red" < "each green" output "each purple" on deciders, for a way of saying "which items are under a specified level" or something like that.
Why ?
Improved circuit functionality and programmability in general. Less cable mess. More ability to perform functions on "each" signals for supply/demand circuits. Better organisation of control circuits in general.

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 9:22 am
by planetmaker
I like the idea quite a lot.

I've one practical question which is mostly an UI one: how do we assign / visualize the colours to the colour channels?

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 9:34 am
by McDuff
I expect that assignment could be done in much the same way that you pick signals now - click on a box and select the colour.

I would also suggest that devices have some kind of light on the outside that shows which channels they're on by changing colour. At present the connection box has different connection points for red and green wires, this could be altered to have a little light array and just one connection point.

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 2:42 pm
by mrvn
I'm not sure how you expect that to work when you need multiple colors.

For example I have an arithmetic combinator. Red and green wires goes to a power pole, another power pole and then green goes to a chest and red to an inserter. Do you pick colors for every wire segment?

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 6:14 pm
by csduff
mrvn wrote: Thu Sep 19, 2019 2:42 pm I'm not sure how you expect that to work when you need multiple colors.

For example I have an arithmetic combinator. Red and green wires goes to a power pole, another power pole and then green goes to a chest and red to an inserter. Do you pick colors for every wire segment?
If I understand the OP correctly, no, you would just run a "data cable" between everything. Then on the individual item you say which network to connect it to.

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 6:50 pm
by eradicator
-1

That suggestsion makes it impossible to connect a combinator to itself on one color, and to the outside with another color. Making trivial things like clocks at least two to three times bigger.

Re: One Wire for control circuits, colours as channels

Posted: Thu Sep 19, 2019 7:59 pm
by csduff
eradicator wrote: Thu Sep 19, 2019 6:50 pm -1

That suggestsion makes it impossible to connect a combinator to itself on one color, and to the outside with another color. Making trivial things like clocks at least two to three times bigger.
Depends on the way the logic is implemented. If you are allowed to output as you currently are, on two separate networks, then there would be no issue.

The only place I can see an issue would be factories which have massive networks connected via circuits. There could be some overlap where it was not intended. But, careful designs would be able to work around this.

Re: One Wire for control circuits, colours as channels

Posted: Fri Sep 20, 2019 2:36 am
by kbk
eradicator wrote: Thu Sep 19, 2019 6:50 pm -1

That suggestsion makes it impossible to connect a combinator to itself on one color, and to the outside with another color. Making trivial things like clocks at least two to three times bigger.
Totally agree.
factorio0.PNG
factorio0.PNG (2.66 KiB) Viewed 3586 times
If we make some kind of possible connections matrix, it'd look like this. Every connection pattern of any use that is possible to make is shown in green.

Now imagine we have got ourselves a single 9 colored bus cable. Until we short-circuit both input and output of a combinator, everything looks doable as it is now. But when we need only one colored channel of signals to short out both jacks and not the other channels, we face problems. First we just can't output one channel and not output the other at the same time, so that we need to select which channel does output and which doesn't. Second, we need to separate networks mid-wire to fix cases where both inputs are present. So I guess this is pretty hard to achieve.
factorio1.PNG
factorio1.PNG (3.93 KiB) Viewed 3586 times

Code: Select all

Legend: nc = not connected
i == input connected 				X == useless
o == output connected				Ev == makes sense with Everything inputs, otherwise useless
i o == both ends connected, 2 networks		so == ability to select colors ability to output needs to be implemented
i-o == both ends connected, 1 network		cs == ablity to separate networks/colors mid-wire needs to be implemented

Re: One Wire for control circuits, colours as channels

Posted: Fri Sep 20, 2019 9:03 am
by McDuff
This is a good point.

A potential workaround for this would be to include a "local loopback" output which feeds the output of a combinator back to the input and only applies within the domain of the combinator itself.

Something like this?
factorio expanded circuit ui.jpg
factorio expanded circuit ui.jpg (36.16 KiB) Viewed 3569 times
What I definitely wouldn't want this to do is take away existing functionality (even if it would kinda break existing things, I would expect most designs to be replicable with the new system)

Re: One Wire for control circuits, colours as channels

Posted: Fri Sep 20, 2019 2:32 pm
by kbk
McDuff wrote: Fri Sep 20, 2019 9:03 am A potential workaround for this would be to include a "local loopback" output which feeds the output of a combinator back to the input and only applies within the domain of the combinator itself.
Come on, this is starting to look like an overhaul request now :)
I see the following problems a developer would face:
If you internalize io loopback (short cable from input to output) and make it configurable then you need to decide connection state for every color (i.e. which channel does inner loopbacks and which does not, there are 9 of them). So the combinator widget grows by at least a row of colored loopback switches and probably a shortcut to turn them on/off simultaneously.
And then you need to somehow manage the collisions when input and output are shorted externally (i.e. single "physical" network) so that this loopback is configurable and unconfigurable at the same time.

When you've done with that you need to reinvent rules on what exactly goes to input and to output. At first this includes some interface to let player decide which output channel is actually able to output. If we decide then to control only colors this may either end up as a similar row with shortcuts for more precise control (how to help distinguish them visually?) or a filter selector ("Everything" plus 9 colors). This eventually allows player to submit globally selected output signal to all chosen channels. If instead we choose to control what signal is emitted exactly off each channel, we need yet another row of per-channel settings. Then maybe a set "colored everything", "colored anything", "colored each" signals...

As you can see, eventually we go full Minecraft here, and it's a whopping lot of work. I fear that if anyone tries to implement all that, Dominik would become a #2 bug killer in team in an instant. Moreover, it totally screws with the combinator widget useability so that less players would use combinators eventually in the event this all comes to life.

Re: One Wire for control circuits, colours as channels

Posted: Fri Sep 20, 2019 4:25 pm
by eradicator
kbk wrote: Fri Sep 20, 2019 2:32 pm As you can see, eventually we go full Minecraft here,
Minecraft has 1 channel. Unless you're talking about mods like Rednet? Which as far as i know did not support outputting more than one channel at a time. The multi-channel feature was usable for cables only, not for machines? (Last played that half a decade ago, so correct me if i'm wrong).
kbk wrote: Fri Sep 20, 2019 2:32 pm and it's a whopping lot of work.
Imho. It'd be a complete rewrite of major parts of the engine (remember circuits can connect to lots of things). Throwing years of optimization and bugfixes out of the window.
kbk wrote: Fri Sep 20, 2019 2:32 pm I fear that if anyone tries to implement all that
I've read a few ten-thousand posts on this forum. And i'm pretty sure you have nothing to worry about :p. If only because it would make the GUI ridiculously overloaded.

Re: One Wire for control circuits, colours as channels

Posted: Fri Sep 20, 2019 4:55 pm
by kbk
eradicator wrote: Fri Sep 20, 2019 4:25 pm
kbk wrote: Fri Sep 20, 2019 2:32 pm As you can see, eventually we go full Minecraft here,
Minecraft has 1 channel.
Yes, redstone, but i'm talking decorative blocks here. Stairs, slabs, raw, polished, whatnot. Most came this year shortly after some 10-ish years of development slowly got "thrown out the window" in recent years. At first their chunk model structure did not allow for fast operations on blocks so block types were softcapped to like 256 different types. Then slowly they managed to refactor everything to allow for alot of different new block types. Hope next thing they "throw out" will be their rendering engine.
As you may probably know, redstone has some design-implications-made-features that could make some circuit stuff unstable, like quasi-connectivity.

Re: One Wire for control circuits, colours as channels

Posted: Mon Sep 30, 2019 9:45 am
by mrvn
The problem is that a single cable means that any point where 2 cables connect all channels mix.

Looping back one output color to the input is the simplest case.

Another case would be having red go from north to south on long distance power poles. Then have green go west to east. At the moment you can have a single power pole where they cross each other without mixing signals. With only one data wire that would not work as it would mix the two.

For LTN train stations I have many places where a green wire is connected across all inserters or all pumps and a red wire connects the inserters to a warehouse per wagon or pumps to tanks. With only one data wire the inserter/warehouse or pump/tank line woudl no longer be isolated from the green wire across all inserter or pumps. Balancing train stations would be much more complex.