Pipes / bridges priority cheat sheet (2024)

Technically, the bridges in A and F are completely redundant, and you should get exactly the same split/merge behavior if you take them out. I was going to write a post on this topic, but since you already started one, I'll make a few comments here.

The key to understand is that this behavior is not about *bridges*. It's about *sources* and *sinks*. The green outlet box is a "source", and the white inlet box is a "sink". And *all* sources and sinks exhibit this behavior, whether they are on a bridge, a shutoff, a refinery, a pump, etc. That's the point @chemiewas making.

More importantly, the interesting behavior does not happen when a source or sink occur in a single isolated segment. But, for completeness, I'll cover all the cases:

  1. Source, no sink: nothing happens. Packets just sit in the pipe because they don't know where to go. Very useful if you need to stop a "bad" packet from damaging some equipment. Most folks have "deconstruct" on a higher priority than "plumbing", so deleting a pipe segment will usually happen faster than clearing out the bad packet on the fly. And sometimes you need to stop the flow just to get at the bad packet.
  2. Sink, no source: same as 1.
  3. Source connected to sink on isolated pipe segment: the trivial case. Packets flow from source to sink at 1 m/s, if present.
  4. One source, two sinks: fair split. This is the A case above, but works the same with or without the bridge. Packets are switched between each sink in a "fair" alternation, regardless of flow rate. That is, even if the flow is sporadic, each packet will alternate between top and bottom, which is equivalent to the split pipe "remembering" which output it sent the last packet on, no matter how long ago. In each case, the entire packet only goes down one branch or the other. The split never divides a packet and sends half down both sides.
  5. Two sources, one sink: fair merge. This is the E/F case above, and works the same with or without the bridge. Packets are "fairly" alternated onto the sink line, conversely to 4 above. If the sources send different elements, then the packets are always forced to alternate. *However*, if they are sending the same element, then the flows can merge completely, with no blocking in any segment, as long as there is sufficient pipe capacity.
    • For instance, if you have two pumps sending 500 g/s of O2 into a merged line, they will merge "cleanly" into a single 1000 g/s stream to the sink, with no blocking.
    • If you have two lines sending 10 kg/s of H2O into a merged line, they will alternate, because even though both sources are H2O, the sink line can still only handle 10 kg/s. You can confirm by checking the output temps, if the inputs are different. Also, the animation shows this behavior clearly. The average flow velocity of the source lines will be 0.5 m/s.
    • If you have two lines sending 750 g/s of H2 into a merged line, they will do a "partial merge" where one source will get to send a whole packet, and the other will get to "fill" the packet with 250 g/s, then they will swap. Every 3rd merge, both packets will merge cleanly, and the source lines will have an average flow velocity of 0.75 m/s.
  6. Pipe passes a sink: biased split. This is D above, and works exactly the same if you replace the bridge with a shut-off, valve, reservoir, etc. Packets will enter the sink if they can, and continue on the pipe if they cannot.
    • Since the bridge is a static building, the only time its sink cannot accept a packet is if the downstream pipe is blocked. This will cause packets to overflow onto the input pipe.
    • If a reservoir is full, it will stop accepting packets, causing overflow on the input.
    • If a shut-off is disabled, it will stop accepting packets...you get the idea.
  7. Pipe passes a source: biased merge. This is B/C above. Packets will exit the source if they can, and block if they cannot. They can "exit the source" if the pipe section connected to the source is empty or has a partial packet of the same element. Just like pure pipe-based merges, a source can "top up" the pipe flow passing by it. Unlike pipe-based merges, the merging is *not* "fair". The pipe always gets precedence over the source.
    • Any source can push packets through an "orphaned" pipe (one that has lost its source), but the bridge is one of the most popular sources for draining a pipe section, because it's fairly cheap to build. However, building a Carbon Skimmer works just as well. Note that nothing needs to be connected to the sink side of such buildings in order for the source side to have its "pushing" effect. Just the presence of the source is sufficient.

In summary, a packet *always* needs to "see" both a source and a sink somewhere on its line to move. Now, in order to understand some funky behavior, you need to know one more rule:

  • A packet will flow towards the nearest "available" sink. A sink is "available" if it can accept a packet.

This rule is almost always the reason you see a packet "bouncing" inside a pipe. For instance, if you have a stream of reservoirs with a single input line going through their sinks, a packet will normally go into the first reservoir until it is full. Then, it will flow into the second until it is full, etc. However, if you start draining packets from the first reservoir, then a packet that has made it past the first and is on its way to the second will decide that it should turn around instead. Thus, if you want uninterrupted input flow, you need to always drain from the *last* reservoir *first* (making them a LIFO buffer, or stack).

Another common scenario is where a bridge or shut-off input has an overflow bypass. Without another bridge to prevent backflow, it is possible for packets to bypass the bridge or shut-off, and then turn around and go back because the shut-off opened up or the bridge became unblocked. In most scenarios, it is possible to solve "bouncing" by forcing a flow direction with a bridge (note that a bridge is not at all magical with direction...it just takes advantage of the fact that packets can only go *into* a sink, and *out of* a source).

P.S. @beowulf2010brings up the important point that merges and splits can go 2, 3, or 4 ways. And, as he observes, a 4-way merge/split is only possible with a bridge or other building that gives access to all 4 sides of the source/sink (like a reservoir, but not a valve, unless the goal is to also bypass the valve, which is pretty useless).

Pipes / bridges priority cheat sheet (2024)

References

Top Articles
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 5449

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.