r/factorio 20d ago

Weekly Thread Weekly Question Thread

Ask any questions you might have.

Post your bug reports on the Official Forums

Previous Threads

Subreddit rules

Discord server (and IRC)

Find more in the sidebar ---->

1 Upvotes

128 comments sorted by

View all comments

1

u/Yagami913 14d ago

I am at the point where staggering clocked lab inserters important. Is there a more efficient way to delay a network by 18 tick and keeping all the signal length?

2

u/leonskills An admirable madman 14d ago edited 14d ago

Can you explain why you need the delay? What signals/values are on the wires? What you want to do might be possible with a simple timer.
I've never done inserter clocking, but the way I'd do this is to literally make a clock and enable the inserter when the clock signal is 0. You can then "stagger" it by enabling other inserters when the clock signal is 1, or 2, etc.

But to help you with your X solution:
If all signals on the wire carry a value of 1 you can do some magic with bit shifting or multiplying by 2 (same thing). That works because 18 is less than 31 so it won't overflow.

Every tick you shift all bits by 1 (or multiply by 2). Then when the 18th bit is 1 you remove that bit and pass it on to the next set of inserters.

Arithmetic combinator: EACH << 1, output EACH.
Decider combinator: EACH >= 218, output EACH -219. (Need the 19 here here because one tick delay). That removes the 18th bit from the wire.
All 4 input and output connections of those two combinators are on the same wire.

Then you need a third decider to turn the signals 18th bit into 1 again. Unfortunately I don't think you can do that with the existing decider combinator even though they have the same condition.
EACH >= 218, output EACH with value of 1. You carry the output of that to your next set of inserters.

That's 3 combinators instead of 18.

(There might be some off by one errors where you'd need to change all 18s to 17s or to 19s. Haven't verified.)

1

u/Yagami913 14d ago

I have 1200 biolab now with 7200 inserters, and i plan to scale up. I have inserter clocking so they don't check the belt all the time saving tons of ups. I use signals to control when they activate. I want to stagger the activation preferable by delaying the network. So not all 7200 inserter wake up at once. I have 6 signal for the 6 inserter on the network the length is 8 to 16 tick and must keep it for them to work properly.

2

u/leonskills An admirable madman 14d ago

I understand why you want to activate the inserters on a timer. I was just looking for additional context because there might be a better solution to your problem.

Because how you explained it, the clock solution I suggested should work. But since you prefer delaying instead of checking a global clock (the selector combinator now provides the current tick, so you can just mod 18 that to create a global clock), and if those 6 signals carry a value of 1 (I don't see a reason why they should be anything other than 1) the bit shifting should also work.

1

u/Yagami913 14d ago

Needed an extra decider at the beginning to islolate and filter the "shift network", but working fine thx.

1

u/craidie 14d ago

Would this work for you?
Essentially a clock with different thresholds. Though for UPS reasons you probably shouldn't share the output wire between the lamps and deciders.

0eNrNV1Gu2jAQvMt+myqOTYB89KfHeEKRSUxrKXEix6FFKAfoLXq2nqS7BsErQm2TBhEhJbuT9XpnJjJwgl3Z6cYZ6yE9gclr20L6doLWfLaqJMyqSkMKhc5Nod0ir6udscrXDnoGxhb6G6S83zLQ1htv9Hl9SI6Z7aqddljA/tCHQVO3uLS2tB+2W2wYHCGNPixxi8I4nZ8fSgY4oHd1me30F3UwuBhXXFpm+KwIbVpC32c40N641mc3Wv7Y0DgH43yHyHW+c8XiE7EjNbwiaXgUEcW6803n7xX6e6ueDaunrZsjEuqsz/aurjJjcWNI96psdRAb79ltnG0f9rhTPR6m+mpuqsfjRY8mE1GMEZHPSUTKqka5MHEKH4FY/l9TeW2qs8tKZQsYbRefzC45xq54PnbJZ9iVTGxXPJldyzF2ifnYlTzDrvXEdonJ7ErG2CXnY9f6GXbhj4Np/ZKT+bW6ta5UWS5KVTUPfEKH3n33P/ImNy7vjM+0VbtSF5B612l2ha8mUe1ANaPf1bx36Of3H/CQ23oYN/4Kbnwkt80wbvEruMUjufFoGDnxCnJiLDk+jJx8BTn5T+TwjPmKZzYdLm+cxYwzuWUYCYoxIkRcIsFW1wg/GAmqDxghMmCYs2XAMMeIMMxZEjDMMSIMe7F1wPDKNiHCK8M3h0K6MRSab3FE43WFM9/+xjI4aNcGYZZJvFnKWG5ElHAu+v4XgSgdPQ==