You brought up several good points. I'm not against your suggestion as much anymore, but I want to present some more alternatives.
mrvn wrote: Thu Dec 07, 2023 7:39 am
I just realized last night that the R/G choice on the output of a arithmetic combinator makes no sense. If you don't want the result on the green wire then don't connect a green wire.
Hmm, it could be useful if multiple outputs were allowed.
mrvn wrote: Thu Dec 07, 2023 7:39 am
What exactly don't you like in the first mockup if choosing the input wires is fine? That is literally all it adds to the already shown interface for the 2.0 combinators.
I don't dislike the first mockup, I just didn't word it clearly.
mrvn wrote: Thu Dec 07, 2023 7:39 am
As for typing in an expression on a single line: I thought about that but then you have to add parens and match them, figure out the right precedence for each operator and whether it is left or right associative and the user has to figure out all that stuff as well. For example take the shift operator: Is A << B + C mend to be (A << B) + C or A << (B + C). Surprise: In C and other languages it is the later. How confused do you think users will be when the precedence and associativity is not what they imagine?
Secondly typing in the item and signal names is hard, more so with non english speakers and translations. You have to type in the internal name like angle-crushed-ore-4. At a minimum that needs an item/signal picker.
Color highlighting or underlining could be used to clarify the first issue. Also, the new combinator output signals pane makes it easier to experiment and learn how things work. So in your example, you could check the precedence by trying different values for C.
As for typing signal names, assuming that all the translated names are unique within a given language setting, the game could let us type the translated name and convert it automatically. I think uniqueness is a safe assumption, but I could be wrong. The internal name could serve as a fallback perhaps.
Alternatively, typing a letter into the expression field could instantly bring up a signal picker with the search bar already focused so you could basically type start typing the translated signal name, which would go straight into the signal picker search bar, and then just click the icon, or better yet, use the arrow keys (while holding alt or something) to select the exact signal and then hit enter/return. Better keyboard-accessibility/-navigability of GUI has been requested elsewhere too.
mrvn wrote: Thu Dec 07, 2023 7:39 am
There is a problem with doing complex logic with separate arithmetic combinators. Each combinator adds a delay of 1 tick. For one thing that makes complex arithmetic slow to react. That delay can have real issues when you control logistic chests or filter inserters with it. Too long of a delay and the inserter will complete an extra swing before you can compute a new filter for it and you get the wrong items.
Secondly the delay means you easily end up with information from different ticks. Take for example A * B + C. This takes 2 combinators and then you add A * B from tick 1 to C from tick 2 giving you a result at tick 3 skewing the result. To get the right answer you need to do A * B + C * 1, adding an extra delay on the C input. Often you don't care abut the timeing skew but when it is important things get ugly quickly.
Thirdly there are only 2 signal colors. That means you can only propagate the signal in so many ways before signals from different inputs affect each other. Then you have to add even more combinators with "EACH + 0 = EACH" just to isolate signals adding more delays and confusion with wires going every which way.
Syncing up delays is not an issue for me personally, but I have a better idea to address it in a more gamey and immersive way: a kind of beacon-like new entity that synchronizes all of the combinators near it.
With this new beacon type, a chain of combinators would be evaluated at once, starting with any combinators that have inputs coming from outside of the beacon's area of effect. After that, the next set of combinators to be evaluated would be ones that receive input from the first set, and so on until all of the combinators have been evaluated, and any outputs connecting to entities outside of the beacon's area of effect would be the final output for that game tick. Every combinator would be evaluated only once to prevent infinite loops. Also because of this, the amount of computations would be similar to if the combinators were evaluated normally.
With the new quality system, higher quality could extend the area of effect, or it could be that the normal quality adds a delay of 4 or 5 ticks to the output, and each higher quality could remove one tick of delay, down to one. Additional beacons could be placed either to extend the area in a single "network" (logistic network style), or each beacon could create its own network, taking only 1 tick to evaluate however many combinators you could fit around it (different networks would not be allowed to overlap).
This would solve the issue of timing in a way that is maybe not as simple as multi-operation combinators, but IMHO more fun and visually interesting. It would be a step toward making combinators an interesting challenge in and of themselves (as a crudely engineered, primitive puzzle piece, not as a container for arbitrary amounts of logic), rather than just a means to "mod" your game without having to write any Lua.
mrvn wrote: Thu Dec 07, 2023 7:39 am
Remember that you can not see what a combinator does. Without alt view you see the operator but not the signals, with alt view you see the signals but not the operator. And you never see the output choice. Eigther way you see less than half the equation. So I challenge you to your claim that an expression tree would be harder to read than a bunch of combinators berried under a nest of wires.
I wish that alt view showed more information when zoomed in. With the current 1.1 combinators it'd be easy to fit every piece of information on top of the combinator if the zoom level was close enough. Additionally, I think there could be a cursor tooltip when you hover over a combinator that shows the complete configuration plus live updating input and output signals. So you could peek into any combinator at any zoom level, with alt mode on or off, and while having another GUI open (multiple open GUIs could be another enhancement btw). This feature could be extended to other circuit-connected entities. And while it could also be shoved into the regular tooltip at the side of the screen, I think having a tooltip at the cursor (in addition to the regular tooltip) with only the most essential info would be worthwhile, at least as an option that could be off by default.
Also, regardless of any other changes in 2.0, wire highlighting on hover should be stronger than it is currently, and some small indication should be given wherever a wire actually connects to an entity versus where it's just passing over it. Also, the red and green connection points on every entity should be diagonally offset from each other so that red and green wires never fully overlap each other.
mrvn wrote: Thu Dec 07, 2023 7:39 am
The complexity could also be limited to a maximum number of operations to keep the expression simple and the internal data structure of the combinator at a fixed side so it doesn't need to use allocations and indirections. Something like 7 operators and 8 inputs for example. Maybe something that fills up a cacheline exactly. I would hate such a limit on principle but reality is what it is.
Seems reasonable.
mrvn wrote: Thu Dec 07, 2023 7:39 am
I also challenge the assumption that a drag&drop in the expression would be harder than having to rewire separate combinators.
Rewiring could also be improved. For example, shift+click on a combinator's input side or output side, or on another entity, could remove connections like it does for copper cables and electric poles. Shift+click while having a specific abstract wire tool active could limit the connection-breaking to that specific wire color.
Control+click with a wire tool could disconnect an existing wire while leaving the other end(s) connected, and letting you connect that end to something else.
Combinators could be fast-replaceable or force-buildable while preserving wire connections.
Etc...
These tricks could be explained in tooltips or tutorials by the way, and beginners could ignore them, while heavy circuit network users could work more efficiently.
Admittedly many of these ideas could also complement new multi-op combinators, perhaps to a lesser degree, and the GUI for multiple operations is probably easier to implement.
Food for thought... maybe someone makes a mod for some of this.