Discuss: Power Switch should not "Blink"

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

fandingo
Inserter
Inserter
Posts: 35
Joined: Fri Apr 22, 2016 4:32 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by fandingo »

ssilk wrote:No, I don't mind. It's a good idea to split the created ideas up from this thread to discuss them separately, but it's always a lot of work to do that.
fandingo wrote: Then why is there any discussion of changing gameplay behavior to address a graphical issue? Makes no sense.
How should I explain you that, if you don't see it? :)
Gross. Make these separate combinators. There's no reason they need to be built into the power switch. Both of these functions have uses outside the power switch.
Good arguments from a technican, not so good from a gamer. :)
The same thing could be said about the entirety of the circuit network.

You just said how those flashing icons were going to change, and this is so trivially controlled by the player that it shouldn't impact game design.
Shouldn't. But that's, what I believe, or do you believe, that I put so much time into this subject, if I didn't thought that? Now prove me wrong. :mrgreen: :twisted:

I'm still missing why it's a problem anytime. Are inserters going to get slower when they're moving heavy stuff like locomotives instead of gear wheels?
No, because there is no created gameplay doing like that. ;)
Kettle meet pot.
Let's talk about power flow through the network. Here's a power switch array that I created:
I don't know what you see, but I see the split-point between two electric networks. If you switch off a switch it takes the amount of needed power used in the controlled network and calculates the delay from that. There is no NP-hard problem. It's a quite simpel calculation. :)
I'm kinda tired of these dismissive one sentence responses to complex problems, so let's see some pseudocode if you're that confident. You'd probably earn a Field's Medal and Nobel Prize today. This switch array needs to turn on in 1/7 the time it would take a 1-switch setup because there are 7 switches and each only needs to provide ~14% of the power. Then change it around so instead of 1 big pole going into and 1 coming out, there's n poles going in and m coming out. Don't forget that the networks of n and m are cyclic graphs either. The image I posted looks neat and tidy since the power switches are all at the same depth in the graph, but make sure your code can handle when they're at arbitrary depths in the N and M networks.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by ssilk »

fandingo wrote:This switch array needs to turn on in 1/7 the time it would take a 1-switch setup because there are 7 switches and each only needs to provide ~14% of the power.
No. :) Why making easy things complicated? It's a game. Has nothing to do with real physics. I can say: the controlled circuit takes 10 megawatt, so I need to wait 10 seconds. No matter which switch I use, which one is open or closed. Nothing forbids me to implement that into software.

You are right, if that would be the rule: divide the power through all open switches; then, yes, it's impossible to calculate. But what do you mean, who am I? I develop also software. I would never come an idea like that, cause I know, it isn't working; implementing it like so was never a choice. See viewtopic.php?f=80&t=15546 Cable Resistance / Non-looseless Power Transmission
This is the same kind of problem and way beyond, what can be calculated with current CPUs.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
mattj256
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 27, 2016 7:25 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by mattj256 »

ssilk wrote:(The duration of this delay depends on the amount of power, that flows through that switch.
I agree with fandingo that this can add a huge amount of computational complexity.
IMHO the power switch's cooldown delay should be a fixed length of time.

The more I think about this, the more I feel that the power switch should function like a thermostat. It's fine to have a single set point with oscillations every five seconds. It's fine to have two different set points: one for ON and one for OFF. It's not ok to leave things as they are. It's not ok for the power switch to require some kind of external mechanism to prevent 30-times-per-second oscillations.

My most preferred outcome would be for both of the suggestions below to be implemented. Otherwise I hope at least one can be implemented.

Allow two separate circuit conditions for the power switch: one for ON and one for OFF.
ssilk wrote: For me it was clear, that with two conditions in the power switch, the power switch works similarly:
* If switch is OFF, only the ON-condition is checked and it switches only once.
* Then the switch is ON and then only the OFF-condition is checked.
Require a delay before the circuit network can switch on or off.
MeduSalem wrote:That brings me to the point that as long as there is not an explicit timer combinator in the game for convenience sake I think that adding a delay to the power switch is probably the best/easiest way to go about it. (I say explicit timer combinator because creating a timer with a combinator is not really straight forward for casual players. I realize that experienced circuit designers may have their fun with that but most people don't.)

So the animation takes something like 5 seconds to close the switch after which it becomes connected, and when shutting off the networks disconnect immediately but the animation takes another 5 seconds to finally reach the open state, from which it can be closed again.
siggboy wrote:The power switch should be nerfed so that it can not switch more often than the animation of the sprite suggests is possible (maybe once per second, give or take, the exact time does not matter much).

If the switch is flipped (be it manual or from a circuit/logistic condition), the switch should become unswitchable until the animation has completed (or 1 second has passed, or whatever the appropriate timeout is). Changing circuit/logistic conditions should simply be ignored during that time. The manual switch should be locked/greyed out/unavailable.

Example: the switch is currently "off", and the condition is "Red = 1". You pulse "Red = 1" into the switch. The switch will turn "on" (from the condition), and after 1 second (assuming that's the timeout) it will turn "off" again. If you sent an oscillating "Red" signal into the switch it would turn "on" and "off" every 1 second.

Are there any problems with this approach that I'm currently not seeing?
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

mattj256 wrote:It's not ok for the power switch to require some kind of external mechanism to prevent 30-times-per-second oscillations.
Why is that "not ok"? It is not "realistic", if that term even makes sense in the Factorio world.

If anything, having a super-fast switch creates more possibilities, it certainly does not harm creativity.

To prevent fast oscillations (if you want/need that), you can put a reasonably simple clock mechanism between your switching signal and the power switch; or you make an actual fuzzy logic with some accumulators and a switch.

Making the switch slower will not make the ugly circuits any prettier. They'll still switch a lot more than necessary, only slightly slowed down by the switch.
Allow two separate circuit conditions for the power switch: one for ON and one for OFF.
If I understand you correctly, you do not want two separate conditions, but you want a "flip-flop" to be built into the power switch. You should make this clear, because simply having separate conditions for ON and OFF without turning the power switch into a flip switch makes no sense.

Right now, when operated manually, the power switch is a flip switch; if operated from a circuit, it is not, the signal needs to remain on the wire for the switch to remain "on".

What you want is to make it work as a flip switch in circuit mode as well.

I think that a new "mode of operation" should be added. Right now we have "enable/disable", which is ambiguous and should be renamed to "Enable on condition". Then another one should be added called "Toggle on condition change", and it would flip the switch whenever the condition changes from true to false and/or false to true (depending how you'd want it to work).

Adding a second, separate condition is bogus, you can make this with an external logic if you need it, it's not even difficult.

Personally I think the "flip-switch" functionality is not needed and should not be added. If you want to make fancy stuff with the power switch then learn to create a flip-switch with a combinator, which is made from ONE single combinator.

Decider combinator. "S > 0; Output S 1". Connect input and output with green wire.
Power switch. Condition "S > 0". Connect the output of the combinator to the power switch.

Now you can flip the switch "ON" by applying a positive "S". And you can switch it "OFF" by applying a negative "S".

All done with 1 additional combinator and 1 piece of wire.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by ssilk »

mattj256 wrote:
ssilk wrote:(The duration of this delay depends on the amount of power, that flows through that switch.
I agree with fandingo that this can add a huge amount of computational complexity.
No. Well. Much disinformation. :) I formulated it with "flow". In Factorio the electric network has no "flow". A network is just a list of devices that add or subtract power from it. That's all.

With the switch we have now just more networks. And the switch is in the main network just a device, which will work so, that the devices inside of that extra network will be added to that list.

More infos about this: https://www.factorio.com/blog/post/fff-115


To the length of delay: I see that as suggestion. The final implementation (if that will be ever changed) needs balancing and this is of course part of that.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

siggboy wrote:Probably some very clever contraptions can be built if you abuse the fact that you can switch power once per tick.
It did not take long for this to happen: viewtopic.php?f=8&t=29302#p185876
(courtesy of DaveMcW)
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
OdinYggd
Fast Inserter
Fast Inserter
Posts: 200
Joined: Wed May 25, 2016 12:55 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by OdinYggd »

Creating a S-R flip flop out of combinators is somewhat counterintuitive. Beginner players, especially those without a background knowledge of electronics, will probably not know about or how to make such a thing and will either just let the switch flutter as it does or give up on using it in that way.

Even knowing how to make a flip flop and setpoint scheme to control it, this is still tedious to wire up each time when you don't have a blueprint handy.

So, with that said, what if we did this:

Modify the Constant Combinator to perform timer and latch functions as well as a fixed ON state.

This would give the constant combinator some versatility, right now I have yet to find a good use for the type. It would also make it a little easier for players to understand- "Hmm. I need the switch to stay triggered once tripped, oh the constant might do it."

Then it is a bit easier to understand and configure, retaining the advantages of the per-tick switching while also making it easier to work with because it would be trivial to put in the help text for the power switch that it is recommended to use it with combinator controls.

I'm imagining 3 modes for the constant combinator:

1. Always-on. This would be the same as its current behavior.
2. Latching. This makes it behave as a S-R flip flop, with a circuit condition for SET and a different condition for RESET.
3. Timer. In this mode it performs a time delay function based on a trigger condition, and would probably also need a reset condition. The result would be a versatile behavior not all that unlike the classic LM555 timer IC, allowing a wide range of useful capabilities to be implemented with a minimum of complexity and workaround.

With that change the circuit network would be expanded to allow a tremendous amount of real world automation scenarios to actually be reproducible in-game, as well as making the power switch a little more intuitive to use without restricting its capabilities for advanced players.
In my mind, Steam is the eternal king of the railway.
IronCartographer
Filter Inserter
Filter Inserter
Posts: 464
Joined: Tue Jun 28, 2016 2:07 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by IronCartographer »

Alright, this looks like the correct thread to post this:

https://www.reddit.com/r/factorio/comme ... ?context=2

Simply put: Make any power network's Total Power Drain (from machines with such a value, added up) have some large multiple (like 5-10x) of that Drain for a very short time after it is connected to power.

This would add realism, be a simple rule, and reward smart use of the power switch. At the same time, the drain value is so low that it wouldn't be game-breaking if someone allowed constant oscillation.

It should have no impact on steady-state performance.
mattj256
Fast Inserter
Fast Inserter
Posts: 203
Joined: Sun Mar 27, 2016 7:25 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by mattj256 »

siggboy wrote:
siggboy wrote:Probably some very clever contraptions can be built if you abuse the fact that you can switch power once per tick.
It did not take long for this to happen: viewtopic.php?f=8&t=29302#p185876
(courtesy of DaveMcW)
Haha that is awesome.
siggboy wrote:
mattj256 wrote:It's not ok for the power switch to require some kind of external mechanism to prevent 30-times-per-second oscillations.
Why is that "not ok"? It is not "realistic", if that term even makes sense in the Factorio world.
That's me being really frustrated. I let this sit for a week so I could be more cool-headed.

In general I like the game's balance between gameplay and realism. It doesn't bother me that you can put 100 locomotives in your pocket or that transport belts don't require external power, because these design choices make the game more fun. (I'm not crazy about the fact that you can put a wooden box inside another wooden box, but it would break too much of the game to try to "fix" that.)

In my own factory I'd rather burn extra coal than have the power switch turn on and off every five seconds. I have my power switch set up so it turns on when an accumulator is mostly empty and off when the accumulator is mostly full. It's a four-combinator setup; I'm sure you would hate it; it works for me. In my own factory I really do want two different conditions. As you've already said this can be done externally and doesn't need to be part of the power switch.

The thing with the power switch is the current implementation is neither realistic nor fun. (Not fun for me anyway.) It's conceptually simple (to the extent that anything involving the circuit network can be called simple) and that's pretty much all it has going for it.

Are there any good mods that have SR latches or timers? I'm a software developer so I don't mind learning a bit about the circuit network. I think it's completely crazy to expect a beginner to be able to avoid 30 oscillations per second with the tools currently in the game, unless they go online and read someone else's instructions. Is that it? The status quo is that the power switch works just like the electric pump (switching instantly) and the status quo is fine? I can't imagine any normal uses for the power switch that would require 30 oscillations per second.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

mattj256 wrote:(I'm not crazy about the fact that you can put a wooden box inside another wooden box, but it would break too much of the game to try to "fix" that.)
Well, you can put an Oil Refinery (or two) into a wooden box. It clearly is a four-dimensional kind of storage (they should be called TARDIS Boxes). In that context you should be able to put boxes into boxes.

What should not be possible is to put boxes with content into other boxes; but that is, in fact, not possible.
I have my power switch set up so it turns on when an accumulator is mostly empty and off when the accumulator is mostly full. It's a four-combinator setup; I'm sure you would hate it; it works for me.
I don't understand why you would think that I'd hate it. To implement a Schmitt Trigger (hysteresis circuit) you need 3 combinators (one to check lower bound, one for upper bound, and one for the latch). I don't know what the fourth one does in your case, I have added a constant combinator to mine so I can configure the limits there, and for the lamp to be green when it's off (not really necessary but nice to have). Probably you use the Bad Latch that needs 2 combinators.
Capture.PNG
Capture.PNG (137.21 KiB) Viewed 8530 times
Blueprint
Somebody has made a Schmitt Trigger out of 4 transport belts. That needs no power to operate, so it's probably better for these kinds of setups (it definitely looks cool): 29598
The thing with the power switch is the current implementation is neither realistic nor fun. (Not fun for me anyway.) It's conceptually simple (to the extent that anything involving the circuit network can be called simple) and that's pretty much all it has going for it.
Well, it's a switch. If operated manually it's a toggle, if operated from a circuit then it's a push-button switch. If you made it a toggle in both cases then that would limit the possibilities for circuits.

It probably should not be able to switch power that rapidly, so I agree about the realism part, but as far as the implementation goes I have no complaints.
Are there any good mods that have SR latches or timers?
SR-Latch = 1 combinator. Timer = 1 combinator. Don't hold your breath for anybody making a mod to replace 1-combinator circuits :).

Actually the TimeTools mod adds a clock combinator that does output the current game time in ticks and days, the hour of the day, the daylight level and a binary signal indicating if it's "day" or "night".
I can't imagine any normal uses for the power switch that would require 30 oscillations per second.
Well that does not mean that there aren't any :). The game should allow as many things as possible, without making it unplayable, unbalanced or simply too difficult. The common tasks need to be easy enough for the average player to make it to the end of the game. The rest can be difficult, it's your task to figure out the solutions. It's the point of playing Factorio.

I could write a mod in LUA that would do what my train scheduler does. But it's more fun to do it with combinators. The SmartTrains mod (that I need) is limited as well, on purpose, so it won't feel OP and solve too many problems for you.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

siggboy wrote:To implement a Schmitt Trigger (hysteresis circuit) you need 3 combinators (one to check lower bound, one for upper bound, and one for the latch).
This was nagging me, and so I tried to make it smaller.

Indeed you can make a Schmitt Trigger with only 2 combinators (plus an optional constant combinator for somewhat easier configuration):
schmitt-trigger.png
schmitt-trigger.png (336.82 KiB) Viewed 15120 times
This configuration is closer to how you'd make a real Schmitt Trigger (comparator + feedback loop).

"U" is the upper threshold.
"D" is the difference to the lower threshold.

(In this example the effective lower threshold is "20").

The decider combinator outputs A=1 if it's in the "high" state, and nothing if it's in the "low" state (so on the power switch you'd set "A=0" as the condition if you want to switch it on when the accumulator goes below 20).

Caveat of this implementation: due to the 2 ticks delay in the feedback loop the contraption can fail if you have wildly flickering input over a wide range. Should not be an issue with power/accu related applications. This should not be a problem at all.
Last edited by siggboy on Mon Aug 01, 2016 9:25 am, edited 1 time in total.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by ssilk »

Very nice. No really cool. I think I should put this post into Show Your Creations.... (?)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

Feel free :). I should make a better screenshot without the fuckup with the green wire. Maybe a circuit diagram.

Actually it should go into the Combinator Contraptions thread (that's stickied already and it's where I would have posted this).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by XKnight »

It is a pity that I should search in the whole forum for the all combinator-related stuff, instead of looking in some dedicated forum section...
Sometimes I think that you are hiding interesting things from me :lol:


Build
Last edited by XKnight on Tue Jul 26, 2016 7:47 pm, edited 1 time in total.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

Nice design, as always. I'm glad you couldn't do it in 1 combinator, that would have been depressing. However, your solution only uses 3 tiles instead of 4, and it's more difficult to understand, so I guess you win :).
XKnight wrote:It is a pity that I should search in the whole forum for the all combinator-related stuff, instead of looking in some dedicated forum section...
Sometimes I think that you are hiding interesting things from me :lol:
In all seriousness, there SHOULD be a dedicated sub-forum ONLY for combinator related designs.

We really need it. It' very difficult right now to learn this because you don't know where to search. The few sticky threads that we have are not enough.

Most of the time somebody posts something in "Show Your Creations", and then you have a valuable discussion, but the information is lost after a while.

Unless you know who the few people are who are actually good with combinators and post designs, it's not even possible to search for this stuff.

So, ssilk, please, I know you're reading everything. Give us a combinator sub-forum! :mrgreen:
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

XKnight wrote:lower limit = 20
upper limit = 80
A = upper limit - 100 = -20
Blue = upper limit - lower limit = 80 - 20 = 60
This explanation is not complete.

Does this imply a value range for "A"?
In the combinator, is "A = upper - (upper + lower)"? That would always make it "-lower", much simpler formula.
What happens if you apply values outside the legal range?
What happens if "A" is not present (zero)?

So I guess "Blue" is like "D" in my example (difference between U and L), "A" is "L * -1" and "U" is implied by "A * -1 + D". (I hope I got it right, just in case somebody tries to set this up with anything other than an accumulator :) ).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by XKnight »

Wow, I made a mistake, explanation is fixed.
siggboy wrote: In the combinator, is "A = upper - (upper + lower)"? That would always make it "-lower", much simpler formula.
Indeed, overengineering. :lol:
siggboy wrote: What happens if you apply values outside the legal range?
What happens if "A" is not present (zero)?
Emmmm, nothing bad (I hope :lol: ).

Actually, if you have (L=20 U=80 D=60) and you send 2^31-60 there might be some problems... and vice versa with negative values.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

I guess it's not necessary to use "Each" in the decider? You could as well do "Blue < A" (or "D < A" with mnemonic signal names).

Then the contraption would still work if there are other inputs on the wire except "A" ("Blue" is of course always illegal).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by XKnight »

siggboy wrote:I guess it's not necessary to use "Each" in the decider? You could as well do "Blue < A" (or "D < A" with mnemonic signal names).

Then the contraption would still work if there are other inputs on the wire except "A" ("Blue" is of course always illegal).
Nope :D It works only with Each mode.
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Discuss: Power Switch should not "Blink"

Post by siggboy »

XKnight wrote:Nope :D It works only with Each mode.
Will you explain why, or do I have to find out myself and explain it? It's not obvious to me right now.

You need to be less mysterious and explain more, then people can learn. Showing off is only 50% of the distance covered :).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Post Reply

Return to “Ideas and Suggestions”